// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause

/dts-v1/;

#include "ipq8074.dtsi"
#include "ipq8074-hk-cpu.dtsi"
#include "ipq8074-ess.dtsi"
#include <dt-bindings/leds/common.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	model = "TP-Link EAP660 HD v1";
	compatible = "tplink,eap660hd-v1", "qcom,ipq8074";

	aliases {
		serial0 = &blsp1_uart5;
		led-boot = &led_status_blue;
		led-failsafe = &led_status_blue;
		led-running = &led_status_blue;
		led-upgrade = &led_status_blue;
	};

	chosen {
		stdout-path = "serial0,115200n8";
		bootargs-append = " root=/dev/ubiblock0_1";
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&tlmm 50 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};

	leds {
		compatible = "gpio-leds";

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

&blsp1_uart5 {
	status = "okay";
};

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

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

&mdio {
	status = "okay";
	pinctrl-0 = <&mdio_pins>;
	pinctrl-names = "default";
	reset-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;

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

&dp5 {
	status = "okay";
	phy-mode = "sgmii";
	phy-handle = <&qca8081_28>;
	label = "lan";
};

&switch {
	status = "okay";
	switch_lan_bmp = <ESS_PORT5>;
	switch_mac_mode1 = <MAC_MODE_SGMII_PLUS>;

	qcom,port_phyinfo {
		port@5 {
			phy_address = <28>;
			port_id = <5>;
			port_mac_sel = "QGMAC_PORT";
		};
	};
};

&edma {
	status = "okay";
};

&qpic_bam {
	status = "okay";
};

&qpic_nand {
	status = "okay";

	nand@0 {
		reg = <0>;
		nand-ecc-strength = <4>;
		nand-ecc-step-size = <512>;
		nand-bus-width = <8>;

		partitions {
			compatible = "qcom,smem-part";
		};
	};
};

&wifi {
	status = "okay";
	qcom,ath11k-calibration-variant = "TP-Link-EAP660-HD-v1";
};
