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

/dts-v1/;
#include <dt-bindings/input/linux-event-codes.h>
#include "mt7986.dtsi"
#include <dt-bindings/gpio/gpio.h>

/ {
	#address-cells = <1>;
	#size-cells = <1>;
	model = "mt7986-glinet_gl-mt6000";
	compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";

	chosen {
		stdout-path = &uart0;
		tick-timer = &timer0;
	};

	config {
		bootcmd = "mtkboardboot";
		blink_led = "white:system";
		system_led = "blue:run";
	};

	memory@40000000 {
		device_type = "memory";
		reg = <0x40000000 0x40000000>;
	};

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

		button-reset {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
		};
	};

	gpio-leds {
		compatible = "gpio-leds";

		led_run: led-0 {
			label = "blue:run";
			gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
			default-state = "on";
		};

		led-1 {
			label = "white:system";
			gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
		};
	};

	reg_1p8v: regulator-1p8v {
		compatible = "regulator-fixed";
		regulator-name = "fixed-1.8V";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_3p3v: regulator-3p3v {
		compatible = "regulator-fixed";
		regulator-name = "fixed-3.3V";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		regulator-always-on;
	};

	bl2_verify {
		bl2_compatible = "emmc";
	};
};

&eth {
	status = "okay";
	mediatek,gmac-id = <0>;
	phy-mode = "2500base-x";
	mediatek,switch = "mt7531";
	reset-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;

	fixed-link {
		speed = <2500>;
		full-duplex;
	};
};

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

&pinctrl {
	mmc0_pins_default: mmc0default {
		mux {
			function = "flash";
			groups =  "emmc_51";
		};

		conf-cmd-dat {
			pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
			       "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
			       "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
			input-enable;
			drive-strength = <MTK_DRIVE_4mA>;
			bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
		};

		conf-clk {
			pins = "EMMC_CK";
			drive-strength = <MTK_DRIVE_6mA>;
			bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
		};

		conf-dsl {
			pins = "EMMC_DSL";
			bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
		};

		conf-rst {
			pins = "EMMC_RSTB";
			drive-strength = <MTK_DRIVE_4mA>;
			bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
		};
	};
};

&uart0 {
	status = "okay";
};

&watchdog {
	status = "disabled";
};
