Re: [PATCH net-next v3 07/11] net: phy: introduce phy_mdiobus_read_mmd()

From: Andrew Lunn
Date: Tue Jul 18 2023 - 19:59:31 EST


> +static int __phy_mdiobus_read_mmd(struct mii_bus *bus, int phy_addr,
> + enum phy_access_mode access_mode,
> + int devad, u32 regnum)
> +{
> + switch (access_mode) {
> + case PHY_ACCESS_C45:
> + return __mdiobus_c45_read(bus, phy_addr, devad, regnum);
> + case PHY_ACCESS_C22:
> + /* ignore return value for legacy reasons */
> + mmd_phy_indirect(bus, phy_addr, devad, regnum, false);
> +
> + /* Read the content of the MMD's selected register */
> + return __mdiobus_read(bus, phy_addr, MII_MMD_DATA);
> + default:
> + return -EOPNOTSUPP;
> + }

So this is reading a C45 register space register, otherwise it would
not be called _mmd and have a devad. So access_mode should really be
transfer mode. Until now, only transfer mode C45 can be used to access
C45 register space. The point of this patchset is to add a new
C45_OVER_C22 transfer mode.

And C22 would should give -EINVAL, since you cannot use plain C22 bus
transactions to access C45 register space.

Andrew