linux/arch/arm64/boot/dts/rockchip/rk3588-ok3588-c.dts

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

/dts-v1/;
#include "rk3588-fet3588-c.dtsi"

/ {
	model = "Forlinx OK3588-C Board";
	compatible = "forlinx,ok3588-c", "forlinx,fet3588-c", "rockchip,rk3588";

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

	adc-keys-0 {
		compatible = "adc-keys";
		io-channels = <&saradc 0>;
		io-channel-names = "buttons";
		keyup-threshold-microvolt = <1800000>;
		poll-interval = <100>;

		button-maskrom {
			label = "Maskrom";
			linux,code = <KEY_SETUP>;
			press-threshold-microvolt = <400>;
		};
	};

	adc-keys-1 {
		compatible = "adc-keys";
		io-channels = <&saradc 1>;
		io-channel-names = "buttons";
		keyup-threshold-microvolt = <1800000>;
		poll-interval = <100>;

		button-volume-up {
			label = "V+/Recovery";
			linux,code = <KEY_VOLUMEUP>;
			press-threshold-microvolt = <17000>;
		};

		button-volume-down {
			label = "V-";
			linux,code = <KEY_VOLUMEDOWN>;
			press-threshold-microvolt = <417000>;
		};

		button-menu {
			label = "Menu";
			linux,code = <KEY_MENU>;
			press-threshold-microvolt = <890000>;
		};

		button-escape {
			label = "ESC";
			linux,code = <KEY_ESC>;
			press-threshold-microvolt = <1235000>;
		};
	};

	fan: pwm-fan {
		compatible = "pwm-fan";
		cooling-levels = <0 95 145 195 255>;
		fan-supply = <&vcc12v_dcin>;
		pwms = <&pwm2 0 50000 0>;
		#cooling-cells = <2>;
	};

	sound {
		compatible = "simple-audio-card";
		pinctrl-names = "default";
		pinctrl-0 = <&hp_detect>;
		simple-audio-card,name = "RK3588 OK3588-C Audio";
		simple-audio-card,bitclock-master = <&masterdai>;
		simple-audio-card,format = "i2s";
		simple-audio-card,frame-master = <&masterdai>;
		simple-audio-card,hp-det-gpio = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
		simple-audio-card,mclk-fs = <256>;
		simple-audio-card,pin-switches = "Headphones", "Speaker";
		simple-audio-card,widgets =
			"Headphones", "Headphones",
			"Speaker", "Speaker",
			"Microphone", "Internal Microphone",
			"Microphone", "Headset Microphone";
		simple-audio-card,routing =
			"Headphones", "LHP",
			"Headphones", "RHP",
			"Speaker", "LSPK",
			"Speaker", "RSPK",
			"LMICP", "Headset Microphone",
			"RMICP", "Internal Microphone";

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

		masterdai: simple-audio-card,codec {
			sound-dai = <&nau8822>;
		};
	};

	vcc12v_dcin: vcc12v-dcin-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vcc12v_dcin";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
	};

	vcc1v8_sys: vcc1v8-sys-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vcc1v8_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc3v3_sys>;
	};

	vcc3v3_pcie2x1l0: vcc3v3-pcie2x1l0-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_pcie2x1l0";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		startup-delay-us = <50000>;
		vin-supply = <&vcc5v0_sys>;
	};

	vcc3v3_pcie2x1l2: vcc3v3-pcie2x1l2-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_pcie2x1l2";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		startup-delay-us = <5000>;
		vin-supply = <&vcc5v0_sys>;
	};

	vcc3v3_pcie30: vcc3v3_pcie30-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_pcie30";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc5v0_sys>;
	};

	vcc3v3_sys: vcc3v3-sys-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc5v0_sys>;
	};

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

&gmac0 {
	clock_in_out = "output";
	phy-handle = <&rgmii_phy0>;
	phy-mode = "rgmii-rxid";
	pinctrl-names = "default";
	pinctrl-0 = <&gmac0_miim
		     &gmac0_tx_bus2
		     &gmac0_rx_bus2
		     &gmac0_rgmii_clk
		     &gmac0_rgmii_bus>;
	tx_delay = <0x44>;
	rx_delay = <0x00>;
	status = "okay";
};

&gmac1 {
	clock_in_out = "output";
	phy-handle = <&rgmii_phy1>;
	phy-mode = "rgmii-rxid";
	pinctrl-names = "default";
	pinctrl-0 = <&gmac1_miim
		     &gmac1_tx_bus2
		     &gmac1_rx_bus2
		     &gmac1_rgmii_clk
		     &gmac1_rgmii_bus>;
	tx_delay = <0x44>;
	rx_delay = <0x00>;
	status = "okay";
};

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

&i2c2 {
	status = "okay";

	tca6424a: gpio@23 {
		compatible = "ti,tca6424";
		reg = <0x23>;
		gpio-controller;
		#gpio-cells = <2>;

		interrupt-parent = <&gpio1>;
		interrupts = <RK_PA4 IRQ_TYPE_EDGE_FALLING>;
		interrupt-controller;
		#interrupt-cells = <2>;

		pinctrl-names = "default";
		pinctrl-0 = <&tca6424a_int>;
		vcc-supply = <&vcc3v3_sys>;
	};
};

&i2c5 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c5m2_xfer>;

	pcf8563: rtc@51 {
		compatible = "nxp,pcf8563";
		reg = <0x51>;
	};
};

&i2c7 {
	status = "okay";

	nau8822: audio-codec@1a {
		compatible = "nuvoton,nau8822";
		reg = <0x1a>;
		clocks = <&cru I2S0_8CH_MCLKOUT>;
		clock-names = "mclk";
		assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
		assigned-clock-rates = <12288000>;
		#sound-dai-cells = <0>;
	};
};

&i2s0_8ch {
	pinctrl-names = "default";
	pinctrl-0 = <&i2s0_lrck
		     &i2s0_mclk
		     &i2s0_sclk
		     &i2s0_sdi0
		     &i2s0_sdo0>;
	status = "okay";
};

&mdio0 {
	rgmii_phy0: ethernet-phy@1 {
		/* RTL8211F */
		compatible = "ethernet-phy-id001c.c916";
		reg = <0x1>;
		pinctrl-names = "default";
		pinctrl-0 = <&rtl8211f_0_rst>;
		reset-assert-us = <20000>;
		reset-deassert-us = <100000>;
		reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
	};
};

&mdio1 {
	rgmii_phy1: ethernet-phy@2 {
		/* RTL8211F */
		compatible = "ethernet-phy-id001c.c916";
		reg = <0x2>;
		pinctrl-names = "default";
		pinctrl-0 = <&rtl8211f_1_rst>;
		reset-assert-us = <20000>;
		reset-deassert-us = <100000>;
		reset-gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>;
	};
};

&pcie2x1l0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie2_0_rst>;
	reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc3v3_pcie2x1l0>;
	status = "okay";
};

&pcie2x1l2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie2_2_rst>;
	reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc3v3_pcie2x1l2>;
	status = "okay";
};

&pcie30phy {
	status = "okay";
};

&pcie3x4 {
	pinctrl-names = "default";
	pinctrl-0 = <&pcie3_rst>;
	reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc3v3_pcie30>;
	status = "okay";
};

&pinctrl {
	pcie2 {
		pcie2_0_rst: pcie2-0-rst {
			rockchip,pins = <4 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		pcie2_2_rst: pcie2-2-rst {
			rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	pcie3 {
		pcie3_rst: pcie3-rst {
			rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	rtl8211f {
		rtl8211f_0_rst: rtl8211f-0-rst {
			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
		};
		rtl8211f_1_rst: rtl8211f-1-rst {
			rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	sound {
		hp_detect: hp-detect {
			rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	tca6424a {
		tca6424a_int: tca6424a-int {
			rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};
};

&pwm2 {
	status = "okay";
};

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

&sdmmc {
	bus-width = <4>;
	cap-mmc-highspeed;
	cap-sd-highspeed;
	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
	disable-wp;
	max-frequency = <150000000>;
	no-sdio;
	no-mmc;
	sd-uhs-sdr104;
	vqmmc-supply = <&vccio_sd_s0>;
	status = "okay";
};

&tsadc {
	status = "okay";
};

&u2phy2 {
	status = "okay";
};

&u2phy2_host {
	status = "okay";
};

&u2phy3 {
	status = "okay";
};

&u2phy3_host {
	status = "okay";
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};

&usb_host1_ehci {
	status = "okay";
};

&usb_host1_ohci {
	status = "okay";
};