Re: [PATCH net-next v2 1/3] net: phy: bcm54811: Fix the PHY initialization

From: Russell King (Oracle)
Date: Mon Jun 23 2025 - 11:57:07 EST


On Mon, Jun 23, 2025 at 05:10:47PM +0200, Kamil Horák - 2N wrote:
> /* With BCM54811, BroadR-Reach implies no autoneg */
> - if (priv->brr_mode)
> + if (priv->brr_mode) {
> phydev->autoneg = 0;

This, to me, looks extremely buggy. Setting phydev->autoneg to zero does
not prevent userspace enabling autoneg later. It also doesn't report to
userspace that autoneg is disabled. Not your problem, but a latent bug
in this driver.

> + /* Disable Long Distance Signaling, the BRR mode autoneg */
> + err = phy_modify(phydev, MII_BCM54XX_LRECR, LRECR_LDSEN, 0);
> + if (err < 0)
> + return err;
> + }
>
> - return bcm5481x_set_brrmode(phydev, priv->brr_mode);
> + if (!phy_interface_is_rgmii(phydev) ||
> + phydev->interface == PHY_INTERFACE_MODE_MII) {

Not sure this condition actually reflects what you're trying to
achieve, because if we're using PHY_INTERFACE_MODE_MII, then
!phy_interface_is_rgmii(phydev) will be true because phydev->interface
isn't one of the RGMII modes. So, I think this can be reduced to simply

if (!phy_interface_is_rgmii(phydev)) {

> + /* Misc Control: GMII/MII Mode (not RGMII) */
> + err = bcm54xx_auxctl_write(phydev,
> + MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
> + MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN |
> + MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RSVD
> + );

I don't think this addition is described in the commit message.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!