Skip to contentSkip to conversation

imx: i.MX8MQ: clear ocotp error bit

PATCH In review Peng Fan 2 participants 6 messages Apr 17, 2019 – Apr 26, 2019

Subsystems (4)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 imx: i.MX8MQ: clear ocotp error bit

In case ocotp error bit is set, clear it.

---
 arch/arm/mach-imx/imx8m/soc.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-imx/imx8m/soc.c +7 -0
index 11251c5f9a..7ec39b3e47 100644
@@ -169,6 +169,7 @@ static void imx_set_wdog_powerdown(bool enable)
 
 int arch_cpu_init(void)
 {
+	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
 	/*
 	 * Init timer at very early state, because sscg pll setting
 	 * will use it
@@ -180,6 +181,12 @@ int arch_cpu_init(void)
 		imx_set_wdog_powerdown(false);
 	}
 
+	if (is_imx8mq()) {
+		clock_enable(CCGR_OCOTP, 1);
+		if (readl(&ocotp->ctrl) & 0x200)
+			writel(0x200, &ocotp->ctrl_clr);
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 1/2 mxc_ocotp: Update redundancy banks for mx7ulp B0

From: Ye Li <[email protected]>

On mx7ulp B0, beside bank 0 and 1, the fuse bank 9, 10, 28 are changed to Redundancy mode not ECC, so they can support to program different bits of a word in multiple times.

---
 drivers/misc/mxc_ocotp.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/misc/mxc_ocotp.c +11 -7
index f84fe88db1..33ea31135c 100644
@@ -354,13 +354,17 @@ static int prepare_write(struct ocotp_regs **regs, u32 bank, u32 word,
 
 	/* Only bank 0 and 1 are redundancy mode, others are ECC mode */
 	if (bank != 0 && bank != 1) {
-		ret = fuse_sense(bank, word, &val);
-		if (ret)
-			return ret;
-
-		if (val != 0) {
-			printf("mxc_ocotp: The word has been programmed, no more write\n");
-			return -EPERM;
+		if ((soc_rev() < CHIP_REV_2_0) ||
+		    ((soc_rev() >= CHIP_REV_2_0) &&
+		    bank != 9 && bank != 10 && bank != 28)) {
+			ret = fuse_sense(bank, word, &val);
+			if (ret)
+				return ret;
+
+			if (val != 0) {
+				printf("mxc_ocotp: The word has been programmed, no more write\n");
+				return -EPERM;
+			}
 		}
 	}
 #endif
Signature · 1 line
2.16.4
#2 lore raw

PATCH 1/2 mxc_ocotp: Update redundancy banks for mx7ulp B0

Quoted 6 lines

From: Ye Li <[email protected]>
On mx7ulp B0, beside bank 0 and 1, the fuse bank 9, 10, 28 are changed to Redundancy mode not ECC, so they can support to program different bits of a word in multiple times.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#3 lore raw

PATCH 2/2 mxc_ocotp: Disable fuse sense for imx8mq B1

In reply to Peng Fan

From: Ye Li <[email protected]>

On iMX8MQ Rev B1, reading from fuse box is not allowed. The OCOTP_READ_FUSE_DATA register is tied to magic number 0xff0055aa for chip rev. So u-boot has to disable the fuse sense function for it.

---
 drivers/misc/mxc_ocotp.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/misc/mxc_ocotp.c +5 -0
index 33ea31135c..1b945e9727 100644
@@ -321,6 +321,11 @@ int fuse_sense(u32 bank, u32 word, u32 *val)
 	struct ocotp_regs *regs;
 	int ret;
 
+	if (is_imx8mq() && is_soc_rev(CHIP_REV_2_1)) {
+		printf("mxc_ocotp %s(): fuse sense is disabled\n", __func__);
+		return -EPERM;
+	}
+
 	ret = prepare_read(&regs, bank, word, val, __func__);
 	if (ret)
 		return ret;
Signature · 1 line
2.16.4
#4 lore raw

PATCH 2/2 mxc_ocotp: Disable fuse sense for imx8mq B1

Quoted 7 lines

From: Ye Li <[email protected]>
On iMX8MQ Rev B1, reading from fuse box is not allowed. The OCOTP_READ_FUSE_DATA register is tied to magic number 0xff0055aa for chip rev. So u-boot has to disable the fuse sense function for it.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw
In reply to Peng Fan
Quoted 2 lines

In case ocotp error bit is set, clear it.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================