Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID
@ 2026-11-16 11:14 Hongmei Xu
  2026-11-16 13:33 ` Andrew Lunn
  2026-11-18 17:17 ` netdev-bot+sashiko
  0 siblings, 2 replies; 3+ messages in thread
From: Hongmei Xu @ 2026-11-16 11:14 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.

Poll VEND1_GLOBAL_RSVD_STAT1 on AQR113/AQR113C 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 a timeout does not necessarily
prevent link establishment.

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 v4:
- Limit provisioning ID poll to AQR113 and AQR113C via
  aqr_need_provision_id_check() helper to avoid fixed timeout loop
  for PHYs who has PROV_ID=0 as valid value. With this change, it also
  avoids touching the existing logic for AQR412C interface mode
  selection issue which is out of this patch scope.
- Return MDIO read error instead of warning on VEND1_GLOBAL_RSVD_STAT1
  read failure
- Update aqr_wait_reset_complete() comment to mention AQR113/AQR113C
  provisioning ID wait
- Link to v3: https://patch.msgid.link/20261112-aquantia-poll-global-status-register-v3-1-c805647a60b4@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 | 33 +++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index e95d391a6dc2..a5bba9be0d06 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -681,12 +681,24 @@ static int aqr107_set_tunable(struct phy_device *phydev,
 #define AQR_FW_WAIT_SLEEP_US	20000
 #define AQR_FW_WAIT_TIMEOUT_US	2000000
 
+static bool aqr_need_provision_id_check(struct phy_device *phydev)
+{
+	return phy_id_compare(phydev->drv->phy_id, PHY_ID_AQR113,
+			      phydev->drv->phy_id_mask) ||
+	       phy_id_compare(phydev->drv->phy_id, PHY_ID_AQR113C,
+			      phydev->drv->phy_id_mask);
+}
+
 /* If we configure settings whilst firmware is still initializing the chip,
  * then these settings may be overwritten. Therefore make sure chip
  * initialization has completed. Use presence of the firmware ID as
  * indicator for initialization having completed.
  * The chip also provides a "reset completed" bit, but it's cleared after
  * read. Therefore function would time out if called again.
+ *
+ * On AQR113 and AQR113C, additionally wait for the provisioning ID to
+ * become non-zero, indicating that firmware provisioning is complete.
+ * Without this polling, link issue can be seen after phy boot.
  */
 int aqr_wait_reset_complete(struct phy_device *phydev)
 {
@@ -702,7 +714,26 @@ int aqr_wait_reset_complete(struct phy_device *phydev)
 		return val;
 	}
 
-	return ret;
+	if (ret)
+		return ret;
+
+	if (aqr_need_provision_id_check(phydev)) {
+		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_err(phydev, "Failed to read VEND1_GLOBAL_RSVD_STAT1: %pe\n",
+				   ERR_PTR(val));
+			return val;
+		}
+		if (ret)
+			phydev_warn(phydev, "Firmware provisioning ID not ready\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] 3+ messages in thread

* Re: [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID
  2026-11-16 11:14 [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID Hongmei Xu
@ 2026-11-16 13:33 ` Andrew Lunn
  2026-11-18 17:17 ` netdev-bot+sashiko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2026-11-16 13:33 UTC (permalink / raw)
  To: Hongmei Xu
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	Sagar Cheluvegowda

On Mon, Nov 16, 2026 at 07:14:50PM +0800, Hongmei Xu wrote:
> 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.
> 
> Poll VEND1_GLOBAL_RSVD_STAT1 on AQR113/AQR113C 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 a timeout does not necessarily
> prevent link establishment.
> 
> 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>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID
  2026-11-16 11:14 [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID Hongmei Xu
  2026-11-16 13:33 ` Andrew Lunn
@ 2026-11-18 17:17 ` netdev-bot+sashiko
  1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sashiko @ 2026-11-18 17:17 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] The new poll in aqr_wait_reset_complete()
  (drivers/net/phy/aquantia/aquantia_main.c, lines 720-734) treats…
- [Low] The commit message says the patch fixes a user-visible defect in
  existing AQR113 support ('Starting subsequent firmware operations…
- [Low] aqr_need_provision_id_check() (aquantia_main.c:684-690) limits
  the new wait to PHY_ID_AQR113 and PHY_ID_AQR113C.
- [Low] When the new PROV_ID poll times out, aqr_wait_reset_complete()
  logs a warning and returns 0 (aquantia_main.c:732-736).

--

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

On AQR113 and AQR113C, aqr_wait_reset_complete() now goes on to poll the
PROV_ID field of VEND1_GLOBAL_RSVD_STAT1 until it is non-zero, after the
firmware ID check. A read error is returned to the caller. A poll timeout
only logs a warning, and the function 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]
This describes a link failure with the existing AQR113 support. That
support already goes through aqr_gen4_config_init()->
aqr_gen1_config_init()->aqr_wait_reset_complete().

Should this carry a Fixes: tag and possibly Cc: stable? Is it meant for
net or net-next?

> diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
> index e95d391a6dc23..a5bba9be0d069 100644
> --- a/drivers/net/phy/aquantia/aquantia_main.c
> +++ b/drivers/net/phy/aquantia/aquantia_main.c
> @@ -681,12 +681,24 @@ static int aqr107_set_tunable(struct phy_device *phydev,
>  #define AQR_FW_WAIT_SLEEP_US	20000
>  #define AQR_FW_WAIT_TIMEOUT_US	2000000
>  
> +static bool aqr_need_provision_id_check(struct phy_device *phydev)
> +{
> +	return phy_id_compare(phydev->drv->phy_id, PHY_ID_AQR113,
> +			      phydev->drv->phy_id_mask) ||
> +	       phy_id_compare(phydev->drv->phy_id, PHY_ID_AQR113C,
> +			      phydev->drv->phy_id_mask);
> +}

[Severity: Low]
This isn't a bug, but AQR114C, AQR115, AQR115C and AQR813 also go
through aqr_gen4_config_init() and aqr_wait_reset_complete(), and they
won't get this wait. The v4 changelog says the narrower scope is
intentional.

Were those parts checked for the same provisioning behaviour? If so,
could the commit message say so?

> +
>  /* If we configure settings whilst firmware is still initializing the chip,
>   * then these settings may be overwritten. Therefore make sure chip
>   * initialization has completed. Use presence of the firmware ID as
>   * indicator for initialization having completed.
>   * The chip also provides a "reset completed" bit, but it's cleared after
>   * read. Therefore function would time out if called again.
> + *
> + * On AQR113 and AQR113C, additionally wait for the provisioning ID to
> + * become non-zero, indicating that firmware provisioning is complete.
> + * Without this polling, link issue can be seen after phy boot.
>   */
>  int aqr_wait_reset_complete(struct phy_device *phydev)
>  {
> @@ -702,7 +714,26 @@ int aqr_wait_reset_complete(struct phy_device *phydev)
>  		return val;
>  	}
>  
> -	return ret;
> +	if (ret)
> +		return ret;
> +
> +	if (aqr_need_provision_id_check(phydev)) {
> +		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]
Is PROV_ID a reliable sign that provisioning is done? Elsewhere in the
driver it looks like a fixed identifier of the firmware image. It sits
next to FW_BUILD_ID and has no validity bit:

drivers/net/phy/aquantia/aquantia.h:
#define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID	GENMASK(7, 4)
#define VEND1_GLOBAL_RSVD_STAT1_PROV_ID		GENMASK(3, 0)

aqr_build_fingerprint() reads it only as one part of the image
fingerprint:

	build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val);
	prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val);

The v4 changelog also says some PHYs use PROV_ID=0 as a valid value.

aqr_need_provision_id_check() decides from the silicon ID. The PROV_ID
value, though, comes from whichever image gets loaded, whether from flash,
nvmem or the filesystem.

What happens if an AQR113/AQR113C runs an image with provisioning ID 0?

The poll could then never succeed. Every call would poll MDIO for the
full AQR_FW_WAIT_TIMEOUT_US (2 seconds) and log "Firmware provisioning ID
not ready". aqr_wait_reset_complete() is called from:

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

phy_init_hw()->aqr_gen4_config_init()->aqr_gen3_config_init()->
  aqr_gen2_config_init()->aqr_gen1_config_init()->
  aqr_wait_reset_complete()

Would bring-up then take at least 4 seconds per PHY, plus 2 seconds on
every attach and resume?

The commit message also seems to contradict itself. It says that starting
operations before the provision ID is valid "leads to steady link
failures", but also that a timeout "does not necessarily prevent link
establishment".

It also says a timeout "indicates a hardware-level provisioning failure".
Nothing in the driver appears to support that.

The driver already polls readiness signals tied to hardware state. One is
the wait_on_global_cfg poll of VEND1_GLOBAL_CFG_100M in
aqr_gen2_fill_interface_modes(). Another is
VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG. Would one of those work for AQR113
instead?

> +		if (val < 0) {
> +			phydev_err(phydev, "Failed to read VEND1_GLOBAL_RSVD_STAT1: %pe\n",
> +				   ERR_PTR(val));
> +			return val;
> +		}
> +		if (ret)
> +			phydev_warn(phydev, "Firmware provisioning ID not ready\n");
> +	}
> +
> +	return 0;
>  }

[Severity: Low]
This isn't a bug, but the new comment above aqr_wait_reset_complete()
says the function waits for the provisioning ID, "indicating that
firmware provisioning is complete". On timeout it only warns and
returns 0, so callers cannot tell that provisioning did not finish.

Returning 0 here looks right. aqr_firmware_load() treats -ETIMEDOUT as
"no firmware loaded" and would load a new image over the running one.
Also, aqr_gen1_config_init() does the downshift, MDI and LED writes
whatever this returns.

Could the comment say that the provisioning wait is best effort? Could it
also say that the link failure described in the commit message can still
happen after a timeout?

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

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

end of thread, other threads:[~2026-11-18 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 11:14 [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID Hongmei Xu
2026-11-16 13:33 ` Andrew Lunn
2026-11-18 17:17 ` 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