Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7e26bc7 authored by Roger Quadros's avatar Roger Quadros Committed by Marc Kleine-Budde
Browse files

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: default avatarRoger Quadros <rogerq@ti.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 65622ed4
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -75,10 +75,19 @@ 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)