summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/ocotp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-imx/ocotp.c')
-rw-r--r--arch/arm/mach-imx/ocotp.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
index 70a89da0e6..a9df08c1b2 100644
--- a/arch/arm/mach-imx/ocotp.c
+++ b/arch/arm/mach-imx/ocotp.c
@@ -110,14 +110,9 @@ static int imx6_ocotp_wait_busy(struct ocotp_priv *priv, u32 flags)
{
uint64_t start = get_time_ns();
- while ((OCOTP_CTRL_BUSY | OCOTP_CTRL_ERROR | flags) &
- readl(priv->base + OCOTP_CTRL)) {
- if (is_timeout(start, MSECOND)) {
- /* Clear ERROR bit */
- writel(OCOTP_CTRL_ERROR, priv->base + OCOTP_CTRL_CLR);
+ while (readl(priv->base + OCOTP_CTRL) & (OCOTP_CTRL_BUSY | flags))
+ if (is_timeout(start, MSECOND))
return -ETIMEDOUT;
- }
- }
return 0;
}
@@ -142,6 +137,8 @@ static int fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
u32 ctrl_reg;
int ret;
+ writel(OCOTP_CTRL_ERROR, priv->base + OCOTP_CTRL_CLR);
+
ctrl_reg = readl(priv->base + OCOTP_CTRL);
ctrl_reg &= ~OCOTP_CTRL_ADDR_MASK;
ctrl_reg &= ~OCOTP_CTRL_WR_UNLOCK_MASK;
@@ -153,7 +150,10 @@ static int fuse_read_addr(struct ocotp_priv *priv, u32 addr, u32 *pdata)
if (ret)
return ret;
- *pdata = readl(priv->base + OCOTP_READ_FUSE_DATA);
+ if (readl(priv->base + OCOTP_CTRL) & OCOTP_CTRL_ERROR)
+ *pdata = 0xbadabada;
+ else
+ *pdata = readl(priv->base + OCOTP_READ_FUSE_DATA);
return 0;
}
@@ -175,11 +175,6 @@ int imx6_ocotp_read_one_u32(struct ocotp_priv *priv, u32 index, u32 *pdata)
return ret;
}
- if (readl(priv->base + OCOTP_CTRL) & OCOTP_CTRL_ERROR) {
- dev_err(priv->cdev.dev, "bad read status at fuse 0x%08x\n", index);
- return -EFAULT;
- }
-
return 0;
}
@@ -218,6 +213,8 @@ static int fuse_blow_addr(struct ocotp_priv *priv, u32 addr, u32 value)
u32 ctrl_reg;
int ret;
+ writel(OCOTP_CTRL_ERROR, priv->base + OCOTP_CTRL_CLR);
+
/* Control register */
ctrl_reg = readl(priv->base + OCOTP_CTRL);
ctrl_reg &= ~OCOTP_CTRL_ADDR_MASK;