From: Florian Fainelli <florian.fainelli@broadcom.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next 2/3] net: phy: broadcom: Wire-up cable tests for BCM54210E
Date: Wed, 2 Dec 2026 16:48:01 -0800 [thread overview]
Message-ID: <20261203004802.85707-3-florian.fainelli@broadcom.com> (raw)
In-Reply-To: <20261203004802.85707-1-florian.fainelli@broadcom.com>
Wire up the cable diagnostics now that we have implemented the cable
test feature, this was verified with a Raspberry Pi 4B using a BCM54210E
PHY:
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/phy/broadcom.c | 43 +++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 9085b72e322f..19b97beb8be8 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -1469,6 +1469,44 @@ static int bcm54xx_disable_autonomous_eee(struct phy_device *phydev)
BCM54XX_MII_BUF_CNTL0_AUTOGREEEN_EN, 0);
}
+static int bcm54xx_cable_test_start(struct phy_device *phydev)
+{
+ int val, ret;
+
+ /* The ECD run never finishes on a line without energy while auto
+ * power-down is enabled.
+ */
+ val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD);
+ if (val < 0)
+ return val;
+
+ ret = bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD,
+ val & ~BCM54XX_SHD_APD_EN);
+ if (ret < 0)
+ return ret;
+
+ ret = bcm_phy_cable_test_start(phydev);
+ if (ret < 0)
+ bcm54xx_adjust_rxrefclk(phydev);
+
+ return ret;
+}
+
+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);
+
+ return 0;
+}
+
static struct phy_driver broadcom_drivers[] = {
{
PHY_ID_MATCH_MODEL(PHY_ID_BCM5411),
@@ -1498,7 +1536,8 @@ static struct phy_driver broadcom_drivers[] = {
PHY_ID_MATCH_MODEL(PHY_ID_BCM54210E),
.name = "Broadcom BCM54210E",
/* PHY_GBIT_FEATURES */
- .flags = PHY_ALWAYS_CALL_SUSPEND,
+ .flags = PHY_ALWAYS_CALL_SUSPEND |
+ PHY_POLL_CABLE_TEST,
.get_sset_count = bcm_phy_get_sset_count,
.get_strings = bcm_phy_get_strings,
.get_stats = bcm54xx_get_stats,
@@ -1513,6 +1552,8 @@ static struct phy_driver broadcom_drivers[] = {
.set_wol = bcm54xx_phy_set_wol,
.led_brightness_set = bcm_phy_led_brightness_set,
.disable_autonomous_eee = bcm54xx_disable_autonomous_eee,
+ .cable_test_start = bcm54xx_cable_test_start,
+ .cable_test_get_status = bcm54xx_cable_test_get_status,
}, {
PHY_ID_MATCH_MODEL(PHY_ID_BCM5461),
.name = "Broadcom BCM5461",
--
2.53.0
next prev parent reply other threads:[~2026-12-03 0:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 0:47 [PATCH net-next 0/3] net: phy: Cable tests for BCM54210E Florian Fainelli
2026-12-03 0:48 ` [PATCH net-next 1/3] net: phy: broadcom: Implement cable test initialization Florian Fainelli
2026-12-03 0:48 ` Florian Fainelli [this message]
2026-12-03 0:48 ` [PATCH net-next 3/3] net: phy: broadcom: Time out a stuck cable test Florian Fainelli
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=20261203004802.85707-3-florian.fainelli@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--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