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