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 Signed-off-by: Sagar Cheluvegowda Signed-off-by: Hongmei Xu --- 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