ramips: mt7621: convert Linksys devices EEPROM to NVMEM format
[openwrt/openwrt.git] / target / linux / ramips / dts / mt7621_xiaomi_mi-router-cr660x.dtsi
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
8 / {
9 aliases {
10 led-boot = &led_sys_yellow;
11 led-failsafe = &led_sys_yellow;
12 led-running = &led_sys_blue;
13 led-upgrade = &led_sys_yellow;
14 label-mac-device = &gmac0;
15 };
16
17 chosen {
18 bootargs = "console=ttyS0,115200n8";
19 };
20
21 leds {
22 compatible = "gpio-leds";
23
24 led_sys_yellow: sys_yellow {
25 label = "yellow:sys";
26 gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
27 };
28
29 led_sys_blue: sys_blue {
30 label = "blue:sys";
31 gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
32 };
33
34 net_yellow {
35 label = "yellow:net";
36 gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
37 };
38
39 net_blue {
40 label = "blue:net";
41 gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
42 };
43 };
44
45 keys {
46 compatible = "gpio-keys";
47
48 reset {
49 label = "reset";
50 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
51 linux,code = <KEY_RESTART>;
52 };
53
54 wps {
55 label = "wps";
56 gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
57 linux,code = <KEY_WPS_BUTTON>;
58 };
59 };
60 };
61
62 &nand {
63 status = "okay";
64
65 partitions {
66 compatible = "fixed-partitions";
67 #address-cells = <1>;
68 #size-cells = <1>;
69
70 partition@0 {
71 label = "Bootloader";
72 reg = <0x0 0x80000>;
73 read-only;
74 };
75
76 partition@80000 {
77 label = "Nvram";
78 reg = <0x80000 0x40000>;
79 read-only;
80 };
81
82 partition@c0000 {
83 label = "Bdata";
84 reg = <0xc0000 0x40000>;
85 read-only;
86 };
87
88 factory: partition@100000 {
89 label = "Factory";
90 reg = <0x100000 0x80000>;
91 read-only;
92
93 nvmem-layout {
94 compatible = "fixed-layout";
95 #address-cells = <1>;
96 #size-cells = <1>;
97
98 eeprom_factory_0: eeprom@0 {
99 reg = <0x0 0xe00>;
100 };
101
102 macaddr_factory_3fff4: macaddr@3fff4 {
103 reg = <0x3fff4 0x6>;
104 };
105
106 macaddr_factory_3fffa: macaddr@3fffa {
107 reg = <0x3fffa 0x6>;
108 };
109 };
110 };
111
112 partition@180000 {
113 label = "crash";
114 reg = <0x180000 0x40000>;
115 read-only;
116 };
117
118 partition@1c0000 {
119 label = "crash_log";
120 reg = <0x1c0000 0x40000>;
121 read-only;
122 };
123
124 /* "kernel" and "ubi" partition is the result of
125 * squashing next consecutive stock partitions:
126 * 1. firmware 0x0200000 - 0x2000000 (Stock firmware 0)
127 * 2. firmware1 0x2000000 - 0x3e00000 (Stock firmware 1)
128 * 3. overlay 0x3e00000 - 0x7000000 (Stock fw Ubi overlay)
129 * 4. obr 0x7000000 - 0x8000000 (Unallocated?)
130 */
131
132 partition@200000 {
133 label = "kernel";
134 reg = <0x200000 0x400000>;
135 };
136
137 partition@600000 {
138 label = "ubi";
139 reg = <0x600000 0x7980000>;
140 };
141
142 /*
143 * Leave 512 KiB for the bad block table
144 */
145 };
146 };
147
148 &pcie {
149 status = "okay";
150 };
151
152 &pcie1 {
153 wifi@0,0 {
154 compatible = "mediatek,mt76";
155 reg = <0x0000 0 0 0 0>;
156 nvmem-cells = <&eeprom_factory_0>;
157 nvmem-cell-names = "eeprom";
158 mediatek,disable-radar-background;
159 };
160 };
161
162 &gmac0 {
163 nvmem-cells = <&macaddr_factory_3fff4>;
164 nvmem-cell-names = "mac-address";
165 };
166
167 &gmac1 {
168 status = "okay";
169 label = "wan";
170 phy-handle = <&ethphy4>;
171
172 nvmem-cells = <&macaddr_factory_3fffa>;
173 nvmem-cell-names = "mac-address";
174 };
175
176 &mdio {
177 ethphy4: ethernet-phy@4 {
178 reg = <4>;
179 };
180 };
181
182 &switch0 {
183 ports {
184 port@0 {
185 status = "okay";
186 label = "lan1";
187 };
188
189 port@1 {
190 status = "okay";
191 label = "lan2";
192 };
193
194 port@2 {
195 status = "okay";
196 label = "lan3";
197 };
198 };
199 };
200
201 &state_default {
202 gpio {
203 groups = "jtag", "uart3", "wdt";
204 function = "gpio";
205 };
206 };