[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220906075616.21347-2-qianfanguijin@163.com>
Date: Tue, 6 Sep 2022 15:56:16 +0800
From: qianfanguijin@....com
To: linux-sunxi@...ts.linux.dev, linux-kernel@...r.kernel.org
Cc: Maxime Ripard <mripard@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
linux-arm-kernel@...ts.infradead.org,
Evgeny Boger <boger@...enboard.com>,
qianfan Zhao <qianfanguijin@....com>
Subject: [PATCH 2/2] drivers: net: mdio-sun4i: Wait mdio write done
From: qianfan Zhao <qianfanguijin@....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@....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
Powered by blists - more mailing lists