// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "ipq6018.dtsi"
#include "ipq6018-ess.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	aliases {
		led-boot = &led_status_red;
		led-failsafe = &led_status_red;
		led-running = &led_status_green;
		led-upgrade = &led_status_blue;
	};

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

	leds {
		compatible = "gpio-leds";

		led_status_red: red {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_STATUS;
			gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>;
		};

		led_status_green: green {
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_STATUS;
			gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
		};

		led_status_blue: blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&tlmm 79 GPIO_ACTIVE_HIGH>;
		};
	};

	usb_vbus: regulator-usb-vbus {
		compatible = "regulator-fixed";
		regulator-name = "usb_vbus";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-boot-on;
	};
};

&tlmm {
	gpio-reserved-ranges = <20 1>;

	mdio_pins: mdio-pins {
		mdc {
			pins = "gpio64";
			function = "mdc";
			drive-strength = <8>;
			bias-pull-up;
		};

		mdio {
			pins = "gpio65";
			function = "mdio";
			drive-strength = <8>;
			bias-pull-up;
		};
	};
};

&blsp1_uart3 {
	pinctrl-0 = <&serial_3_pins>;
	pinctrl-names = "default";
	status = "okay";
};

&qusb_phy_0 {
	vdd-supply = <&usb_vbus>;
	status = "okay";
};

&rpm {
	status = "disabled";
};

&sdhc {
	bus-width = <8>;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	non-removable;
	status = "okay";
};

&ssphy_0 {
	status = "okay";
};

&usb3 {
	status = "okay";
};

&mdio {
	status = "okay";

	pinctrl-0 = <&mdio_pins>;
	pinctrl-names = "default";
	reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>;

	ethernet-phy-package@24 {
		compatible = "qcom,qca8075-package";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <24>;

		qca8075_0: ethernet-phy@24 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <24>;
		};

		qca8075_1: ethernet-phy@25 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <25>;
		};

		qca8075_2: ethernet-phy@26 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <26>;
		};

		qca8075_3: ethernet-phy@27 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <27>;
		};
	};
};
