* [PATCH] net: airoha: fix PCS calibration retry limit
@ 2026-08-18 8:20 Li Xiao
2026-09-03 9:39 ` Jerome Forissier
2026-09-11 13:17 ` Jerome Forissier
0 siblings, 2 replies; 3+ messages in thread
From: Li Xiao @ 2026-08-18 8:20 UTC (permalink / raw)
To: Christian Marangi, u-boot
Cc: Jerome Forissier, Tom Rini, Mikhail Kshevetskiy, Li Xiao
From: Li Xiao <Li.Xiao@airoha.com>
The calibration retry counter starts at zero and is incremented after
the limit check. Using a strict greater-than comparison therefore allows
one more retry than AIROHA_PCS_MAX_CALIBRATION_TRY specifies.
Use a greater-than-or-equal comparison so the function stops after the
configured number of retries.
Fixes: d4dd6eb29bda ("net: airoha: add support for Airoha PCS driver")
Signed-off-by: Li Xiao <Li.Xiao@airoha.com>
---
Fix an off-by-one condition in the Airoha AN7581 PCS calibration retry
loop. The current comparison permits one retry beyond the configured
limit.
The change was build-tested with an7581_evb_defconfig.
---
drivers/net/airoha/pcs-an7581.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/airoha/pcs-an7581.c b/drivers/net/airoha/pcs-an7581.c
index 746ff55d72..bc15d9d07c 100644
--- a/drivers/net/airoha/pcs-an7581.c
+++ b/drivers/net/airoha/pcs-an7581.c
@@ -1321,7 +1321,7 @@ retry_calibration:
*/
regmap_read(priv->xfi_pma, AIROHA_PCS_PMA_RX_FREQDET, &val);
if (!(val & AIROHA_PCS_PMA_FBCK_LOCK)) {
- if (calibration_try > AIROHA_PCS_MAX_CALIBRATION_TRY) {
+ if (calibration_try >= AIROHA_PCS_MAX_CALIBRATION_TRY) {
dev_err(priv->dev, "No FBCK Lock from FreqDet module after %d calibration try. PCS won't work.\n",
AIROHA_PCS_MAX_CALIBRATION_TRY);
return -EIO;
---
base-commit: 527115ef6783cec49e5610c523c124b399011361
change-id: 20260814-fix-airoha-pcs-calibration-retry-f0c9f06f8122
Best regards,
--
Li Xiao <Li.Xiao@airoha.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net: airoha: fix PCS calibration retry limit
2026-08-18 8:20 [PATCH] net: airoha: fix PCS calibration retry limit Li Xiao
@ 2026-09-03 9:39 ` Jerome Forissier
2026-09-11 13:17 ` Jerome Forissier
1 sibling, 0 replies; 3+ messages in thread
From: Jerome Forissier @ 2026-09-03 9:39 UTC (permalink / raw)
To: Li Xiao, Christian Marangi, u-boot
Cc: Tom Rini, Mikhail Kshevetskiy, Li Xiao, nd
Hi Xiao,
On 18/08/2026 10:20, Li Xiao wrote:
> From: Li Xiao <Li.Xiao@airoha.com>
>
> The calibration retry counter starts at zero and is incremented after
> the limit check. Using a strict greater-than comparison therefore allows
> one more retry than AIROHA_PCS_MAX_CALIBRATION_TRY specifies.
>
> Use a greater-than-or-equal comparison so the function stops after the
> configured number of retries.
>
> Fixes: d4dd6eb29bda ("net: airoha: add support for Airoha PCS driver")
>
> Signed-off-by: Li Xiao <Li.Xiao@airoha.com>
> ---
> Fix an off-by-one condition in the Airoha AN7581 PCS calibration retry
> loop. The current comparison permits one retry beyond the configured
> limit.
>
> The change was build-tested with an7581_evb_defconfig.
> ---
> drivers/net/airoha/pcs-an7581.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/airoha/pcs-an7581.c b/drivers/net/airoha/pcs-an7581.c
> index 746ff55d72..bc15d9d07c 100644
> --- a/drivers/net/airoha/pcs-an7581.c
> +++ b/drivers/net/airoha/pcs-an7581.c
> @@ -1321,7 +1321,7 @@ retry_calibration:
> */
> regmap_read(priv->xfi_pma, AIROHA_PCS_PMA_RX_FREQDET, &val);
> if (!(val & AIROHA_PCS_PMA_FBCK_LOCK)) {
> - if (calibration_try > AIROHA_PCS_MAX_CALIBRATION_TRY) {
> + if (calibration_try >= AIROHA_PCS_MAX_CALIBRATION_TRY) {
> dev_err(priv->dev, "No FBCK Lock from FreqDet module after %d calibration try. PCS won't work.\n",
> AIROHA_PCS_MAX_CALIBRATION_TRY);
> return -EIO;
>
> ---
> base-commit: 527115ef6783cec49e5610c523c124b399011361
> change-id: 20260814-fix-airoha-pcs-calibration-retry-f0c9f06f8122
>
> Best regards,
> --
> Li Xiao <Li.Xiao@airoha.com>
Reviewed-by: Jerome Forissier <jerome.forissier@arm.com>
Thanks,
--
Jerome
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net: airoha: fix PCS calibration retry limit
2026-08-18 8:20 [PATCH] net: airoha: fix PCS calibration retry limit Li Xiao
2026-09-03 9:39 ` Jerome Forissier
@ 2026-09-11 13:17 ` Jerome Forissier
1 sibling, 0 replies; 3+ messages in thread
From: Jerome Forissier @ 2026-09-11 13:17 UTC (permalink / raw)
To: Christian Marangi, u-boot, Li Xiao
Cc: Tom Rini, Mikhail Kshevetskiy, Li Xiao, nd
On Tue, 18 Aug 2026 16:20:10 +0800, Li Xiao wrote:
> The calibration retry counter starts at zero and is incremented after
> the limit check. Using a strict greater-than comparison therefore allows
> one more retry than AIROHA_PCS_MAX_CALIBRATION_TRY specifies.
>
> Use a greater-than-or-equal comparison so the function stops after the
> configured number of retries.
>
> [...]
Applied to u-boot-net branch for-main, thanks!
[1/1] net: airoha: fix PCS calibration retry limit
commit: 70d4ce22fdaabe1cc39aeaa9c87c1ba2515a4a55
Best regards,
--
Jerome Forissier <jerome.forissier@arm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-11 13:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 8:20 [PATCH] net: airoha: fix PCS calibration retry limit Li Xiao
2026-09-03 9:39 ` Jerome Forissier
2026-09-11 13:17 ` Jerome Forissier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.