// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright (c) 2024 Rockchip Electronics Co., Ltd.
 */

/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/soc/rockchip,vop2.h>

#include "rk3576.dtsi"

/ {
	model = "Ariaboard Photonicat 2";
	compatible = "ariaboard,photonicat2", "rockchip,rk3576";

	aliases {
		ethernet0 = &gmac0;
		ethernet1 = &gmac1;
		mmc0 = &sdhci;
		mmc1 = &sdmmc;
	};

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

	battery: battery {
		compatible = "simple-battery";
		device-chemistry = "lithium-ion";
		voltage-min-design-microvolt = <6800000>;
		voltage-max-design-microvolt = <8400000>;
		energy-full-design-microwatt-hours = <51800000>;
		ocv-capacity-celsius = <20>;
		ocv-capacity-table-0 =  <8344000 100>, <8184000 95>, <8070000 90>, <7980000 85>,
					<7878000 80>, <7790000 75>, <7704000 70>, <7614000 65>,
					<7524000 60>, <7426000 55>, <7344000 50>, <7294000 45>,
					<7258000 40>, <7226000 35>, <7196000 30>, <7156000 25>,
					<7100000 20>, <7038000 15>, <6958000 10>, <6876000 5>,
					<6800000 0>;
	};

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

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

	vccin_pd: regulator-vccin-pd {
		compatible = "regulator-fixed";
		regulator-name = "vccin_pd";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
	};

	vcc5v0_sys_s5: regulator-vcc5v0-sys-s5 {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_sys_s5";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vccin_pd>;
	};

	vcc_1v1_nldo_s3: regulator-vcc-1v1-nldo-s3 {
		compatible = "regulator-fixed";
		regulator-name = "vcc_1v1_nldo_s3";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1100000>;
		regulator-max-microvolt = <1100000>;
		vin-supply = <&vcc5v0_sys_s5>;
	};

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

	vcc_2v0_pldo_s3: regulator-vcc-2v0-pldo-s3 {
		compatible = "regulator-fixed";
		regulator-name = "vcc_2v0_pldo_s3";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <2000000>;
		regulator-max-microvolt = <2000000>;
		vin-supply = <&vcc5v0_sys_s5>;
	};

	vcc_3v3_pcie0: regulator-vcc-3v3-pcie0 {
		compatible = "regulator-fixed";
		enable-active-high;
		gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&pcie0_pwren_h>;
		regulator-name = "vcc_3v3_pcie0";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		startup-delay-us = <5000>;
		vin-supply = <&vcc5v0_otg>;
	};

	vcc_3v3_pcie1: regulator-vcc-3v3-pcie1 {
		compatible = "regulator-fixed";
		enable-active-high;
		gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&pcie1_pwren_h>;
		regulator-name = "vcc_3v3_pcie1";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		startup-delay-us = <5000>;
		vin-supply = <&vcc5v0_sys_s5>;
	};

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

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

	vcc_5v0_device: regulator-vcc-5v0-device {
		compatible = "regulator-fixed";
		regulator-name = "vcc_5v0_device";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vccin_pd>;
	};

	vcc5v0_otg: regulator-vcc5v0-otg {
		compatible = "regulator-fixed";
		enable-active-high;
		gpios = <&gpio4 RK_PC4 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb_otg0_pwren_h>;
		regulator-name = "vcc5v0_otg";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc5v0_usb_switch>;
	};

	vcc5v0_usb_switch: vcc5v0-usb-switch {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_usb_switch";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		enable-active-high;
		gpio = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&gpio0_c2>;
		vin-supply = <&vcc5v0_sys_s5>;
	};

	rfkill-pcie-bluetooth {
		compatible = "rfkill-gpio";
		label = "rfkill-pcie-bluetooth";
		pinctrl-names = "default";
		pinctrl-0 = <&m2_bt_en>;
		radio-type = "bluetooth";
		shutdown-gpios = <&gpio0 RK_PD0 GPIO_ACTIVE_HIGH>;
	};

	rfkill-pcie-wlan {
		compatible = "rfkill-gpio";
		label = "rfkill-pcie-wlan";
		pinctrl-names = "default";
		pinctrl-0 = <&m2_wlan_en>;
		radio-type = "wlan";
		shutdown-gpios = <&gpio0 RK_PD1 GPIO_ACTIVE_HIGH>;
	};

	rfkill-usb-wlan {
		compatible = "rfkill-gpio";
		label = "rfkill-usb-wlan";
		pinctrl-names = "default";
		pinctrl-0 = <&rf_pwr_en_n>;
		radio-type = "wlan";
		reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>;
		shutdown-gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>;
	};

	rfkill-usb-wwan {
		compatible = "rfkill-gpio";
		label = "rfkill-usb-wwan";
		pinctrl-names = "default";
		pinctrl-0 = <&rst_5g_1v8_h>;
		radio-type = "wwan";
		reset-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>;
		shutdown-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
	};
};

&combphy0_ps {
	status = "okay";
};

&combphy1_psu {
	status = "okay";
};

&cpu_b0 {
	cpu-supply = <&vdd_cpu_big_s0>;
};

&cpu_b1 {
	cpu-supply = <&vdd_cpu_big_s0>;
};

&cpu_b2 {
	cpu-supply = <&vdd_cpu_big_s0>;
};

&cpu_b3 {
	cpu-supply = <&vdd_cpu_big_s0>;
};

&cpu_l0 {
	cpu-supply = <&vdd_cpu_lit_s0>;
};

&cpu_l1 {
	cpu-supply = <&vdd_cpu_lit_s0>;
};

&cpu_l2 {
	cpu-supply = <&vdd_cpu_lit_s0>;
};

&cpu_l3 {
	cpu-supply = <&vdd_cpu_lit_s0>;
};

&gmac0 {
	clock_in_out = "output";
	phy-handle = <&rgmii_phy0>;
	phy-mode = "rgmii-id";
	pinctrl-names = "default";
	pinctrl-0 = <&eth0m1_miim
		     &eth0m1_tx_bus2
		     &eth0m1_rx_bus2
		     &eth0m1_rgmii_clk
		     &eth0m1_rgmii_bus
		     &ethm1_clk0_25m_out>;
	status = "okay";
};

&gmac1 {
	clock_in_out = "output";
	phy-handle = <&rgmii_phy1>;
	phy-mode = "rgmii-id";
	pinctrl-names = "default";
	pinctrl-0 = <&eth1m0_miim
		     &eth1m0_tx_bus2
		     &eth1m0_rx_bus2
		     &eth1m0_rgmii_clk
		     &eth1m0_rgmii_bus
		     &ethm0_clk1_25m_out>;
	status = "okay";
};

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

&hdmi {
	enable-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>;
	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";
};

&hdptxphy {
	status = "okay";
};

&i2c1 {
	status = "okay";

	pmic@23 {
		compatible = "rockchip,rk806";
		reg = <0x23>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupt-parent = <&gpio0>;
		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
		system-power-controller;

		vcc1-supply = <&vcc5v0_sys_s5>;
		vcc2-supply = <&vcc5v0_sys_s5>;
		vcc3-supply = <&vcc5v0_sys_s5>;
		vcc4-supply = <&vcc5v0_sys_s5>;
		vcc5-supply = <&vcc5v0_sys_s5>;
		vcc6-supply = <&vcc5v0_sys_s5>;
		vcc7-supply = <&vcc5v0_sys_s5>;
		vcc8-supply = <&vcc5v0_sys_s5>;
		vcc9-supply = <&vcc5v0_sys_s5>;
		vcc10-supply = <&vcc5v0_sys_s5>;
		vcc11-supply = <&vcc_2v0_pldo_s3>;
		vcc12-supply = <&vcc5v0_sys_s5>;
		vcc13-supply = <&vcc_1v1_nldo_s3>;
		vcc14-supply = <&vcc_1v1_nldo_s3>;
		vcca-supply = <&vcc5v0_sys_s5>;

		rk806_dvs1_null: dvs1-null-pins {
			pins = "gpio_pwrctrl1";
			function = "pin_fun0";
		};

		rk806_dvs1_pwrdn: dvs1-pwrdn-pins {
			pins = "gpio_pwrctrl1";
			function = "pin_fun2";
		};

		rk806_dvs1_rst: dvs1-rst-pins {
			pins = "gpio_pwrctrl1";
			function = "pin_fun3";
		};

		rk806_dvs1_slp: dvs1-slp-pins {
			pins = "gpio_pwrctrl1";
			function = "pin_fun1";
		};

		rk806_dvs2_dvs: dvs2-dvs-pins {
			pins = "gpio_pwrctrl2";
			function = "pin_fun4";
		};

		rk806_dvs2_gpio: dvs2-gpio-pins {
			pins = "gpio_pwrctrl2";
			function = "pin_fun5";
		};

		rk806_dvs2_null: dvs2-null-pins {
			pins = "gpio_pwrctrl2";
			function = "pin_fun0";
		};

		rk806_dvs2_pwrdn: dvs2-pwrdn-pins {
			pins = "gpio_pwrctrl2";
			function = "pin_fun2";
		};

		rk806_dvs2_rst: dvs2-rst-pins {
			pins = "gpio_pwrctrl2";
			function = "pin_fun3";
		};

		rk806_dvs2_slp: dvs2-slp-pins {
			pins = "gpio_pwrctrl2";
			function = "pin_fun1";
		};

		rk806_dvs3_dvs: dvs3-dvs-pins {
			pins = "gpio_pwrctrl3";
			function = "pin_fun4";
		};

		rk806_dvs3_gpio: dvs3-gpio-pins {
			pins = "gpio_pwrctrl3";
			function = "pin_fun5";
		};

		rk806_dvs3_null: dvs3-null-pins {
			pins = "gpio_pwrctrl3";
			function = "pin_fun0";
		};

		rk806_dvs3_pwrdn: dvs3-pwrdn-pins {
			pins = "gpio_pwrctrl3";
			function = "pin_fun2";
		};

		rk806_dvs3_rst: dvs3-rst-pins {
			pins = "gpio_pwrctrl3";
			function = "pin_fun3";
		};

		rk806_dvs3_slp: dvs3-slp-pins {
			pins = "gpio_pwrctrl3";
			function = "pin_fun1";
		};

		regulators {
			vdd_cpu_big_s0: dcdc-reg1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <950000>;
				regulator-ramp-delay = <12500>;
				regulator-name = "vdd_cpu_big_s0";
				regulator-enable-ramp-delay = <400>;

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

			vdd_npu_s0: dcdc-reg2 {
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <950000>;
				regulator-ramp-delay = <12500>;
				regulator-enable-ramp-delay = <400>;
				regulator-name = "vdd_npu_s0";

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

			vdd_cpu_lit_s0: dcdc-reg3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <950000>;
				regulator-name = "vdd_cpu_lit_s0";
				regulator-ramp-delay = <12500>;

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

			vcc_3v3_s3: dcdc-reg4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vcc_3v3_s3";

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

			vdd_gpu_s0: dcdc-reg5 {
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <900000>;
				regulator-ramp-delay = <12500>;
				regulator-name = "vdd_gpu_s0";
				regulator-enable-ramp-delay = <400>;

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

			vddq_ddr_s0: dcdc-reg6 {
				regulator-always-on;
				regulator-boot-on;
				regulator-name = "vddq_ddr_s0";

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

			vdd_logic_s0: dcdc-reg7 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <800000>;
				regulator-name = "vdd_logic_s0";

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

			vcc_1v8_s3: dcdc-reg8 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc_1v8_s3";

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

			vdd2_ddr_s3: dcdc-reg9 {
				regulator-always-on;
				regulator-boot-on;
				regulator-name = "vdd2_ddr_s3";

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

			vdd_ddr_s0: dcdc-reg10 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <1200000>;
				regulator-name = "vdd_ddr_s0";

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

			vcca_1v8_s0: pldo-reg1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcca_1v8_s0";

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

			vcca1v8_pldo2_s0: pldo-reg2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcca1v8_pldo2_s0";

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

			vdda_1v2_s0: pldo-reg3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1200000>;
				regulator-name = "vdda_1v2_s0";

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

			vcca_3v3_s0: pldo-reg4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vcca_3v3_s0";

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

			vccio_sd_s0: pldo-reg5 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vccio_sd_s0";

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

			vcca1v8_pldo6_s3: pldo-reg6 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcca1v8_pldo6_s3";

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

			vdd_0v75_s3: nldo-reg1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <750000>;
				regulator-max-microvolt = <750000>;
				regulator-name = "vdd_0v75_s3";

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

			vdda_ddr_pll_s0: nldo-reg2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <850000>;
				regulator-max-microvolt = <850000>;
				regulator-name = "vdda_ddr_pll_s0";

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

			vdda0v75_hdmi_s0: nldo-reg3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <837500>;
				regulator-max-microvolt = <837500>;
				regulator-name = "vdda0v75_hdmi_s0";

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

			vdda_0v85_s0: nldo-reg4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <850000>;
				regulator-max-microvolt = <850000>;
				regulator-name = "vdda_0v85_s0";

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

			vdda_0v75_s0: nldo-reg5 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <750000>;
				regulator-max-microvolt = <750000>;
				regulator-name = "vdda_0v75_s0";

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

&i2c8 {
	pinctrl-0 = <&i2c8m3_xfer>;
	status = "okay";
};

&mdio0 {
	rgmii_phy0: phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
		clocks = <&cru REFCLKO25M_GMAC0_OUT>;
		pinctrl-names = "default";
		pinctrl-0 = <&eth0_rstn_l>;
		reset-assert-us = <20000>;
		reset-deassert-us = <100000>;
		reset-gpios = <&gpio0 RK_PD2 GPIO_ACTIVE_LOW>;

		leds {
			#address-cells = <1>;
			#size-cells = <0>;

			led@1 {
				reg = <1>;
				color = <LED_COLOR_ID_GREEN>;
				function = LED_FUNCTION_WAN;
				default-state = "keep";
			};

			led@2 {
				reg = <2>;
				color = <LED_COLOR_ID_AMBER>;
				function = LED_FUNCTION_WAN;
				default-state = "keep";
			};
		};
	};
};

&mdio1 {
	rgmii_phy1: phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
		clocks = <&cru REFCLKO25M_GMAC1_OUT>;
		pinctrl-names = "default";
		pinctrl-0 = <&eth1_rstn_l>;
		reset-assert-us = <20000>;
		reset-deassert-us = <100000>;
		reset-gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_LOW>;

		leds {
			#address-cells = <1>;
			#size-cells = <0>;

			led@1 {
				reg = <1>;
				color = <LED_COLOR_ID_GREEN>;
				function = LED_FUNCTION_LAN;
				default-state = "keep";
			};

			led@2 {
				reg = <2>;
				color = <LED_COLOR_ID_AMBER>;
				function = LED_FUNCTION_LAN;
				default-state = "keep";
			};
		};
	};
};

&pcie0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie0_perstn>;
	reset-gpios = <&gpio4 RK_PC7 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc_3v3_pcie0>;
	status = "okay";
};

&pcie1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie1_perstn &pcie1m2_pins>;
	reset-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc_3v3_pcie1>;
	status = "okay";
};

&pinctrl {
	gmac0 {
		eth0_rstn_l: eth0-rstn-l {
			rockchip,pins = <0 RK_PD2 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	gmac1 {
		eth1_rstn_l: eth1-rstn-l {
			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	spi1 {
		spi1m2_1_pins: spi1m2-1-pins {
			rockchip,pins =
				/* spi1_clk_m2 */
				<3 RK_PC7 10 &pcfg_pull_none>,
				/* spi1_mosi_m2 */
				<3 RK_PC6 10 &pcfg_pull_none>;
		};
	};

	pcie {
		pcie0_perstn: pcie0-perstn {
			rockchip,pins = <4 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>;
		};

		pcie0_pwren_h: pcie0-pwren-h {
			rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_down>;
		};

		pcie1_perstn: pcie1-perstn {
			rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
		};

		pcie1_pwren_h: pcie1-pwren-h {
			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	rfkill {
		rst_5g_1v8_h: 5g-rst-1v8-h {
			rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		m2_bt_en: m2-bt-en {
			rockchip,pins = <0 RK_PD0 RK_FUNC_GPIO &pcfg_pull_down>;
		};

		m2_wlan_en: m2-wlan-en {
			rockchip,pins = <0 RK_PD1 RK_FUNC_GPIO &pcfg_pull_down>;
		};

		rf_pwr_en_n: rf-pwr-en-n {
			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	usb {
		gpio0_c2: gpio0-c2 {
			rockchip,pins = <0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		pwm2_ch1_m3: pwm2-ch1-m3 {
			rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
		};

		usb_otg0_pwren_h: usb-otg0-pwren-h {
			rockchip,pins = <4 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};

&sai6 {
	status = "okay";
};

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

&sdhci {
	bus-width = <8>;
	cap-mmc-highspeed;
	full-pwr-cycle-in-suspend;
	max-frequency = <100000000>;
	mmc-hs400-1_8v;
	mmc-hs400-enhanced-strobe;
	no-sdio;
	no-sd;
	non-removable;
	/delete-property/ supports-cqe;
	status = "okay";
};

&sdmmc {
	bus-width = <4>;
	cap-mmc-highspeed;
	cap-sd-highspeed;
	disable-wp;
	no-mmc;
	no-sdio;
	sd-uhs-sdr104;
	vmmc-supply = <&vcc_3v3_s3>;
	vqmmc-supply = <&vccio_sd_s0>;
	status = "okay";
};

&spi1 {
	pinctrl-0 = <&spi1m2_csn0 &spi1m2_1_pins>;
	status = "okay";

	spidev@0 {
		compatible = "micron,spi-authenta";
		reg = <0>;
		spi-max-frequency = <6000000>;
	};
};

&u2phy0 {
	status = "okay";
};

&u2phy0_otg {
	phy-supply = <&vcc5v0_otg>;
	status = "okay";
};

&usbdp_phy {
	status = "okay";
};

&usb_drd0_dwc3 {
	dr_mode = "host";
	pinctrl-names = "default";
	pinctrl-0 = <&pwm2_ch1_m3>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	hub_2_0: hub@1 {
		compatible = "usb5e3,610";
		reg = <1>;
		peer-hub = <&hub_3_0>;
		reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
	};

	hub_3_0: hub@2 {
		compatible = "usb5e3,620";
		reg = <2>;
		peer-hub = <&hub_2_0>;
		reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
	};
};

&uart0 {
	status = "okay";
};

&uart2 {
	pinctrl-0 = <&uart2m2_xfer>;
	status = "okay";
};

&uart10 {
	pinctrl-0 = <&uart10m2_xfer>;
	status = "okay";

	pcat-pm {
		compatible = "photonicat-pm";
		baudrate = <115200>;
		force-poweroff-timeout = <60>;
		pm-version = <2>;
		power-gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;

		charger {
			monitored-battery = <&battery>;
		};

		fan {
		};
	};
};

&vop {
	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>;
	};
};
