linux/arch/arm64/boot/dts/rockchip/rk3568-mecsbc.dts

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

/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/pwm/pwm.h>
#include "rk3568.dtsi"

/ {
	model = "Protonic MECSBC";
	compatible = "prt,mecsbc", "rockchip,rk3568";

	aliases {
		mmc0 = &sdhci;
		mmc1 = &sdmmc0;
	};

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

	tas2562-sound {
		compatible = "simple-audio-card";
		simple-audio-card,format = "i2s";
		simple-audio-card,name = "Speaker";
		simple-audio-card,mclk-fs = <256>;

		simple-audio-card,cpu {
			sound-dai = <&i2s1_8ch>;
		};

		simple-audio-card,codec {
			sound-dai = <&tas2562>;
		};
	};

	vdd_gpu: regulator-vdd-gpu {
		compatible = "pwm-regulator";
		pwms = <&pwm1 0 5000 PWM_POLARITY_INVERTED>;
		regulator-name = "vdd_gpu";
		regulator-min-microvolt = <915000>;
		regulator-max-microvolt = <1000000>;
		regulator-always-on;
		regulator-boot-on;
		regulator-settling-time-up-us = <250>;
		pwm-dutycycle-range = <0 100>; /* dutycycle inverted 0% => 0.915V */
	};

	p3v3: regulator-p3v3 {
		compatible = "regulator-fixed";
		regulator-name = "p3v3";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};

	p1v8: regulator-p1v8 {
		compatible = "regulator-fixed";
		regulator-name = "p1v8";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
	};

	vcc_sd: regulator-sd {
		compatible = "regulator-gpio";
		enable-gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
		regulator-name = "sdcard-gpio-supply";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;
		states = <1800000 0x1>, <3300000 0x0>;
	};

	vdd_npu: regulator-vdd-npu {
		compatible = "pwm-regulator";
		pwms = <&pwm2 0 5000 PWM_POLARITY_INVERTED>;
		regulator-name = "vdd_npu";
		regulator-min-microvolt = <915000>;
		regulator-max-microvolt = <1000000>;
		regulator-always-on;
		regulator-boot-on;
		regulator-settling-time-up-us = <250>;
		pwm-dutycycle-range = <0 100>; /* dutycycle inverted 0% => 0.915V */
	};
};

&combphy0 {
	status = "okay";
};

&combphy1 {
	status = "okay";
};

&combphy2 {
	status = "okay";
};

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

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

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

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

&gmac1 {
	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>;
	phy-handle = <&rgmii_phy1>;
	phy-mode = "rgmii-id";
	clock_in_out = "output";
	pinctrl-names = "default";
	pinctrl-0 = <&gmac1m1_miim
		     &gmac1m1_tx_bus2
		     &gmac1m1_rx_bus2
		     &gmac1m1_rgmii_clk
		     &gmac1m1_clkinout
		     &gmac1m1_rgmii_bus>;
	status = "okay";
};

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

&gpu_opp_table {
	compatible = "operating-points-v2";

	opp-200000000 {
		opp-hz = /bits/ 64 <200000000>;
		opp-microvolt = <915000>;
	};

	opp-300000000 {
		opp-hz = /bits/ 64 <300000000>;
		opp-microvolt = <915000>;
	};

	opp-400000000 {
		opp-hz = /bits/ 64 <400000000>;
		opp-microvolt = <915000>;
	};

	opp-600000000 {
		opp-hz = /bits/ 64 <600000000>;
		opp-microvolt = <920000>;
	};

	opp-700000000 {
		opp-hz = /bits/ 64 <700000000>;
		opp-microvolt = <950000>;
	};

	opp-800000000 {
		opp-hz = /bits/ 64 <800000000>;
		opp-microvolt = <1000000>;
	};
};

&i2c0 {
	status = "okay";

	vdd_cpu: regulator@60 {
		compatible = "fcs,fan53555";
		reg = <0x60>;
		fcs,suspend-voltage-selector = <1>;
		regulator-name = "vdd_cpu";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <800000>;
		regulator-max-microvolt = <1150000>;
		regulator-ramp-delay = <2300>;

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

&i2c2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2m0_xfer>;
};

&i2c3 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c3m0_xfer>;
	status = "okay";

	tas2562: amplifier@4c {
		compatible = "ti,tas2562";
		reg = <0x4c>;
		#sound-dai-cells = <0>;
		shutdown-gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>;
		interrupt-parent = <&gpio1>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_tas2562>;
		interrupts = <RK_PD1 IRQ_TYPE_LEVEL_LOW>;
		ti,imon-slot-no = <0>;
	};
};

&i2c5 {
	status = "okay";

	temperature-sensor@48 {
		compatible = "ti,tmp1075";
		reg = <0x48>;
	};

	rtc@51 {
		compatible = "nxp,pcf85363";
		reg = <0x51>;
		#clock-cells = <0>;
		clock-output-names = "rtcic_32kout";
	};
};

&i2s1_8ch {
	pinctrl-names = "default";
	pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_lrcktx &i2s1m0_sdi0 &i2s1m0_sdo0>;
	rockchip,trcm-sync-tx-only;
	status = "okay";
};

&mdio1 {
	rgmii_phy1: ethernet-phy@2 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <0x2>;
		pinctrl-names = "default";
		pinctrl-0 = <&eth_phy1_rst>;
		reset-assert-us = <20000>;
		reset-deassert-us = <100000>;
		reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>;
	};
};

&pcie2x1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie20m1_pins>;
	reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
	status = "okay";
};

&pcie30phy {
	status = "okay";
};

&pcie3x2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie30x2m1_pins>;
	reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&p3v3>;
	status = "okay";
};

&pinctrl {
	ethernet {
		eth_phy1_rst: eth-phy1-rst {
			rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	tas2562 {
		pinctrl_tas2562: tas2562 {
			rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};
};

&pmu_io_domains {
	pmuio1-supply = <&p3v3>;
	pmuio2-supply = <&p3v3>;
	vccio1-supply = <&p1v8>;
	vccio2-supply = <&p1v8>;
	vccio3-supply = <&vcc_sd>;
	vccio4-supply = <&p1v8>;
	vccio5-supply = <&p3v3>;
	vccio6-supply = <&p1v8>;
	vccio7-supply = <&p3v3>;
	status = "okay";
};

&pwm1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&pwm1m0_pins>;
};

&pwm2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&pwm2m0_pins>;
};

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

&sdhci {
	bus-width = <8>;
	max-frequency = <200000000>;
	non-removable;
	pinctrl-names = "default";
	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
	vmmc-supply = <&p3v3>;
	vqmmc-supply = <&p1v8>;
	mmc-hs200-1_8v;
	non-removable;
	no-sd;
	no-sdio;
	status = "okay";
};

&sdmmc0 {
	bus-width = <4>;
	cap-sd-highspeed;
	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
	disable-wp;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
	sd-uhs-sdr50;
	sd-uhs-sdr104;
	vmmc-supply = <&p3v3>;
	vqmmc-supply = <&vcc_sd>;
	status = "okay";
};

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

&uart2 {
	status = "okay";
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};

&usb_host0_xhci {
	dr_mode = "host";
	extcon = <&usb2phy0>;
	status = "okay";
};

&usb_host1_ehci {
	status = "okay";
};

&usb_host1_ohci {
	status = "okay";
};

&usb_host1_xhci {
	status = "okay";
};

&usb2phy0 {
	status = "okay";
};

&usb2phy0_host {
	status = "okay";
};

&usb2phy0_otg {
	status = "okay";
};

&usb2phy1 {
	status = "okay";
};

&usb2phy1_host {
	status = "okay";
};

&usb2phy1_otg {
	status = "okay";
};