ramips: mt7621: convert to nvmem-layout
[openwrt/staging/nbd.git] / target / linux / ramips / dts / mt7621_xiaomi_mi-router-3-pro.dts
1 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2
3 #include "mt7621.dtsi"
4
5 #include <dt-bindings/gpio/gpio.h>
6 #include <dt-bindings/input/input.h>
7 #include <dt-bindings/leds/common.h>
8
9 / {
10 compatible = "xiaomi,mi-router-3-pro", "mediatek,mt7621-soc";
11 model = "Xiaomi Mi Router 3 Pro";
12
13 aliases {
14 led-boot = &led_status_yellow;
15 led-failsafe = &led_status_red;
16 led-running = &led_status_blue;
17 led-upgrade = &led_status_yellow;
18 label-mac-device = &gmac0;
19 };
20
21 chosen {
22 bootargs = "console=ttyS0,115200n8";
23 };
24
25 leds {
26 compatible = "gpio-leds";
27
28 led_status_red: led-0 {
29 label = "red:status";
30 color = <LED_COLOR_ID_RED>;
31 function = LED_FUNCTION_STATUS;
32 gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
33 };
34
35 led_status_blue: led-1 {
36 label = "blue:status";
37 color = <LED_COLOR_ID_BLUE>;
38 function = LED_FUNCTION_STATUS;
39 gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
40 };
41
42 led_status_yellow: led-2 {
43 label = "yellow:status";
44 color = <LED_COLOR_ID_YELLOW>;
45 function = LED_FUNCTION_STATUS;
46 gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
47 };
48
49 led-3 {
50 label = "amber:wan";
51 color = <LED_COLOR_ID_AMBER>;
52 function = LED_FUNCTION_WAN;
53 gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
54 linux,default-trigger = "mt7530-0:04:1Gbps";
55 };
56
57 led-4 {
58 label = "amber:lan3";
59 color = <LED_COLOR_ID_AMBER>;
60 function = LED_FUNCTION_LAN;
61 function-enumerator = <3>;
62 gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
63 linux,default-trigger = "mt7530-0:03:1Gbps";
64 };
65
66 led-5 {
67 label = "amber:lan2";
68 color = <LED_COLOR_ID_AMBER>;
69 function = LED_FUNCTION_LAN;
70 function-enumerator = <2>;
71 gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
72 linux,default-trigger = "mt7530-0:02:1Gbps";
73 };
74
75 led-6 {
76 label = "amber:lan1";
77 color = <LED_COLOR_ID_AMBER>;
78 function = LED_FUNCTION_LAN;
79 function-enumerator = <1>;
80 gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
81 linux,default-trigger = "mt7530-0:01:1Gbps";
82 };
83 };
84
85 keys {
86 compatible = "gpio-keys";
87
88 reset {
89 label = "reset";
90 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
91 linux,code = <KEY_RESTART>;
92 };
93 };
94
95 reg_usb_vbus: regulator {
96 compatible = "regulator-fixed";
97 regulator-name = "usb_vbus";
98 regulator-min-microvolt = <5000000>;
99 regulator-max-microvolt = <5000000>;
100 gpio = <&gpio 12 GPIO_ACTIVE_HIGH>;
101 enable-active-high;
102 };
103 };
104
105 &xhci {
106 vbus-supply = <&reg_usb_vbus>;
107 };
108
109 &nand {
110 status = "okay";
111
112 partitions {
113 compatible = "fixed-partitions";
114 #address-cells = <1>;
115 #size-cells = <1>;
116
117 partition@0 {
118 label = "Bootloader";
119 reg = <0x0 0x40000>;
120 read-only;
121 };
122
123 partition@40000 {
124 label = "Config";
125 reg = <0x40000 0x40000>;
126 };
127
128 partition@80000 {
129 label = "Bdata";
130 reg = <0x80000 0x40000>;
131 read-only;
132 };
133
134 factory: partition@c0000 {
135 label = "factory";
136 reg = <0x0c0000 0x40000>;
137 read-only;
138
139 nvmem-layout {
140 compatible = "fixed-layout";
141 #address-cells = <1>;
142 #size-cells = <1>;
143
144 eeprom_factory_0: eeprom@0 {
145 reg = <0x0 0x4da8>;
146 };
147
148 eeprom_factory_8000: eeprom@8000 {
149 reg = <0x8000 0x4da8>;
150 };
151
152 macaddr_factory_e000: macaddr@e000 {
153 reg = <0xe000 0x6>;
154 };
155
156 macaddr_factory_e006: macaddr@e006 {
157 reg = <0xe006 0x6>;
158 };
159 };
160 };
161
162 partition@100000 {
163 label = "crash";
164 reg = <0x100000 0x40000>;
165 };
166
167 partition@140000 {
168 label = "crash_syslog";
169 reg = <0x140000 0x80000>;
170 };
171
172 partition@1c0000 {
173 label = "reserved0";
174 reg = <0x1c0000 0x40000>;
175 read-only;
176 };
177
178 /* We keep stock xiaomi firmware (kernel0) here */
179 partition@200000 {
180 label = "kernel_stock";
181 reg = <0x200000 0x400000>;
182 };
183
184 partition@600000 {
185 label = "kernel";
186 reg = <0x600000 0x400000>;
187 };
188
189 partition@a00000 {
190 label = "ubi";
191 reg = <0xa00000 0xf580000>;
192 };
193 };
194 };
195
196 &pcie {
197 status = "okay";
198 };
199
200 &pcie0 {
201 wifi@0,0 {
202 compatible = "mediatek,mt76";
203 reg = <0x0000 0 0 0 0>;
204 nvmem-cells = <&eeprom_factory_0>;
205 nvmem-cell-names = "eeprom";
206 ieee80211-freq-limit = <2400000 2500000>;
207 };
208 };
209
210 &pcie1 {
211 wifi@0,0 {
212 compatible = "mediatek,mt76";
213 reg = <0x0000 0 0 0 0>;
214 nvmem-cells = <&eeprom_factory_8000>;
215 nvmem-cell-names = "eeprom";
216 ieee80211-freq-limit = <5000000 6000000>;
217 };
218 };
219
220 &gmac0 {
221 nvmem-cells = <&macaddr_factory_e006>;
222 nvmem-cell-names = "mac-address";
223 };
224
225 &gmac1 {
226 status = "okay";
227 label = "wan";
228 phy-handle = <&ethphy4>;
229
230 nvmem-cells = <&macaddr_factory_e000>;
231 nvmem-cell-names = "mac-address";
232 };
233
234 &mdio {
235 ethphy4: ethernet-phy@4 {
236 reg = <4>;
237 };
238 };
239
240 &switch0 {
241 ports {
242 port@1 {
243 status = "okay";
244 label = "lan3";
245 };
246
247 port@2 {
248 status = "okay";
249 label = "lan2";
250 };
251
252 port@3 {
253 status = "okay";
254 label = "lan1";
255 };
256 };
257 };
258
259 &state_default {
260 gpio {
261 groups = "jtag", "uart2", "uart3", "wdt";
262 function = "gpio";
263 };
264 };