From: Alexandru Gagniuc Date: Mon, 16 May 2022 02:54:47 +0000 (-0500) Subject: realtek: EnGenius EWS2910P: add support for SFP ports X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4d1fc8916c50bb06c2cc0147e36d93eba6b85a9c;p=openwrt%2Fstaging%2Fthess.git realtek: EnGenius EWS2910P: add support for SFP ports The SFP cages 9F and 10F share the same SCL line. Currently, there isn't a good way to model this. Thus, only one SFP port can be fully supported. Cage 10F is fully supported with an I2C bus and sfp handle. Linux automatically handles enabling or disabling the TX laser. Cage 9F is only parially supported, without the sfp handle. The SDA line is hogged as an input, so that it remains high. SCL transitions sould not affect modules connected to this cage. The default value of the tx-disable line is high (active). It is exported as a gpio, but the laser is off by default. To enable the laser: echo 0 > /sys/class/gpio/sff-p9-tx-disable/value Thus, both modules can be used for networking, but only 10F will be able to detect and identify a plugged in SFP module. Signed-off-by: Alexandru Gagniuc --- diff --git a/target/linux/realtek/dts-5.10/rtl8380_engenius_ews2910p.dts b/target/linux/realtek/dts-5.10/rtl8380_engenius_ews2910p.dts index feb57fecff..f87c9585f9 100644 --- a/target/linux/realtek/dts-5.10/rtl8380_engenius_ews2910p.dts +++ b/target/linux/realtek/dts-5.10/rtl8380_engenius_ews2910p.dts @@ -42,6 +42,25 @@ #gpio-cells = <2>; gpio-controller; indirect-access-bus-id = <0>; + + sff_p9_gpios { + gpio-hog; + gpios = < 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>, + < 11 GPIO_ACTIVE_HIGH>, /* los-gpio */ + < 12 GPIO_ACTIVE_LOW>; /* mod-def0-gpio */ + input; + line-name = "sff-p9-gpios"; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + sff-p9-tx-disable { + gpio-export,name = "sff-p9-tx-disable"; + gpio-export,output = <1>; + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + }; }; gpio-restart { @@ -72,6 +91,22 @@ gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; }; }; + + i2c1: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + sfp1: sfp-p10 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + tx-disable-gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>; + los-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>; + }; }; &spi0 { @@ -138,6 +173,9 @@ INTERNAL_PHY(13) INTERNAL_PHY(14) INTERNAL_PHY(15) + + INTERNAL_PHY(24) + INTERNAL_PHY(26) }; }; @@ -155,6 +193,17 @@ SWITCH_PORT(14, 7, internal) SWITCH_PORT(15, 8, internal) + SWITCH_SFP_PORT(24, 9, 1000base-x) + + port@26 { + reg = <26>; + label = "lan10"; + phy-mode = "1000base-x"; + phy-handle = <&phy26>; + managed = "in-band-status"; + sfp = <&sfp1>; + }; + port@28 { ethernet = <ðernet0>; reg = <28>;