Skip to content

Commit 284779d

Browse files
vwaxPaolo Abeni
authored and
Paolo Abeni
committed
net: stmmac: Apply redundant write work around on 4.xx too
commit a3a57bf ("net: stmmac: work around sporadic tx issue on link-up") worked around a problem with TX sometimes not working after a link-up by avoiding a redundant write to MAC_CTRL_REG (aka GMAC_CONFIG), since the IP appeared to have problems with handling multiple writes to that register in some cases. That commit however only added the work around to dwmac_lib.c (apart from the common code in stmmac_main.c), but my systems with version 4.21a of the IP exhibit the same problem, so add the work around to dwmac4_lib.c too. Fixes: a3a57bf ("net: stmmac: work around sporadic tx issue on link-up") Signed-off-by: Vincent Whitchurch <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 4e62c99 commit 284779d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,15 @@ void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, const u8 addr[6],
240240
void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable)
241241
{
242242
u32 value = readl(ioaddr + GMAC_CONFIG);
243+
u32 old_val = value;
243244

244245
if (enable)
245246
value |= GMAC_CONFIG_RE | GMAC_CONFIG_TE;
246247
else
247248
value &= ~(GMAC_CONFIG_TE | GMAC_CONFIG_RE);
248249

249-
writel(value, ioaddr + GMAC_CONFIG);
250+
if (value != old_val)
251+
writel(value, ioaddr + GMAC_CONFIG);
250252
}
251253

252254
void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,

0 commit comments

Comments
 (0)