Re: [PATCH v3 4/4] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY

From: Dimitri Fedrau
Date: Thu Dec 21 2023 - 09:45:56 EST


Am Thu, Dec 21, 2023 at 03:25:56PM +0100 schrieb Andrew Lunn:
> > Without setting the master-slave option it didn't work. I think its
> > mandatory.
>
> I don't think it is. The PHY should have a default setting for
> master-slave. Often its based on the typical use case. If its
> typically inside a switch, then it should default to prefer-master. If
> its typically in an end system, then it should be prefer-slave.
>
That would be the case if you use a forced configuration. I think this
is already implemented by reading out the MDIO_PMA_PMD_BT1_CTRL in
genphy_c45_pma_baset1_read_master_slave. Probably the problem arises
with following lines which prevents an inital read of the configuration:

static int mv88q2xxx_config_init(struct phy_device *phydev)
{
int ret;

/* The 88Q2XXX PHYs do have the extended ability register available, but
* register MDIO_PMA_EXTABLE where they should signalize it does not
* work according to specification. Therefore, we force it here.
*/
phydev->pma_extable = MDIO_PMA_EXTABLE_BT1;

if (phydev->drv->phy_id == MARVELL_PHY_ID_88Q2220)
return 0;

/* Read the current PHY configuration */
ret = genphy_c45_read_pma(phydev);
if (ret)
return ret;

return mv88q2xxx_config_aneg(phydev);
}

If I type in "ethtool -s eth0 autoneg on" I don't have to set the
master-slave option. Is the assumption here that we always start with a
forced configuration ? If yes, then I have to fix it.

> Andrew

Dimitri