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

#include "armada-385-fortinet-fg-xxe.dtsi"

/ {
	memory@0 {
		device_type = "memory";
		reg = <0x00000000 0x80000000>; /* 2GB */
	};
};

&gpio_leds {
	led-14 {
		gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
		color = <LED_COLOR_ID_GREEN>;
		function = LED_FUNCTION_SPEED_WAN;
		function-enumerator = <1>;
		linux,default-trigger = "f1072004.mdio-mii:00:1Gbps";
	};

	led-15 {
		gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
		color = <LED_COLOR_ID_GREEN>;
		function = LED_FUNCTION_SPEED_WAN;
		function-enumerator = <2>;
		linux,default-trigger = "f1072004.mdio-mii:01:1Gbps";
	};

	led-16 {
		gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
		color = <LED_COLOR_ID_AMBER>;
		function = LED_FUNCTION_SPEED_LAN;
		function-enumerator = <5>;
		linux,default-trigger = "mv88e6xxx-0:00:100Mbps";
	};

	led-17 {
		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
		color = <LED_COLOR_ID_GREEN>;
		function = LED_FUNCTION_SPEED_LAN;
		function-enumerator = <5>;
		linux,default-trigger = "mv88e6xxx-0:00:1Gbps";
	};
};

&pinctrl {
	pmx_phy_switch_pins: phy-switch-pins {
		marvell,pins = "mpp19", "mpp20", "mpp23", "mpp34", "mpp41";
		marvell,function = "gpio";
	};
};

&eth1 {
	status = "okay";

	phy-handle = <&ethphy0>;
	phy-connection-type = "sgmii";
	buffer-manager = <&bm>;
	bm,pool-long = <2>;
	nvmem-cells = <&macaddr_bdinfo_d880 1>;
	nvmem-cell-names = "mac-address";
};

&eth2 {
	status = "okay";

	phy-handle = <&ethphy1>;
	phy-connection-type = "sgmii";
	buffer-manager = <&bm>;
	bm,pool-long = <3>;
	nvmem-cells = <&macaddr_bdinfo_d880 2>;
	nvmem-cell-names = "mac-address";
};

&mdio {
	pinctrl-names = "default";
	pinctrl-0 = <&mdio_pins>, <&pmx_phy_switch_pins>;

	/* Marvell 88E1512 */
	ethphy0: ethernet-phy@0 {
		compatible = "ethernet-phy-id0141,0dd1",
			     "ethernet-phy-ieee802.3-c22";
		reg = <0x0>;
		interrupt-parent = <&gpio0>;
		interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
		reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
		reset-assert-us = <10000>;
		reset-deassert-us = <10000>;
		/*
		 * LINK/ACT   (Green): LED[0], Active Low
		 * SPEED 100M (Amber): LED[1], Active High
		 */
		marvell,reg-init = <3 16 0 0x71>,
				   <3 17 0 0x4>;
	};

	/* Marvell 88E1512 */
	ethphy1: ethernet-phy@1 {
		compatible = "ethernet-phy-id0141,0dd1",
			     "ethernet-phy-ieee802.3-c22";
		reg = <0x1>;
		interrupt-parent = <&gpio1>;
		interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
		reset-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
		reset-assert-us = <10000>;
		reset-deassert-us = <10000>;
		/*
		 * LINK/ACT   (Green): LED[0], Active Low
		 * SPEED 100M (Amber): LED[1], Active High
		 */
		marvell,reg-init = <3 16 0 0x71>,
				   <3 17 0 0x4>;
	};

	/* Marvell 88E6176 */
	switch@2 {
		compatible = "marvell,mv88e6085";
		reg = <0x2>;
		reset-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;

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

			port@0 {
				reg = <0>;
				label = "lan5";
				nvmem-cells = <&macaddr_bdinfo_d880 7>;
				nvmem-cell-names = "mac-address";
			};

			port@1 {
				reg = <1>;
				label = "lan4";
				nvmem-cells = <&macaddr_bdinfo_d880 6>;
				nvmem-cell-names = "mac-address";
			};

			port@2 {
				reg = <2>;
				label = "lan3";
				nvmem-cells = <&macaddr_bdinfo_d880 5>;
				nvmem-cell-names = "mac-address";
			};

			port@3 {
				reg = <3>;
				label = "lan2";
				nvmem-cells = <&macaddr_bdinfo_d880 4>;
				nvmem-cell-names = "mac-address";
			};

			port@4 {
				reg = <4>;
				label = "lan1";
				nvmem-cells = <&macaddr_bdinfo_d880 3>;
				nvmem-cell-names = "mac-address";
			};

			port@6 {
				reg = <6>;
				ethernet = <&eth0>;
				phy-connection-type = "rgmii-id";

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