[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1415371762-29885-2-git-send-email-rogerq@ti.com>
Date: Fri, 7 Nov 2014 16:49:15 +0200
From: Roger Quadros <rogerq@...com>
To: <wg@...ndegger.com>, <mkl@...gutronix.de>
CC: <wsa@...-dreams.de>, <tony@...mide.com>, <tglx@...utronix.de>,
<mugunthanvnm@...com>, <george.cherian@...com>, <balbi@...com>,
<nsekhar@...com>, <nm@...com>,
<sergei.shtylyov@...entembedded.com>, <linux-omap@...r.kernel.org>,
<linux-can@...r.kernel.org>, <netdev@...r.kernel.org>,
Roger Quadros <rogerq@...com>
Subject: [PATCH v4 1/8] net: can: c_can: Add timeout to c_can_hw_raminit_ti()
TI's RAMINIT DONE mechanism is buggy on AM43xx SoC and may not always
be set after the START bit is set. Although it seems to work fine even
in that case. So add a timeout mechanism to c_can_hw_raminit_wait_ti().
Don't bail out in that failure case but just print an error message.
Signed-off-by: Roger Quadros <rogerq@...com>
---
drivers/net/can/c_can/c_can_platform.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index fb279d6..b144e71 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -75,10 +75,18 @@ static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv,
static void c_can_hw_raminit_wait_ti(const struct c_can_priv *priv, u32 mask,
u32 val)
{
+ int timeout = 0;
/* We look only at the bits of our instance. */
val &= mask;
- while ((readl(priv->raminit_ctrlreg) & mask) != val)
+ while ((readl(priv->raminit_ctrlreg) & mask) != val) {
udelay(1);
+ timeout++;
+
+ if (timeout == 1000) {
+ dev_err(&priv->dev->dev, "%s: time out\n", __func__);
+ break;
+ }
+ }
}
static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists