ramips: convert mt76 PCIe NIC EEPROM to NVMEM format for legacy SoCs
[openwrt/openwrt.git] / target / linux / ramips / dts / mt7621_cudy_wr2100.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
8 / {
9 compatible = "cudy,wr2100", "mediatek,mt7621-soc";
10 model = "Cudy WR2100";
11
12 aliases {
13 led-boot = &led_internet_blue;
14 led-failsafe = &led_internet_blue;
15 led-running = &led_internet_blue;
16 led-upgrade = &led_internet_blue;
17 label-mac-device = &gmac0;
18 };
19
20 chosen {
21 bootargs = "console=ttyS0,115200";
22 };
23
24 keys {
25 compatible = "gpio-keys";
26
27 reset {
28 label = "reset";
29 gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
30 linux,code = <KEY_RESTART>;
31 };
32
33 wps {
34 label = "wps";
35 gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
36 linux,code = <KEY_WPS_BUTTON>;
37 };
38 };
39
40 leds {
41 compatible = "gpio-leds";
42
43 led_internet_blue: internet_blue {
44 label = "blue:internet";
45 gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
46 };
47
48 internet_red {
49 label = "red:internet";
50 gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
51 };
52
53 wan {
54 label = "green:wan";
55 gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
56 };
57
58 lan1 {
59 label = "green:lan1";
60 gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
61 };
62
63 lan2 {
64 label = "green:lan2";
65 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
66 };
67
68 lan3 {
69 label = "green:lan3";
70 gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
71 };
72
73 lan4 {
74 label = "green:lan4";
75 gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
76 };
77 };
78 };
79
80 &gmac0 {
81 nvmem-cells = <&macaddr_bdinfo_de00>;
82 nvmem-cell-names = "mac-address";
83 };
84
85 &pcie {
86 status = "okay";
87 };
88
89 &pcie0 {
90 wifi@0,0 {
91 compatible = "mediatek,mt76";
92 reg = <0x0000 0 0 0 0>;
93 nvmem-cells = <&eeprom_factory_0>;
94 nvmem-cell-names = "eeprom";
95 ieee80211-freq-limit = <2400000 2500000>;
96 };
97 };
98
99 &pcie1 {
100 wifi@1,0 {
101 compatible = "mediatek,mt76";
102 reg = <0x0000 0 0 0 0>;
103 nvmem-cells = <&eeprom_factory_8000>;
104 nvmem-cell-names = "eeprom";
105 ieee80211-freq-limit = <5000000 6000000>;
106 };
107 };
108
109 &spi0 {
110 status = "okay";
111
112 flash@0 {
113 compatible = "jedec,spi-nor";
114 reg = <0>;
115 spi-max-frequency = <50000000>;
116
117 partitions {
118 compatible = "fixed-partitions";
119 #address-cells = <1>;
120 #size-cells = <1>;
121
122 partition@0 {
123 label = "u-boot";
124 reg = <0x0 0x30000>;
125 read-only;
126 };
127
128 partition@30000 {
129 label = "u-boot-env";
130 reg = <0x30000 0x10000>;
131 read-only;
132 };
133
134 factory: partition@40000 {
135 compatible = "nvmem-cells";
136 label = "factory";
137 reg = <0x40000 0x10000>;
138 #address-cells = <1>;
139 #size-cells = <1>;
140 read-only;
141
142 eeprom_factory_0: eeprom@0 {
143 reg = <0x0 0x400>;
144 };
145
146 eeprom_factory_8000: eeprom@8000 {
147 reg = <0x8000 0x4da8>;
148 };
149 };
150
151 partition@50000 {
152 compatible = "denx,uimage";
153 label = "firmware";
154 reg = <0x50000 0xf80000>;
155 };
156
157 partition@fd0000 {
158 label = "debug";
159 reg = <0xfd0000 0x10000>;
160 read-only;
161 };
162
163 partition@fe0000 {
164 label = "backup";
165 reg = <0xfe0000 0x10000>;
166 read-only;
167 };
168
169 bdinfo: partition@ff0000 {
170 compatible = "nvmem-cells";
171 label = "bdinfo";
172 reg = <0xff0000 0x10000>;
173 #address-cells = <1>;
174 #size-cells = <1>;
175 read-only;
176
177 macaddr_bdinfo_de00: macaddr@de00 {
178 reg = <0xde00 0x6>;
179 };
180 };
181 };
182 };
183 };
184
185 &state_default {
186 gpio {
187 groups = "i2c", "jtag", "uart2", "uart3", "wdt";
188 function = "gpio";
189 };
190 };
191
192 &gmac1 {
193 status = "okay";
194 label = "wan";
195 phy-handle = <&ethphy4>;
196
197 nvmem-cells = <&macaddr_bdinfo_de00>;
198 nvmem-cell-names = "mac-address";
199 mac-address-increment = <1>;
200 };
201
202 &mdio {
203 ethphy4: ethernet-phy@4 {
204 reg = <4>;
205 };
206 };
207
208 &switch0 {
209 ports {
210 port@0 {
211 status = "okay";
212 label = "lan1";
213 };
214
215 port@1 {
216 status = "okay";
217 label = "lan2";
218 };
219
220 port@2 {
221 status = "okay";
222 label = "lan3";
223 };
224
225 port@3 {
226 status = "okay";
227 label = "lan4";
228 };
229 };
230 };