[PATCH] fixup! i.MX: HABv4: fix i.MX8MQ device lockdown

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

 



Fixed up patch splits imx_hab_lockdown_device_ocotp into two
functions, one i.MX6- and another i.MX8M-specific, because they differ
in the fuse written: OCOTP_SEC_CONFIG_1 vs MX8M_OCOTP_SEC_CONFIG_1.

The same OCOTP_SEC_CONFIG_1 fuse is also read in
imx_hab_device_locked_down_ocotp, so split that two into imx6 and imx8m
variants.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/hab/hab.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 444472511771..1edc495aee94 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -176,7 +176,7 @@ static int imx8m_hab_lockdown_device_ocotp(void)
 	return imx_ocotp_write_field(MX8MQ_OCOTP_DIR_BT_DIS, 1);
 }
 
-static int imx_hab_device_locked_down_ocotp(void)
+static int imx6_hab_device_locked_down_ocotp(void)
 {
 	int ret;
 	unsigned int v;
@@ -188,6 +188,18 @@ static int imx_hab_device_locked_down_ocotp(void)
 	return v;
 }
 
+static int imx8m_hab_device_locked_down_ocotp(void)
+{
+	int ret;
+	unsigned int v;
+
+	ret = imx_ocotp_read_field(MX8M_OCOTP_SEC_CONFIG_1, &v);
+	if (ret < 0)
+		return ret;
+
+	return v;
+}
+
 struct imx_hab_ops {
 	int (*write_srk_hash)(const u8 *srk, unsigned flags);
 	int (*read_srk_hash)(u8 *srk);
@@ -208,7 +220,7 @@ static struct imx_hab_ops imx6_hab_ops_ocotp = {
 	.write_srk_hash = imx_hab_write_srk_hash_ocotp,
 	.read_srk_hash =  imx_hab_read_srk_hash_ocotp,
 	.lockdown_device = imx6_hab_lockdown_device_ocotp,
-	.device_locked_down = imx_hab_device_locked_down_ocotp,
+	.device_locked_down = imx6_hab_device_locked_down_ocotp,
 	.permanent_write_enable = imx_hab_permanent_write_enable_ocotp,
 };
 
@@ -216,7 +228,7 @@ static struct imx_hab_ops imx8m_hab_ops_ocotp = {
 	.write_srk_hash = imx_hab_write_srk_hash_ocotp,
 	.read_srk_hash =  imx_hab_read_srk_hash_ocotp,
 	.lockdown_device = imx8m_hab_lockdown_device_ocotp,
-	.device_locked_down = imx_hab_device_locked_down_ocotp,
+	.device_locked_down = imx8m_hab_device_locked_down_ocotp,
 	.permanent_write_enable = imx_hab_permanent_write_enable_ocotp,
 };
 
-- 
2.39.2





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

  Powered by Linux