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