Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mdio: aspeed: add dummy read to avoid read-after-write issue

The Aspeed MDIO controller may return incorrect data when a read operation
follows immediately after a write. Due to a controller bug, the subsequent
read can latch stale data, causing the polling logic to terminate earlier
than expected.

To work around this hardware issue, insert a dummy read after each write
operation. This ensures that the next actual read returns the correct
data and prevents premature polling exit.

This workaround has been verified to stabilize MDIO transactions on
affected Aspeed platforms.

Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20251211-aspeed_mdio_add_dummy_read-v3-1-382868869004@aspeedtech.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jacky Chou and committed by
Paolo Abeni
d1a1a4ba bf4172bd

+7
+7
drivers/net/mdio/mdio-aspeed.c
··· 63 63 64 64 iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); 65 65 66 + /* Workaround for read-after-write issue. 67 + * The controller may return stale data if a read follows immediately 68 + * after a write. A dummy read forces the hardware to update its 69 + * internal state, ensuring that the next real read returns correct data. 70 + */ 71 + ioread32(ctx->base + ASPEED_MDIO_CTRL); 72 + 66 73 return readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl, 67 74 !(ctrl & ASPEED_MDIO_CTRL_FIRE), 68 75 ASPEED_MDIO_INTERVAL_US,