mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Fabian Pflug <f.pflug@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Marco Felsch <m.felsch@pengutronix.de>,
	 Fabian Pflug <f.pflug@pengutronix.de>
Subject: [PATCH 3/4] i.MX: HAB: extend field_return support to imx6
Date: Thu, 18 Dec 2025 18:36:30 +0100	[thread overview]
Message-ID: <20251218-v2025-11-0-topic-imx6-field-return-v1-3-3781143198d6@pengutronix.de> (raw)
In-Reply-To: <20251218-v2025-11-0-topic-imx6-field-return-v1-0-3781143198d6@pengutronix.de>

Extend the helper for imx_fuse_burn with support for i.MX6 devices.

Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
---
 drivers/hab/hab.c                | 10 ++++++----
 include/mach/imx/ocotp-fusemap.h |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 1c747e8a3e..281645f79e 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -262,7 +262,7 @@ static int imx8m_hab_revoke_key_ocotp(unsigned key_idx)
  */
 #define MX8MP_FIELD_RETURN_PATTERN	0x28001401
 
-static int imx8m_hab_field_return_ocotp(void)
+static int imx_hab_field_return_ocotp(void)
 {
 	int ret;
 
@@ -274,7 +274,9 @@ static int imx8m_hab_field_return_ocotp(void)
 	if (ret == 1)
 		return -EINVAL;
 
-	if (cpu_is_mx8mp())
+	if (cpu_is_mx6())
+		ret = imx_ocotp_write_field(MX6_OCOTP_FIELD_RETURN, 1);
+	else if (cpu_is_mx8mp())
 		ret = imx_ocotp_write_field(MX8MP_OCOTP_FIELD_RETURN,
 					    MX8MP_FIELD_RETURN_PATTERN);
 	else
@@ -282,7 +284,6 @@ static int imx8m_hab_field_return_ocotp(void)
 
 	return ret;
 }
-
 struct imx_hab_ops {
 	int (*write_srk_hash)(const u8 *srk, unsigned flags);
 	int (*read_srk_hash)(u8 *srk);
@@ -310,6 +311,7 @@ static struct imx_hab_ops imx6_hab_ops_ocotp = {
 	.device_locked_down = imx6_hab_device_locked_down_ocotp,
 	.permanent_write_enable = imx_hab_permanent_write_enable_ocotp,
 	.print_status = imx6_hab_print_status,
+	.field_return = imx_hab_field_return_ocotp,
 };
 
 static struct imx_hab_ops imx8m_hab_ops_ocotp = {
@@ -320,7 +322,7 @@ static struct imx_hab_ops imx8m_hab_ops_ocotp = {
 	.permanent_write_enable = imx_hab_permanent_write_enable_ocotp,
 	.print_status = imx8m_hab_print_status,
 	.revoke_key = imx8m_hab_revoke_key_ocotp,
-	.field_return = imx8m_hab_field_return_ocotp,
+	.field_return = imx_hab_field_return_ocotp,
 };
 
 static int imx_ahab_write_srk_hash(const u8 *__newsrk, unsigned flags)
diff --git a/include/mach/imx/ocotp-fusemap.h b/include/mach/imx/ocotp-fusemap.h
index ae10dcef2a..3fd9d6df24 100644
--- a/include/mach/imx/ocotp-fusemap.h
+++ b/include/mach/imx/ocotp-fusemap.h
@@ -103,6 +103,7 @@
 #define MX8M_OCOTP_TZASC_EN		(OCOTP_WORD(0x480) | OCOTP_BIT(11) | OCOTP_WIDTH(1))
 #define MX8MP_OCOTP_ROM_NO_LOG		(OCOTP_WORD(0x480) | OCOTP_BIT(22) | OCOTP_WIDTH(1))
 #define MX8M_OCOTP_RECOVERY_SDMMC_BOOT_DIS	(OCOTP_WORD(0x490) | OCOTP_BIT(23) | OCOTP_WIDTH(1))
+#define MX6_OCOTP_FIELD_RETURN		(OCOTP_WORD(0x6E0) | OCOTP_BIT(0) | OCOTP_WIDTH(1))
 #define MX8M_OCOTP_FIELD_RETURN		(OCOTP_WORD(0x630) | OCOTP_BIT(0) | OCOTP_WIDTH(1))
 #define MX8MP_OCOTP_FIELD_RETURN	(OCOTP_WORD(0x630) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
 #define MX8M_OCOTP_SRK_REVOKE		(OCOTP_WORD(0x670) | OCOTP_BIT(0) | OCOTP_WIDTH(4))

-- 
2.47.3




  parent reply	other threads:[~2025-12-18 17:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 17:36 [PATCH 0/4] i.mx: hab/ocotop: extend field return to i.MX6 Fabian Pflug
2025-12-18 17:36 ` [PATCH 1/4] arm: mach-imx6: use kconfig for field return Fabian Pflug
2025-12-18 19:12   ` Marco Felsch
2025-12-18 17:36 ` [PATCH 2/4] nvmem: ocotp: extend support to query the sticky bit Fabian Pflug
2025-12-18 19:16   ` Marco Felsch
2025-12-18 17:36 ` Fabian Pflug [this message]
2025-12-18 19:23   ` [PATCH 3/4] i.MX: HAB: extend field_return support to imx6 Marco Felsch
2025-12-18 17:36 ` [PATCH 4/4] commands: hab: extend by field_return fuse burn Fabian Pflug
2025-12-18 20:03   ` Marco Felsch

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=20251218-v2025-11-0-topic-imx6-field-return-v1-3-3781143198d6@pengutronix.de \
    --to=f.pflug@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    /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