1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2022 Hardkernel Co., Ltd.
4 *
5 */
6
7/dts-v1/;
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/leds/common.h>
10#include <dt-bindings/pinctrl/rockchip.h>
11#include <dt-bindings/soc/rockchip,vop2.h>
12#include "rk3568.dtsi"
13
14/ {
15	model = "Hardkernel ODROID-M1";
16	compatible = "rockchip,rk3568-odroid-m1", "rockchip,rk3568";
17
18	aliases {
19		ethernet0 = &gmac0;
20		i2c0 = &i2c3;
21		i2c3 = &i2c0;
22		mmc0 = &sdhci;
23		mmc1 = &sdmmc0;
24		serial0 = &uart1;
25		serial1 = &uart0;
26	};
27
28	chosen {
29		stdout-path = "serial2:1500000n8";
30	};
31
32	dc_12v: dc-12v-regulator {
33		compatible = "regulator-fixed";
34		regulator-name = "dc_12v";
35		regulator-always-on;
36		regulator-boot-on;
37		regulator-min-microvolt = <12000000>;
38		regulator-max-microvolt = <12000000>;
39	};
40
41	hdmi-con {
42		compatible = "hdmi-connector";
43		type = "a";
44
45		port {
46			hdmi_con_in: endpoint {
47				remote-endpoint = <&hdmi_out_con>;
48			};
49		};
50	};
51
52	leds {
53		compatible = "gpio-leds";
54
55		led_power: led-0 {
56			gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
57			function = LED_FUNCTION_POWER;
58			color = <LED_COLOR_ID_RED>;
59			default-state = "keep";
60			linux,default-trigger = "default-on";
61			pinctrl-names = "default";
62			pinctrl-0 = <&led_power_pin>;
63		};
64		led_work: led-1 {
65			gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
66			function = LED_FUNCTION_HEARTBEAT;
67			color = <LED_COLOR_ID_BLUE>;
68			linux,default-trigger = "heartbeat";
69			pinctrl-names = "default";
70			pinctrl-0 = <&led_work_pin>;
71		};
72	};
73
74	rk809-sound {
75		compatible = "simple-audio-card";
76		pinctrl-names = "default";
77		pinctrl-0 = <&hp_det_pin>;
78		simple-audio-card,name = "Analog RK817";
79		simple-audio-card,format = "i2s";
80		simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
81		simple-audio-card,mclk-fs = <256>;
82		simple-audio-card,widgets =
83			"Headphone", "Headphones",
84			"Speaker", "Speaker";
85		simple-audio-card,routing =
86			"Headphones", "HPOL",
87			"Headphones", "HPOR",
88			"Speaker", "SPKO";
89
90		simple-audio-card,cpu {
91			sound-dai = <&i2s1_8ch>;
92		};
93
94		simple-audio-card,codec {
95			sound-dai = <&rk809>;
96		};
97	};
98
99	vcc3v3_sys: vcc3v3-sys-regulator {
100		compatible = "regulator-fixed";
101		regulator-name = "vcc3v3_sys";
102		regulator-always-on;
103		regulator-boot-on;
104		regulator-min-microvolt = <3300000>;
105		regulator-max-microvolt = <3300000>;
106		vin-supply = <&dc_12v>;
107	};
108
109	vcc5v0_sys: vcc5v0-sys-regulator {
110		compatible = "regulator-fixed";
111		regulator-name = "vcc5v0_sys";
112		regulator-always-on;
113		regulator-boot-on;
114		regulator-min-microvolt = <5000000>;
115		regulator-max-microvolt = <5000000>;
116		vin-supply = <&dc_12v>;
117	};
118
119	vcc5v0_usb_host: vcc5v0-usb-host-regulator {
120		compatible = "regulator-fixed";
121		regulator-name = "vcc5v0_usb_host";
122		enable-active-high;
123		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
124		pinctrl-names = "default";
125		pinctrl-0 = <&vcc5v0_usb_host_en_pin>;
126		regulator-min-microvolt = <5000000>;
127		regulator-max-microvolt = <5000000>;
128		vin-supply = <&vcc5v0_sys>;
129	};
130
131	vcc5v0_usb_otg: vcc5v0-usb-otg-regulator {
132		compatible = "regulator-fixed";
133		regulator-name = "vcc5v0_usb_otg";
134		enable-active-high;
135		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
136		pinctrl-names = "default";
137		pinctrl-0 = <&vcc5v0_usb_otg_en_pin>;
138		regulator-min-microvolt = <5000000>;
139		regulator-max-microvolt = <5000000>;
140		vin-supply = <&vcc5v0_sys>;
141	};
142};
143
144&combphy0 {
145	/* Used for USB3 */
146	phy-supply = <&vcc5v0_usb_host>;
147	status = "okay";
148};
149
150&combphy1 {
151	/* Used for USB3 */
152	phy-supply = <&vcc5v0_usb_otg>;
153	status = "okay";
154};
155
156&cpu0 {
157	cpu-supply = <&vdd_cpu>;
158};
159
160&cpu1 {
161	cpu-supply = <&vdd_cpu>;
162};
163
164&cpu2 {
165	cpu-supply = <&vdd_cpu>;
166};
167
168&cpu3 {
169	cpu-supply = <&vdd_cpu>;
170};
171
172&gmac0 {
173	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>;
174	assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>;
175	assigned-clock-rates = <0>, <125000000>;
176	clock_in_out = "output";
177	phy-handle = <&rgmii_phy0>;
178	phy-mode = "rgmii";
179	phy-supply = <&vcc3v3_sys>;
180	pinctrl-names = "default";
181	pinctrl-0 = <&gmac0_miim
182		     &gmac0_tx_bus2
183		     &gmac0_rx_bus2
184		     &gmac0_rgmii_clk
185		     &gmac0_rgmii_bus>;
186	status = "okay";
187
188	tx_delay = <0x4f>;
189	rx_delay = <0x2d>;
190};
191
192&gpu {
193	mali-supply = <&vdd_gpu>;
194	status = "okay";
195};
196
197&hdmi {
198	avdd-0v9-supply = <&vdda0v9_image>;
199	avdd-1v8-supply = <&vcca1v8_image>;
200	status = "okay";
201};
202
203&hdmi_in {
204	hdmi_in_vp0: endpoint {
205		remote-endpoint = <&vp0_out_hdmi>;
206	};
207};
208
209&hdmi_out {
210	hdmi_out_con: endpoint {
211		remote-endpoint = <&hdmi_con_in>;
212	};
213};
214
215&hdmi_sound {
216	status = "okay";
217};
218
219&i2c0 {
220	status = "okay";
221
222	vdd_cpu: regulator@1c {
223		compatible = "tcs,tcs4525";
224		reg = <0x1c>;
225		fcs,suspend-voltage-selector = <1>;
226		regulator-name = "vdd_cpu";
227		regulator-always-on;
228		regulator-boot-on;
229		regulator-min-microvolt = <800000>;
230		regulator-max-microvolt = <1150000>;
231		regulator-ramp-delay = <2300>;
232		vin-supply = <&vcc3v3_sys>;
233
234		regulator-state-mem {
235			regulator-off-in-suspend;
236		};
237	};
238
239	rk809: pmic@20 {
240		compatible = "rockchip,rk809";
241		reg = <0x20>;
242		interrupt-parent = <&gpio0>;
243		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
244		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
245		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
246		#clock-cells = <1>;
247		clock-names = "mclk";
248		clocks = <&cru I2S1_MCLKOUT_TX>;
249		pinctrl-names = "default";
250		pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>;
251		rockchip,system-power-controller;
252		#sound-dai-cells = <0>;
253		vcc1-supply = <&vcc3v3_sys>;
254		vcc2-supply = <&vcc3v3_sys>;
255		vcc3-supply = <&vcc3v3_sys>;
256		vcc4-supply = <&vcc3v3_sys>;
257		vcc5-supply = <&vcc3v3_sys>;
258		vcc6-supply = <&vcc3v3_sys>;
259		vcc7-supply = <&vcc3v3_sys>;
260		vcc8-supply = <&vcc3v3_sys>;
261		vcc9-supply = <&vcc3v3_sys>;
262		wakeup-source;
263
264		regulators {
265			vdd_logic: DCDC_REG1 {
266				regulator-name = "vdd_logic";
267				regulator-always-on;
268				regulator-boot-on;
269				regulator-init-microvolt = <900000>;
270				regulator-initial-mode = <0x2>;
271				regulator-min-microvolt = <500000>;
272				regulator-max-microvolt = <1350000>;
273				regulator-ramp-delay = <6001>;
274
275				regulator-state-mem {
276					regulator-off-in-suspend;
277				};
278			};
279
280			vdd_gpu: DCDC_REG2 {
281				regulator-name = "vdd_gpu";
282				regulator-always-on;
283				regulator-init-microvolt = <900000>;
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_ddr: DCDC_REG3 {
295				regulator-name = "vcc_ddr";
296				regulator-always-on;
297				regulator-boot-on;
298				regulator-initial-mode = <0x2>;
299
300				regulator-state-mem {
301					regulator-on-in-suspend;
302				};
303			};
304
305			vdd_npu: DCDC_REG4 {
306				regulator-name = "vdd_npu";
307				regulator-init-microvolt = <900000>;
308				regulator-initial-mode = <0x2>;
309				regulator-min-microvolt = <500000>;
310				regulator-max-microvolt = <1350000>;
311				regulator-ramp-delay = <6001>;
312
313				regulator-state-mem {
314					regulator-off-in-suspend;
315				};
316			};
317
318			vcc_1v8: DCDC_REG5 {
319				regulator-name = "vcc_1v8";
320				regulator-always-on;
321				regulator-boot-on;
322				regulator-min-microvolt = <1800000>;
323				regulator-max-microvolt = <1800000>;
324
325				regulator-state-mem {
326					regulator-off-in-suspend;
327				};
328			};
329
330			vdda0v9_image: LDO_REG1 {
331				regulator-name = "vdda0v9_image";
332				regulator-always-on;
333				regulator-min-microvolt = <900000>;
334				regulator-max-microvolt = <900000>;
335
336				regulator-state-mem {
337					regulator-off-in-suspend;
338				};
339			};
340
341			vdda_0v9: LDO_REG2 {
342				regulator-name = "vdda_0v9";
343				regulator-always-on;
344				regulator-boot-on;
345				regulator-min-microvolt = <900000>;
346				regulator-max-microvolt = <900000>;
347
348				regulator-state-mem {
349					regulator-off-in-suspend;
350				};
351			};
352
353			vdda0v9_pmu: LDO_REG3 {
354				regulator-name = "vdda0v9_pmu";
355				regulator-always-on;
356				regulator-boot-on;
357				regulator-min-microvolt = <900000>;
358				regulator-max-microvolt = <900000>;
359
360				regulator-state-mem {
361					regulator-on-in-suspend;
362					regulator-suspend-microvolt = <900000>;
363				};
364			};
365
366			vccio_acodec: LDO_REG4 {
367				regulator-name = "vccio_acodec";
368				regulator-always-on;
369				regulator-boot-on;
370				regulator-min-microvolt = <3300000>;
371				regulator-max-microvolt = <3300000>;
372
373				regulator-state-mem {
374					regulator-off-in-suspend;
375				};
376			};
377
378			vccio_sd: LDO_REG5 {
379				regulator-name = "vccio_sd";
380				regulator-min-microvolt = <1800000>;
381				regulator-max-microvolt = <3300000>;
382
383				regulator-state-mem {
384					regulator-off-in-suspend;
385				};
386			};
387
388			vcc3v3_pmu: LDO_REG6 {
389				regulator-name = "vcc3v3_pmu";
390				regulator-always-on;
391				regulator-boot-on;
392				regulator-min-microvolt = <3300000>;
393				regulator-max-microvolt = <3300000>;
394
395				regulator-state-mem {
396					regulator-on-in-suspend;
397					regulator-suspend-microvolt = <3300000>;
398				};
399			};
400
401			vcca_1v8: LDO_REG7 {
402				regulator-name = "vcca_1v8";
403				regulator-always-on;
404				regulator-boot-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			vcca1v8_pmu: LDO_REG8 {
414				regulator-name = "vcca1v8_pmu";
415				regulator-always-on;
416				regulator-boot-on;
417				regulator-min-microvolt = <1800000>;
418				regulator-max-microvolt = <1800000>;
419
420				regulator-state-mem {
421					regulator-on-in-suspend;
422					regulator-suspend-microvolt = <1800000>;
423				};
424			};
425
426			vcca1v8_image: LDO_REG9 {
427				regulator-name = "vcca1v8_image";
428				regulator-always-on;
429				regulator-min-microvolt = <1800000>;
430				regulator-max-microvolt = <1800000>;
431
432				regulator-state-mem {
433					regulator-off-in-suspend;
434				};
435			};
436
437			vcc_3v3: SWITCH_REG1 {
438				regulator-name = "vcc_3v3";
439				regulator-always-on;
440				regulator-boot-on;
441
442				regulator-state-mem {
443					regulator-off-in-suspend;
444				};
445			};
446
447			vcc3v3_sd: SWITCH_REG2 {
448				regulator-name = "vcc3v3_sd";
449
450				regulator-state-mem {
451					regulator-off-in-suspend;
452				};
453			};
454		};
455	};
456};
457
458&i2s0_8ch {
459	status = "okay";
460};
461
462&i2s1_8ch {
463	rockchip,trcm-sync-tx-only;
464	status = "okay";
465};
466
467&mdio0 {
468	rgmii_phy0: ethernet-phy@0 {
469		compatible = "ethernet-phy-ieee802.3-c22";
470		reg = <0x0>;
471		reset-assert-us = <20000>;
472		reset-deassert-us = <100000>;
473		reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
474	};
475};
476
477&pinctrl {
478	fspi {
479		fspi_dual_io_pins: fspi-dual-io-pins {
480			rockchip,pins =
481				/* fspi_clk */
482				<1 RK_PD0 1 &pcfg_pull_none>,
483				/* fspi_cs0n */
484				<1 RK_PD3 1 &pcfg_pull_none>,
485				/* fspi_d0 */
486				<1 RK_PD1 1 &pcfg_pull_none>,
487				/* fspi_d1 */
488				<1 RK_PD2 1 &pcfg_pull_none>;
489		};
490	};
491
492	leds {
493		led_power_pin: led-power-pin {
494			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
495		};
496		led_work_pin: led-work-pin {
497			rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
498		};
499	};
500
501	pmic {
502		pmic_int_l: pmic-int-l {
503			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
504		};
505	};
506
507	rk809 {
508		hp_det_pin: hp-det-pin {
509			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
510		};
511	};
512
513	usb {
514		vcc5v0_usb_host_en_pin: vcc5v0-usb-host-en-pin {
515			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
516		};
517		vcc5v0_usb_otg_en_pin: vcc5v0-usb-dr-en-pin {
518			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
519		};
520	};
521};
522
523&pmu_io_domains {
524	pmuio1-supply = <&vcc3v3_pmu>;
525	pmuio2-supply = <&vcc3v3_pmu>;
526	vccio1-supply = <&vccio_acodec>;
527	vccio2-supply = <&vcc_1v8>;
528	vccio3-supply = <&vccio_sd>;
529	vccio4-supply = <&vcc_1v8>;
530	vccio5-supply = <&vcc_3v3>;
531	vccio6-supply = <&vcc_3v3>;
532	vccio7-supply = <&vcc_3v3>;
533	status = "okay";
534};
535
536&saradc {
537	vref-supply = <&vcca_1v8>;
538	status = "okay";
539};
540
541&sdhci {
542	bus-width = <8>;
543	max-frequency = <200000000>;
544	non-removable;
545	pinctrl-names = "default";
546	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe &emmc_rstnout>;
547	vmmc-supply = <&vcc_3v3>;
548	vqmmc-supply = <&vcc_1v8>;
549	status = "okay";
550};
551
552&sdmmc0 {
553	bus-width = <4>;
554	cap-sd-highspeed;
555	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
556	disable-wp;
557	pinctrl-names = "default";
558	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
559	sd-uhs-sdr50;
560	vmmc-supply = <&vcc3v3_sd>;
561	vqmmc-supply = <&vccio_sd>;
562	status = "okay";
563};
564
565&sfc {
566	/* Dual I/O mode as the D2 pin conflicts with the eMMC */
567	pinctrl-0 = <&fspi_dual_io_pins>;
568	pinctrl-names = "default";
569	#address-cells = <1>;
570	#size-cells = <0>;
571	status = "okay";
572
573	flash@0 {
574		compatible = "jedec,spi-nor";
575		reg = <0>;
576		spi-max-frequency = <100000000>;
577		spi-rx-bus-width = <2>;
578		spi-tx-bus-width = <1>;
579
580		partitions {
581			compatible = "fixed-partitions";
582			#address-cells = <1>;
583			#size-cells = <1>;
584
585			partition@0 {
586				label = "SPL";
587				reg = <0x0 0xe0000>;
588			};
589			partition@e0000 {
590				label = "U-Boot Env";
591				reg = <0xe0000 0x20000>;
592			};
593			partition@100000 {
594				label = "U-Boot";
595				reg = <0x100000 0x200000>;
596			};
597			partition@300000 {
598				label = "splash";
599				reg = <0x300000 0x100000>;
600			};
601			partition@400000 {
602				label = "Filesystem";
603				reg = <0x400000 0xc00000>;
604			};
605		};
606	};
607};
608
609&tsadc {
610	rockchip,hw-tshut-mode = <1>;
611	rockchip,hw-tshut-polarity = <0>;
612	status = "okay";
613};
614
615&uart2 {
616	status = "okay";
617};
618
619&usb_host0_ehci {
620	status = "okay";
621};
622
623&usb_host0_ohci {
624	status = "okay";
625};
626
627&usb_host0_xhci {
628	dr_mode = "host";
629	status = "okay";
630};
631
632&usb_host1_ehci {
633	status = "okay";
634};
635
636&usb_host1_ohci {
637	status = "okay";
638};
639
640&usb_host1_xhci {
641	status = "okay";
642};
643
644&usb2phy0 {
645	status = "okay";
646};
647
648&usb2phy0_host {
649	phy-supply = <&vcc5v0_usb_host>;
650	status = "okay";
651};
652
653&usb2phy0_otg {
654	phy-supply = <&vcc5v0_usb_otg>;
655	status = "okay";
656};
657
658&usb2phy1 {
659	status = "okay";
660};
661
662&usb2phy1_host {
663	phy-supply = <&vcc5v0_usb_host>;
664	status = "okay";
665};
666
667&usb2phy1_otg {
668	phy-supply = <&vcc5v0_usb_host>;
669	status = "okay";
670};
671
672&vop {
673	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
674	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
675	status = "okay";
676};
677
678&vop_mmu {
679	status = "okay";
680};
681
682&vp0 {
683	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
684		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
685		remote-endpoint = <&hdmi_in_vp0>;
686	};
687};
688