Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] On BCM53573 boards, one successful cable test on a BCM54210E
silently drops the forced-master setting.
--
net: phy: broadcom: Wire-up cable tests for BCM54210E
This commit wires up cable diagnostics for the BCM54210E PHY. It turns off
auto power-down while the ECD run is in progress. On completion or on a
start failure it restores auto power-down through
bcm54xx_adjust_rxrefclk().
> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
> index 9085b72e322f4..19b97beb8be8d 100644
> --- a/drivers/net/phy/broadcom.c
> +++ b/drivers/net/phy/broadcom.c
[ ... ]
> +static int bcm54xx_cable_test_get_status(struct phy_device *phydev,
> + bool *finished)
> +{
> + int ret;
> +
> + ret = bcm_phy_cable_test_get_status(phydev, finished);
> + if (ret < 0 || !*finished)
> + return ret;
> +
> + /* Put auto power-down back the way config_init() left it */
> + bcm54xx_adjust_rxrefclk(phydev);
[Severity: Medium]
Does a successful cable test on BCM53573 boards drop the forced master
mode that config_init() set up?
bgmac_probe() in drivers/net/ethernet/broadcom/bgmac-bcma.c sets
PHY_BRCM_EN_MASTER_MODE for a BCM54210E on BCM53573. bcm54210e_config_init()
then sets the master bits:
drivers/net/phy/broadcom.c:bcm54210e_config_init() {
...
if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
val = phy_read(phydev, MII_CTRL1000);
val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
phy_write(phydev, MII_CTRL1000, val);
}
...
}
With this patch, bcm54xx_cable_test_start()->bcm_phy_cable_test_start()->
_bcm_phy_cable_test_start() becomes reachable for this PHY. That path
clears the register unconditionally:
drivers/net/phy/bcm-phy-lib.c:_bcm_phy_cable_test_start() {
...
phy_write(phydev, MII_CTRL1000, 0);
...
}
When the test completes, bcm54xx_cable_test_get_status() only calls
bcm54xx_adjust_rxrefclk(). That restores the SCR3 and APD shadow
registers, not MII_CTRL1000.
The BCM54210E entry has no .config_aneg, so the renegotiation after the
test goes through genphy_config_aneg(). genphy_setup_master_slave()
returns early for MASTER_SLAVE_CFG_UNKNOWN or MASTER_SLAVE_CFG_UNSUPPORTED,
because the forced-master request comes from a driver-private dev_flag
rather than ethtool or DT. genphy_config_advert() only modifies
ADVERTISE_1000FULL and ADVERTISE_1000HALF.
So the PHY renegotiates with automatic master/slave resolution until the
next phy_init_hw(). Only the abort path re-runs config_init, through
phy_abort_cable_test()->phy_init_hw().
The later commit in this series, "net: phy: broadcom: Recover BCM54210E
from aborted cable tests", adds bcm54210e_soft_reset(). That only acts
when phydev->state == PHY_CABLETEST on the abort path. The successful
completion path is unchanged, so the problem is still there at the end of
the series.
Could the completion path re-apply the PHY_BRCM_EN_MASTER_MODE bits, or
save and restore MII_CTRL1000 around the test?
> +
> + return 0;
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40broadcom.com