mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Stefan Kerkmann <s.kerkmann@pengutronix.de>
Subject: [PATCH v3 10/10] hab: lock GP5 on i.MX8MP socs
Date: Thu, 23 Jan 2025 15:56:15 +0100	[thread overview]
Message-ID: <20250123-v2024-05-0-topic-hab-v3-10-e90d0e43c2de@pengutronix.de> (raw)
In-Reply-To: <20250123-v2024-05-0-topic-hab-v3-0-e90d0e43c2de@pengutronix.de>

This change locks down the GP5 eFuses against modification on i.MX8MP
SoCs. To cite the i.MX8MP reference manual (Rev. 3):

  The GP5_LOCK eFuse locks the upper 64 bits of the 128-bit UNIQUE_ID
  (UID) eFuse field. The users must program the GP5_LOCK eFuse to b'11
  (WP+OP), thereby locking the upper 64-bit UID eFuse field. For devices
  shipped with date codes 2435 and later, the GP5_LOCK has been
  programmed to b'11 by NXP in production. Only devices with date codes
  prior to 2435 should be programmed to update the GP5_LOCK eFuse to
  b'11.

Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
---
 drivers/hab/hab.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 0f0c8766f069697944570290cb5796430ddae125..7fb759c152379dda2d43f139baf1aa6cf2051234 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -200,11 +200,15 @@ static int imx8m_hab_lockdown_device_ocotp(unsigned flags)
 	if (ret < 0)
 		return ret;
 
-	/* Only i.MX8MQ requires fusing of DIR_BT_DIS */
-	if (!cpu_is_mx8mq())
-		return ret;
+	/* Lock upper 64bit of the 128bit UNIQUE_ID eFuse field on i.MX8MP */
+	if (cpu_is_mx8mp())
+		return imx_ocotp_write_field(MX8MP_OCOTP_GP5_LOCK, 0b11);
 
-	return imx_ocotp_write_field(MX8MQ_OCOTP_DIR_BT_DIS, 1);
+	/* Only i.MX8MQ requires fusing of DIR_BT_DIS */
+	if (cpu_is_mx8mq())
+		return imx_ocotp_write_field(MX8MQ_OCOTP_DIR_BT_DIS, 1);
+
+	return 0;
 }
 
 static int imx6_hab_device_locked_down_ocotp(void)

-- 
2.39.5




  parent reply	other threads:[~2025-01-23 15:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 14:56 [PATCH v3 00/10] i.MX8M HAB and OCOTP additions and fixes Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 01/10] nvmem: ocotp: add support to get/set srk_revoke sticky bit Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 02/10] nvmem: ocotp: add support to query the field-return " Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 03/10] hab: convert flags to use BIT() macro Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 04/10] i.MX: HAB: add imx_hab_revoke_key support Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 05/10] i.MX: HABv4: add more i.MX8M fuse defines Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 06/10] i.MX8M: HABv4: add an option to allow key revocation Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 07/10] i.MX8M: HABv4: add option to allow burning the field-return fuse Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 08/10] i.MX: HAB: add imx_hab_field_return support Stefan Kerkmann
2025-01-23 14:56 ` [PATCH v3 09/10] i.mx8: ocotp: add GPx_LOCK defines Stefan Kerkmann
2025-01-23 14:56 ` Stefan Kerkmann [this message]
2025-01-28 10:00 ` [PATCH v3 00/10] i.MX8M HAB and OCOTP additions and fixes Sascha Hauer

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=20250123-v2024-05-0-topic-hab-v3-10-e90d0e43c2de@pengutronix.de \
    --to=s.kerkmann@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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