From 665a8a2d2d5debed06bb2c68c31d9c9d1ae76b6c Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Tue, 15 Aug 2017 23:49:14 +0300 Subject: [PATCH] Add ENC28J60 example overlay --- examples/README.md | 8 ++++++++ examples/spi-enc28j60.dts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 examples/spi-enc28j60.dts diff --git a/examples/README.md b/examples/README.md index d6be216..39badca 100644 --- a/examples/README.md +++ b/examples/README.md @@ -58,6 +58,14 @@ Compared to the other ones in this repository these are "standalone" - no fixup - may require changing the interrupt GPIO specifier +### spi-enc28j60 +- overlays for a ENC28J60 Ethernet controller connected to the SPI bus +- bindings documentation: [microchip,enc28j60.txt](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/devicetree/bindings/net/microchip,enc28j60.txt) +- requires activating the SPI bus device is connected to by a kernel provided overlays (i.e. `overlays=spi0`) +- may require changing the interrupt GPIO specifier +- using external pull-up resistor on the interrupt line is highly recommended if the module doesn't have one + + ### spi-mcp251x - overlays for a MCP251x CAN controller connected to the SPI bus - bindings documentation: [microchip,mcp251x.txt](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/devicetree/bindings/net/can/microchip,mcp251x.txt) diff --git a/examples/spi-enc28j60.dts b/examples/spi-enc28j60.dts new file mode 100644 index 0000000..923c5c9 --- /dev/null +++ b/examples/spi-enc28j60.dts @@ -0,0 +1,38 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun50i-a64", "allwinner,sun50i-h5"; + + /* This fragment is required only if the IRQ pin requires internal pull-up */ + fragment@0 { + target = <&pio>; + __overlay__ { + enc28j60_pins: enc28j60_pins { + pins = "PA7"; + function = "irq"; + bias-pull-up; + }; + }; + }; + + fragment@1 { + target = <&spi0>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + enc28j60 { + compatible = "microchip,enc28j60"; + reg = <0>; + interrupt-parent = <&pio>; + interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */ + spi-max-frequency = <12000000>; + status = "okay"; + /* These are required only if internal pull-up is used for the IRQ pin */ + pinctrl-names = "default"; + pinctrl-0 = <&enc28j60_pins>; + }; + }; + }; +};