realtek: add full SFP support to D-Link DGS-1210-28 series
authorAndreas Böhler <dev@aboehler.at>
Sat, 1 Jun 2024 17:14:39 +0000 (19:14 +0200)
committerSander Vanheule <sander@svanheule.net>
Sun, 15 Sep 2024 14:40:40 +0000 (16:40 +0200)
The DGS-1210-28 series was lacking full SFP support due to missing GPIOs.
Fortunately, the existing GPIO definitions of DGS-1210-52 match, this adds
the required i2c-gpio nodes to the DTS and allows hotplug SFP support.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
Link: https://github.com/openwrt/openwrt/pull/15616
Signed-off-by: Sander Vanheule <sander@svanheule.net>
target/linux/realtek/dts/rtl8382_d-link_dgs-1210-28.dts
target/linux/realtek/dts/rtl8382_d-link_dgs-1210-28_common.dtsi
target/linux/realtek/dts/rtl8382_d-link_dgs-1210-28mp-f.dts
target/linux/realtek/dts/rtl8393_d-link_dgs-1210-52.dts
target/linux/realtek/dts/rtl839x_d-link_dgs-1210_gpio.dtsi [deleted file]
target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio_sfp.dtsi [new file with mode: 0644]

index 0bcb196b7c97328a7a04f47fe43bf9453d7aba4a..29ff8153fbf7bf6758a07c98d6d503a05e2e51b4 100644 (file)
@@ -3,6 +3,7 @@
 #include "rtl838x.dtsi"
 #include "rtl83xx_d-link_dgs-1210_common.dtsi"
 #include "rtl83xx_d-link_dgs-1210_gpio.dtsi"
+#include "rtl83xx_d-link_dgs-1210_gpio_sfp.dtsi"
 #include "rtl8382_d-link_dgs-1210-28_common.dtsi"
 
 / {
index 17866d5f038f3cfeafe5aab982295aa4cee4fc32..d5b984b0a6f1e900f100f4f8ac82d5741d14d94b 100644 (file)
                EXTERNAL_PHY(22)
                EXTERNAL_PHY(23)
 
-               EXTERNAL_SFP_PHY(24)
-               EXTERNAL_SFP_PHY(25)
-               EXTERNAL_SFP_PHY(26)
-               EXTERNAL_SFP_PHY(27)
+               /* External phy RTL8214FC */
+               EXTERNAL_SFP_PHY_FULL(24, 0)
+               EXTERNAL_SFP_PHY_FULL(25, 1)
+               EXTERNAL_SFP_PHY_FULL(26, 2)
+               EXTERNAL_SFP_PHY_FULL(27, 3)
        };
 };
 
index ce008229b3334fc61fb619484ad918fec2bcc067..d1419cf7ed19d54af68097bc232d7e49fced10ad 100644 (file)
@@ -3,6 +3,7 @@
 #include "rtl838x.dtsi"
 #include "rtl83xx_d-link_dgs-1210_common.dtsi"
 #include "rtl83xx_d-link_dgs-1210_gpio.dtsi"
+#include "rtl83xx_d-link_dgs-1210_gpio_sfp.dtsi"
 #include "rtl8382_d-link_dgs-1210-28_common.dtsi"
 
 / {
index 5b876e7c431dae1949522265d84b3e8d61141e13..3ddf56f4f5ca5a3ef698be7736e7c81a95f69940 100644 (file)
@@ -3,7 +3,7 @@
 #include "rtl839x.dtsi"
 #include "rtl83xx_d-link_dgs-1210_common.dtsi"
 #include "rtl83xx_d-link_dgs-1210_gpio.dtsi"
-#include "rtl839x_d-link_dgs-1210_gpio.dtsi"
+#include "rtl83xx_d-link_dgs-1210_gpio_sfp.dtsi"
 
 / {
        compatible = "d-link,dgs-1210-52", "realtek,rtl8393-soc";
diff --git a/target/linux/realtek/dts/rtl839x_d-link_dgs-1210_gpio.dtsi b/target/linux/realtek/dts/rtl839x_d-link_dgs-1210_gpio.dtsi
deleted file mode 100644 (file)
index 260ab67..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
-
-/ {
-       /* Lan 49 */
-       i2c0: i2c-gpio-0 {
-               compatible = "i2c-gpio";
-               sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               scl-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               i2c-gpio,delay-us = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       sfp0: sfp-p49 {
-               compatible = "sff,sfp";
-               i2c-bus = <&i2c0>;
-               los-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
-               mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;
-               /* tx-disable-gpio handled by RTL8214FC based on media setting */
-       };
-
-       /* Lan 50 */
-       i2c1: i2c-gpio-1 {
-               compatible = "i2c-gpio";
-               sda-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               scl-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               i2c-gpio,delay-us = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       sfp1: sfp-p50 {
-               compatible = "sff,sfp";
-               i2c-bus = <&i2c1>;
-               los-gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>;
-               mod-def0-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
-               /* tx-disable-gpio handled by RTL8214FC based on media setting */
-       };
-
-       /* Lan 51 */
-       i2c2: i2c-gpio-2 {
-               compatible = "i2c-gpio";
-               sda-gpios = <&gpio1 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               scl-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               i2c-gpio,delay-us = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       sfp2: sfp-p51 {
-               compatible = "sff,sfp";
-               i2c-bus = <&i2c2>;
-               los-gpio = <&gpio1 25 GPIO_ACTIVE_HIGH>;
-               mod-def0-gpio = <&gpio1 24 GPIO_ACTIVE_LOW>;
-               /* tx-disable-gpio handled by RTL8214FC based on media setting */
-       };
-
-       /* Lan 52 */
-       i2c3: i2c-gpio-3 {
-               compatible = "i2c-gpio";
-               sda-gpios = <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               scl-gpios = <&gpio1 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
-               i2c-gpio,delay-us = <2>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       sfp3: sfp-p52 {
-               compatible = "sff,sfp";
-               i2c-bus = <&i2c3>;
-               los-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
-               mod-def0-gpio = <&gpio1 13 GPIO_ACTIVE_LOW>;
-               /* tx-disable-gpio handled by RTL8214FC based on media setting */
-       };
-};
diff --git a/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio_sfp.dtsi b/target/linux/realtek/dts/rtl83xx_d-link_dgs-1210_gpio_sfp.dtsi
new file mode 100644 (file)
index 0000000..260ab67
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/ {
+       /* Lan 49 */
+       i2c0: i2c-gpio-0 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp0: sfp-p49 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c0>;
+               los-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;
+               /* tx-disable-gpio handled by RTL8214FC based on media setting */
+       };
+
+       /* Lan 50 */
+       i2c1: i2c-gpio-1 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp1: sfp-p50 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c1>;
+               los-gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
+               /* tx-disable-gpio handled by RTL8214FC based on media setting */
+       };
+
+       /* Lan 51 */
+       i2c2: i2c-gpio-2 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp2: sfp-p51 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c2>;
+               los-gpio = <&gpio1 25 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 24 GPIO_ACTIVE_LOW>;
+               /* tx-disable-gpio handled by RTL8214FC based on media setting */
+       };
+
+       /* Lan 52 */
+       i2c3: i2c-gpio-3 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp3: sfp-p52 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c3>;
+               los-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 13 GPIO_ACTIVE_LOW>;
+               /* tx-disable-gpio handled by RTL8214FC based on media setting */
+       };
+};