2641a5b0b1d3c6f3249926acc2a64f6705d8489f
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-4.19 / 950-0734-overlays-Add-w5500-overlay.patch
1 From cb9a896a799393b3cb5947bef3c95eb5ffb44776 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 10 Oct 2019 09:08:47 +0100
4 Subject: [PATCH] overlays: Add w5500 overlay
5
6 Add an overlay to configure the Wiznet W5500 Ethernet controller on
7 SPI0. The 'cs' parameter chooses the Chip Select (default 0).
8
9 See: https://github.com/raspberrypi/linux/issues/3276
10
11 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
12 ---
13 arch/arm/boot/dts/overlays/Makefile | 1 +
14 arch/arm/boot/dts/overlays/README | 10 ++++
15 arch/arm/boot/dts/overlays/w5500-overlay.dts | 63 ++++++++++++++++++++
16 3 files changed, 74 insertions(+)
17 create mode 100644 arch/arm/boot/dts/overlays/w5500-overlay.dts
18
19 --- a/arch/arm/boot/dts/overlays/Makefile
20 +++ b/arch/arm/boot/dts/overlays/Makefile
21 @@ -183,6 +183,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
22 vga666.dtbo \
23 w1-gpio.dtbo \
24 w1-gpio-pullup.dtbo \
25 + w5500.dtbo \
26 wittypi.dtbo
27
28 targets += dtbs dtbs_install
29 --- a/arch/arm/boot/dts/overlays/README
30 +++ b/arch/arm/boot/dts/overlays/README
31 @@ -2538,6 +2538,16 @@ Params: gpiopin GPIO for
32 pullup Now enabled by default (ignored)
33
34
35 +Name: w5500
36 +Info: Overlay for the Wiznet W5500 Ethernet Controller on SPI0
37 +Load: dtoverlay=w5500,<param>=<val>
38 +Params: int_pin GPIO used for INT (default 25)
39 +
40 + speed SPI bus speed (default 30000000)
41 +
42 + cs SPI bus Chip Select (default 0)
43 +
44 +
45 Name: wittypi
46 Info: Configures the wittypi RTC module.
47 Load: dtoverlay=wittypi,<param>=<val>
48 --- /dev/null
49 +++ b/arch/arm/boot/dts/overlays/w5500-overlay.dts
50 @@ -0,0 +1,63 @@
51 +// Overlay for the Wiznet w5500 Ethernet Controller
52 +/dts-v1/;
53 +/plugin/;
54 +
55 +/ {
56 + compatible = "brcm,bcm2835";
57 +
58 + fragment@0 {
59 + target = <&spidev0>;
60 + __overlay__ {
61 + status = "disabled";
62 + };
63 + };
64 +
65 + fragment@1 {
66 + target = <&spidev1>;
67 + __dormant__ {
68 + status = "disabled";
69 + };
70 + };
71 +
72 + fragment@2 {
73 + target = <&spi0>;
74 + __overlay__ {
75 + /* needed to avoid dtc warning */
76 + #address-cells = <1>;
77 + #size-cells = <0>;
78 +
79 + status = "okay";
80 +
81 + eth1: w5500@0{
82 + compatible = "wiznet,w5500";
83 + reg = <0>; /* CE0 */
84 + pinctrl-names = "default";
85 + pinctrl-0 = <&eth1_pins>;
86 + interrupt-parent = <&gpio>;
87 + interrupts = <25 0x8>;
88 + spi-max-frequency = <30000000>;
89 +// local-mac-address = [aa bb cc dd ee ff];
90 + status = "okay";
91 + };
92 + };
93 + };
94 +
95 + fragment@3 {
96 + target = <&gpio>;
97 + __overlay__ {
98 + eth1_pins: eth1_pins {
99 + brcm,pins = <25>;
100 + brcm,function = <0>; /* in */
101 + brcm,pull = <0>; /* none */
102 + };
103 + };
104 + };
105 +
106 + __overrides__ {
107 + int_pin = <&eth1>, "interrupts:0",
108 + <&eth1_pins>, "brcm,pins:0";
109 + speed = <&eth1>, "spi-max-frequency:0";
110 + cs = <&eth1>, "reg:0",
111 + <0>, "!0=1";
112 + };
113 +};