Messages in this thread Patch in this message | | | From | qianfanguijin@163 ... | Subject | [PATCH 2/2] drivers: net: mdio-sun4i: Wait mdio write done | Date | Tue, 6 Sep 2022 15:56:16 +0800 |
| |
From: qianfan Zhao <qianfanguijin@163.com>
Data maybe written to the B register if the B register is reading immediately after 'sun4i_mdio_write' write a value to A register.
Wait write done and fix it.
Signed-off-by: qianfan Zhao <qianfanguijin@163.com> --- drivers/net/mdio/mdio-sun4i.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio/mdio-sun4i.c b/drivers/net/mdio/mdio-sun4i.c index 168e2a375535..72ac142f2edf 100644 --- a/drivers/net/mdio/mdio-sun4i.c +++ b/drivers/net/mdio/mdio-sun4i.c @@ -79,7 +79,10 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, /* and write data */ writel(value, data->membase + EMAC_MAC_MWTD_REG); - return 0; + /* Wait write complete */ + return read_poll_timeout(readl, tmp, (tmp & 1) == 0, + 20, 10000, false, + data->membase + EMAC_MAC_MIND_REG); } static int sun4i_mdio_probe(struct platform_device *pdev) -- 2.25.1
| |