mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Subject: [PATCH 3/6] i.MX: HABv4: extend support to i.MX8M SoCs
Date: Wed,  5 Jul 2023 16:42:16 +0200	[thread overview]
Message-ID: <20230705144219.504194-3-r.czerwinski@pengutronix.de> (raw)
In-Reply-To: <20230705144219.504194-1-r.czerwinski@pengutronix.de>

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@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




  parent reply	other threads:[~2023-07-05 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 2/6] i.MX: HABv4: fix event status comparison Rouven Czerwinski
2023-07-05 14:42 ` Rouven Czerwinski [this message]
2023-07-26  6:31   ` [PATCH] fixup! i.MX: HABv4: extend support to i.MX8M SoCs Ahmad Fatoum
2023-07-26  7:51     ` Marco Felsch
2023-07-05 14:42 ` [PATCH 4/6] ARM: i.MX: allow HAB for i.MX8M family Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 5/6] ARM: i.MX: introduce build_imx8m_habv4img Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 6/6] ARM: i.MX: convert i.MX8MP/MM EVK to helper Rouven Czerwinski
2023-07-05 14:50 ` [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Ahmad Fatoum
2023-07-05 15:10 ` Rouven Czerwinski

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=20230705144219.504194-3-r.czerwinski@pengutronix.de \
    --to=r.czerwinski@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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