Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v3] net: phy: aquantia: Poll global status register for provision ID
@ 2026-11-12  3:02 Hongmei Xu
  2026-11-16 13:50 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: Hongmei Xu @ 2026-11-12  3:02 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Sagar Cheluvegowda, Hongmei Xu

According to the AQR113 PHY databook, after firmware reset, a 20ms
timer needs to be engaged to allow the supplies to settle prior to
allowing the PHY to boot. The working flow is:
  -After the 20 ms timer has completed, hardware state machines
   designed to guarantee PLL and band-gap stability engage.
  -After the PLLs and band-gap are locked and functioning properly,
   the processor and digital circuitry are released from reset.
  -The PHY image is then loaded through MDIO boot-load and the
   processor boots.
  -After the processor boots, any provisioned register values are
   set, and the PHY enters the provisioned operating state.

Starting subsequent firmware operations before the provision ID is
valid leads to steady link failures; this has been observed during
AQR113 PHY bring-up.

Also the provisioning ID is a component of the firmware fingerprint
used to identify the host interface mode for PHYs like AQR412C. When
such a PHY is provisioned with MUSX firmware, the fingerprint
determines whether the host interface should be reported as 10G-QXGMII
rather than USXGMII. Without a valid provisioning ID, the fingerprint
cannot be correctly built, making USXGMII and 10G-QXGMII
indistinguishable and potentially causing an interface mismatch.

Poll VEND1_GLOBAL_RSVD_STAT1 until the provision ID field is non-zero
before returning from aqr_wait_reset_complete(). A timeout indicates
a hardware-level provisioning failure that software cannot remediate;
the warning is logged to flag the hardware problem, but probe is not
failed since not all PHYs require a valid provision ID.

Co-developed-by: Sagar Cheluvegowda <sagar.cheluvegowda@oss.qualcomm.com>
Signed-off-by: Sagar Cheluvegowda <sagar.cheluvegowda@oss.qualcomm.com>
Signed-off-by: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
---
Changes in v3:
- Merge split string in phydev_warn() into a single line per kernel coding style
- Link to v2: https://patch.msgid.link/20261111-aquantia-poll-global-status-register-v2-1-b602fc7e80a9@oss.qualcomm.com

Changes in v2:
- Change the log when provisioning ID poll times out to hint the
  mode mismatch possibility
- Update commit message to describe the AQR113 databook boot sequence
  and explain why polling PROV_ID is necessary
- Update commit message to explain that timeout prevents fingerprint
  construction for PHYs like AQR412C with MUSX firmware which in a result cause mode mismatch
- Link to v1: https://patch.msgid.link/20261029-aquantia-poll-global-status-register-v1-1-808089824a3d@oss.qualcomm.com
---
 drivers/net/phy/aquantia/aquantia_main.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index e95d391a6dc2..b90221f1cf41 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -702,7 +702,22 @@ int aqr_wait_reset_complete(struct phy_device *phydev)
 		return val;
 	}
 
-	return ret;
+	if (ret)
+		return ret;
+
+	ret = read_poll_timeout(phy_read_mmd, val,
+				val < 0 ||
+				FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val),
+				AQR_FW_WAIT_SLEEP_US, AQR_FW_WAIT_TIMEOUT_US,
+				false, phydev, MDIO_MMD_VEND1,
+				VEND1_GLOBAL_RSVD_STAT1);
+	if (val < 0)
+		phydev_warn(phydev, "Failed to read VEND1_GLOBAL_RSVD_STAT1: %pe\n",
+			    ERR_PTR(val));
+	else if (ret)
+		phydev_warn(phydev, "Firmware provisioning ID not ready; interface mode detection may be incorrect\n");
+
+	return 0;
 }
 
 static int aqr_build_fingerprint(struct phy_device *phydev)

---
base-commit: 944ae66642b726bd6b25ae71b1e9ff88a0e0bdb0
change-id: 20260923-aquantia-poll-global-status-register-d8966a46e56d

Best regards,
--  
Hongmei Xu <hongmei.xu@oss.qualcomm.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v3] net: phy: aquantia: Poll global status register for provision ID
  2026-11-12  3:02 [PATCH net-next v3] net: phy: aquantia: Poll global status register for provision ID Hongmei Xu
@ 2026-11-16 13:50 ` netdev-bot+sashiko
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 13:50 UTC (permalink / raw)
  To: hongmei.xu
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, sagar.cheluvegowda

Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 3

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] In aqr_wait_reset_complete()
  (drivers/net/phy/aquantia/aquantia_main.c:708-718), the new poll uses…
- [Low] The commit message presents the change as a fix for user-visible
  problems: steady link failures on AQR113, and a possible wrong host…
- [Low] The comment above aqr_wait_reset_complete()
  (aquantia_main.c:684-690) still says 'Use presence of the firmware ID…
- [Low] aqr_wait_reset_complete() now handles MDIO read errors
  inconsistently.

--

net: phy: aquantia: Poll global status register for provision ID

This patch adds a second poll to aqr_wait_reset_complete(). Once the
firmware ID is present, it also waits for the provisioning ID field in
VEND1_GLOBAL_RSVD_STAT1 to become non-zero. On timeout or on a read error
it logs a warning and still returns 0.

> Starting subsequent firmware operations before the provision ID is
> valid leads to steady link failures; this has been observed during
> AQR113 PHY bring-up.

[Severity: Low]
The commit message describes failures that users can see: link failures
on AQR113, and a possible USXGMII vs 10G-QXGMII mismatch on AQR412C with
MUSX firmware. There is no Fixes: tag and no Cc: stable.

The fingerprint-based translation in aqr_translate_interface() was added
by commit a76f26f7a81e ("net: phy: aquantia: support phy-mode =
"10g-qxgmii" on NXP SPF-30841 (AQR412C)"). The FW_ID-only completion check
goes back to commit 43429a0353af ("net: phy: aquantia: report PHY details
like firmware version").

Should one of these be named in a Fixes: tag so the change can reach
stable trees? If this counts as new board bring-up support, the tag may
not be needed.

> diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
> index e95d391a6dc23..b90221f1cf41c 100644
> --- a/drivers/net/phy/aquantia/aquantia_main.c
> +++ b/drivers/net/phy/aquantia/aquantia_main.c
> @@ -702,7 +702,22 @@ int aqr_wait_reset_complete(struct phy_device *phydev)
>  		return val;
>  	}
>  
> -	return ret;
> +	if (ret)
> +		return ret;
> +
> +	ret = read_poll_timeout(phy_read_mmd, val,
> +				val < 0 ||
> +				FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val),
> +				AQR_FW_WAIT_SLEEP_US, AQR_FW_WAIT_TIMEOUT_US,
> +				false, phydev, MDIO_MMD_VEND1,
> +				VEND1_GLOBAL_RSVD_STAT1);

[Severity: Medium]
What happens here on a PHY whose firmware image reports a provisioning ID
of 0?

VEND1_GLOBAL_RSVD_STAT1_PROV_ID holds the provisioning ID of the loaded
image. It is not a ready bit. The commit message also says "not all PHYs
require a valid provision ID". If 0 is a valid value, the exit condition
can never become true. read_poll_timeout() would then run for the full
AQR_FW_WAIT_TIMEOUT_US (2 s, about 100 MDIO reads) and print the warning
on every call.

The code alone doesn't show whether such images ship. The only in-tree
fingerprint uses prov_id 1, but the commit message suggests they exist.

The poll isn't limited to a particular model or firmware. It is reached
once at probe:

aqr107_probe()->aqr_firmware_load()->aqr_wait_reset_complete()

and on every phy_init_hw() (attach and resume):

phy_init_hw()->aqr_gen{1..4}_config_init()->aqr_gen1_config_init()
    ->aqr_wait_reset_complete()

That covers AQR105/107/AQCS109/AQR111/111B0/112/412/412C/113/113C/114C/
115/115C/AQR813. On multi-port packages each port waits separately.
Before this patch, the function returned on the first FW_ID read once the
firmware was running.

Only AQR412C uses the fingerprint, in aqr_translate_interface(). For the
other models, the "interface mode detection may be incorrect" warning
doesn't apply.

Could the wait be limited to the PHYs that need it, or use a different
completion indicator?

> +	if (val < 0)
> +		phydev_warn(phydev, "Failed to read VEND1_GLOBAL_RSVD_STAT1: %pe\n",
> +			    ERR_PTR(val));

[Severity: Low]
Is it intended that an MDIO read error on VEND1_GLOBAL_RSVD_STAT1 only
produces a warning?

On a read error, the FW_ID poll just above returns the negative errno:

	if (val < 0) {
		phydev_err(phydev, "Failed to read VEND1_GLOBAL_FW_ID: %pe\n",
			   ERR_PTR(val));
		return val;
	}

In the new poll, val < 0 makes the condition true, ret stays 0, and the
function falls through to return 0. In aqr_firmware_load(), the error then
lands in case 0 ("Some firmware is loaded => do nothing"). It never
reaches the default arm, which is commented "PHY read error, propagate it
to the caller".

The practical impact is small. FW_ID was already non-zero, and
aqr_build_fingerprint() reads RSVD_STAT1 again later and propagates a
persistent failure.

The commit message explains why a provisioning timeout is non-fatal.
Should a bus error be handled the same way as the FW_ID read error?

> +	else if (ret)
> +		phydev_warn(phydev, "Firmware provisioning ID not ready; interface mode detection may be incorrect\n");
> +
> +	return 0;
>  }

[Severity: Low]
This isn't a bug, but the comment above aqr_wait_reset_complete() still
says:

 * initialization has completed. Use presence of the firmware ID as
 * indicator for initialization having completed.

With the second poll, the function can now block for up to about 4 s
instead of 2 s. A return value of 0 can also mean the firmware ID is
present but provisioning wasn't confirmed, either because the poll timed
out or because the RSVD_STAT1 read failed.

Should the comment be updated to match?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-aquantia-poll-global-status-register-v3-1-c805647a60b4%40oss.qualcomm.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-16 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  3:02 [PATCH net-next v3] net: phy: aquantia: Poll global status register for provision ID Hongmei Xu
2026-11-16 13:50 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox