// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
 * Copyright (C) 2022 MediaTek Inc.
 * Author: Sam.Shih <sam.shih@mediatek.com>
 */

/dts-v1/;
#include "mt7988a.dtsi"
#include <dt-bindings/pinctrl/mt65xx.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>

/ {
	model = "MediaTek MT7988A Reference Board";
	compatible = "mediatek,mt7988a-rfb",
		     "mediatek,mt7988a";

	chosen {
		bootargs = "console=ttyS0,115200n1 loglevel=8  \
			    earlycon=uart8250,mmio32,0x11000000 \
			    pci=pcie_bus_perf";
	};

	memory {
		reg = <0 0x40000000 0 0x40000000>;
	};
};

&eth {
	pinctrl-0 = <&mdio0_pins>;
	pinctrl-names = "default";
};

&gmac0 {
	status = "okay";
};

&cpu0 {
	proc-supply = <&rt5190_buck3>;
};

&cpu1 {
	proc-supply = <&rt5190_buck3>;
};

&cpu2 {
	proc-supply = <&rt5190_buck3>;
};

&cpu3 {
	proc-supply = <&rt5190_buck3>;
};

&cci {
	proc-supply = <&rt5190_buck3>;
};

&eth {
	status = "okay";
};

&switch {
	status = "okay";
};

&gsw_phy0 {
	pinctrl-names = "gbe-led";
	pinctrl-0 = <&gbe0_led0_pins>;
};

&gsw_phy0_led0 {
	status = "okay";
	color = <LED_COLOR_ID_GREEN>;
};

&gsw_phy1 {
	pinctrl-names = "gbe-led";
	pinctrl-0 = <&gbe1_led0_pins>;
};

&gsw_phy1_led0 {
	status = "okay";
	color = <LED_COLOR_ID_GREEN>;
};

&gsw_phy2 {
	pinctrl-names = "gbe-led";
	pinctrl-0 = <&gbe2_led0_pins>;
};

&gsw_phy2_led0 {
	status = "okay";
	color = <LED_COLOR_ID_GREEN>;
};

&gsw_phy3 {
	pinctrl-names = "gbe-led";
	pinctrl-0 = <&gbe3_led0_pins>;
};

&gsw_phy3_led0 {
	status = "okay";
	color = <LED_COLOR_ID_GREEN>;
};

&i2c0 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0_pins>;
	status = "okay";

	rt5190a_64: rt5190a@64 {
		compatible = "richtek,rt5190a";
		reg = <0x64>;
		/*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/
		vin2-supply = <&rt5190_buck1>;
		vin3-supply = <&rt5190_buck1>;
		vin4-supply = <&rt5190_buck1>;

		regulators {
			rt5190_buck1: buck1 {
				regulator-name = "rt5190a-buck1";
				regulator-min-microvolt = <5090000>;
				regulator-max-microvolt = <5090000>;
				regulator-allowed-modes =
				<RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
				regulator-boot-on;
				regulator-always-on;
			};
			buck2 {
				regulator-name = "vcore";
				regulator-min-microvolt = <600000>;
				regulator-max-microvolt = <1400000>;
				regulator-boot-on;
				regulator-always-on;
			};
			rt5190_buck3: buck3 {
				regulator-name = "vproc";
				regulator-min-microvolt = <600000>;
				regulator-max-microvolt = <1400000>;
				regulator-boot-on;
			};
			buck4 {
				regulator-name = "rt5190a-buck4";
				regulator-min-microvolt = <850000>;
				regulator-max-microvolt = <850000>;
				regulator-allowed-modes =
				<RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
				regulator-boot-on;
				regulator-always-on;
			};
			ldo {
				regulator-name = "rt5190a-ldo";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1200000>;
				regulator-boot-on;
				regulator-always-on;
			};
		};
	};
};

&pcie0 {
	status = "okay";
};

&pcie1 {
	status = "okay";
};

&pcie2 {
	status = "disabled";
};

&pcie3 {
	status = "okay";
};

&ssusb0 {
	status = "okay";
};

&ssusb1 {
	status = "okay";
};

&tphy {
	status = "okay";
};

&uart0 {
	status = "okay";
};

&watchdog {
	status = "okay";
};

&xphy {
	status = "okay";
};
