[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191002070721.9916-1-haan@cellavision.se>
Date: Wed, 2 Oct 2019 09:07:21 +0200
From: Hans Andersson <haan@...lavision.se>
To: <mcoquelin.stm32@...il.com>
CC: <peppe.cavallaro@...com>, <alexandre.torgue@...com>,
<joabreu@...opsys.com>, <davem@...emloft.net>,
<netdev@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
Hans Andersson <hans.andersson@...lavision.se>
Subject: [PATCH] net: stmmac: Read user ID muliple times if needed.
From: Hans Andersson <hans.andersson@...lavision.se>
When we read user ID / Synopsys ID we might still be in reset,
so read muliple times if needed.
Signed-off-by: Hans Andersson <hans.andersson@...lavision.se>
---
drivers/net/ethernet/stmicro/stmmac/hwif.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 6c61b75..3347164 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -10,7 +10,16 @@
static u32 stmmac_get_id(struct stmmac_priv *priv, u32 id_reg)
{
- u32 reg = readl(priv->ioaddr + id_reg);
+ u32 reg;
+ int i;
+
+ /* We might still be in reset when we read, */
+ /* so read multiple times if needed. */
+ for (i = 0; i < 10; i++) {
+ reg = readl(priv->ioaddr + id_reg);
+ if (reg)
+ break;
+ }
if (!reg) {
dev_info(priv->device, "Version ID not available\n");
--
2.17.1
Powered by blists - more mailing lists