[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9d937969-85e1-4490-836b-ec8f34cbd9ed@lunn.ch>
Date: Mon, 26 Aug 2024 04:13:53 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Paweł Dembicki <paweldembicki@...il.com>
Cc: netdev@...r.kernel.org, Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: phy: vitesse: implement MDI-X
configuration in vsc73xx
On Fri, Aug 23, 2024 at 10:46:44AM +0200, Paweł Dembicki wrote:
> czw., 22 sie 2024 o 17:58 Andrew Lunn <andrew@...n.ch> 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?
ETH_TP_MDI_INVALID generally means there is no support for controlling
MDI. But you are adding support. The most useful default is
ETH_TP_MDI_AUTO. So i would do that here. I would also set
phydev->mdio_ctrl to whatever the hardware defaults to in .probe, or
.config_init
Andrew
Powered by blists - more mailing lists