From: Fabian Pflug <f.pflug@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Fabian Pflug <f.pflug@pengutronix.de>
Subject: [PATCH v2 3/4] i.MX: HAB: extend field_return support to imx6
Date: Fri, 19 Dec 2025 10:06:57 +0100 [thread overview]
Message-ID: <20251219-v2025-11-0-topic-imx6-field-return-v2-3-2696ac61ae2d@pengutronix.de> (raw)
In-Reply-To: <20251219-v2025-11-0-topic-imx6-field-return-v2-0-2696ac61ae2d@pengutronix.de>
Extend the helper for imx_fuse_burn with support for i.MX6 devices.
Create a helper function for i.MX8 and i.MX6 rom the old i.MX8M
function, as they all share the same pattern.
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
---
drivers/hab/hab.c | 22 +++++++++++++++-------
include/mach/imx/ocotp-fusemap.h | 1 +
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 1c747e8a3e..3c9739871b 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(unint32_t field, unsigned int value)
{
int ret;
@@ -274,13 +274,20 @@ static int imx8m_hab_field_return_ocotp(void)
if (ret == 1)
return -EINVAL;
- if (cpu_is_mx8mp())
- ret = imx_ocotp_write_field(MX8MP_OCOTP_FIELD_RETURN,
- MX8MP_FIELD_RETURN_PATTERN);
- else
- ret = imx_ocotp_write_field(MX8M_OCOTP_FIELD_RETURN, 1);
+ return imx_ocotp_write_field(field, value);
+}
- return ret;
+static int imx6_hab_field_return_ocotp(void)
+{
+ return imx_hab_field_return_ocotp(MX6_OCOTP_FIELD_RETURN, 1);
+}
+
+static int imx8m_hab_field_return_ocotp(void)
+{
+ if (cpu_is_mx8mp())
+ return imx_hab_field_return_ocotp(MX8MP_OCOTP_FIELD_RETURN,
+ MX8MP_FIELD_RETURN_PATTERN);
+ return imx_hab_field_return_ocotp(MX8M_OCOTP_FIELD_RETURN, 1);
}
struct imx_hab_ops {
@@ -310,6 +317,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 = imx6_hab_field_return_ocotp,
};
static struct imx_hab_ops imx8m_hab_ops_ocotp = {
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
next prev parent reply other threads:[~2025-12-19 9:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 9:06 [PATCH v2 0/4] i.mx: hab/ocotop: extend field return to i.MX6 Fabian Pflug
2025-12-19 9:06 ` [PATCH v2 1/4] arm: mach-imx6: use kconfig for field return Fabian Pflug
2025-12-19 9:14 ` Ahmad Fatoum
2025-12-19 10:06 ` Marco Felsch
2025-12-19 9:06 ` [PATCH v2 2/4] nvmem: ocotp: extend support to query the sticky bit Fabian Pflug
2025-12-19 9:06 ` Fabian Pflug [this message]
2025-12-19 9:56 ` [PATCH v2 3/4] i.MX: HAB: extend field_return support to imx6 Marco Felsch
2025-12-19 9:06 ` [PATCH v2 4/4] commands: hab: extend by field_return fuse burn Fabian Pflug
2025-12-19 9:57 ` Marco Felsch
2025-12-19 10:03 ` Lucas Stach
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=20251219-v2025-11-0-topic-imx6-field-return-v2-3-2696ac61ae2d@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