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

/dts-v1/;

#include "rk3528-nanopi.dtsi"

/ {
	model = "FriendlyElec NanoPi Zero2";
	compatible = "friendlyarm,nanopi-zero2", "rockchip,rk3528";

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

		button-recovery {
			label = "RECOVERY";
			linux,code = <KEY_VENDOR>;
			press-threshold-microvolt = <0>;
		};
	};

	vcc0v6_ddr: regulator-0v6-vcc-ddr {
		compatible = "regulator-fixed";
		regulator-name = "vcc0v6_ddr";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <600000>;
		regulator-max-microvolt = <600000>;
		vin-supply = <&vcc5v0_sys>;
	};

	usb2_host_5v: regulator-5v0-usb2-host {
		compatible = "regulator-fixed";
		enable-active-high;
		gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb20_host1_pwren>;
		regulator-name = "usb2_host_5v";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc5v0_sys>;
	};
};

&led1 {
	default-state = "on";
	function = LED_FUNCTION_STATUS;
	linux,default-trigger = "default-on";
};

&pinctrl {
	usb {
		usb20_host1_pwren: usb20-host1-pwren {
			rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};

&usb_host0_xhci {
	extcon = <&usb2phy>;
	maximum-speed = "high-speed";
	phys = <&usb2phy_otg>;
	phy-names = "usb2-phy";
	status = "okay";
};

&usb2phy {
	status = "okay";
};

&usb2phy_host {
	phy-supply = <&usb2_host_5v>;
	status = "okay";
};

&usb2phy_otg {
	status = "okay";
};