[openwrt/openwrt] realtek: sfp: add mdio bus only for sfps with a phy

LEDE Commits lede-commits at lists.infradead.org
Tue Feb 25 11:57:51 PST 2025


svanheule pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/ccf54ca6732ed6b70d0039cf4c17d7c832aa5d06

commit ccf54ca6732ed6b70d0039cf4c17d7c832aa5d06
Author: Bjørn Mork <bjorn at mork.no>
AuthorDate: Wed Feb 5 08:37:51 2025 +0100

    realtek: sfp: add mdio bus only for sfps with a phy
    
    The SMBus patch broke the logic and caused the driver to always
    register an mdio bus, regardless of the sfp.  Restore original
    logic.
    
    Signed-off-by: Bjørn Mork <bjorn at mork.no>
    Link: https://github.com/openwrt/openwrt/pull/17950
    Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
 .../714-net-phy-sfp-add-support-for-SMBus.patch           | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch
index 76e2d76506..cb9a1da7e6 100644
--- a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch
+++ b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch
@@ -107,21 +107,20 @@ Signed-off-by: Antoine Tenart <antoine.tenart at bootlin.com>
  static void sfp_i2c_mdiobus_destroy(struct sfp *sfp)
  {
  	mdiobus_unregister(sfp->i2c_mii);
-@@ -1871,8 +1948,15 @@ static void sfp_sm_fault(struct sfp *sfp
+@@ -1875,9 +1952,15 @@ static void sfp_sm_fault(struct sfp *sfp
  
  static int sfp_sm_add_mdio_bus(struct sfp *sfp)
  {
 -	if (sfp->mdio_protocol != MDIO_I2C_NONE)
--		return sfp_i2c_mdiobus_create(sfp);
-+	if (i2c_check_functionality(sfp->i2c, I2C_FUNC_I2C)) {
-+		if (sfp->mdio_protocol != MDIO_I2C_NONE)
-+			return sfp_i2c_mdiobus_create(sfp);
-+
++	if (sfp->mdio_protocol == MDIO_I2C_NONE)
 +		return 0;
-+	}
 +
++	if (i2c_check_functionality(sfp->i2c, I2C_FUNC_I2C))
+ 		return sfp_i2c_mdiobus_create(sfp);
+ 
 +	if (i2c_check_functionality(sfp->i2c, I2C_FUNC_SMBUS_BYTE_DATA))
 +		return sfp_sm_mdiobus_create(sfp);
- 
++
  	return 0;
  }
+ 




More information about the lede-commits mailing list