#include "mt7621_mikrotik.dtsi"

/ {
	compatible = "mikrotik,routerboard-m33g", "mediatek,mt7621-soc";
	model = "MikroTik RouterBOARD M33G";

	aliases {
		led-boot = &led_usr;
		led-failsafe = &led_usr;
		led-running = &led_usr;
		led-upgrade = &led_usr;
	};

	leds {
		compatible = "gpio-leds";

		led_usr: usr {
			label = "green:usr";
			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
		};
	};

	pcie0_vcc_reg {
		compatible = "regulator-fixed";
		regulator-name = "pcie0_vcc";

		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};

	pcie1_vcc_reg {
		compatible = "regulator-fixed";
		regulator-name = "pcie1_vcc";

		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};

	pcie2_vcc_reg {
		compatible = "regulator-fixed";
		regulator-name = "pcie2_vcc";

		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};

	usb_vcc_reg {
		compatible = "regulator-fixed";
		regulator-name = "usb_vcc";

		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-always-on;
	};
};

&spi0 {
	flash@1 {
		compatible = "jedec,spi-nor";
		reg = <1>;
		spi-max-frequency = <33000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			// Region <0x0 0x40000> seems reserved by OEM

			partition@40000 {
				compatible = "mikrotik,minor";
				label = "firmware";
				reg = <0x040000 0xfc0000>;
			};
		};
	};
};

&gmac1 {
	status = "okay";
	label = "wan";
	phy-handle = <&ethphy0>;
};

&ethphy0 {
	/delete-property/ interrupts;
};

&switch0 {
	ports {
		port@1 {
			status = "okay";
			label = "lan1";
		};

		port@2 {
			status = "okay";
			label = "lan2";
		};
	};
};

&state_default {
	gpio {
		groups = "uart2", "wdt";
		function = "gpio";
	};
};

&sdhci {
	status = "okay";
};

&i2c {
	status = "okay";
};

&pcie {
	status = "okay";
};

&uartlite3 {
	status = "okay";
};
