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