All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: stm32: Auto-detect ROM API table on STM32MP15xx
@ 2025-05-12 16:45 Marek Vasut
  2025-05-21 14:40 ` Patrice CHOTARD
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2025-05-12 16:45 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Patrice Chotard, Patrick Delaunay, Simon Glass,
	Sughosh Ganu, Tom Rini, uboot-stm32

The ROM API table location is passed to the SPL by BootROM in register r0,
make use of this, store the content of r0 and later use it to access the
ROM API table to determine current boot device.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
---
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Cc: uboot-stm32@st-md-mailman.stormreply.com
---
 arch/arm/mach-stm32mp/stm32mp1/cpu.c        | 3 +--
 arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
index 18175fd12cc..9ab5a3ede52 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
@@ -330,8 +330,7 @@ static uintptr_t nt_fw_dtb __section(".data");
 void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
 		      unsigned long r3)
 {
-	if (IS_ENABLED(CONFIG_STM32_ECDSA_VERIFY))
-		rom_api_table = r0;
+	rom_api_table = r0;
 
 	if (IS_ENABLED(CONFIG_TFABOOT))
 		nt_fw_dtb = r2;
diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
index caeeeca863c..07d99034861 100644
--- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
+++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
@@ -64,7 +64,6 @@
  * - boot instance = bit 31:16
  * - boot device = bit 15:0
  */
-#define BOOTROM_PARAM_ADDR	0x2FFC0078
 #define BOOTROM_MODE_MASK	GENMASK(15, 0)
 #define BOOTROM_MODE_SHIFT	0
 #define BOOTROM_INSTANCE_MASK	GENMASK(31, 16)
@@ -189,7 +188,7 @@ void spl_board_init(void)
 static void update_bootmode(void)
 {
 	u32 boot_mode;
-	u32 bootrom_itf = readl(BOOTROM_PARAM_ADDR);
+	u32 bootrom_itf = readl(get_stm32mp_rom_api_table());
 	u32 bootrom_device, bootrom_instance;
 
 	/* enable TAMP clock = RTCAPBEN */
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: stm32: Auto-detect ROM API table on STM32MP15xx
  2025-05-12 16:45 [PATCH] ARM: stm32: Auto-detect ROM API table on STM32MP15xx Marek Vasut
@ 2025-05-21 14:40 ` Patrice CHOTARD
  2025-06-09  8:55   ` Patrice CHOTARD
  0 siblings, 1 reply; 3+ messages in thread
From: Patrice CHOTARD @ 2025-05-21 14:40 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Patrick Delaunay, Simon Glass, Sughosh Ganu, Tom Rini,
	uboot-stm32



On 5/12/25 18:45, Marek Vasut wrote:
> The ROM API table location is passed to the SPL by BootROM in register r0,
> make use of this, store the content of r0 and later use it to access the
> ROM API table to determine current boot device.
> 
> Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
> ---
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> Cc: uboot-stm32@st-md-mailman.stormreply.com
> ---
>  arch/arm/mach-stm32mp/stm32mp1/cpu.c        | 3 +--
>  arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> index 18175fd12cc..9ab5a3ede52 100644
> --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> @@ -330,8 +330,7 @@ static uintptr_t nt_fw_dtb __section(".data");
>  void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
>  		      unsigned long r3)
>  {
> -	if (IS_ENABLED(CONFIG_STM32_ECDSA_VERIFY))
> -		rom_api_table = r0;
> +	rom_api_table = r0;
>  
>  	if (IS_ENABLED(CONFIG_TFABOOT))
>  		nt_fw_dtb = r2;
> diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
> index caeeeca863c..07d99034861 100644
> --- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
> +++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
> @@ -64,7 +64,6 @@
>   * - boot instance = bit 31:16
>   * - boot device = bit 15:0
>   */
> -#define BOOTROM_PARAM_ADDR	0x2FFC0078
>  #define BOOTROM_MODE_MASK	GENMASK(15, 0)
>  #define BOOTROM_MODE_SHIFT	0
>  #define BOOTROM_INSTANCE_MASK	GENMASK(31, 16)
> @@ -189,7 +188,7 @@ void spl_board_init(void)
>  static void update_bootmode(void)
>  {
>  	u32 boot_mode;
> -	u32 bootrom_itf = readl(BOOTROM_PARAM_ADDR);
> +	u32 bootrom_itf = readl(get_stm32mp_rom_api_table());
>  	u32 bootrom_device, bootrom_instance;
>  
>  	/* enable TAMP clock = RTCAPBEN */

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: stm32: Auto-detect ROM API table on STM32MP15xx
  2025-05-21 14:40 ` Patrice CHOTARD
@ 2025-06-09  8:55   ` Patrice CHOTARD
  0 siblings, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2025-06-09  8:55 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Patrick Delaunay, Simon Glass, Sughosh Ganu, Tom Rini,
	uboot-stm32



On 5/21/25 16:40, Patrice CHOTARD wrote:
> 
> 
> On 5/12/25 18:45, Marek Vasut wrote:
>> The ROM API table location is passed to the SPL by BootROM in register r0,
>> make use of this, store the content of r0 and later use it to access the
>> ROM API table to determine current boot device.
>>
>> Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
>> ---
>> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
>> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
>> Cc: Tom Rini <trini@konsulko.com>
>> Cc: u-boot@lists.denx.de
>> Cc: uboot-stm32@st-md-mailman.stormreply.com
>> ---
>>  arch/arm/mach-stm32mp/stm32mp1/cpu.c        | 3 +--
>>  arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 3 +--
>>  2 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
>> index 18175fd12cc..9ab5a3ede52 100644
>> --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c
>> +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
>> @@ -330,8 +330,7 @@ static uintptr_t nt_fw_dtb __section(".data");
>>  void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
>>  		      unsigned long r3)
>>  {
>> -	if (IS_ENABLED(CONFIG_STM32_ECDSA_VERIFY))
>> -		rom_api_table = r0;
>> +	rom_api_table = r0;
>>  
>>  	if (IS_ENABLED(CONFIG_TFABOOT))
>>  		nt_fw_dtb = r2;
>> diff --git a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
>> index caeeeca863c..07d99034861 100644
>> --- a/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
>> +++ b/arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c
>> @@ -64,7 +64,6 @@
>>   * - boot instance = bit 31:16
>>   * - boot device = bit 15:0
>>   */
>> -#define BOOTROM_PARAM_ADDR	0x2FFC0078
>>  #define BOOTROM_MODE_MASK	GENMASK(15, 0)
>>  #define BOOTROM_MODE_SHIFT	0
>>  #define BOOTROM_INSTANCE_MASK	GENMASK(31, 16)
>> @@ -189,7 +188,7 @@ void spl_board_init(void)
>>  static void update_bootmode(void)
>>  {
>>  	u32 boot_mode;
>> -	u32 bootrom_itf = readl(BOOTROM_PARAM_ADDR);
>> +	u32 bootrom_itf = readl(get_stm32mp_rom_api_table());
>>  	u32 bootrom_device, bootrom_instance;
>>  
>>  	/* enable TAMP clock = RTCAPBEN */
> 
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> Thanks
> Patrice
Applied to u-boot-stm32/next

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-09  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 16:45 [PATCH] ARM: stm32: Auto-detect ROM API table on STM32MP15xx Marek Vasut
2025-05-21 14:40 ` Patrice CHOTARD
2025-06-09  8:55   ` Patrice CHOTARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.