linux/arch/arm64/boot/dts/rockchip/rk3566-radxa-zero-3.dtsi

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/soc/rockchip,vop2.h>
#include "rk3566.dtsi"

/ {
	chosen {
		stdout-path = "serial2:1500000n8";
	};

	hdmi-con {
		compatible = "hdmi-connector";
		type = "d";

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&user_led2>;

		led-green {
			color = <LED_COLOR_ID_GREEN>;
			default-state = "on";
			function = LED_FUNCTION_HEARTBEAT;
			gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};

	vcc_1v8: regulator-1v8-vcc {
		compatible = "regulator-fixed";
		regulator-name = "vcc_1v8";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_1v8_p>;
	};

	vcca_1v8: regulator-1v8-vcca {
		compatible = "regulator-fixed";
		regulator-name = "vcca_1v8";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_1v8_p>;
	};

	vcca1v8_image: regulator-1v8-vcca-image {
		compatible = "regulator-fixed";
		regulator-name = "vcca1v8_image";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_1v8_p>;
	};

	vcc_3v3: regulator-3v3-vcc {
		compatible = "regulator-fixed";
		regulator-name = "vcc_3v3";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc3v3_sys>;
	};

	vcc_sys: regulator-5v0-vcc-sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
	};
};

&combphy1 {
	status = "okay";
};

&cpu0 {
	cpu-supply = <&vdd_cpu>;
};

&cpu1 {
	cpu-supply = <&vdd_cpu>;
};

&cpu2 {
	cpu-supply = <&vdd_cpu>;
};

&cpu3 {
	cpu-supply = <&vdd_cpu>;
};

&gpio0 {
	gpio-line-names =
		/* GPIO0_A0 - A7 */
		"", "", "", "", "", "", "", "",
		/* GPIO0_B0 - B7 */
		"", "", "", "", "", "", "", "",
		/* GPIO0_C0 - C7 */
		"", "", "", "", "", "", "", "",
		/* GPIO0_D0 - D7 */
		"pin-10 [GPIO0_D0]", "pin-08 [GPIO0_D1]", "",
		"", "", "", "", "";
};

&gpio1 {
	gpio-line-names =
		/* GPIO1_A0 - A7 */
		"pin-03 [GPIO1_A0]", "pin-05 [GPIO1_A1]", "",
		"",                  "pin-37 [GPIO1_A4]", "",
		"",                  "",
		/* GPIO1_B0 - B7 */
		"", "", "", "", "", "", "", "",
		/* GPIO1_C0 - C7 */
		"", "", "", "", "", "", "", "",
		/* GPIO1_D0 - D7 */
		"", "", "", "", "", "", "", "";
};

&gpio2 {
	gpio-line-names =
		/* GPIO2_A0 - A7 */
		"", "", "", "", "", "", "", "",
		/* GPIO2_B0 - B7 */
		"", "", "", "", "", "", "", "",
		/* GPIO2_C0 - C7 */
		"", "", "", "", "", "", "", "",
		/* GPIO2_D0 - D7 */
		"", "", "", "", "", "", "", "";
};

&gpio3 {
	gpio-line-names =
		/* GPIO3_A0 - A7 */
		"",                  "pin-11 [GPIO3_A1]", "pin-13 [GPIO3_A2]",
		"pin-12 [GPIO3_A3]", "pin-35 [GPIO3_A4]", "pin-40 [GPIO3_A5]",
		"pin-38 [GPIO3_A6]", "pin-36 [GPIO3_A7]",
		/* GPIO3_B0 - B7 */
		"pin-15 [GPIO3_B0]", "pin-16 [GPIO3_B1]", "pin-18 [GPIO3_B2]",
		"pin-29 [GPIO3_B3]", "pin-31 [GPIO3_B4]", "",
		"", "",
		/* GPIO3_C0 - C7 */
		"",                  "pin-22 [GPIO3_C1]", "pin-32 [GPIO3_C2]",
		"pin-33 [GPIO3_C3]", "pin-07 [GPIO3_C4]", "",
		"", "",
		/* GPIO3_D0 - D7 */
		"", "", "", "", "", "", "", "";
};

&gpio4 {
	gpio-line-names =
		/* GPIO4_A0 - A7 */
		"", "", "", "", "", "", "", "",
		/* GPIO4_B0 - B7 */
		"",                  "",                  "pin-27 [GPIO4_B2]",
		"pin-28 [GPIO4_B3]", "", "", "", "",
		/* GPIO4_C0 - C7 */
		"",                  "",                  "pin-23 [GPIO4_C2]",
		"pin-19 [GPIO4_C3]", "",                  "pin-21 [GPIO4_C5]",
		"pin-24 [GPIO4_C6]", "",
		/* GPIO4_D0 - D7 */
		"", "", "", "", "", "", "", "";
};

&gpu {
	mali-supply = <&vdd_gpu_npu>;
	status = "okay";
};

&hdmi {
	avdd-0v9-supply = <&vdda_0v9>;
	avdd-1v8-supply = <&vcca1v8_image>;
	status = "okay";
};

&hdmi_in {
	hdmi_in_vp0: endpoint {
		remote-endpoint = <&vp0_out_hdmi>;
	};
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&hdmi_sound {
	status = "okay";
};

&i2c0 {
	status = "okay";

	rk817: pmic@20 {
		compatible = "rockchip,rk817";
		reg = <0x20>;
		#clock-cells = <1>;
		clock-output-names = "rk817-clkout1", "rk817-clkout2";
		interrupt-parent = <&gpio0>;
		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&pmic_int_l>;
		system-power-controller;
		wakeup-source;

		vcc1-supply = <&vcc_sys>;
		vcc2-supply = <&vcc_sys>;
		vcc3-supply = <&vcc_sys>;
		vcc4-supply = <&vcc_sys>;
		vcc5-supply = <&vcc_sys>;
		vcc6-supply = <&vcc_sys>;
		vcc7-supply = <&vcc_sys>;
		vcc8-supply = <&vcc_sys>;
		vcc9-supply = <&vcc5v_midu>;

		regulators {
			vdd_logic: DCDC_REG1 {
				regulator-name = "vdd_logic";
				regulator-always-on;
				regulator-boot-on;
				regulator-initial-mode = <0x2>;
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1350000>;
				regulator-ramp-delay = <6001>;

				regulator-state-mem {
					regulator-off-in-suspend;
					regulator-suspend-microvolt = <900000>;
				};
			};

			vdd_gpu_npu: DCDC_REG2 {
				regulator-name = "vdd_gpu_npu";
				regulator-always-on;
				regulator-boot-on;
				regulator-initial-mode = <0x2>;
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1350000>;
				regulator-ramp-delay = <6001>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc_ddr: DCDC_REG3 {
				regulator-name = "vcc_ddr";
				regulator-always-on;
				regulator-boot-on;
				regulator-initial-mode = <0x2>;

				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};

			vcc3v3_sys: DCDC_REG4 {
				regulator-name = "vcc3v3_sys";
				regulator-always-on;
				regulator-boot-on;
				regulator-initial-mode = <0x2>;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			vcca1v8_pmu: LDO_REG1 {
				regulator-name = "vcca1v8_pmu";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vdda_0v9: LDO_REG2 {
				regulator-name = "vdda_0v9";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <900000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vdda0v9_pmu: LDO_REG3 {
				regulator-name = "vdda0v9_pmu";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <900000>;

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <900000>;
				};
			};

			vccio_acodec: LDO_REG4 {
				regulator-name = "vccio_acodec";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vccio_sd: LDO_REG5 {
				regulator-name = "vccio_sd";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc3v3_pmu: LDO_REG6 {
				regulator-name = "vcc3v3_pmu";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			vcc_1v8_p: LDO_REG7 {
				regulator-name = "vcc_1v8_p";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc1v8_dvp: LDO_REG8 {
				regulator-name = "vcc1v8_dvp";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc2v8_dvp: LDO_REG9 {
				regulator-name = "vcc2v8_dvp";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <2800000>;
				regulator-max-microvolt = <2800000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc5v_midu: BOOST {
				regulator-name = "vcc5v_midu";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5000000>;

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vbus: OTG_SWITCH {
				regulator-name = "vbus";

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};
	};

	vdd_cpu: regulator@40 {
		compatible = "rockchip,rk8600";
		reg = <0x40>;
		fcs,suspend-voltage-selector = <1>;
		regulator-name = "vdd_cpu";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <712500>;
		regulator-max-microvolt = <1390000>;
		regulator-ramp-delay = <2300>;
		vin-supply = <&vcc_sys>;

		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};
};

&i2s0_8ch {
	status = "okay";
};

&pinctrl {
	leds {
		user_led2: user-led2 {
			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	pmic {
		pmic_int_l: pmic-int-l {
			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};
};

&pmu_io_domains {
	pmuio1-supply = <&vcc3v3_pmu>;
	pmuio2-supply = <&vcca1v8_pmu>;
	vccio1-supply = <&vccio_acodec>;
	vccio2-supply = <&vcc_1v8>;
	vccio3-supply = <&vccio_sd>;
	vccio4-supply = <&vcc_1v8>;
	vccio5-supply = <&vcc_3v3>;
	vccio6-supply = <&vcc_3v3>;
	vccio7-supply = <&vcc_3v3>;
	status = "okay";
};

&saradc {
	vref-supply = <&vcca_1v8>;
	status = "okay";
};

&sdmmc0 {
	bus-width = <4>;
	cap-sd-highspeed;
	disable-wp;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
	vmmc-supply = <&vcc3v3_sys>;
	vqmmc-supply = <&vccio_sd>;
	status = "okay";
};

&tsadc {
	rockchip,hw-tshut-mode = <1>;
	rockchip,hw-tshut-polarity = <0>;
	status = "okay";
};

&uart2 {
	status = "okay";
};

&usb_host0_xhci {
	dr_mode = "peripheral";
	status = "okay";
};

&usb_host1_xhci {
	status = "okay";
};

&usb2phy0 {
	status = "okay";
};

&usb2phy0_host {
	status = "okay";
};

&usb2phy0_otg {
	status = "okay";
};

&vop {
	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
	status = "okay";
};

&vop_mmu {
	status = "okay";
};

&vp0 {
	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
		remote-endpoint = <&hdmi_in_vp0>;
	};
};