Re: [PATCH net-next v2 1/3] net: macb: fix SGMII with inband aneg disabled

From: Conor Dooley

Date: Fri Mar 06 2026 - 11:31:57 EST


On Thu, Mar 05, 2026 at 02:28:08PM +0000, Russell King (Oracle) wrote:
> I suggest something like the following in vitesse.c for this PHY:
>
> #define VSC8662_EXT_CON1 0x17
> #define VSC8662_EXT_CON_MAC_AN BIT(13)
>
> #define VSC8662_MAC_AN 0x1b
> #define VSC8662_MAC_AN_BYPASS BIT(13)
>
> static unsigned int vsc8662_inband_caps(struct phy_device *phydev,
> phy_interface_t interface)
> {
> if (interface == PHY_INTERFACE_MODE_SGMII)
> return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE |
> LINK_INBAND_BYPASS;
>
> return 0;
> }
>
> static int vsc8662_config_inband(struct phy_device *phydev, unsigned int modes)
> {
> bool changed = false;
> u16 mask;
> int ret;
>
> mask = VSC8662_EXT_CON_MAC_AN;
> ret = phy_modify_changed(phydev, VSC8662_EXT_CON1, mask,
> modes & (LINK_INBAND_ENABLE |
> LINK_INBAND_BYPASS) ? mask : 0);
> if (ret > 0)
> changed = true;

FYI, clang warns that changed is set but not used.

> else if (ret < 0)
> return ret;
>
> mask = VSC8662_MAC_AN_BYPASS;
> ret = phy_modify(phydev, VSC8662_MAC_AN, mask,
> modes & LINK_INBAND_BYPASS ? mask : 0);
> if (ret < 0)
> return ret;
>
> return genphy_soft_reset(phydev);
> }
>
> and the appropriate initialisers in the phy_driver struct.

I tested this, on top of the failing next that I found the problem on,
and it seems to make things work. Thanks for coming up with it.

Could you please make this a patch, I don't understand why this is the
correct way to fix the problem, or the impact on users of the 8662 other
than me, so I wouldn't be able to write a suitable commit message.

Cheers,
Conor.

Attachment: signature.asc
Description: PGP signature