From: Hans Andersson <haan@cellavision.se>
To: <mcoquelin.stm32@gmail.com>
Cc: alexandre.torgue@st.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, davem@davemloft.net,
joabreu@synopsys.com, peppe.cavallaro@st.com,
Hans Andersson <hans.andersson@cellavision.se>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH] net: stmmac: Read user ID muliple times if needed.
Date: Wed, 2 Oct 2019 09:07:21 +0200 [thread overview]
Message-ID: <20191002070721.9916-1-haan@cellavision.se> (raw)
From: Hans Andersson <hans.andersson@cellavision.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@cellavision.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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-10-02 7:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 7:07 Hans Andersson [this message]
2019-10-02 7:52 ` [PATCH] net: stmmac: Read user ID muliple times if needed Jose Abreu
2019-10-02 8:02 ` Hans Andersson
2019-10-02 8:08 ` Jose Abreu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191002070721.9916-1-haan@cellavision.se \
--to=haan@cellavision.se \
--cc=alexandre.torgue@st.com \
--cc=davem@davemloft.net \
--cc=hans.andersson@cellavision.se \
--cc=joabreu@synopsys.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).