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

#include "rtl838x.dtsi"
#include "rtl83xx_hpe_1920.dtsi"

/ {
	gpio1: rtl8231-gpio {
		compatible = "realtek,rtl8231-gpio";
		#gpio-cells = <2>;
		gpio-controller;
		indirect-access-bus-id = <0>;
	};

	i2c0: i2c-gpio-0 {
		compatible = "i2c-gpio";
		sda-gpios = <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		scl-gpios = <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		i2c-gpio,delay-us = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
	};

	sfp0: sfp-0 {
		compatible = "sff,sfp";
		i2c-bus = <&i2c0>;
		los-gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>;
		mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>;
		// tx-fault unconnected
		// tx-disable connected to RTL8214FC
	};

	i2c1: i2c-gpio-1 {
		compatible = "i2c-gpio";
		sda-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		scl-gpios = <&gpio1 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		i2c-gpio,delay-us = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
	};

	sfp1: sfp-1 {
		compatible = "sff,sfp";
		i2c-bus = <&i2c1>;
		los-gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
		mod-def0-gpio = <&gpio1 25 GPIO_ACTIVE_LOW>;
		// tx-fault unconnected
		// tx-disable connected to RTL8214FC
	};

	i2c2: i2c-gpio-2 {
		compatible = "i2c-gpio";
		sda-gpios = <&gpio1 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		scl-gpios = <&gpio1 28 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		i2c-gpio,delay-us = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
	};

	sfp2: sfp-2 {
		compatible = "sff,sfp";
		i2c-bus = <&i2c2>;
		los-gpio = <&gpio1 30 GPIO_ACTIVE_HIGH>;
		mod-def0-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
		// tx-fault unconnected
		// tx-disable connected to RTL8214FC
	};

	i2c3: i2c-gpio-3 {
		compatible = "i2c-gpio";
		sda-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		scl-gpios = <&gpio1 32 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
		i2c-gpio,delay-us = <2>;
		#address-cells = <1>;
		#size-cells = <0>;
	};

	sfp3: sfp-3 {
		compatible = "sff,sfp";
		i2c-bus = <&i2c3>;
		los-gpio = <&gpio1 34 GPIO_ACTIVE_HIGH>;
		mod-def0-gpio = <&gpio1 33 GPIO_ACTIVE_LOW>;
		// tx-fault unconnected
		// tx-disable connected to RTL8214FC
	};
};

&ethernet0 {
	mdio: mdio-bus {
		compatible = "realtek,rtl838x-mdio";
		regmap = <&ethernet0>;
		#address-cells = <1>;
		#size-cells = <0>;

		INTERNAL_PHY(8)
		INTERNAL_PHY(9)
		INTERNAL_PHY(10)
		INTERNAL_PHY(11)
		INTERNAL_PHY(12)
		INTERNAL_PHY(13)
		INTERNAL_PHY(14)
		INTERNAL_PHY(15)

		EXTERNAL_PHY(16)
		EXTERNAL_PHY(17)
		EXTERNAL_PHY(18)
		EXTERNAL_PHY(19)
		EXTERNAL_PHY(20)
		EXTERNAL_PHY(21)
		EXTERNAL_PHY(22)
		EXTERNAL_PHY(23)

		EXTERNAL_SFP_PHY_FULL(24, 0)
		EXTERNAL_SFP_PHY_FULL(25, 1)
		EXTERNAL_SFP_PHY_FULL(26, 2)
		EXTERNAL_SFP_PHY_FULL(27, 3)
	};
};
