Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: florian.fainelli@broadcom.com
Cc: netdev@vger.kernel.org, nb@tipi-net.de,
	bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch,
	hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net-next v2 3/4] net: phy: broadcom: Wire-up cable tests for BCM54210E
Date: Sun, 06 Dec 2026 00:07:35 +0000	[thread overview]
Message-ID: <179651565536.3148.15517909109675965375@kernel.org> (raw)
In-Reply-To: <20261204233633.3790143-4-florian.fainelli@broadcom.com>

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/20261204233633.3790143-1-florian.fainelli%40broadcom.com

  reply	other threads:[~2026-12-06  0:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 23:36 [PATCH net-next v2 0/4] net: phy: Cable tests for BCM54210E Florian Fainelli
2026-12-04 23:36 ` [PATCH net-next v2 1/4] net: phy: broadcom: Report failed ECD pairs as unspecified Florian Fainelli
2026-12-06  0:07   ` netdev-bot+sashiko
2026-12-04 23:36 ` [PATCH net-next v2 2/4] net: phy: broadcom: Implement cable test initialization for BCM54210E Florian Fainelli
2026-12-06  0:07   ` netdev-bot+sashiko
2026-12-04 23:36 ` [PATCH net-next v2 3/4] net: phy: broadcom: Wire-up cable tests " Florian Fainelli
2026-12-06  0:07   ` netdev-bot+sashiko [this message]
2026-12-04 23:36 ` [PATCH net-next v2 4/4] net: phy: broadcom: Recover BCM54210E from aborted cable tests Florian Fainelli
2026-12-06  0:07   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179651565536.3148.15517909109675965375@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox