From: Hans Andersson <[email protected]>
When we read user ID / Synopsys ID we might still be in reset,
so read muliple times if needed.
Signed-off-by: Hans Andersson <[email protected]>
---
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
From: Hans Andersson <[email protected]>
Date: Oct/02/2019, 08:07:21 (UTC+00:00)
> When we read user ID / Synopsys ID we might still be in reset,
> so read muliple times if needed.
We shouldn't even try to read it if IP is in reset ...
---
Thanks,
Jose Miguel Abreu
We assert / de-assert the reset line, but the CPU is too fast and the IP is still
in reset when we later try to read user ID / Synopsys ID. Another option would
be to add a delay after we reset.
-----Original Message-----
From: Jose Abreu <[email protected]>
Sent: den 2 oktober 2019 09:52
To: Hans Andersson <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Hans Andersson <[email protected]>
Subject: RE: [PATCH] net: stmmac: Read user ID muliple times if needed.
From: Hans Andersson <[email protected]>
Date: Oct/02/2019, 08:07:21 (UTC+00:00)
> When we read user ID / Synopsys ID we might still be in reset, so read
> muliple times if needed.
We shouldn't even try to read it if IP is in reset ...
---
Thanks,
Jose Miguel Abreu
From: Hans Andersson <[email protected]>
Date: Oct/02/2019, 09:02:02 (UTC+00:00)
> We assert / de-assert the reset line, but the CPU is too fast and the IP is still
> in reset when we later try to read user ID / Synopsys ID. Another option would
> be to add a delay after we reset.
Then I think you should fix the reset driver to only return when the
reset is fully done.
---
Thanks,
Jose Miguel Abreu