// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
 * Copyright (C) 2022 SmartRG Inc.
 * Author: Chad Monroe <chad.monroe@smartrg.com>
 */

#include "mt7986a-smartrg-bonanza-peak.dtsi"

/ {
	model = "SmartRG SDG-8614";
	compatible = "smartrg,sdg-8614", "mediatek,mt7986a";

	/* SFP1 cage (WAN) */
	i2c_sfp1: i2c-gpio-0 {
		compatible = "i2c-gpio";
		sda-gpios = <&pio 62 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		scl-gpios = <&pio 63 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		i2c-gpio,delay-us = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
	};

	sfp1: sfp1 {
		compatible = "sff,sfp";
		i2c-bus = <&i2c_sfp1>;
		los-gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
		mod-def0-gpios = <&pio 65 GPIO_ACTIVE_LOW>;
		rate-select0-gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
		rate-select1-gpios = <&pio 28 GPIO_ACTIVE_HIGH>;
		tx-disable-gpios = <&pio 64 GPIO_ACTIVE_HIGH>;
		tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
		maximum-power-milliwatt = <3000>;
	};

	leds {
		compatible = "gpio-leds";

		sfp_red {
			color = <LED_COLOR_ID_RED>;
			function = "sfp";
			function-enumerator = <1>;
			gpios = <&pio 16 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		sfp_green {
			color = <LED_COLOR_ID_GREEN>;
			function = "sfp";
			function-enumerator = <0>;
			gpios = <&pio 19 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};
	};
};

&mux_sel {
	output-low;
	/delete-node/ output-high;
};

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

&gmac1 {
	sfp = <&sfp1>;
	managed = "in-band-status";
};

&mdio {
	switch: switch@1f {
		compatible = "mediatek,mt7531";
		reg = <31>;
		reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@1 {
				reg = <1>;
				label = "lan3";
			};

			port@2 {
				reg = <2>;
				label = "lan2";
			};

			port@3 {
				reg = <3>;
				label = "lan1";
			};

			port5: port@5 {
				reg = <5>;
				label = "lan4";

				phy-mode = "2500base-x";
				phy-handle = <&phy5>;
			};

			port@6 {
				reg = <6>;
				ethernet = <&gmac0>;
				phy-mode = "2500base-x";

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

&wifi {
	ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>;
};
