sunxi: backport stmmac network patches
[openwrt/openwrt.git] / target / linux / sunxi / patches-4.14 / 025-arm64-dts-allwinner-A64-Restore-EMAC-changes.patch
1 From 94f442886711c6c4f4383a1c5a6994a788ba05d8 Mon Sep 17 00:00:00 2001
2 From: Corentin Labbe <clabbe.montjoie@gmail.com>
3 Date: Tue, 31 Oct 2017 09:19:13 +0100
4 Subject: [PATCH] arm64: dts: allwinner: A64: Restore EMAC changes
5
6 The original dwmac-sun8i DT bindings have some issue on how to handle
7 integrated PHY and was reverted in last RC of 4.13.
8 But now we have a solution so we need to get back that was reverted.
9
10 This patch restore arm64 DT about dwmac-sun8i for A64
11 This reverts commit 87e1f5e8bb4b ("arm64: dts: allwinner: Revert EMAC changes")
12
13 Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
14 Acked-by: Florian Fainelli <f.fainelli@gmail.com>
15 Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
16 ---
17 .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 16 ++++++++++++++++
18 .../boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 15 +++++++++++++++
19 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 17 +++++++++++++++++
20 .../dts/allwinner/sun50i-a64-sopine-baseboard.dts | 16 ++++++++++++++++
21 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 20 ++++++++++++++++++++
22 5 files changed, 84 insertions(+)
23
24 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
25 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
26 @@ -51,6 +51,7 @@
27 compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";
28
29 aliases {
30 + ethernet0 = &emac;
31 serial0 = &uart0;
32 serial1 = &uart1;
33 };
34 @@ -69,6 +70,14 @@
35 status = "okay";
36 };
37
38 +&emac {
39 + pinctrl-names = "default";
40 + pinctrl-0 = <&rgmii_pins>;
41 + phy-mode = "rgmii";
42 + phy-handle = <&ext_rgmii_phy>;
43 + status = "okay";
44 +};
45 +
46 &i2c1 {
47 pinctrl-names = "default";
48 pinctrl-0 = <&i2c1_pins>;
49 @@ -79,6 +88,13 @@
50 bias-pull-up;
51 };
52
53 +&mdio {
54 + ext_rgmii_phy: ethernet-phy@1 {
55 + compatible = "ethernet-phy-ieee802.3-c22";
56 + reg = <1>;
57 + };
58 +};
59 +
60 &mmc0 {
61 pinctrl-names = "default";
62 pinctrl-0 = <&mmc0_pins>;
63 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
64 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
65 @@ -48,3 +48,18 @@
66
67 /* TODO: Camera, touchscreen, etc. */
68 };
69 +
70 +&emac {
71 + pinctrl-names = "default";
72 + pinctrl-0 = <&rgmii_pins>;
73 + phy-mode = "rgmii";
74 + phy-handle = <&ext_rgmii_phy>;
75 + status = "okay";
76 +};
77 +
78 +&mdio {
79 + ext_rgmii_phy: ethernet-phy@1 {
80 + compatible = "ethernet-phy-ieee802.3-c22";
81 + reg = <1>;
82 + };
83 +};
84 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
85 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
86 @@ -51,6 +51,7 @@
87 compatible = "pine64,pine64", "allwinner,sun50i-a64";
88
89 aliases {
90 + ethernet0 = &emac;
91 serial0 = &uart0;
92 serial1 = &uart1;
93 serial2 = &uart2;
94 @@ -71,6 +72,15 @@
95 status = "okay";
96 };
97
98 +&emac {
99 + pinctrl-names = "default";
100 + pinctrl-0 = <&rmii_pins>;
101 + phy-mode = "rmii";
102 + phy-handle = <&ext_rmii_phy1>;
103 + status = "okay";
104 +
105 +};
106 +
107 &i2c1 {
108 pinctrl-names = "default";
109 pinctrl-0 = <&i2c1_pins>;
110 @@ -81,6 +91,13 @@
111 bias-pull-up;
112 };
113
114 +&mdio {
115 + ext_rmii_phy1: ethernet-phy@1 {
116 + compatible = "ethernet-phy-ieee802.3-c22";
117 + reg = <1>;
118 + };
119 +};
120 +
121 &mmc0 {
122 pinctrl-names = "default";
123 pinctrl-0 = <&mmc0_pins>;
124 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
125 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
126 @@ -53,6 +53,7 @@
127 "allwinner,sun50i-a64";
128
129 aliases {
130 + ethernet0 = &emac;
131 serial0 = &uart0;
132 };
133
134 @@ -76,6 +77,21 @@
135 status = "okay";
136 };
137
138 +&emac {
139 + pinctrl-names = "default";
140 + pinctrl-0 = <&rgmii_pins>;
141 + phy-mode = "rgmii";
142 + phy-handle = <&ext_rgmii_phy>;
143 + status = "okay";
144 +};
145 +
146 +&mdio {
147 + ext_rgmii_phy: ethernet-phy@1 {
148 + compatible = "ethernet-phy-ieee802.3-c22";
149 + reg = <1>;
150 + };
151 +};
152 +
153 &mmc2 {
154 pinctrl-names = "default";
155 pinctrl-0 = <&mmc2_pins>;
156 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
157 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
158 @@ -449,6 +449,26 @@
159 #size-cells = <0>;
160 };
161
162 + emac: ethernet@1c30000 {
163 + compatible = "allwinner,sun50i-a64-emac";
164 + syscon = <&syscon>;
165 + reg = <0x01c30000 0x10000>;
166 + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
167 + interrupt-names = "macirq";
168 + resets = <&ccu RST_BUS_EMAC>;
169 + reset-names = "stmmaceth";
170 + clocks = <&ccu CLK_BUS_EMAC>;
171 + clock-names = "stmmaceth";
172 + status = "disabled";
173 + #address-cells = <1>;
174 + #size-cells = <0>;
175 +
176 + mdio: mdio {
177 + #address-cells = <1>;
178 + #size-cells = <0>;
179 + };
180 + };
181 +
182 gic: interrupt-controller@1c81000 {
183 compatible = "arm,gic-400";
184 reg = <0x01c81000 0x1000>,