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

/dts-v1/;
#include "mt7987a.dtsi"
#include "mt7987-emmc.dtsi"
#include "mt7987a-u-boot.dtsi"
#include "mt7987-netsys-u-boot.dtsi"

#include <dt-bindings/input/input.h>

/ {
	model = "MediaTek MT7987 EMMC airpi H5000M";
	compatible = "mediatek,mt7987", "mediatek,mt7987-emmc-rfb",
			"mediatek,mt7987a";

	chosen {
		bootargs = "console=ttyS0,115200n1 loglevel=8  \
			    earlycon=uart8250,mmio32,0x11000000 \
			    pci=pcie_bus_perf ubi.block=0,firmware \
			    root=/dev/fit0 rootwait";
	};

	bl2_verify {
		bl2_compatible = "emmc";
	};

	config {
		blink_led = "wifi";
		system_led = "sys";
	};

	gpio-keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
			debounce-interval = <10>;
		};

		wps {
			label = "wps";
			linux,code = <KEY_WPS_BUTTON>;
			gpios = <&pio 0 GPIO_ACTIVE_LOW>;
			debounce-interval = <10>;
		};
	};

	leds {
		compatible = "gpio-leds";
		led0 {
			label = "wifi";
			gpios = <&pio 3 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		led1 {
			label = "sys";
			gpios = <&pio 4 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};
	};
};


&eth0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mdio0_pins>;
	phy-mode = "2500base-x";
	phy-handle = <&phy1>;

	phy1: ethernet-phy@1 {
		compatible = "ethernet-phy-id001c.c849", "ethernet-phy-ieee802.3-c45";
		reg = <1>;
		phy-mode = "2500base-x";
		reset-gpios = <&pio 42 GPIO_ACTIVE_LOW>;
		reset-assert-us = <200000>;
		reset-deassert-us = <200000>;
	};
};

&eth1 {
	status = "okay";
	pinctrl-names = "i2p5gbe-led";
	pinctrl-0 = <&i2p5gbe_led0_pins>;
	phy-mode = "xgmii";
	phy-handle = <&phy15>;

	phy15: ethernet-phy@15 {
		compatible = "ethernet-phy-ieee802.3-c45";
		reg = <15>;
		phy-mode = "xgmii";
	};
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc_pins_default>;
	max-frequency = <48000000>;
	bus-width = <8>;
	cap-mmc-highspeed;
	cap-mmc-hw-reset;
	vmmc-supply = <&reg_3p3v>;
	vqmmc-supply = <&reg_3p3v>;
	non-removable;
	status = "okay";
};
