[PATCH 1/2] ARM: stm32mp: switch internal SoC code to hexadecimal
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Apr 9 06:19:19 PDT 2025
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 at 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
More information about the barebox
mailing list