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
132&cpu0 {
133	cpu-supply = <&vdd_cpu>;
134};
135
136&cpu1 {
137	cpu-supply = <&vdd_cpu>;
138};
139
140&cpu2 {
141	cpu-supply = <&vdd_cpu>;
142};
143
144&cpu3 {
145	cpu-supply = <&vdd_cpu>;
146};
147
148&gmac0 {
149	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>;
150	assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>;
151	assigned-clock-rates = <0>, <125000000>;
152	clock_in_out = "output";
153	phy-handle = <&rgmii_phy0>;
154	phy-mode = "rgmii";
155	phy-supply = <&vcc3v3_sys>;
156	pinctrl-names = "default";
157	pinctrl-0 = <&gmac0_miim
158		     &gmac0_tx_bus2
159		     &gmac0_rx_bus2
160		     &gmac0_rgmii_clk
161		     &gmac0_rgmii_bus>;
162	status = "okay";
163
164	tx_delay = <0x4f>;
165	rx_delay = <0x2d>;
166};
167
168&gpu {
169	mali-supply = <&vdd_gpu>;
170	status = "okay";
171};
172
173&hdmi {
174	avdd-0v9-supply = <&vdda0v9_image>;
175	avdd-1v8-supply = <&vcca1v8_image>;
176	status = "okay";
177};
178
179&hdmi_in {
180	hdmi_in_vp0: endpoint {
181		remote-endpoint = <&vp0_out_hdmi>;
182	};
183};
184
185&hdmi_out {
186	hdmi_out_con: endpoint {
187		remote-endpoint = <&hdmi_con_in>;
188	};
189};
190
191&hdmi_sound {
192	status = "okay";
193};
194
195&i2c0 {
196	status = "okay";
197
198	vdd_cpu: regulator@1c {
199		compatible = "tcs,tcs4525";
200		reg = <0x1c>;
201		fcs,suspend-voltage-selector = <1>;
202		regulator-name = "vdd_cpu";
203		regulator-always-on;
204		regulator-boot-on;
205		regulator-min-microvolt = <800000>;
206		regulator-max-microvolt = <1150000>;
207		regulator-ramp-delay = <2300>;
208		vin-supply = <&vcc3v3_sys>;
209
210		regulator-state-mem {
211			regulator-off-in-suspend;
212		};
213	};
214
215	rk809: pmic@20 {
216		compatible = "rockchip,rk809";
217		reg = <0x20>;
218		interrupt-parent = <&gpio0>;
219		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
220		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
221		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
222		#clock-cells = <1>;
223		clock-names = "mclk";
224		clocks = <&cru I2S1_MCLKOUT_TX>;
225		pinctrl-names = "default";
226		pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>;
227		rockchip,system-power-controller;
228		#sound-dai-cells = <0>;
229		vcc1-supply = <&vcc3v3_sys>;
230		vcc2-supply = <&vcc3v3_sys>;
231		vcc3-supply = <&vcc3v3_sys>;
232		vcc4-supply = <&vcc3v3_sys>;
233		vcc5-supply = <&vcc3v3_sys>;
234		vcc6-supply = <&vcc3v3_sys>;
235		vcc7-supply = <&vcc3v3_sys>;
236		vcc8-supply = <&vcc3v3_sys>;
237		vcc9-supply = <&vcc3v3_sys>;
238		wakeup-source;
239
240		regulators {
241			vdd_logic: DCDC_REG1 {
242				regulator-name = "vdd_logic";
243				regulator-always-on;
244				regulator-boot-on;
245				regulator-init-microvolt = <900000>;
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			vdd_gpu: DCDC_REG2 {
257				regulator-name = "vdd_gpu";
258				regulator-always-on;
259				regulator-init-microvolt = <900000>;
260				regulator-initial-mode = <0x2>;
261				regulator-min-microvolt = <500000>;
262				regulator-max-microvolt = <1350000>;
263				regulator-ramp-delay = <6001>;
264
265				regulator-state-mem {
266					regulator-off-in-suspend;
267				};
268			};
269
270			vcc_ddr: DCDC_REG3 {
271				regulator-name = "vcc_ddr";
272				regulator-always-on;
273				regulator-boot-on;
274				regulator-initial-mode = <0x2>;
275
276				regulator-state-mem {
277					regulator-on-in-suspend;
278				};
279			};
280
281			vdd_npu: DCDC_REG4 {
282				regulator-name = "vdd_npu";
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_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				regulator-state-mem {
427					regulator-off-in-suspend;
428				};
429			};
430		};
431	};
432};
433
434&i2s0_8ch {
435	status = "okay";
436};
437
438&i2s1_8ch {
439	rockchip,trcm-sync-tx-only;
440	status = "okay";
441};
442
443&mdio0 {
444	rgmii_phy0: ethernet-phy@0 {
445		compatible = "ethernet-phy-ieee802.3-c22";
446		reg = <0x0>;
447		reset-assert-us = <20000>;
448		reset-deassert-us = <100000>;
449		reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
450	};
451};
452
453&pinctrl {
454	fspi {
455		fspi_dual_io_pins: fspi-dual-io-pins {
456			rockchip,pins =
457				/* fspi_clk */
458				<1 RK_PD0 1 &pcfg_pull_none>,
459				/* fspi_cs0n */
460				<1 RK_PD3 1 &pcfg_pull_none>,
461				/* fspi_d0 */
462				<1 RK_PD1 1 &pcfg_pull_none>,
463				/* fspi_d1 */
464				<1 RK_PD2 1 &pcfg_pull_none>;
465		};
466	};
467
468	leds {
469		led_power_pin: led-power-pin {
470			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
471		};
472		led_work_pin: led-work-pin {
473			rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
474		};
475	};
476
477	pmic {
478		pmic_int_l: pmic-int-l {
479			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
480		};
481	};
482
483	rk809 {
484		hp_det_pin: hp-det-pin {
485			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
486		};
487	};
488
489	usb {
490		vcc5v0_usb_host_en_pin: vcc5v0-usb-host-en-pin {
491			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
492		};
493		vcc5v0_usb_otg_en_pin: vcc5v0-usb-otg-en-pin {
494			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
495		};
496	};
497};
498
499&pmu_io_domains {
500	pmuio1-supply = <&vcc3v3_pmu>;
501	pmuio2-supply = <&vcc3v3_pmu>;
502	vccio1-supply = <&vccio_acodec>;
503	vccio2-supply = <&vcc_1v8>;
504	vccio3-supply = <&vccio_sd>;
505	vccio4-supply = <&vcc_1v8>;
506	vccio5-supply = <&vcc_3v3>;
507	vccio6-supply = <&vcc_3v3>;
508	vccio7-supply = <&vcc_3v3>;
509	status = "okay";
510};
511
512&saradc {
513	vref-supply = <&vcca_1v8>;
514	status = "okay";
515};
516
517&sdhci {
518	bus-width = <8>;
519	max-frequency = <200000000>;
520	non-removable;
521	pinctrl-names = "default";
522	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe &emmc_rstnout>;
523	vmmc-supply = <&vcc_3v3>;
524	vqmmc-supply = <&vcc_1v8>;
525	status = "okay";
526};
527
528&sdmmc0 {
529	bus-width = <4>;
530	cap-sd-highspeed;
531	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
532	disable-wp;
533	pinctrl-names = "default";
534	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
535	sd-uhs-sdr50;
536	vmmc-supply = <&vcc3v3_sd>;
537	vqmmc-supply = <&vccio_sd>;
538	status = "okay";
539};
540
541&sfc {
542	/* Dual I/O mode as the D2 pin conflicts with the eMMC */
543	pinctrl-0 = <&fspi_dual_io_pins>;
544	pinctrl-names = "default";
545	#address-cells = <1>;
546	#size-cells = <0>;
547	status = "okay";
548
549	flash@0 {
550		compatible = "jedec,spi-nor";
551		reg = <0>;
552		spi-max-frequency = <100000000>;
553		spi-rx-bus-width = <2>;
554		spi-tx-bus-width = <1>;
555
556		partitions {
557			compatible = "fixed-partitions";
558			#address-cells = <1>;
559			#size-cells = <1>;
560
561			partition@0 {
562				label = "SPL";
563				reg = <0x0 0xe0000>;
564			};
565			partition@e0000 {
566				label = "U-Boot Env";
567				reg = <0xe0000 0x20000>;
568			};
569			partition@100000 {
570				label = "U-Boot";
571				reg = <0x100000 0x200000>;
572			};
573			partition@300000 {
574				label = "splash";
575				reg = <0x300000 0x100000>;
576			};
577			partition@400000 {
578				label = "Filesystem";
579				reg = <0x400000 0xc00000>;
580			};
581		};
582	};
583};
584
585&tsadc {
586	rockchip,hw-tshut-mode = <1>;
587	rockchip,hw-tshut-polarity = <0>;
588	status = "okay";
589};
590
591&uart2 {
592	status = "okay";
593};
594
595&usb_host0_ehci {
596	status = "okay";
597};
598
599&usb_host0_ohci {
600	status = "okay";
601};
602
603&usb_host1_ehci {
604	status = "okay";
605};
606
607&usb_host1_ohci {
608	status = "okay";
609};
610
611&usb2phy1 {
612	status = "okay";
613};
614
615&usb2phy1_host {
616	phy-supply = <&vcc5v0_usb_host>;
617	status = "okay";
618};
619
620&usb2phy1_otg {
621	phy-supply = <&vcc5v0_usb_host>;
622	status = "okay";
623};
624
625&vop {
626	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
627	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
628	status = "okay";
629};
630
631&vop_mmu {
632	status = "okay";
633};
634
635&vp0 {
636	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
637		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
638		remote-endpoint = <&hdmi_in_vp0>;
639	};
640};
641