From: Andrew Lunn <andrew@lunn.ch>
To: Yongzhao Chen <yongzhao.derek@gmail.com>
Cc: netdev@vger.kernel.org, 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>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: phy: qca83xx: read resolved QCA8337 link status
Date: Tue, 29 Sep 2026 02:40:37 +0200 [thread overview]
Message-ID: <01a62e77-6c4e-4665-ba46-26d12b1c77b4@lunn.ch> (raw)
In-Reply-To: <20260928220749.857-1-yongzhao.derek@gmail.com>
On Tue, Sep 29, 2026 at 12:07:49AM +0200, Yongzhao Chen wrote:
> Read QCA8337's vendor status on each autonegotiated link check so the
> reported speed matches the PHY after SmartSpeed changes negotiation.
> Keep link down while that status is unresolved or encodes a reserved
> speed; PHYLIB then notifies its consumers when valid status returns.
> Forced mode continues to use the generic BMCR result.
>
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Yongzhao Chen <yongzhao.derek@gmail.com>
> Assisted-by: LLM
> ---
> Andrew suggested this in his review of RFC v3 4/5, where he noted that
> read_status should report the real speed from the vendor register.
> Thanks, Andrew. I mentioned this change in the same thread:
> https://lore.kernel.org/netdev/20260924234814.1734-1-yongzhao.derek@gmail.com/
>
> It does not depend on the qca8k series and applies to net-next on its own.
>
> Testing: a model test compiles this function with the real
> genphy_read_status(), phy_resolve_aneg_pause(), phy_read_status() and
> phy_check_link_status() and covers 10/100/1000 in both duplexes,
> unresolved and reserved speed codes, a speed change while the link
> stays up, forced mode, pause resolution and MDIO read errors. W=1
> builds for arm64 are clean. The same function is in my OpenWrt Linux
> 6.18.52 build for a Redmi AX5400 (QCA8337), including the build used
> to test the at803x IPQ5018 fixes. I have not injected a real SmartSpeed
> downshift on a user port.
>
> drivers/net/phy/qcom/qca83xx.c | 49 ++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/drivers/net/phy/qcom/qca83xx.c b/drivers/net/phy/qcom/qca83xx.c
> index bc70ed8efd8..b3f3183d4a4 100644
> --- a/drivers/net/phy/qcom/qca83xx.c
> +++ b/drivers/net/phy/qcom/qca83xx.c
> @@ -92,6 +92,54 @@ static int qca83xx_probe(struct phy_device *phydev)
> return 0;
> }
>
> +static int qca8337_read_status(struct phy_device *phydev)
> +{
> + int ret, ss;
> +
> + ret = genphy_read_status(phydev);
> + if (ret)
> + return ret;
> + if (phydev->autoneg == AUTONEG_DISABLE)
> + return 0;
> +
> + phydev->speed = SPEED_UNKNOWN;
> + phydev->duplex = DUPLEX_UNKNOWN;
> + phydev->pause = false;
> + phydev->asym_pause = false;
> + if (!phydev->link)
> + return 0;
If there is no link, genphy_read_status() will of already set these to
_UNKNOWN etc. There is no need to clear them.
> + /* SmartSpeed can make the actual speed differ from the advertised modes. */
> + ss = phy_read(phydev, AT803X_SPECIFIC_STATUS);
> + if (ss < 0)
> + return ss;
> + if (!(ss & AT803X_SS_SPEED_DUPLEX_RESOLVED)) {
> + phydev->link = 0;
Can this really happen? BCMR says there is link, but this says there
is no link? What does the data sheet say? It seems unlikely to me.
Andrew
next prev parent reply other threads:[~2026-09-29 0:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 22:07 [PATCH net-next] net: phy: qca83xx: read resolved QCA8337 link status Yongzhao Chen
2026-09-29 0:40 ` Andrew Lunn [this message]
2026-09-30 21:23 ` Yongzhao Chen
2026-09-30 21:33 ` Andrew Lunn
2026-10-01 18:16 ` Yongzhao Chen
2026-10-01 18:46 ` Andrew Lunn
2026-10-02 20:35 ` Yongzhao Chen
2026-10-03 14:38 ` Andrew Lunn
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=01a62e77-6c4e-4665-ba46-26d12b1c77b4@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yongzhao.derek@gmail.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