Re: [PATCH net-next V2 4/5] net: lan743x: Implement phylink pcs

From: Andrew Lunn
Date: Wed Sep 11 2024 - 13:27:18 EST


> +static int pci11x1x_pcs_read(struct mii_bus *bus, int addr, int devnum,
> + int regnum)
> +{
> + struct lan743x_adapter *adapter = bus->priv;
> +
> + if (addr)
> + return -EOPNOTSUPP;
> +
> + return lan743x_sgmii_read(adapter, devnum, regnum);
> +}

> static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
> {
> + struct dw_xpcs *xpcs;
> u32 sgmii_ctl;
> int ret;
>
> @@ -3783,8 +3823,17 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
> "SGMII operation\n");
> adapter->mdiobus->read = lan743x_mdiobus_read_c22;
> adapter->mdiobus->write = lan743x_mdiobus_write_c22;
> - adapter->mdiobus->read_c45 = lan743x_mdiobus_read_c45;
> - adapter->mdiobus->write_c45 = lan743x_mdiobus_write_c45;
> + if (adapter->is_sfp_support_en) {
> + adapter->mdiobus->read_c45 =
> + pci11x1x_pcs_read;
> + adapter->mdiobus->write_c45 =
> + pci11x1x_pcs_write;

As you can see, the naming convention is to put the bus transaction
type on the end. So please name these pci11x1x_pcs_read_c45...

Also, am i reading this correct. C22 transfers will go out a
completely different bus to C45 transfers when there is an SFP?

If there are two physical MDIO busses, please instantiate two Linux
MDIO busses.

Andrew

---
pw-bot: cr