Re: [PATCH net-next v11] net: mdio: Add RTL9300 MDIO driver

From: Andrew Lunn
Date: Fri Mar 14 2025 - 11:26:48 EST


> +static int rtl9300_mdiobus_probe_one(struct device *dev, struct rtl9300_mdio_priv *priv,
> + struct fwnode_handle *node)
> +{
> + struct rtl9300_mdio_chan *chan;
> + struct fwnode_handle *child;
> + struct mii_bus *bus;
> + u32 mdio_bus;
> + int err;
> +
> + err = fwnode_property_read_u32(node, "reg", &mdio_bus);
> + if (err)
> + return err;
> +
> + /* The MDIO interfaces are either in GPHY (i.e. clause 22) or 10GPHY
> + * mode (i.e. clause 45).

I still need more clarification about this. Is this solely about the
polling? Or does an interface in C22 mode go horribly wrong when asked
to do a C45 bus transaction?

> + bus->name = "Realtek Switch MDIO Bus";
> + bus->read = rtl9300_mdio_read_c22;
> + bus->write = rtl9300_mdio_write_c22;
> + bus->read_c45 = rtl9300_mdio_read_c45;
> + bus->write_c45 = rtl9300_mdio_write_c45;

You are providing C45 bus methods, independent of the interface
mode. So when accessing EEE registers in C45 address space, C45 bus
transactions are going to be used, even on an MDIO interface using C22
mode. Does this work? Can you actually do both C22 and C45 bus
transactions independent of the interface mode?

Andrew