1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4
5#include <dt-bindings/gpio/gpio.h>
6#include <dt-bindings/pinctrl/rockchip.h>
7#include <dt-bindings/soc/rockchip,vop2.h>
8#include "rk3566.dtsi"
9
10/ {
11	model = "Pine64 Quartz64 Model B";
12	compatible = "pine64,quartz64-b", "rockchip,rk3566";
13
14	aliases {
15		ethernet0 = &gmac1;
16		mmc0 = &sdmmc0;
17		mmc1 = &sdhci;
18		mmc2 = &sdmmc1;
19	};
20
21	chosen: chosen {
22		stdout-path = "serial2:1500000n8";
23	};
24
25	gmac1_clkin: external-gmac1-clock {
26		compatible = "fixed-clock";
27		clock-frequency = <125000000>;
28		clock-output-names = "gmac1_clkin";
29		#clock-cells = <0>;
30	};
31
32	hdmi-con {
33		compatible = "hdmi-connector";
34		type = "a";
35
36		port {
37			hdmi_con_in: endpoint {
38				remote-endpoint = <&hdmi_out_con>;
39			};
40		};
41	};
42
43	leds {
44		compatible = "gpio-leds";
45
46		led-user {
47			label = "user-led";
48			default-state = "on";
49			gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
50			linux,default-trigger = "heartbeat";
51			pinctrl-names = "default";
52			pinctrl-0 = <&user_led_enable_h>;
53			retain-state-suspended;
54		};
55	};
56
57	sound {
58		compatible = "simple-audio-card";
59		simple-audio-card,format = "i2s";
60		simple-audio-card,name = "Analog RK809";
61		simple-audio-card,mclk-fs = <256>;
62
63		simple-audio-card,cpu {
64			sound-dai = <&i2s1_8ch>;
65		};
66
67		simple-audio-card,codec {
68			sound-dai = <&rk809>;
69		};
70	};
71
72	sdio_pwrseq: sdio-pwrseq {
73		status = "okay";
74		compatible = "mmc-pwrseq-simple";
75		clocks = <&rk809 1>;
76		clock-names = "ext_clock";
77		pinctrl-names = "default";
78		pinctrl-0 = <&wifi_enable_h>;
79		reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>;
80		post-power-on-delay-ms = <100>;
81		power-off-delay-us = <5000000>;
82	};
83
84	vcc3v3_pcie_p: regulator-vcc3v3-pcie-p {
85		compatible = "regulator-fixed";
86		enable-active-high;
87		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
88		pinctrl-names = "default";
89		pinctrl-0 = <&pcie_enable_h>;
90		regulator-name = "vcc3v3_pcie_p";
91		regulator-min-microvolt = <3300000>;
92		regulator-max-microvolt = <3300000>;
93		vin-supply = <&vcc_3v3>;
94	};
95
96	vcc5v0_in: regulator-vcc5v0-in {
97		compatible = "regulator-fixed";
98		regulator-name = "vcc5v0_in";
99		regulator-always-on;
100		regulator-boot-on;
101		regulator-min-microvolt = <5000000>;
102		regulator-max-microvolt = <5000000>;
103	};
104
105	vcc5v0_sys: regulator-vcc5v0-sys {
106		compatible = "regulator-fixed";
107		regulator-name = "vcc5v0_sys";
108		regulator-always-on;
109		regulator-boot-on;
110		regulator-min-microvolt = <5000000>;
111		regulator-max-microvolt = <5000000>;
112		vin-supply = <&vcc5v0_in>;
113	};
114
115	vcc3v3_sys: regulator-vcc3v3-sys {
116		compatible = "regulator-fixed";
117		regulator-name = "vcc3v3_sys";
118		regulator-min-microvolt = <3300000>;
119		regulator-max-microvolt = <3300000>;
120		regulator-always-on;
121		vin-supply = <&vcc5v0_sys>;
122	};
123
124	vcc5v0_usb30_host: regulator-vcc5v0-usb30-host {
125		compatible = "regulator-fixed";
126		regulator-name = "vcc5v0_usb30_host";
127		enable-active-high;
128		gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>;
129		pinctrl-names = "default";
130		pinctrl-0 = <&vcc5v0_usb30_host_en_h>;
131		regulator-always-on;
132		regulator-min-microvolt = <5000000>;
133		regulator-max-microvolt = <5000000>;
134		vin-supply = <&vcc5v0_sys>;
135	};
136
137	vcc5v0_usb_otg: regulator-vcc5v0-usb-otg {
138		compatible = "regulator-fixed";
139		regulator-name = "vcc5v0_usb_otg";
140		enable-active-high;
141		gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
142		pinctrl-names = "default";
143		pinctrl-0 = <&vcc5v0_usb_otg_en_h>;
144		regulator-always-on;
145		regulator-min-microvolt = <5000000>;
146		regulator-max-microvolt = <5000000>;
147		vin-supply = <&vcc5v0_sys>;
148	};
149};
150
151&combphy1 {
152	status = "okay";
153};
154
155&combphy2 {
156	status = "okay";
157};
158
159&cpu0 {
160	cpu-supply = <&vdd_cpu>;
161};
162
163&cpu1 {
164	cpu-supply = <&vdd_cpu>;
165};
166
167&cpu2 {
168	cpu-supply = <&vdd_cpu>;
169};
170
171&cpu3 {
172	cpu-supply = <&vdd_cpu>;
173};
174
175&gmac1 {
176	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>,
177			  <&cru SCLK_GMAC1_RGMII_SPEED>,
178			  <&cru SCLK_GMAC1>;
179	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>,
180				 <&cru SCLK_GMAC1>,
181				 <&gmac1_clkin>;
182	clock_in_out = "input";
183	phy-mode = "rgmii";
184	phy-supply = <&vcc_3v3>;
185	pinctrl-names = "default";
186	pinctrl-0 = <&gmac1m1_miim
187		     &gmac1m1_tx_bus2
188		     &gmac1m1_rx_bus2
189		     &gmac1m1_rgmii_clk
190		     &gmac1m1_clkinout
191		     &gmac1m1_rgmii_bus>;
192	snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
193	snps,reset-active-low;
194	/* Reset time is 20ms, 100ms for rtl8211f, also works well here */
195	snps,reset-delays-us = <0 20000 100000>;
196	tx_delay = <0x4f>;
197	rx_delay = <0x24>;
198	phy-handle = <&rgmii_phy1>;
199	status = "okay";
200};
201
202&gpu {
203	mali-supply = <&vdd_gpu>;
204	status = "okay";
205};
206
207&hdmi {
208	avdd-0v9-supply = <&vdda0v9_image>;
209	avdd-1v8-supply = <&vcca1v8_image>;
210	status = "okay";
211};
212
213&hdmi_in {
214	hdmi_in_vp0: endpoint {
215		remote-endpoint = <&vp0_out_hdmi>;
216	};
217};
218
219&hdmi_out {
220	hdmi_out_con: endpoint {
221		remote-endpoint = <&hdmi_con_in>;
222	};
223};
224
225&hdmi_sound {
226	status = "okay";
227};
228
229&i2c0 {
230	status = "okay";
231
232	vdd_cpu: regulator@1c {
233		compatible = "tcs,tcs4525";
234		reg = <0x1c>;
235		fcs,suspend-voltage-selector = <1>;
236		regulator-name = "vdd_cpu";
237		regulator-min-microvolt = <800000>;
238		regulator-max-microvolt = <1150000>;
239		regulator-ramp-delay = <2300>;
240		regulator-always-on;
241		regulator-boot-on;
242		vin-supply = <&vcc5v0_sys>;
243
244		regulator-state-mem {
245			regulator-off-in-suspend;
246		};
247	};
248
249	rk809: pmic@20 {
250		compatible = "rockchip,rk809";
251		reg = <0x20>;
252		interrupt-parent = <&gpio0>;
253		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
254		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
255		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
256		clock-names = "mclk";
257		clocks = <&cru I2S1_MCLKOUT_TX>;
258		clock-output-names = "rk808-clkout1", "rk808-clkout2";
259
260		pinctrl-names = "default";
261		pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>;
262		system-power-controller;
263		#sound-dai-cells = <0>;
264		wakeup-source;
265		#clock-cells = <1>;
266
267		vcc1-supply = <&vcc3v3_sys>;
268		vcc2-supply = <&vcc3v3_sys>;
269		vcc3-supply = <&vcc3v3_sys>;
270		vcc4-supply = <&vcc3v3_sys>;
271		vcc5-supply = <&vcc3v3_sys>;
272		vcc6-supply = <&vcc3v3_sys>;
273		vcc7-supply = <&vcc3v3_sys>;
274		vcc8-supply = <&vcc3v3_sys>;
275		vcc9-supply = <&vcc3v3_sys>;
276
277		regulators {
278			vdd_log: DCDC_REG1 {
279				regulator-name = "vdd_log";
280				regulator-always-on;
281				regulator-boot-on;
282				regulator-min-microvolt = <500000>;
283				regulator-max-microvolt = <1350000>;
284				regulator-ramp-delay = <6001>;
285
286				regulator-state-mem {
287					regulator-on-in-suspend;
288					regulator-suspend-microvolt = <900000>;
289				};
290			};
291
292			vdd_gpu: DCDC_REG2 {
293				regulator-name = "vdd_gpu";
294				regulator-always-on;
295				regulator-boot-on;
296				regulator-min-microvolt = <500000>;
297				regulator-max-microvolt = <1350000>;
298				regulator-ramp-delay = <6001>;
299
300				regulator-state-mem {
301					regulator-off-in-suspend;
302					regulator-suspend-microvolt = <900000>;
303				};
304			};
305
306			vcc_ddr: DCDC_REG3 {
307				regulator-name = "vcc_ddr";
308				regulator-always-on;
309				regulator-boot-on;
310				regulator-initial-mode = <0x2>;
311				regulator-state-mem {
312					regulator-on-in-suspend;
313				};
314			};
315
316			vdd_npu: DCDC_REG4 {
317				regulator-name = "vdd_npu";
318				regulator-min-microvolt = <900000>;
319				regulator-max-microvolt = <1350000>;
320				regulator-initial-mode = <0x2>;
321				regulator-state-mem {
322					regulator-off-in-suspend;
323				};
324			};
325
326			vcc_1v8: DCDC_REG5 {
327				regulator-name = "vcc_1v8";
328				regulator-always-on;
329				regulator-boot-on;
330				regulator-min-microvolt = <1800000>;
331				regulator-max-microvolt = <1800000>;
332
333				regulator-state-mem {
334					regulator-on-in-suspend;
335					regulator-suspend-microvolt = <1800000>;
336				};
337			};
338
339			vdda0v9_image: LDO_REG1 {
340				regulator-name = "vdda0v9_image";
341				regulator-always-on;
342				regulator-boot-on;
343				regulator-min-microvolt = <900000>;
344				regulator-max-microvolt = <900000>;
345
346				regulator-state-mem {
347					regulator-on-in-suspend;
348					regulator-suspend-microvolt = <900000>;
349				};
350			};
351
352			vdda_0v9: LDO_REG2 {
353				regulator-name = "vdda_0v9";
354				regulator-always-on;
355				regulator-boot-on;
356				regulator-min-microvolt = <900000>;
357				regulator-max-microvolt = <900000>;
358
359				regulator-state-mem {
360					regulator-on-in-suspend;
361					regulator-suspend-microvolt = <900000>;
362				};
363			};
364
365			vdda0v9_pmu: LDO_REG3 {
366				regulator-name = "vdda0v9_pmu";
367				regulator-always-on;
368				regulator-boot-on;
369				regulator-min-microvolt = <900000>;
370				regulator-max-microvolt = <900000>;
371				regulator-state-mem {
372					regulator-on-in-suspend;
373					regulator-suspend-microvolt = <900000>;
374				};
375			};
376
377			vccio_acodec: LDO_REG4 {
378				regulator-name = "vccio_acodec";
379				regulator-always-on;
380				regulator-boot-on;
381				regulator-min-microvolt = <3300000>;
382				regulator-max-microvolt = <3300000>;
383
384				regulator-state-mem {
385					regulator-on-in-suspend;
386					regulator-suspend-microvolt = <3300000>;
387
388				};
389			};
390
391			vccio_sd: LDO_REG5 {
392				regulator-name = "vccio_sd";
393				regulator-always-on;
394				regulator-boot-on;
395				regulator-min-microvolt = <1800000>;
396				regulator-max-microvolt = <3300000>;
397
398				regulator-state-mem {
399					regulator-on-in-suspend;
400					regulator-suspend-microvolt = <3300000>;
401				};
402			};
403
404			vcc3v3_pmu: LDO_REG6 {
405				regulator-name = "vcc3v3_pmu";
406				regulator-always-on;
407				regulator-boot-on;
408				regulator-min-microvolt = <3300000>;
409				regulator-max-microvolt = <3300000>;
410
411				regulator-state-mem {
412					regulator-on-in-suspend;
413					regulator-suspend-microvolt = <3300000>;
414				};
415			};
416
417			vcca_1v8: LDO_REG7 {
418				regulator-name = "vcca_1v8";
419				regulator-always-on;
420				regulator-boot-on;
421				regulator-min-microvolt = <1800000>;
422				regulator-max-microvolt = <1800000>;
423
424				regulator-state-mem {
425					regulator-on-in-suspend;
426					regulator-suspend-microvolt = <1800000>;
427				};
428			};
429
430			vcca1v8_pmu: LDO_REG8 {
431				regulator-name = "vcca1v8_pmu";
432				regulator-always-on;
433				regulator-boot-on;
434				regulator-min-microvolt = <1800000>;
435				regulator-max-microvolt = <1800000>;
436
437				regulator-state-mem {
438					regulator-on-in-suspend;
439					regulator-suspend-microvolt = <1800000>;
440				};
441			};
442
443			vcca1v8_image: LDO_REG9 {
444				regulator-name = "vcca1v8_image";
445				regulator-always-on;
446				regulator-boot-on;
447				regulator-min-microvolt = <1800000>;
448				regulator-max-microvolt = <1800000>;
449
450				regulator-state-mem {
451					regulator-on-in-suspend;
452					regulator-suspend-microvolt = <1800000>;
453				};
454			};
455
456			vcc_3v3: SWITCH_REG1 {
457				regulator-boot-on;
458				regulator-name = "vcc_3v3";
459			};
460
461			vcc3v3_sd: SWITCH_REG2 {
462				regulator-name = "vcc3v3_sd";
463			};
464		};
465	};
466};
467
468/* i2c2_m1 exposed on csi port, pulled up to vcc_3v3 */
469&i2c2 {
470	pinctrl-names = "default";
471	pinctrl-0 = <&i2c2m1_xfer>;
472	status = "okay";
473};
474
475/* i2c3_m1 exposed on dsi port, pulled up to vcc_3v3 */
476&i2c3 {
477	pinctrl-names = "default";
478	pinctrl-0 = <&i2c3m1_xfer>;
479	status = "okay";
480};
481
482/*
483 * i2c4_m0 is exposed on PI40, pulled up to vcc_3v3
484 * pin 27 - i2c4_sda_m0
485 * pin 28 - i2c4_scl_m0
486 */
487&i2c4 {
488	status = "okay";
489};
490
491/*
492 * i2c5_m0 is exposed on PI40
493 * pin 29 - i2c5_scl_m0
494 * pin 31 - i2c5_sda_m0
495 */
496&i2c5 {
497	status = "disabled";
498};
499
500&i2s0_8ch {
501	status = "okay";
502};
503
504&i2s1_8ch {
505	pinctrl-names = "default";
506	pinctrl-0 = <&i2s1m0_sclktx
507		     &i2s1m0_lrcktx
508		     &i2s1m0_sdi0
509		     &i2s1m0_sdo0>;
510	rockchip,trcm-sync-tx-only;
511	status = "okay";
512};
513
514&mdio1 {
515	rgmii_phy1: ethernet-phy@1 {
516		compatible = "ethernet-phy-ieee802.3-c22";
517		reg = <0x1>;
518	};
519};
520
521&pcie2x1 {
522	pinctrl-names = "default";
523	pinctrl-0 = <&pcie_reset_h>;
524	reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
525	vpcie3v3-supply = <&vcc3v3_pcie_p>;
526	status = "okay";
527};
528
529&pinctrl {
530	bt {
531		bt_enable_h: bt-enable-h {
532			rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
533		};
534
535		bt_host_wake_l: bt-host-wake-l {
536			rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_down>;
537		};
538
539		bt_wake_l: bt-wake-l {
540			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
541		};
542	};
543
544	leds {
545		user_led_enable_h: user-led-enable-h {
546			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
547		};
548	};
549
550	pcie {
551		pcie_enable_h: pcie-enable-h {
552			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
553		};
554
555		pcie_reset_h: pcie-reset-h {
556			rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
557		};
558	};
559
560	pmic {
561		pmic_int: pmic_int {
562			rockchip,pins =
563				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
564		};
565	};
566
567	sdio-pwrseq {
568		wifi_enable_h: wifi-enable-h {
569			rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
570		};
571	};
572
573	usb {
574		vcc5v0_usb30_host_en_h: vcc5v0-usb30-host-en_h {
575			rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
576		};
577
578		vcc5v0_usb_otg_en_h: vcc5v0-usb-otg-en_h {
579			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
580		};
581	};
582};
583
584&pmu_io_domains {
585	status = "okay";
586	pmuio1-supply = <&vcc3v3_pmu>;
587	pmuio2-supply = <&vcca1v8_pmu>;
588	vccio1-supply = <&vccio_acodec>;
589	vccio2-supply = <&vcc_1v8>;
590	vccio3-supply = <&vccio_sd>;
591	vccio4-supply = <&vcca1v8_pmu>;
592	vccio5-supply = <&vcc_3v3>;
593	vccio6-supply = <&vcc_3v3>;
594	vccio7-supply = <&vcc_3v3>;
595};
596
597&saradc {
598	vref-supply = <&vcca_1v8>;
599	status = "okay";
600};
601
602&sdhci {
603	bus-width = <8>;
604	mmc-hs200-1_8v;
605	non-removable;
606	vmmc-supply = <&vcc_3v3>;
607	vqmmc-supply = <&vcc_1v8>;
608	status = "okay";
609};
610
611&sdmmc0 {
612	bus-width = <4>;
613	cap-sd-highspeed;
614	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
615	disable-wp;
616	pinctrl-names = "default";
617	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
618	sd-uhs-sdr50;
619	vmmc-supply = <&vcc3v3_sd>;
620	vqmmc-supply = <&vccio_sd>;
621	status = "okay";
622};
623
624&sdmmc1 {
625	bus-width = <4>;
626	cap-sd-highspeed;
627	cap-sdio-irq;
628	keep-power-in-suspend;
629	mmc-pwrseq = <&sdio_pwrseq>;
630	non-removable;
631	pinctrl-names = "default";
632	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
633	vmmc-supply = <&vcc3v3_sys>;
634	vqmmc-supply = <&vcca1v8_pmu>;
635	status = "okay";
636};
637
638&sfc {
639	pinctrl-0 = <&fspi_pins>;
640	pinctrl-names = "default";
641	#address-cells = <1>;
642	#size-cells = <0>;
643	status = "okay";
644
645	flash@0 {
646		compatible = "jedec,spi-nor";
647		reg = <0>;
648		spi-max-frequency = <24000000>;
649		spi-rx-bus-width = <4>;
650		spi-tx-bus-width = <1>;
651	};
652};
653
654&tsadc {
655	rockchip,hw-tshut-mode = <1>;
656	rockchip,hw-tshut-polarity = <0>;
657	status = "okay";
658};
659
660&uart1 {
661	dma-names = "tx", "rx";
662	pinctrl-names = "default";
663	pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>;
664	status = "okay";
665	uart-has-rtscts;
666
667	bluetooth {
668		compatible = "brcm,bcm4345c5";
669		clocks = <&rk809 1>;
670		clock-names = "lpo";
671		device-wakeup-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
672		host-wakeup-gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
673		shutdown-gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
674		pinctrl-names = "default";
675		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
676		vbat-supply = <&vcc3v3_sys>;
677		vddio-supply = <&vcca1v8_pmu>;
678	};
679};
680
681/*
682 * uart2_m0 is exposed on PI40
683 * pin 8  - uart2_tx_m0
684 * pin 10 - uart2_rx_m0
685 */
686&uart2 {
687	status = "okay";
688};
689
690&usb2phy0_host {
691	phy-supply = <&vcc5v0_usb30_host>;
692	status = "okay";
693};
694
695&usb2phy0_otg {
696	phy-supply = <&vcc5v0_usb_otg>;
697	status = "okay";
698};
699
700&usb2phy1_otg {
701	phy-supply = <&vcc5v0_usb30_host>;
702	status = "okay";
703};
704
705&usb2phy0 {
706	status = "okay";
707};
708
709&usb2phy1 {
710	status = "okay";
711};
712
713&usb_host0_xhci {
714	status = "okay";
715};
716
717&usb_host1_xhci {
718	status = "okay";
719};
720
721&usb_host0_ehci {
722	status = "okay";
723};
724
725&usb_host0_ohci {
726	status = "okay";
727};
728
729&vop {
730	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
731	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
732	status = "okay";
733};
734
735&vop_mmu {
736	status = "okay";
737};
738
739&vp0 {
740	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
741		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
742		remote-endpoint = <&hdmi_in_vp0>;
743	};
744};
745