[PATCH] net: zynq_gem: Clear stale speed bits in NWCFG before setting new ones
Rafał Hibner
rafal.hibner at secom.com.pl
Mon Apr 20 09:46:40 CEST 2026
Commit ecba4380ad26 ("net: zynq_gem: Update the MDC clock divisor in the
probe function") changed zynq_gem_init() from a direct register write to
a read-modify-write pattern in order to preserve MDC clock divider bits.
However, the old speed selection bits (SPEED100/SPEED1000) are never
cleared before OR-ing in the new value.
When the PHY renegotiates at a different speed between successive calls
to zynq_gem_init() (e.g. link flapping from 1 Gbps to 100 Mbps on a
marginal cable), both SPEED100 and SPEED1000 end up set simultaneously
in NWCFG. This confuses the GEM hardware and no frames are received.
Fix by explicitly clearing both speed bits before merging the new
configuration, so only the currently negotiated speed is ever active.
Fixes: ecba4380ad26 ("net: zynq_gem: Update the MDC clock divisor in the probe function")
Signed-off-by: Rafał Hibner <rafal.hibner at secom.com.pl>
---
drivers/net/zynq_gem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 407b022508c..f18458aee98 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -612,6 +612,7 @@ static int zynq_gem_init(struct udevice *dev)
break;
}
nwcfg = readl(®s->nwcfg);
+ nwcfg &= ~(ZYNQ_GEM_NWCFG_SPEED100 | ZYNQ_GEM_NWCFG_SPEED1000);
nwcfg |= nwconfig;
if (nwcfg)
writel(nwcfg, ®s->nwcfg);
--
2.43.0
More information about the U-Boot
mailing list