lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] drivers: net: mdio-sun4i: Wait mdio write done
Date
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
\
 
 \ /
  Last update: 2022-09-06 09:57    [W:0.052 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site