xref: /linux/arch/arm64/boot/dts/rockchip/rk3568-qnap-ts433.dts (revision f6e8dc9edf963dbc99085e54f6ced6da9daa6100)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
4 * Copyright (c) 2024 Uwe Kleine-König
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/gpio/gpio.h>
12#include "rk3568.dtsi"
13
14/ {
15	model = "Qnap TS-433-4G NAS System 4-Bay";
16	compatible = "qnap,ts433", "rockchip,rk3568";
17
18	aliases {
19		ethernet0 = &gmac0;
20		mmc0 = &sdhci;
21		rtc0 = &rtc_rv8263;
22	};
23
24	chosen {
25		stdout-path = "serial2:115200n8";
26	};
27
28	keys {
29		compatible = "gpio-keys";
30		pinctrl-0 = <&copy_button_pin>, <&reset_button_pin>;
31		pinctrl-names = "default";
32
33		key-copy {
34			label = "copy";
35			gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
36			linux,code = <KEY_COPY>;
37		};
38
39		key-reset {
40			label = "reset";
41			gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_LOW>;
42			linux,code = <KEY_RESTART>;
43		};
44	};
45
46	leds {
47		compatible = "gpio-leds";
48
49		led-0 {
50			color = <LED_COLOR_ID_GREEN>;
51			function = LED_FUNCTION_DISK;
52			gpios = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>;
53			label = "hdd1:green:disk";
54			linux,default-trigger = "disk-activity";
55			pinctrl-names = "default";
56			pinctrl-0 = <&hdd1_led_pin>;
57		};
58
59		led-1 {
60			color = <LED_COLOR_ID_GREEN>;
61			function = LED_FUNCTION_DISK;
62			gpios = <&gpio1 RK_PD6 GPIO_ACTIVE_LOW>;
63			label = "hdd2:green:disk";
64			linux,default-trigger = "disk-activity";
65			pinctrl-names = "default";
66			pinctrl-0 = <&hdd2_led_pin>;
67		};
68
69		led-2 {
70			color = <LED_COLOR_ID_GREEN>;
71			function = LED_FUNCTION_DISK;
72			gpios = <&gpio1 RK_PD7 GPIO_ACTIVE_LOW>;
73			label = "hdd3:green:disk";
74			linux,default-trigger = "disk-activity";
75			pinctrl-names = "default";
76			pinctrl-0 = <&hdd3_led_pin>;
77		};
78
79		led-3 {
80			color = <LED_COLOR_ID_GREEN>;
81			function = LED_FUNCTION_DISK;
82			gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>;
83			label = "hdd4:green:disk";
84			linux,default-trigger = "disk-activity";
85			pinctrl-names = "default";
86			pinctrl-0 = <&hdd4_led_pin>;
87		};
88	};
89
90	dc_12v: regulator-dc-12v {
91		compatible = "regulator-fixed";
92		regulator-name = "dc_12v";
93		regulator-always-on;
94		regulator-boot-on;
95		regulator-min-microvolt = <12000000>;
96		regulator-max-microvolt = <12000000>;
97	};
98
99	vcc3v3_pcie: regulator-vcc3v3-pcie {
100		compatible = "regulator-fixed";
101		regulator-name = "vcc3v3_pcie";
102		regulator-min-microvolt = <3300000>;
103		regulator-max-microvolt = <3300000>;
104		enable-active-high;
105		gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
106		vin-supply = <&dc_12v>;
107	};
108
109	vcc3v3_sys: regulator-vcc3v3-sys {
110		compatible = "regulator-fixed";
111		regulator-name = "vcc3v3_sys";
112		regulator-always-on;
113		regulator-boot-on;
114		regulator-min-microvolt = <3300000>;
115		regulator-max-microvolt = <3300000>;
116		vin-supply = <&dc_12v>;
117	};
118
119	vcc5v0_host: regulator-vcc5v0-host {
120		compatible = "regulator-fixed";
121		enable-active-high;
122		pinctrl-names = "default";
123		pinctrl-0 = <&vcc5v0_host_en>;
124		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
125		regulator-name = "vcc5v0_host";
126		regulator-always-on;
127		regulator-boot-on;
128		regulator-min-microvolt = <5000000>;
129		regulator-max-microvolt = <5000000>;
130		vin-supply = <&vcc5v0_usb>;
131	};
132
133	vcc5v0_otg: regulator-vcc5v0-otg {
134		compatible = "regulator-fixed";
135		enable-active-high;
136		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
137		pinctrl-names = "default";
138		pinctrl-0 = <&vcc5v0_otg_en>;
139		regulator-name = "vcc5v0_otg";
140		regulator-always-on;
141		regulator-boot-on;
142		regulator-min-microvolt = <5000000>;
143		regulator-max-microvolt = <5000000>;
144		vin-supply = <&vcc5v0_usb>;
145	};
146
147	vcc5v0_sys: regulator-vcc5v0-sys {
148		compatible = "regulator-fixed";
149		regulator-name = "vcc5v0_sys";
150		regulator-always-on;
151		regulator-boot-on;
152		regulator-min-microvolt = <5000000>;
153		regulator-max-microvolt = <5000000>;
154		vin-supply = <&dc_12v>;
155	};
156
157	vcc5v0_usb: regulator-vcc5v0-usb {
158		compatible = "regulator-fixed";
159		regulator-name = "vcc5v0_usb";
160		regulator-always-on;
161		regulator-boot-on;
162		regulator-min-microvolt = <5000000>;
163		regulator-max-microvolt = <5000000>;
164		vin-supply = <&dc_12v>;
165	};
166};
167
168/* connected to usb_host0_xhci */
169&combphy0 {
170	status = "okay";
171};
172
173/* connected to sata1 */
174&combphy1 {
175	status = "okay";
176};
177
178/* connected to sata2 */
179&combphy2 {
180	status = "okay";
181};
182
183&cpu0 {
184	cpu-supply = <&vdd_cpu>;
185};
186
187&cpu1 {
188	cpu-supply = <&vdd_cpu>;
189};
190
191&cpu2 {
192	cpu-supply = <&vdd_cpu>;
193};
194
195&cpu3 {
196	cpu-supply = <&vdd_cpu>;
197};
198
199&gmac0 {
200	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>;
201	assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>;
202	assigned-clock-rates = <0>, <125000000>;
203	clock_in_out = "output";
204	phy-handle = <&rgmii_phy0>;
205	phy-mode = "rgmii-id";
206	pinctrl-names = "default";
207	pinctrl-0 = <&gmac0_miim
208		     &gmac0_tx_bus2
209		     &gmac0_rx_bus2
210		     &gmac0_rgmii_clk
211		     &gmac0_rgmii_bus>;
212	status = "okay";
213};
214
215&gpu {
216	mali-supply = <&vdd_gpu>;
217	status = "okay";
218};
219
220&i2c0 {
221	status = "okay";
222
223	pmic@20 {
224		compatible = "rockchip,rk809";
225		reg = <0x20>;
226		interrupt-parent = <&gpio0>;
227		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
228		#clock-cells = <1>;
229		pinctrl-names = "default";
230		pinctrl-0 = <&pmic_int_l>;
231		system-power-controller;
232		vcc1-supply = <&vcc3v3_sys>;
233		vcc2-supply = <&vcc3v3_sys>;
234		vcc3-supply = <&vcc3v3_sys>;
235		vcc4-supply = <&vcc3v3_sys>;
236		vcc5-supply = <&vcc3v3_sys>;
237		vcc6-supply = <&vcc3v3_sys>;
238		vcc7-supply = <&vcc3v3_sys>;
239		vcc8-supply = <&vcc3v3_sys>;
240		vcc9-supply = <&vcc3v3_sys>;
241		wakeup-source;
242
243		regulators {
244			vdd_logic: DCDC_REG1 {
245				regulator-name = "vdd_logic";
246				regulator-always-on;
247				regulator-boot-on;
248				regulator-initial-mode = <0x2>;
249				regulator-min-microvolt = <500000>;
250				regulator-max-microvolt = <1350000>;
251				regulator-ramp-delay = <6001>;
252
253				regulator-state-mem {
254					regulator-off-in-suspend;
255				};
256			};
257
258			vdd_gpu: DCDC_REG2 {
259				regulator-name = "vdd_gpu";
260				regulator-always-on;
261				regulator-initial-mode = <0x2>;
262				regulator-min-microvolt = <500000>;
263				regulator-max-microvolt = <1350000>;
264				regulator-ramp-delay = <6001>;
265
266				regulator-state-mem {
267					regulator-off-in-suspend;
268				};
269			};
270
271			vcc_ddr: DCDC_REG3 {
272				regulator-name = "vcc_ddr";
273				regulator-always-on;
274				regulator-boot-on;
275				regulator-initial-mode = <0x2>;
276
277				regulator-state-mem {
278					regulator-on-in-suspend;
279				};
280			};
281
282			vdd_npu: DCDC_REG4 {
283				regulator-name = "vdd_npu";
284				regulator-initial-mode = <0x2>;
285				regulator-min-microvolt = <500000>;
286				regulator-max-microvolt = <1350000>;
287				regulator-ramp-delay = <6001>;
288
289				regulator-state-mem {
290					regulator-off-in-suspend;
291				};
292			};
293
294			vcc_1v8: DCDC_REG5 {
295				regulator-name = "vcc_1v8";
296				regulator-always-on;
297				regulator-boot-on;
298				regulator-min-microvolt = <1800000>;
299				regulator-max-microvolt = <1800000>;
300
301				regulator-state-mem {
302					regulator-off-in-suspend;
303				};
304			};
305
306			vdda0v9_image: LDO_REG1 {
307				regulator-name = "vdda0v9_image";
308				regulator-always-on;
309				regulator-min-microvolt = <900000>;
310				regulator-max-microvolt = <900000>;
311
312				regulator-state-mem {
313					regulator-off-in-suspend;
314				};
315			};
316
317			vdda_0v9: LDO_REG2 {
318				regulator-name = "vdda_0v9";
319				regulator-always-on;
320				regulator-boot-on;
321				regulator-min-microvolt = <900000>;
322				regulator-max-microvolt = <900000>;
323
324				regulator-state-mem {
325					regulator-off-in-suspend;
326				};
327			};
328
329			vdda0v9_pmu: LDO_REG3 {
330				regulator-name = "vdda0v9_pmu";
331				regulator-always-on;
332				regulator-boot-on;
333				regulator-min-microvolt = <900000>;
334				regulator-max-microvolt = <900000>;
335
336				regulator-state-mem {
337					regulator-on-in-suspend;
338					regulator-suspend-microvolt = <900000>;
339				};
340			};
341
342			vccio_acodec: LDO_REG4 {
343				regulator-name = "vccio_acodec";
344				regulator-always-on;
345				regulator-boot-on;
346				regulator-min-microvolt = <3300000>;
347				regulator-max-microvolt = <3300000>;
348
349				regulator-state-mem {
350					regulator-off-in-suspend;
351				};
352			};
353
354			vccio_sd: LDO_REG5 {
355				regulator-name = "vccio_sd";
356				regulator-min-microvolt = <1800000>;
357				regulator-max-microvolt = <3300000>;
358
359				regulator-state-mem {
360					regulator-off-in-suspend;
361				};
362			};
363
364			vcc3v3_pmu: LDO_REG6 {
365				regulator-name = "vcc3v3_pmu";
366				regulator-always-on;
367				regulator-boot-on;
368				regulator-min-microvolt = <3300000>;
369				regulator-max-microvolt = <3300000>;
370
371				regulator-state-mem {
372					regulator-on-in-suspend;
373					regulator-suspend-microvolt = <3300000>;
374				};
375			};
376
377			vcca_1v8: LDO_REG7 {
378				regulator-name = "vcca_1v8";
379				regulator-always-on;
380				regulator-boot-on;
381				regulator-min-microvolt = <1800000>;
382				regulator-max-microvolt = <1800000>;
383
384				regulator-state-mem {
385					regulator-off-in-suspend;
386				};
387			};
388
389			vcca1v8_pmu: LDO_REG8 {
390				regulator-name = "vcca1v8_pmu";
391				regulator-always-on;
392				regulator-boot-on;
393				regulator-min-microvolt = <1800000>;
394				regulator-max-microvolt = <1800000>;
395
396				regulator-state-mem {
397					regulator-on-in-suspend;
398					regulator-suspend-microvolt = <1800000>;
399				};
400			};
401
402			vcca1v8_image: LDO_REG9 {
403				regulator-name = "vcca1v8_image";
404				regulator-always-on;
405				regulator-min-microvolt = <1800000>;
406				regulator-max-microvolt = <1800000>;
407
408				regulator-state-mem {
409					regulator-off-in-suspend;
410				};
411			};
412
413			vcc_3v3: SWITCH_REG1 {
414				regulator-name = "vcc_3v3";
415				regulator-always-on;
416				regulator-boot-on;
417
418				regulator-state-mem {
419					regulator-off-in-suspend;
420				};
421			};
422
423			vcc3v3_sd: SWITCH_REG2 {
424				regulator-name = "vcc3v3_sd";
425				/*
426				 * turning this off, breaks access to both
427				 * PCIe controllers, refclk generator perhaps
428				 */
429				regulator-always-on;
430				regulator-boot-on;
431
432				regulator-state-mem {
433					regulator-off-in-suspend;
434				};
435			};
436		};
437	};
438
439	vdd_cpu: regulator@40 {
440		compatible = "silergy,syr827";
441		reg = <0x40>;
442		fcs,suspend-voltage-selector = <1>;
443		regulator-name = "vdd_cpu";
444		regulator-always-on;
445		regulator-boot-on;
446		regulator-min-microvolt = <712500>;
447		regulator-max-microvolt = <1390000>;
448		regulator-ramp-delay = <2300>;
449		vin-supply = <&vcc5v0_sys>;
450	};
451};
452
453&i2c1 {
454	status = "okay";
455
456	rtc_rv8263: rtc@51 {
457		compatible = "microcrystal,rv8263";
458		reg = <0x51>;
459		wakeup-source;
460	};
461
462	/* eeprom for vital-product-data on the mainboard */
463	eeprom@54 {
464		compatible = "giantec,gt24c04a", "atmel,24c04";
465		reg = <0x54>;
466		label = "VPD_MB";
467		num-addresses = <2>;
468		pagesize = <16>;
469		read-only;
470	};
471
472	/* eeprom for vital-product-data on the backplane */
473	eeprom@56 {
474		compatible = "giantec,gt24c04a", "atmel,24c04";
475		reg = <0x56>;
476		label = "VPD_BP";
477		num-addresses = <2>;
478		pagesize = <16>;
479		read-only;
480	};
481};
482
483&mdio0 {
484	rgmii_phy0: ethernet-phy@3 {
485		/* Motorcomm YT8521 phy */
486		compatible = "ethernet-phy-ieee802.3-c22";
487		reg = <0x3>;
488		pinctrl-0 = <&eth_phy0_reset_pin>;
489		pinctrl-names = "default";
490		reset-assert-us = <10000>;
491		reset-gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_LOW>;
492	};
493};
494
495/*
496 * The MCU can provide system temperature too, but only by polling and of
497 * course also cannot set trip points. So attach to the cpu thermal-zone
498 * instead to control the fan.
499 */
500&cpu_thermal {
501	trips {
502		case_fan0: case-fan0 {
503			hysteresis = <2000>;
504			temperature = <35000>;
505			type = "active";
506		};
507
508		case_fan1: case-fan1 {
509			hysteresis = <2000>;
510			temperature = <45000>;
511			type = "active";
512		};
513
514		case_fan2: case-fan2 {
515			hysteresis = <2000>;
516			temperature = <65000>;
517			type = "active";
518		};
519	};
520
521	cooling-maps {
522		/*
523		 * Always provide some air movement, due to small case
524		 * full of harddrives.
525		 */
526		map1 {
527			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
528			trip = <&case_fan0>;
529		};
530
531		map2 {
532			cooling-device = <&fan 2 3>;
533			trip = <&case_fan1>;
534		};
535
536		map3 {
537			cooling-device = <&fan 4 THERMAL_NO_LIMIT>;
538			trip = <&case_fan2>;
539		};
540	};
541};
542
543&pcie30phy {
544	data-lanes = <1 2>;
545	status = "okay";
546};
547
548/* Connected to a JMicron AHCI SATA controller */
549&pcie3x1 {
550	reset-gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
551	vpcie3v3-supply = <&vcc3v3_pcie>;
552	status = "okay";
553};
554
555/* Connected to the 2.5G NIC for the upper network jack */
556&pcie3x2 {
557	num-lanes = <1>;
558	reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
559	vpcie3v3-supply = <&vcc3v3_pcie>;
560	status = "okay";
561};
562
563&pinctrl {
564	gmac0 {
565		eth_phy0_reset_pin: eth-phy0-reset-pin {
566			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
567		};
568	};
569
570	keys {
571		copy_button_pin: copy-button-pin {
572			rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
573		};
574
575		reset_button_pin: reset-button-pin {
576			rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
577		};
578	};
579
580	leds {
581		hdd1_led_pin: hdd1-led-pin {
582			rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
583		};
584
585		hdd2_led_pin: hdd2-led-pin {
586			rockchip,pins = <1 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
587		};
588
589		hdd3_led_pin: hdd3-led-pin {
590			rockchip,pins = <1 RK_PD7 RK_FUNC_GPIO &pcfg_pull_up>;
591		};
592
593		hdd4_led_pin: hdd4_led-pin {
594			rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
595		};
596	};
597
598	pmic {
599		pmic_int_l: pmic-int-l {
600			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
601		};
602	};
603
604	usb {
605		vcc5v0_host_en: vcc5v0-host-en {
606			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
607		};
608
609		vcc5v0_otg_en: vcc5v0-otg-en {
610			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
611		};
612	};
613};
614
615&pmu_io_domains {
616	vccio4-supply = <&vcc_1v8>;
617	vccio6-supply = <&vcc_1v8>;
618	status = "okay";
619};
620
621&sata1 {
622	status = "okay";
623};
624
625&sata2 {
626	status = "okay";
627};
628
629&sdhci {
630	bus-width = <8>;
631	max-frequency = <200000000>;
632	non-removable;
633	pinctrl-names = "default";
634	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
635	status = "okay";
636};
637
638&tsadc {
639	rockchip,hw-tshut-mode = <1>;
640	rockchip,hw-tshut-polarity = <0>;
641	status = "okay";
642};
643
644/*
645 * Connected to an MCU, that provides access to more LEDs,
646 * buzzer, fan control and more.
647 */
648&uart0 {
649	status = "okay";
650
651	mcu {
652		compatible = "qnap,ts433-mcu";
653
654		fan: fan-0 {
655			#cooling-cells = <2>;
656			cooling-levels = <0 64 89 128 166 204 221 238>;
657		};
658	};
659};
660
661/*
662 * Pins available on CN3 connector at TTL voltage level (3V3).
663 * ,_  _.
664 * |1234|  1=TX 2=VCC
665 * `----'  3=RX 4=GND
666 */
667&uart2 {
668	status = "okay";
669};
670
671&usb2phy0 {
672	status = "okay";
673};
674
675/* connected to usb_host0_xhci */
676&usb2phy0_otg {
677	phy-supply = <&vcc5v0_otg>;
678	status = "okay";
679};
680
681&usb2phy1 {
682	status = "okay";
683};
684
685/* connected to usb_host1_ehci/ohci */
686&usb2phy1_host {
687	phy-supply = <&vcc5v0_host>;
688	status = "okay";
689};
690
691/* connected to usb_host0_ehci/ohci */
692&usb2phy1_otg {
693	phy-supply = <&vcc5v0_host>;
694	status = "okay";
695};
696
697/* right port backside */
698&usb_host0_ehci {
699	status = "okay";
700};
701
702&usb_host0_ohci {
703	status = "okay";
704};
705
706/* front port */
707&usb_host0_xhci {
708	dr_mode = "host";
709	status = "okay";
710};
711
712/* left port backside */
713&usb_host1_ehci {
714	status = "okay";
715};
716
717&usb_host1_ohci {
718	status = "okay";
719};
720