]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: 6.12: proper mdio c45 handling in DSA driver
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 3 Jun 2025 14:46:00 +0000 (10:46 -0400)
committerRobert Marko <robimarko@gmail.com>
Wed, 11 Jun 2025 20:27:22 +0000 (22:27 +0200)
As the mdio bus has been hardened and can now handle c45 requests
the DSA driver must honor that as well. For this

- add proper upstreamed bus read_c45 and write_c45 functions
- take over the disabled port mask from upstream bus

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/18935
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c

index 9aa847d9c4666ccc97245a0ff75275578a4aadbf..411ee7f5e3fe61583c1addf975c6accbcc963326 100644 (file)
@@ -272,20 +272,34 @@ int write_phy(u32 port, u32 page, u32 reg, u32 val)
        return -1;
 }
 
-static int rtldsa_mdio_read(struct mii_bus *bus, int addr, int regnum)
+static int rtldsa_bus_read(struct mii_bus *bus, int addr, int regnum)
 {
        struct rtl838x_switch_priv *priv = bus->priv;
 
        return mdiobus_read_nested(priv->parent_bus, addr, regnum);
 }
 
-static int rtldsa_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
+static int rtldsa_bus_write(struct mii_bus *bus, int addr, int regnum, u16 val)
 {
        struct rtl838x_switch_priv *priv = bus->priv;
 
        return mdiobus_write_nested(priv->parent_bus, addr, regnum, val);
 }
 
+static int rtldsa_bus_c45_read(struct mii_bus *bus, int addr, int devad, int regnum)
+{
+       struct rtl838x_switch_priv *priv = bus->priv;
+
+       return mdiobus_c45_read_nested(priv->parent_bus, addr, devad, regnum);
+}
+
+static int rtldsa_bus_c45_write(struct mii_bus *bus, int addr, int devad, int regnum, u16 val)
+{
+       struct rtl838x_switch_priv *priv = bus->priv;
+
+       return mdiobus_c45_write_nested(priv->parent_bus, addr, devad, regnum, val);
+}
+
 static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
 {
        struct device *dev = priv->dev;
@@ -316,8 +330,11 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
                return -ENOMEM;
 
        bus->name = "rtldsa_mdio";
-       bus->read = rtldsa_mdio_read;
-       bus->write = rtldsa_mdio_write;
+       bus->read = rtldsa_bus_read;
+       bus->write = rtldsa_bus_write;
+       bus->read_c45 = rtldsa_bus_c45_read;
+       bus->write_c45 = rtldsa_bus_c45_write;
+       bus->phy_mask = priv->parent_bus->phy_mask;
        snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", bus->name, dev->id);
 
        bus->parent = dev;