blob: fade02c3c83e2e9eed7be3d757e20ee2a363f851 [file] [log] [blame]
Pali Rohár6763ff82024-06-06 18:33:26 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Turris 1.x Device Tree Source
4 *
5 * Copyright 2013 - 2022 CZ.NIC z.s.p.o. (http://www.nic.cz/)
6 *
7 * Pinout, Schematics and Altium hardware design files are open source
8 * and available at: https://docs.turris.cz/hw/turris-1x/turris-1x/
9 */
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/interrupt-controller/irq.h>
13#include <dt-bindings/leds/common.h>
14/include/ "fsl/p2020si-pre.dtsi"
15
16/ {
17 model = "Turris 1.x";
18
19 /* fsl,P2020RDB-PC is required for booting Linux */
20 compatible = "cznic,turris1x", "fsl,P2020RDB-PC";
21
22 aliases {
23 ethernet0 = &enet0;
24 ethernet1 = &enet1;
25 ethernet2 = &enet2;
26 serial0 = &serial0;
27 serial1 = &serial1;
28 pci0 = &pci0;
29 pci1 = &pci1;
30 pci2 = &pci2;
31 spi0 = &spi0;
32 };
33
34 memory {
35 device_type = "memory";
36 };
37
38 soc: soc@ffe00000 {
39 ranges = <0x0 0x0 0xffe00000 0x00100000>;
40
41 i2c@3000 {
42 /* PCA9557PW GPIO controller for boot config */
43 gpio-controller@18 {
44 compatible = "nxp,pca9557";
45 label = "bootcfg";
46 reg = <0x18>;
47 #gpio-cells = <2>;
48 gpio-controller;
49 polarity = <0x00>;
50 };
51
52 /* STM32F030R8T6 MCU for power control */
53 power-control@2a {
54 /*
55 * Turris Power Control firmware runs on STM32F0 MCU.
56 * This firmware is open source and available at:
57 * https://gitlab.nic.cz/turris/hw/turris_power_control
58 */
59 reg = <0x2a>;
60 };
61
62 /* DDR3 SPD/EEPROM PSWP instruction */
63 eeprom@32 {
64 reg = <0x32>;
65 };
66
67 /* SA56004ED temperature control */
68 temperature-sensor@4c {
69 compatible = "nxp,sa56004";
70 reg = <0x4c>;
71 interrupt-parent = <&gpio>;
72 interrupts = <12 IRQ_TYPE_LEVEL_LOW>, /* GPIO12 - ALERT pin */
73 <13 IRQ_TYPE_LEVEL_LOW>; /* GPIO13 - CRIT pin */
74 };
75
76 /* DDR3 SPD/EEPROM */
77 eeprom@52 {
78 compatible = "atmel,spd";
79 reg = <0x52>;
80 };
81
82 /* MCP79402-I/ST Protected EEPROM */
83 eeprom@57 {
84 reg = <0x57>;
85 };
86
87 /* ATSHA204-TH-DA-T crypto module */
88 crypto@64 {
89 compatible = "atmel,atsha204";
90 reg = <0x64>;
91 };
92
93 /* IDT6V49205BNLGI clock generator */
94 clock-generator@69 {
95 compatible = "idt,6v49205b";
96 reg = <0x69>;
97 };
98
99 /* MCP79402-I/ST RTC */
100 rtc@6f {
101 compatible = "microchip,mcp7940x";
102 reg = <0x6f>;
103 interrupt-parent = <&gpio>;
104 interrupts = <14 0>; /* GPIO14 - MFP pin */
105 };
106 };
107
108 /* SPI on connector P1 */
109 spi0: spi@7000 {
110 };
111
112 gpio: gpio-controller@fc00 {
113 #interrupt-cells = <2>;
114 interrupt-controller;
115 };
116
117 /* Connected to SMSC USB2412-DZK 2-Port USB 2.0 Hub Controller */
118 usb@22000 {
119 phy_type = "ulpi";
120 dr_mode = "host";
121 };
122
123 enet0: ethernet@24000 {
124 /* Connected to port 6 of QCA8337N-AL3C switch */
125 phy-connection-type = "rgmii-id";
126
127 fixed-link {
128 speed = <1000>;
129 full-duplex;
130 };
131 };
132
133 mdio@24520 {
134 /* KSZ9031RNXCA ethernet phy for WAN port */
135 phy: ethernet-phy@7 {
136 interrupts = <3 1 0 0>;
137 reg = <0x7>;
138 };
139
140 /* QCA8337N-AL3C switch with integrated ethernet PHYs for LAN ports */
141 switch@10 {
142 compatible = "qca,qca8337";
143 interrupts = <2 1 0 0>;
144 reg = <0x10>;
145
146 ports {
147 #address-cells = <1>;
148 #size-cells = <0>;
149
150 port@0 {
151 reg = <0>;
152 label = "cpu";
153 ethernet = <&enet1>;
154 phy-mode = "rgmii-id";
155
156 fixed-link {
157 speed = <1000>;
158 full-duplex;
159 };
160 };
161
162 port@1 {
163 reg = <1>;
164 label = "lan5";
165 };
166
167 port@2 {
168 reg = <2>;
169 label = "lan4";
170 };
171
172 port@3 {
173 reg = <3>;
174 label = "lan3";
175 };
176
177 port@4 {
178 reg = <4>;
179 label = "lan2";
180 };
181
182 port@5 {
183 reg = <5>;
184 label = "lan1";
185 };
186
187 port@6 {
188 reg = <6>;
189 label = "cpu";
190 ethernet = <&enet0>;
191 phy-mode = "rgmii-id";
192
193 fixed-link {
194 speed = <1000>;
195 full-duplex;
196 };
197 };
198 };
199 };
200 };
201
202 ptp_clock@24e00 {
203 fsl,tclk-period = <5>;
204 fsl,tmr-prsc = <200>;
205 fsl,tmr-add = <0xcccccccd>;
206 fsl,tmr-fiper1 = <0x3b9ac9fb>;
207 fsl,tmr-fiper2 = <0x0001869b>;
208 fsl,max-adj = <249999999>;
209 };
210
211 enet1: ethernet@25000 {
212 /* Connected to port 0 of QCA8337N-AL3C switch */
213 phy-connection-type = "rgmii-id";
214
215 fixed-link {
216 speed = <1000>;
217 full-duplex;
218 };
219 };
220
221 mdio@25520 {
222 status = "disabled";
223 };
224
225 enet2: ethernet@26000 {
226 /* Connected to KSZ9031RNXCA ethernet phy (WAN port) */
227 label = "wan";
228 phy-handle = <&phy>;
229 phy-connection-type = "rgmii-id";
230 };
231
232 mdio@26520 {
233 status = "disabled";
234 };
235
236 sdhc@2e000 {
237 bus-width = <4>;
238 cd-gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
239 };
240 };
241
242 lbc: localbus@ffe05000 {
243 reg = <0 0xffe05000 0 0x1000>;
244
245 ranges = <0x0 0x0 0x0 0xef000000 0x01000000>, /* NOR */
246 <0x1 0x0 0x0 0xff800000 0x00040000>, /* NAND */
247 <0x3 0x0 0x0 0xffa00000 0x00020000>; /* CPLD */
248
249 /* S29GL128P90TFIR10 NOR */
250 nor@0,0 {
251 compatible = "cfi-flash";
252 reg = <0x0 0x0 0x01000000>;
253 bank-width = <2>;
254 device-width = <1>;
255
256 partitions {
257 compatible = "fixed-partitions";
258 #address-cells = <1>;
259 #size-cells = <1>;
260
261 partition@0 {
262 /* 128 kB for Device Tree Blob */
263 reg = <0x00000000 0x00020000>;
264 label = "dtb";
265 };
266
267 partition@20000 {
268 /* 1.7 MB for Linux Kernel Image */
269 reg = <0x00020000 0x001a0000>;
270 label = "kernel";
271 };
272
273 partition@1c0000 {
274 /* 1.5 MB for Rescue JFFS2 Root File System */
275 reg = <0x001c0000 0x00180000>;
276 label = "rescue";
277 };
278
279 partition@340000 {
280 /* 11 MB for TAR.XZ Archive with Factory content of NAND
281 * Root File System
282 */
283 reg = <0x00340000 0x00b00000>;
284 label = "factory";
285 };
286
287 partition@e40000 {
288 /* 768 kB for Certificates JFFS2 File System */
289 reg = <0x00e40000 0x000c0000>;
290 label = "certificates";
291 };
292
293 /* free unused space 0x00f00000-0x00f20000 */
294
295 partition@f20000 {
296 /* 128 kB for U-Boot Environment Variables */
297 reg = <0x00f20000 0x00020000>;
298 label = "u-boot-env";
299 };
300
301 partition@f40000 {
302 /* 768 kB for U-Boot Bootloader Image */
303 reg = <0x00f40000 0x000c0000>;
304 label = "u-boot";
305 };
306 };
307 };
308
309 /* MT29F2G08ABAEAWP:E NAND */
310 nand@1,0 {
311 compatible = "fsl,p2020-fcm-nand", "fsl,elbc-fcm-nand";
312 reg = <0x1 0x0 0x00040000>;
313 nand-ecc-mode = "soft";
314 nand-ecc-algo = "bch";
315
316 partitions {
317 compatible = "fixed-partitions";
318 #address-cells = <1>;
319 #size-cells = <1>;
320
321 partition@0 {
322 /* 256 MB for UBI with one volume: UBIFS Root File System */
323 reg = <0x00000000 0x10000000>;
324 label = "rootfs";
325 };
326 };
327 };
328
329 /* LCMXO1200C-3FTN256C FPGA */
330 cpld@3,0 {
331 /*
332 * Turris CPLD firmware which runs on this Lattice FPGA,
333 * is extended version of P1021RDB-PC CPLD v4.1 firmware.
334 * It is backward compatible with its original version
335 * and the only extension is support for Turris LEDs.
336 * Turris CPLD firmware is open source and available at:
337 * https://gitlab.nic.cz/turris/hw/turris_cpld/-/blob/master/CZ_NIC_Router_CPLD.v
338 */
339 compatible = "cznic,turris1x-cpld", "fsl,p1021rdb-pc-cpld", "simple-bus",
340 "syscon";
341 reg = <0x3 0x0 0x30>;
342 #address-cells = <1>;
343 #size-cells = <1>;
344 ranges = <0x0 0x3 0x0 0x00020000>;
345
346 /* MAX6370KA+T watchdog */
347 watchdog@2 {
348 /*
349 * CPLD firmware maps SET0, SET1 and SET2
350 * input logic of MAX6370KA+T chip to CPLD
351 * memory space at byte offset 0x2. WDI
352 * input logic is outside of the CPLD and
353 * connected via external GPIO.
354 */
355 compatible = "maxim,max6370";
356 reg = <0x02 0x01>;
357 gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
358 };
359
360 reboot@d {
361 /*
362 * CPLD firmware which manages system reset and
363 * watchdog registers has bugs. It does not
364 * autoclear system reset register after change
365 * and watchdog ignores reset line on immediate
366 * succeeding reset cycle triggered by watchdog.
367 * These bugs have to be workarounded in U-Boot
368 * bootloader. So use system reset via syscon as
369 * a last resort because older U-Boot versions
370 * do not have workaround for watchdog.
371 *
372 * Reset method via rstcr's global-utilities
373 * (the preferred one) has priority level 128,
374 * watchdog has priority level 0 and default
375 * syscon-reboot priority level is 192.
376 *
377 * So define syscon-reboot with custom priority
378 * level 64 (between rstcr and watchdog) because
379 * rstcr should stay as default preferred reset
380 * method and reset via watchdog is more broken
381 * than system reset via syscon.
382 */
383 compatible = "syscon-reboot";
384 reg = <0x0d 0x01>;
385 offset = <0x0d>;
386 mask = <0x01>;
387 value = <0x01>;
388 priority = <64>;
389 };
390
391 led-controller@13 {
392 /*
393 * LEDs are controlled by CPLD firmware.
394 * All five LAN LEDs share common RGB settings
395 * and so it is not possible to set different
396 * colors on different LAN ports.
397 */
398 compatible = "cznic,turris1x-leds";
399 reg = <0x13 0x1d>;
400 #address-cells = <1>;
401 #size-cells = <0>;
402
403 multi-led@0 {
404 reg = <0x0>;
405 color = <LED_COLOR_ID_RGB>;
406 function = LED_FUNCTION_WAN;
407 };
408
409 multi-led@1 {
410 reg = <0x1>;
411 color = <LED_COLOR_ID_RGB>;
412 function = LED_FUNCTION_LAN;
413 function-enumerator = <5>;
414 };
415
416 multi-led@2 {
417 reg = <0x2>;
418 color = <LED_COLOR_ID_RGB>;
419 function = LED_FUNCTION_LAN;
420 function-enumerator = <4>;
421 };
422
423 multi-led@3 {
424 reg = <0x3>;
425 color = <LED_COLOR_ID_RGB>;
426 function = LED_FUNCTION_LAN;
427 function-enumerator = <3>;
428 };
429
430 multi-led@4 {
431 reg = <0x4>;
432 color = <LED_COLOR_ID_RGB>;
433 function = LED_FUNCTION_LAN;
434 function-enumerator = <2>;
435 };
436
437 multi-led@5 {
438 reg = <0x5>;
439 color = <LED_COLOR_ID_RGB>;
440 function = LED_FUNCTION_LAN;
441 function-enumerator = <1>;
442 };
443
444 multi-led@6 {
445 reg = <0x6>;
446 color = <LED_COLOR_ID_RGB>;
447 function = LED_FUNCTION_WLAN;
448 };
449
450 multi-led@7 {
451 reg = <0x7>;
452 color = <LED_COLOR_ID_RGB>;
453 function = LED_FUNCTION_POWER;
454 };
455 };
456 };
457 };
458
459 pci2: pcie@ffe08000 {
460 /*
461 * PCIe bus for on-board TUSB7340RKM USB 3.0 xHCI controller.
462 * This xHCI controller is available only on Turris 1.1 boards.
463 * Turris 1.0 boards have nothing connected to this PCIe bus,
464 * so system would see only PCIe Root Port of this PCIe Root
465 * Complex. TUSB7340RKM xHCI controller has four SuperSpeed
466 * channels. Channel 0 is connected to the front USB 3.0 port,
467 * channel 1 (but only USB 2.0 subset) to USB 2.0 pins on mPCIe
468 * slot 1 (CN5), channels 2 and 3 to connector P600.
469 *
470 * P2020 PCIe Root Port uses 1MB of PCIe MEM and xHCI controller
471 * uses 64kB + 8kB of PCIe MEM. No PCIe IO is used or required.
472 * So allocate 2MB of PCIe MEM for this PCIe bus.
473 */
474 reg = <0 0xffe08000 0 0x1000>;
475 ranges = <0x02000000 0x0 0xc0000000 0 0xc0000000 0x0 0x00200000>, /* MEM */
476 <0x01000000 0x0 0x00000000 0 0xffc20000 0x0 0x00010000>; /* IO */
477
478 pcie@0 {
479 ranges;
480 };
481 };
482
483 pci1: pcie@ffe09000 {
484 /* PCIe bus on mPCIe slot 2 (CN6) for expansion mPCIe card */
485 reg = <0 0xffe09000 0 0x1000>;
486 ranges = <0x02000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000>, /* MEM */
487 <0x01000000 0x0 0x00000000 0 0xffc10000 0x0 0x00010000>; /* IO */
488
489 pcie@0 {
490 ranges;
491 };
492 };
493
494 pci0: pcie@ffe0a000 {
495 /*
496 * PCIe bus on mPCIe slot 1 (CN5) for expansion mPCIe card.
497 * Turris 1.1 boards have in this mPCIe slot additional USB 2.0
498 * pins via channel 1 of TUSB7340RKM xHCI controller and also
499 * additional SIM card slot, both for USB-based WWAN cards.
500 */
501 reg = <0 0xffe0a000 0 0x1000>;
502 ranges = <0x02000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000>, /* MEM */
503 <0x01000000 0x0 0x00000000 0 0xffc00000 0x0 0x00010000>; /* IO */
504
505 pcie@0 {
506 ranges;
507 };
508 };
509};
510
511/include/ "fsl/p2020si-post.dtsi"