[PATCH 2/2] HAB: extend fuse information with i.MX8M

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>

The i.MX8M family of processors moved the SEC_CONFIG_1 fuse to a
different location. Extend the hab driver with the new location and take
care of the DIR_BT_DIS fuse which only needs to be burned on i.MX8MQ.

Signed-off-by: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/hab/hab.c | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index aa848979b467..ee402352f243 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -150,23 +150,45 @@ static int imx_hab_permanent_write_enable_ocotp(int enable)
 	return imx_ocotp_permanent_write(enable);
 }
 
+static uint32_t get_sec_config_fuse(void) {
+	if (cpu_is_mx6()) {
+		return OCOTP_SEC_CONFIG_1;
+	} else {
+		return MX8M_OCOTP_SEC_CONFIG_1;
+	}
+}
+
 static int imx_hab_lockdown_device_ocotp(void)
 {
 	int ret;
+	uint32_t dis_fuse;
+	uint32_t sec_fuse;
 
-	ret = imx_ocotp_write_field(OCOTP_DIR_BT_DIS, 1);
-	if (ret < 0)
-		return ret;
+	if (cpu_is_mx6() || cpu_is_mx8mq()) {
+		if (cpu_is_mx6()) {
+			dis_fuse = OCOTP_DIR_BT_DIS;
+		} else {
+			dis_fuse = MX8MQ_OCOTP_DIR_BT_DIS;
+		}
+		ret = imx_ocotp_write_field(dis_fuse, 1);
+		if (ret < 0)
+			return ret;
+	}
 
-	return imx_ocotp_write_field(OCOTP_SEC_CONFIG_1, 1);
+	sec_fuse = get_sec_config_fuse();
+
+	return imx_ocotp_write_field(sec_fuse, 1);
 }
 
 static int imx_hab_device_locked_down_ocotp(void)
 {
 	int ret;
+	uint32_t fuse;
 	unsigned int v;
 
-	ret = imx_ocotp_read_field(OCOTP_SEC_CONFIG_1, &v);
+	fuse = get_sec_config_fuse();
+
+	ret = imx_ocotp_read_field(fuse, &v);
 	if (ret < 0)
 		return ret;
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux