Re: [PATCH net-next] net: phy: vitesse: implement MDI-X configuration in vsc73xx

From: Paweł Dembicki
Date: Fri Aug 23 2024 - 04:47:06 EST


czw., 22 sie 2024 o 17:58 Andrew Lunn <andrew@xxxxxxx> napisał(a):
>
> > +static int vsc73xx_mdix_set(struct phy_device *phydev, u8 mdix)
> > +{
> > + int ret;
> > + u16 val;
> > +
> > + val = phy_read(phydev, MII_VSC73XX_PHY_BYPASS_CTRL);
> > +
> > + switch (mdix) {
> > + case ETH_TP_MDI:
> > + val |= MII_VSC73XX_PBC_FOR_SPD_AUTO_MDIX_DIS |
> > + MII_VSC73XX_PBC_PAIR_SWAP_DIS |
> > + MII_VSC73XX_PBC_POL_INV_DIS;
> > + break;
> > + case ETH_TP_MDI_X:
> > + /* When MDI-X auto configuration is disabled, is possible
> > + * to force only MDI mode. Let's use autoconfig for forced
> > + * MDIX mode.
> > + */
> > + default:
> > + val &= ~(MII_VSC73XX_PBC_FOR_SPD_AUTO_MDIX_DIS |
>
> This could be a little bit more readable if rather than default: you
> used case ETH_TP_MDI_AUTO: . Then after this code, add a real default:
> which returns -EINVAL,
>

How should I handle ETH_TP_MDI_INVALID? Should I do it like in
marvell.c or rockchip.c, or leave it as the default?