[PATCH 3/6] i.MX: HABv4: extend support to i.MX8M SoCs

Rouven Czerwinski r.czerwinski at pengutronix.de
Wed Jul 5 07:42:16 PDT 2023


Instead of only supporting i.MX8MQ based boards, extend support to the
whole i.MX8M family. OCRAM address values were taken from AN12263 Rev1
06/2020. While at it turn the OCRAM adresses into defines as well.

Signed-off-by: Rouven Czerwinski <r.czerwinski at pengutronix.de>
---
 drivers/hab/habv4.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 26463c8ce0..f558465618 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -205,18 +205,36 @@ static enum hab_status hab_sip_report_status(enum hab_config *config,
 	return (enum hab_status)res.a0;
 }
 
+#define IMX8MQ_ROM_OCRAM_ADDRESS	0x9061C0
+#define IMX8MM_ROM_OCRAM_ADDRESS	0x908040
+#define IMX8MN_ROM_OCRAM_ADDRESS	0x908040
+#define IMX8MP_ROM_OCRAM_ADDRESS	0x90D040
+
 static enum hab_status imx8m_read_sram_events(enum hab_status status,
 					     uint32_t index, void *event,
 					     uint32_t *bytes)
 {
 	struct hab_event_record *events[10];
 	int num_events = 0;
-	char *sram = (char *)0x9061c0;
+	char *sram;
 	int i = 0;
 	int internal_index = 0;
 	char *end = 0;
 	struct hab_event_record *search;
 
+	if (cpu_is_mx8mq()) {
+		sram = (char *)IMX8MQ_ROM_OCRAM_ADDRESS;
+	} else if (cpu_is_mx8mm()) {
+		sram = (char *)IMX8MM_ROM_OCRAM_ADDRESS;
+	} else if (cpu_is_mx8mn()) {
+		sram = (char *)IMX8MN_ROM_OCRAM_ADDRESS;
+	} else if (cpu_is_mx8mp()) {
+		sram = (char *)IMX8MP_ROM_OCRAM_ADDRESS;
+	} else {
+		/* No known i.MX8M variant */
+		return HAB_STATUS_FAILURE;
+	}
+
 	/*
 	 * AN12263 HABv4 Guidelines and Recommendations
 	 * recommends the address and size, however errors are usually contained
@@ -593,7 +611,7 @@ static int imx8m_hab_get_status(void)
 
 static int init_imx8m_hab_get_status(void)
 {
-	if (!cpu_is_mx8mq())
+	if (!cpu_is_mx8m())
 		/* can happen in multi-image builds and is not an error */
 		return 0;
 
-- 
2.41.0




More information about the barebox mailing list