ramips: add support for Sercomm CPJ routers
[openwrt/openwrt.git] / target / linux / ramips / dts / mt7620a_sercomm_cpj.dtsi
1 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2
3 #include "mt7620a.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 aliases {
11 label-mac-device = &ethernet;
12
13 led-boot = &status_green;
14 led-failsafe = &status_amber;
15 led-running = &status_green;
16 led-upgrade = &status_amber;
17 };
18
19 keys {
20 compatible = "gpio-keys";
21
22 button-0 {
23 label = "reset";
24 linux,code = <KEY_RESTART>;
25 gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
26 debounce-interval = <60>;
27 };
28
29 button-1 {
30 label = "wps";
31 linux,code = <KEY_RESTART>;
32 gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
33 debounce-interval = <60>;
34 };
35 };
36
37 leds {
38 compatible = "gpio-leds";
39
40 status_green: led-0 {
41 label = "green:status";
42 gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
43 color = <LED_COLOR_ID_GREEN>;
44 function = LED_FUNCTION_STATUS;
45 };
46
47 status_amber: led-1 {
48 label = "amber:status";
49 gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
50 color = <LED_COLOR_ID_AMBER>;
51 function = LED_FUNCTION_STATUS;
52 };
53
54 led-2 {
55 color = <LED_COLOR_ID_GREEN>;
56 function = LED_FUNCTION_WAN;
57 gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
58 };
59
60 led-3 {
61 color = <LED_COLOR_ID_GREEN>;
62 function = LED_FUNCTION_LAN;
63 function-enumerator = <1>;
64 gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
65 };
66
67 led-4 {
68 color = <LED_COLOR_ID_GREEN>;
69 function = LED_FUNCTION_LAN;
70 function-enumerator = <2>;
71 gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
72 };
73
74 led-5 {
75 color = <LED_COLOR_ID_GREEN>;
76 function = LED_FUNCTION_LAN;
77 function-enumerator = <3>;
78 gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
79 };
80
81 led-6 {
82 color = <LED_COLOR_ID_GREEN>;
83 function = LED_FUNCTION_LAN;
84 function-enumerator = <4>;
85 gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
86 };
87
88 led-7 {
89 color = <LED_COLOR_ID_GREEN>;
90 function = LED_FUNCTION_WLAN;
91 function-enumerator = <24>;
92 gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
93 linux,default-trigger = "phy1tpt";
94 };
95 };
96
97 virtual_flash {
98 compatible = "mtd-concat";
99
100 devices = <&fwconcat0 &fwconcat1>;
101
102 partitions {
103 compatible = "fixed-partitions";
104 #address-cells = <1>;
105 #size-cells = <1>;
106
107 partition@0 {
108 compatible = "openwrt,uimage";
109 /* sercomm krnl hdr with fw chksums */
110 openwrt,offset = <0x100>;
111 label = "firmware";
112 reg = <0x0 0x0>;
113 };
114 };
115 };
116 };
117
118 &ethernet {
119 nvmem-cells = <&macaddr_label 0>;
120 nvmem-cell-names = "mac-address";
121 };
122
123 &gpio1 {
124 status = "okay";
125 };
126
127 &gpio2 {
128 status = "okay";
129 };
130
131 &gpio3 {
132 status = "okay";
133 };
134
135 &pcie {
136 status = "okay";
137 };
138
139 /* mt7612 */
140 &pcie0 {
141 wifi@0,0 {
142 compatible = "mediatek,mt76";
143 reg = <0x0000 0 0 0 0>;
144 ieee80211-freq-limit = <5000000 6000000>;
145
146 nvmem-cells = <&eeprom_factory_8000>, <&macaddr_label 6>;
147 nvmem-cell-names = "eeprom", "mac-address";
148
149 /* 5 GHz WLAN phy green led */
150 led {
151 led-sources = <2>;
152 led-active-low;
153 };
154 };
155 };
156
157 &spi0 {
158 status = "okay";
159
160 flash@0 {
161 compatible = "jedec,spi-nor";
162 reg = <0>;
163 spi-max-frequency = <70000000>;
164 m25p,fast-read;
165
166 partitions {
167 compatible = "fixed-partitions";
168 #address-cells = <1>;
169 #size-cells = <1>;
170
171 /* whole flash */
172 partition@0_all {
173 label = "ALL";
174 reg = <0x0 0x1000000>;
175 read-only;
176 };
177
178 partition@0 {
179 label = "u-boot";
180 reg = <0x0 0x30000>;
181 read-only;
182 };
183
184 partition@30000 {
185 label = "ftd_and_bootflag";
186 reg = <0x30000 0x20000>;
187 };
188
189 partition@50000 {
190 label = "Factory";
191 reg = <0x50000 0x10000>;
192 read-only;
193
194 nvmem-layout {
195 compatible = "fixed-layout";
196 #address-cells = <1>;
197 #size-cells = <1>;
198
199 eeprom_factory_0: eeprom@0 {
200 reg = <0x0 0x200>;
201 };
202
203 eeprom_factory_8000: eeprom@8000 {
204 reg = <0x8000 0x200>;
205 };
206 };
207 };
208
209 partition@60000 {
210 label = "SC Nvram(permanent data)";
211 reg = <0x60000 0x10000>;
212 read-only;
213
214 nvmem-layout {
215 compatible = "fixed-layout";
216 #address-cells = <1>;
217 #size-cells = <1>;
218
219 macaddr_label: macaddr@0 {
220 compatible = "mac-base";
221 reg = <0x0 0x6>;
222 #nvmem-cell-cells = <1>;
223 };
224 };
225 };
226
227 fwconcat0: partition@70000 {
228 label = "Firmware";
229 reg = <0x70000 0x790000>;
230
231 compatible = "fixed-partitions";
232 #address-cells = <1>;
233 #size-cells = <1>;
234
235 partition@0 {
236 label = "Kernel";
237 reg = <0x0 0x200000>;
238 };
239
240 partition@200000 {
241 label = "RootFS";
242 reg = <0x200000 0x590000>;
243 };
244 };
245
246 fwconcat1: partition@800000 {
247 label = "Firmware2";
248 reg = <0x800000 0x790000>;
249
250 compatible = "fixed-partitions";
251 #address-cells = <1>;
252 #size-cells = <1>;
253
254 partition@0 {
255 label = "Kernel2";
256 reg = <0x0 0x200000>;
257 };
258
259 partition@200000 {
260 label = "RootFS2";
261 reg = <0x200000 0x590000>;
262 };
263 };
264
265 partition@f90000 {
266 label = "MAC IP";
267 reg = <0xf90000 0x10000>;
268 read-only;
269 };
270
271 partition@fa0000 {
272 label = "Critical Log";
273 reg = <0xfa0000 0x10000>;
274 read-only;
275 };
276
277 partition@fb000 {
278 label = "Critical Log Bak";
279 reg = <0xfb0000 0x10000>;
280 read-only;
281 };
282
283 partition@fc0000 {
284 label = "Xml Config";
285 reg = <0xfc0000 0x20000>;
286 read-only;
287 };
288
289 partition@fe0000 {
290 label = "Xml Config Bak";
291 reg = <0xfe0000 0x20000>;
292 read-only;
293 };
294 };
295 };
296 };
297
298 &state_default {
299 gpio {
300 groups = "ephy", "rgmii1", "uartf", "wled";
301 function = "gpio";
302 };
303 };
304
305 /* mt7620 */
306 &wmac {
307 nvmem-cells = <&eeprom_factory_0>, <&macaddr_label 2>;
308 nvmem-cell-names = "eeprom", "mac-address";
309 };