// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd
 */

/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include "rk3399pro-npu.dtsi"

/ {
	model = "Rockchip RK3399pro-npu EVB V10 Board";
	compatible = "rockchip,rk3399pro-npu-evb-v10", "rockchip,rk3399pro-npu";

	chosen {
		bootargs = "earlycon=uart8250,mmio32,0xff550000 console=ttyFIQ0 init=/init kpti=0";
	};

	keys: gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pwr_key>;

		power {
			gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
			label = "GPIO Power";
			linux,code = <116>;
			wakeup-source;
		};
	};

	fiq-debugger {
		compatible = "rockchip,fiq-debugger";
		rockchip,serial-id = <2>;
		rockchip,wake-irq = <0>;
		/* If enable uart uses irq instead of fiq */
		rockchip,irq-mode-enable = <0>;
		rockchip,baudrate = <1500000>;  /* Only 115200 and 1500000 */
		interrupts = <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&uart2m0_xfer>;
		status = "okay";
	};

	vdd_cpu: vdd-cpu {
		compatible = "regulator-fixed";
		regulator-name = "vdd_cpu";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <850000>;
		regulator-max-microvolt = <850000>;
	};

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

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

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

&i2c1 {
	status = "okay";

	vdd_npu: tcs4525@1c {
		compatible = "tcs,tcs4525";
		reg = <0x1c>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "fan53555-reg";
		pinctrl-0 = <&vsel_gpio>;
		vsel-gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
		regulator-name = "vdd_npu";
		regulator-min-microvolt = <750000>;
		regulator-max-microvolt = <800000>;
		regulator-ramp-delay = <2300>;
		fcs,suspend-voltage-selector = <1>;
		regulator-always-on;
		regulator-boot-on;
		regulator-initial-state = <3>;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};
};

&npu {
	npu-supply = <&vdd_npu>;
	status = "okay";
};

&combphy {
	status = "okay";
};

&u2phy {
	status = "okay";
};

&u2phy_otg {
	status = "okay";
};

&usbdrd3 {
	status = "okay";
};

&usbdrd_dwc3 {
	status = "okay";
};

&tsadc {
	rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
	rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
	pinctrl-names = "init", "default";
	pinctrl-0 = <&tsadc_otp_gpio>;
	pinctrl-1 = <&tsadc_otp_out>;
	status = "okay";
};

&pinctrl {
	vsel_gpio: vsel-gpio {
		rockchip,pins =
			<0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
	};

	pwr_key: pwr-key {
		rockchip,pins =
			<0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
	};
};
