mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] ARM: stm32mp: switch internal SoC code to hexadecimal
Date: Wed,  9 Apr 2025 15:19:19 +0200	[thread overview]
Message-ID: <20250409131920.1949534-1-a.fatoum@pengutronix.de> (raw)

stm32mp_code() is used internally in SoC support code to record the
information what SoC we are running on per device tree.

By changing the information to hexadecimal, we can more easily apply
bitmasks to check if we are on STM32MP15 or STM32MP13.

Do that and while at it, rename the function as not to confuse any
out-of-tree users.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-stm32mp/init.c       | 14 +++++++-------
 arch/arm/mach-stm32mp/stm32image.c |  2 +-
 include/mach/stm32mp/stm32.h       |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-stm32mp/init.c b/arch/arm/mach-stm32mp/init.c
index 2eb8b6beec2a..b24649e86658 100644
--- a/arch/arm/mach-stm32mp/init.c
+++ b/arch/arm/mach-stm32mp/init.c
@@ -229,9 +229,9 @@ static int stm32mp15_setup_cpu_type(void)
 	return 0;
 }
 
-static int __st32mp_soc;
+static unsigned __st32mp_soc;
 
-int stm32mp_soc(void)
+unsigned stm32mp_soc_code(void)
 {
 	return __st32mp_soc;
 }
@@ -241,17 +241,17 @@ static int stm32mp_init(void)
 	u32 boot_ctx;
 
 	if (of_machine_is_compatible("st,stm32mp135"))
-		__st32mp_soc = 32135;
+		__st32mp_soc = 0x32135;
 	else if (of_machine_is_compatible("st,stm32mp151"))
-		__st32mp_soc = 32151;
+		__st32mp_soc = 0x32151;
 	else if (of_machine_is_compatible("st,stm32mp153"))
-		__st32mp_soc = 32153;
+		__st32mp_soc = 0x32153;
 	else if (of_machine_is_compatible("st,stm32mp157"))
-		__st32mp_soc = 32157;
+		__st32mp_soc = 0x32157;
 	else
 		return 0;
 
-	if (__st32mp_soc == 32135) {
+	if (__st32mp_soc == 0x32135) {
 		boot_ctx = readl(STM32MP13_TAMP_BOOT_CONTEXT);
 	} else {
 		stm32mp15_setup_cpu_type();
diff --git a/arch/arm/mach-stm32mp/stm32image.c b/arch/arm/mach-stm32mp/stm32image.c
index 37d7c731209e..1b2e8c618c85 100644
--- a/arch/arm/mach-stm32mp/stm32image.c
+++ b/arch/arm/mach-stm32mp/stm32image.c
@@ -46,7 +46,7 @@ static struct image_handler image_handler_stm32_image_v1_handler = {
 
 static int stm32mp_register_stm32image_image_handler(void)
 {
-	if (!stm32mp_soc())
+	if (!stm32mp_soc_code())
 		return 0;
 
 	return register_image_handler(&image_handler_stm32_image_v1_handler);
diff --git a/include/mach/stm32mp/stm32.h b/include/mach/stm32mp/stm32.h
index f698ebfaf4f1..a37d62cdaedb 100644
--- a/include/mach/stm32mp/stm32.h
+++ b/include/mach/stm32mp/stm32.h
@@ -28,6 +28,6 @@
 #define STM32_DDR_BASE			0xC0000000
 #define STM32_DDR_SIZE			SZ_1G
 
-int stm32mp_soc(void);
+unsigned stm32mp_soc_code(void);
 
 #endif /* _MACH_STM32_H_ */
-- 
2.39.5




             reply	other threads:[~2025-04-09 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 13:19 Ahmad Fatoum [this message]
2025-04-09 13:19 ` [PATCH 2/2] ARM: stm32mp: init: expand bootsource logic to STM32MP13{1,3} Ahmad Fatoum
2025-04-10  6:37 ` [PATCH 1/2] ARM: stm32mp: switch internal SoC code to hexadecimal 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=20250409131920.1949534-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@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