๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27549

Re: [PATCH net-next v2 3/4] net: phy: broadcom: Wire-up cable tests for BCM54210E

#27549
From: netdev-bot+sashiko
Date: Sun, 06 Dec 2026 00:07
103 lines
11427 bytes
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
Technical Details
Message-ID: <179651565536.3148.15517909109675965375@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378185-linux-kernel-netdev=dewy.ru
References: <20261204233633.3790143-4-florian.fainelli@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378185-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179651565536.3148.15517909109675965375@kernel.org>
References: <20261204233633.3790143-4-florian.fainelli@broadcom.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3148045"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6Qw+QYz8tWdQu9k9fjuB/J4g3Gg= sha256:l/TOcLDgux7oRXO3tnv5hh19EXSwoBXnPed+6Gsq3Qc=
	sha1:ylRFgl8NKSmHujpX/b8vVu+Tcww= sha256:ZU95J056aOOfszrS34zZ8bd7NtBaE0sYIpdHmJpBYy8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 3B703117EFF; Sun,  6 Dec 2026 03:07:57 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.54
X-Spam-Status: No, score=-3.54 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id h8R08HBGLVgj;
	Sun,  6 Dec 2026 03:07:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378185-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id B83CA117EFB; Sun,  6 Dec 2026 03:07:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 80B7433D11; Sun,  6 Dec 2026 00:07:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796515657;
	b=WOBWPAEbLUhGjGkpAiWXRyGJ1sbRKaIWKPWFW0Z70BeY8zebEHzJCILcSb+DASenecjZ
	 hVDvzAr9ZrCNzFzCAWYNcz3qKhuyciKnijCHut2FY0q+s6AG69F5smQyEQwCFujsfw2b1
	 lhukCt/07qq/iaVTIQ16ElA5PsxKt15hiBxoI73EtC2EIgYhhmHW55lbHYTSjl4YR7kRl
	 yufCI1IOMjXCtyd5LJEQDtZUx7ff6TNBn67H2pGTk3LhQ2mrsP5KxTxzKaEEJc9xykMVV
	 HFaDo9JNYd3B6+kKuXy3+eMVGhK8hE0k/NcwSYGBvU6znozUqy0vyoa/JpVf8YM0E8g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796515657;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=kb7W5Jp6d6BQCQqiRlZda95c3LZdDf2M3RFdUnNzVVw=;
	b=jxOXECjIAb7Jvn/FOoj/xx/OaAoXp1z203w+fIEX4rJ4CURGx2kyvZbhau1tcPQJusOY
	 4Al8e6M0HbSL1dRal+Hmilg7xpGeWw0H4j1xfeNUUeYYjnz3q1gk5o4eW9WPFOgZN18Ah
	 f+kA8XEGMpg4nJ2VgyPubxoX6pe5ABfpI2C+0ZMHwnAtpLEuXOP3XVQeXRcMjYWiKYF1T
	 73f7zl3Wmwm1VrjQUnKm+KelL+FhyOcW23x7LLVY0ZN7SgW5iUvBMpmcJWssbGDTjxWQs
	 IUTgsm/eMDmGE+EX/VrOEw6/JFgjsQYtzqZynXdKK7AmiCVq+ZdeturFr6vRIXf0MNA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8KrMRJm;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FD05606A32F;
	Sun,  6 Dec 2026 00:07:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8KrMRJm
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796515656;
	b=DYp3VhxfB95lV6ZcyUcKZjLf6/OOVMYlNJIVrY5SnfZFli2pLaByY4/GFYDGO2u5+alR
	 70QOV881yj91VuebK0mYH97XLxSiKO/p+Gtkq9OfgDzwGJ8ccLfksa8zKsiRw9eqA/aL8
	 uPrhqjAOh75995gUVN2JAwdxVPIg5jtm0xfDAi4JuxGVsgzMVpmAKn5+JD3DFbgxlPiiz
	 9goN0rLqgPskCStYKRivXvEeYK+jiwyyaYVt9OG24x8gCL4icYZlS/6aMTorNHs837q4F
	 iH5fgFaCKipgmiRmUg2FUYdAOLpifdYbH6UjLSwmtoAYujn+CfFqI3ExiJlsEjhJCGA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796515656;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=kb7W5Jp6d6BQCQqiRlZda95c3LZdDf2M3RFdUnNzVVw=;
	b=SzWN3SrMpQHcTplvPhczI7uuIaqgiwIN1W1K27TbA1z+fnPZaDUca4HK7a9SKyl/5Pfe
	 GGHml/WKe5GxjTGToVEXq4kTWm9f9SuRl2wnv+QRoCI+QaBLzvzTmB3AzCuUglOxLfhpP
	 asJAnlCStArf+FpjF2lZXVuxITJcYNnOxYxcet1umflCC82aXG/SUiLBNdotFjL7eAIIj
	 6SnID1ktE54mzEbrCNmhStNL61k8OhnR6c7jR6g3mhZFQhE7QOkY1zpV88s0tXNGil+3k
	 gL345LqneNp6eakMl6n6lsvXwjLCy0InL34xQ7zd8DFvaQhhFC91XhWCPolDBveSr/w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8KrMRJm;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 706DD606A334
	for <netdev@vger.kernel.org>; Sun,  6 Dec 2026 00:07:36 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE4221F00A07;
	Sun,  6 Dec 2026 00:07:35 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796515656;
	bh=kb7W5Jp6d6BQCQqiRlZda95c3LZdDf2M3RFdUnNzVVw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=L8KrMRJmr7BB3iBvsoC7tVLwWxYYl0r6BgdmyqIeq++d7RUm5zjAhYPLUe0XxYeYA
	 99K8e3hFSH5tgedn9gZyxejSrJPpp7QXNbxcGl3hGVhVraGyEWPw7i1FZX2wXxE4uZ
	 XnVh4BWdsQ4JVUmrBgm2TODHCs46pQa/OMObCHVz2Q+bBtJR5B+u1mBC8EVDO/MTbW
	 4JolVl0ZEuAfPklqG9S+ojjYaSVQB8D7vIulsWxSd09Bka8hpK1KUSkFzjkIRTGnjC
	 kxUcLsDTmAt9raUZCSVXF+/9wkAMD0lgTpfSRe7AqN6eJnOyEv/e0PaaoFr4QUkhxH
	 8pso0TSZZXPUA==
X-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
X-In-Reply-To: <20261204233633.3790143-4-florian.fainelli@broadcom.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list