Skip to contentSkip to conversation

rockchip: ROCKCHIP_COMMON_STACK_ADDR improvements

PATCH Superseded Jonas Karlman 3 participants 12 messages Jan 26, 2025 – Feb 9, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover rockchip: ROCKCHIP_COMMON_STACK_ADDR improvements

Use of the Kconfig symbol ROCKCHIP_COMMON_STACK_ADDR is currently not working well when a SoC needs to use a custom tpl.c and the default values are only working when DRAM base address is 0x0.

This series changes to not imply TPL_ROCKCHIP_COMMON_BOARD and instead let each SoC symbol decide. It also adds default values for the two other used DRAM base addresses, 0x60000000 and 0x40000000. Finally, it also moves imply of ROCKCHIP_EXTERNAL_TPL under each SoC symbol.

Jonas Karlman (5):
rockchip: Move imply TPL_ROCKCHIP_COMMON_BOARD under SoC Kconfig
symbol
rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR
rockchip: Move imply ROCKCHIP_COMMON_STACK_ADDR under SoC Kconfig
symbol
rockchip: Move imply ROCKCHIP_EXTERNAL_TPL under SoC Kconfig symbol
rockchip: Add RK3576 support for ROCKCHIP_COMMON_STACK_ADDR

 arch/arm/mach-rockchip/Kconfig        | 67 ++++++++++++++++++++-------
 arch/arm/mach-rockchip/px30/Kconfig   |  3 --
 arch/arm/mach-rockchip/rk3308/Kconfig |  3 --
 arch/arm/mach-rockchip/rk3328/Kconfig |  3 --
 arch/arm/mach-rockchip/rk3399/Kconfig |  3 --
 arch/arm/mach-rockchip/rk3568/Kconfig |  3 --
 arch/arm/mach-rockchip/rk3588/Kconfig |  3 --
 7 files changed, 50 insertions(+), 35 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/5 rockchip: Move imply TPL_ROCKCHIP_COMMON_BOARD under SoC Kconfig symbol

The Kconfig symbol ROCKCHIP_COMMON_STACK_ADDR currently imply the TPL_ROCKCHIP_COMMON_BOARD option when TPL=y. This is inconvenient for a SoC with very limited SRAM to use a custom tpl.c together with the common stack addresses.

Move any imply TPL_ROCKCHIP_COMMON_BOARD to under the SoC symbol, where it belongs. Add the missing imply to RK3328 and PX30 use a SoC specific tpl.c and only expect imply TPL_LIBGENERIC_SUPPORT.

---
 arch/arm/mach-rockchip/Kconfig | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm/mach-rockchip/Kconfig +6 -5
index 4d3157b2edd3..5aa9e0f1af3b 100644
@@ -16,6 +16,7 @@ config ROCKCHIP_PX30
 	select DEBUG_UART_BOARD_INIT
 	imply ROCKCHIP_COMMON_BOARD
 	imply SPL_ROCKCHIP_COMMON_BOARD
+	imply TPL_LIBGENERIC_SUPPORT
 	imply ARMV8_CRYPTO
 	imply ARMV8_SET_SMPEN
 	help
@@ -212,6 +213,7 @@ config ROCKCHIP_RK3328
 	imply SPL_ROCKCHIP_COMMON_BOARD
 	imply SPL_SEPARATE_BSS
 	imply SPL_SERIAL
+	imply TPL_ROCKCHIP_COMMON_BOARD
 	imply TPL_SERIAL
 	help
 	  The Rockchip RK3328 is a ARM-based SoC with a quad-core Cortex-A53.
@@ -608,11 +610,10 @@ config ROCKCHIP_COMMON_STACK_ADDR
 	imply SPL_ROCKCHIP_COMMON_BOARD if SPL
 	imply SPL_SYS_MALLOC_F if SPL
 	imply SPL_SYS_MALLOC_SIMPLE if SPL
-	imply TPL_LIBCOMMON_SUPPORT if TPL
-	imply TPL_LIBGENERIC_SUPPORT if TPL
-	imply TPL_ROCKCHIP_COMMON_BOARD if TPL
-	imply TPL_SYS_MALLOC_F if TPL
-	imply TPL_SYS_MALLOC_SIMPLE if TPL
+	imply TPL_LIBCOMMON_SUPPORT if TPL && TPL_ROCKCHIP_COMMON_BOARD
+	imply TPL_LIBGENERIC_SUPPORT if TPL && TPL_ROCKCHIP_COMMON_BOARD
+	imply TPL_SYS_MALLOC_F if TPL && TPL_ROCKCHIP_COMMON_BOARD
+	imply TPL_SYS_MALLOC_SIMPLE if TPL && TPL_ROCKCHIP_COMMON_BOARD
 
 config NR_DRAM_BANKS
 	default 10 if ROCKCHIP_EXTERNAL_TPL
Signature · 1 line
2.48.1
#2 lore raw

PATCH 2/5 rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

In reply to Jonas Karlman

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
 arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +24 -11
index 5aa9e0f1af3b..da20d3233fe3 100644
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
 if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
 config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000
 
 config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
 config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108
+	default 0x00000000
 
 config SPL_HAS_BSS_LINKER_SECTION
 	default y if ARM64
 
 config SPL_BSS_START_ADDR
-	default 0x3f80000
+	default 0x63f80000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f80000 if SPL_TEXT_BASE = 0x00000000
 
 config SPL_BSS_MAX_SIZE
-	default 0x8000 if SPL_BSS_START_ADDR = 0x3f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x63f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x03f80000
 
 config SPL_STACK_R
-	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config SPL_STACK_R_ADDR
-	default 0x3e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x63e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x03e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config SPL_STACK_R_MALLOC_SIMPLE_LEN
-	default 0x200000 if SPL_STACK_R_ADDR = 0x3e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x63e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x03e00000
 
 endif
 endif
Signature · 1 line
2.48.1
#3 lore raw

Re: [PATCH 2/5] rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

Hi Jonas,

thanks for working on this.  Please see one comment below.

Am 27.01.25 um 00:48 schrieb Jonas Karlman:

Quoted 38 lines

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
  arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
  1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +8 -4
index 5aa9e0f1af3b..da20d3233fe3 100644
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
  if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
  config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000
 
  config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 661

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +4 -2
 
  config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
  config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \

I'm not sure if adding RK3036 and RK3188 is correct at this point. Both use SPL (without TPL) currently for DRAM initialization and thus need their CFG_IRAM_BASE as SPL_TEXT_BASE.

Regards,

Alex

Quoted 33 lines
arch/arm/mach-rockchip/Kconfig +12 -5
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108
+	default 0x00000000
 
  config SPL_HAS_BSS_LINKER_SECTION
  	default y if ARM64
 
  config SPL_BSS_START_ADDR
-	default 0x3f80000
+	default 0x63f80000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f80000 if SPL_TEXT_BASE = 0x00000000
 
  config SPL_BSS_MAX_SIZE
-	default 0x8000 if SPL_BSS_START_ADDR = 0x3f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x63f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x03f80000
 
  config SPL_STACK_R
-	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_STACK_R_ADDR
-	default 0x3e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x63e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x03e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_STACK_R_MALLOC_SIMPLE_LEN
-	default 0x200000 if SPL_STACK_R_ADDR = 0x3e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x63e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x03e00000
 
  endif
  endif
#4 lore raw

Re: [PATCH 2/5] rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

Hi Alex,

Quoted 49 lines · Alex Bee

Hi Jonas,

thanks for working on this.  Please see one comment below.

Am 27.01.25 um 00:48 schrieb Jonas Karlman:

Quoted 44 lines

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
  arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
  1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +10 -5
index 5aa9e0f1af3b..da20d3233fe3 100644
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
  if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
  config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000
 
  config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
Quoted 8 lines

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 661

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +2 -1
  config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \

I'm not sure if adding RK3036 and RK3188 is correct at this point. Both use SPL (without TPL) currently for DRAM initialization and thus need their CFG_IRAM_BASE as SPL_TEXT_BASE.

I think it should be safe to add these default values here, any value defined in board defconfig or soc Kconfig will take precedence.

The RK3036 and RK3188 boards use SPL back-to-brom to load U-Boot proper, if someone wants to move these board to use similar TPL+SPL+FIT this will prepare for such occasion.

Having them included here also prevents a possible issue in case someone in the future where to add a select/imply ROCKCHIP_COMMON_STACK_ADDR for these SoCs, else they may fallback to wrongly use 0x0.

Do you want me to drop them in a v2?

Regards,
Jonas

Quoted 38 lines

Regards,

Alex

Quoted 33 lines
arch/arm/mach-rockchip/Kconfig +12 -5
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108
+	default 0x00000000
 
  config SPL_HAS_BSS_LINKER_SECTION
  	default y if ARM64
 
  config SPL_BSS_START_ADDR
-	default 0x3f80000
+	default 0x63f80000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f80000 if SPL_TEXT_BASE = 0x00000000
 
  config SPL_BSS_MAX_SIZE
-	default 0x8000 if SPL_BSS_START_ADDR = 0x3f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x63f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x03f80000
 
  config SPL_STACK_R
-	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_STACK_R_ADDR
-	default 0x3e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x63e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x03e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_STACK_R_MALLOC_SIMPLE_LEN
-	default 0x200000 if SPL_STACK_R_ADDR = 0x3e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x63e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x03e00000
 
  endif
  endif
#5 lore raw

Re: [PATCH 2/5] rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

Hi Jonas,

Quoted 66 lines

Hi Alex,

Quoted 49 lines · Alex Bee

Hi Jonas,

thanks for working on this.  Please see one comment below.

Am 27.01.25 um 00:48 schrieb Jonas Karlman:

Quoted 44 lines

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
   arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
   1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +10 -5
index 5aa9e0f1af3b..da20d3233fe3 100644
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
   if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
   config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000
 
   config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
Quoted 7 lines

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 661

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +2 -1
   config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \

I'm not sure if adding RK3036 and RK3188 is correct at this point. Both use SPL (without TPL) currently for DRAM initialization and thus need their CFG_IRAM_BASE as SPL_TEXT_BASE.

I think it should be safe to add these default values here, any value defined in board defconfig or soc Kconfig will take precedence.

The RK3036 and RK3188 boards use SPL back-to-brom to load U-Boot proper, if someone wants to move these board to use similar TPL+SPL+FIT this will prepare for such occasion.

Quoted 8 lines

Having them included here also prevents a possible issue in case someone in the future where to add a select/imply ROCKCHIP_COMMON_STACK_ADDR for these SoCs, else they may fallback to wrongly use 0x0.

Do you want me to drop them in a v2?

Regards,
Jonas

it is currently "safe" as it would of course be overwritten by the currently existing defconfigs. But if someone dares to use this symbol for a downstream/new board for either of these two SoCs, things go south.

How about adding some "extra security" by making it depends on TPL || ROCKCHIP_EXTERNAL_TPL

As I mentioned off-list: I'm not sure if any of these XXX_ROCKCHIP_COMMON_BORD belong here: I understand the goal of syncing configurations for the different SoCs, but I'm not sure if a symbol called ROCKCHIP_COMMON_STACK_ADDR is the right place for it (plus the XXX_ROCKCHIP_COMMON_BORD symbols (should) have no dependency on using ROCKCHIP_COMMON_STACK_ADDR, neither code-wise nor from semantics).

Regards,
Alex

Quoted 37 lines
Quoted 37 lines

Regards,

Alex

Quoted 33 lines
arch/arm/mach-rockchip/Kconfig +12 -5
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108
+	default 0x00000000
 
   config SPL_HAS_BSS_LINKER_SECTION
   	default y if ARM64
 
   config SPL_BSS_START_ADDR
-	default 0x3f80000
+	default 0x63f80000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f80000 if SPL_TEXT_BASE = 0x00000000
 
   config SPL_BSS_MAX_SIZE
-	default 0x8000 if SPL_BSS_START_ADDR = 0x3f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x63f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x03f80000
 
   config SPL_STACK_R
-	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config SPL_STACK_R_ADDR
-	default 0x3e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x63e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x03e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config SPL_STACK_R_MALLOC_SIMPLE_LEN
-	default 0x200000 if SPL_STACK_R_ADDR = 0x3e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x63e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x03e00000
 
   endif
   endif
#6 lore raw

Re: [PATCH 2/5] rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

Hi Alex,

Quoted 83 lines · Alex Bee

Hi Jonas,

Quoted 66 lines

Hi Alex,

Quoted 49 lines · Alex Bee

Hi Jonas,

thanks for working on this.  Please see one comment below.

Am 27.01.25 um 00:48 schrieb Jonas Karlman:

Quoted 44 lines

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
   arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
   1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +10 -5
index 5aa9e0f1af3b..da20d3233fe3 100644
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
   if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
   config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000
 
   config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
Quoted 7 lines

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 661

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +2 -1
   config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \

I'm not sure if adding RK3036 and RK3188 is correct at this point. Both use SPL (without TPL) currently for DRAM initialization and thus need their CFG_IRAM_BASE as SPL_TEXT_BASE.

I think it should be safe to add these default values here, any value defined in board defconfig or soc Kconfig will take precedence.

The RK3036 and RK3188 boards use SPL back-to-brom to load U-Boot proper, if someone wants to move these board to use similar TPL+SPL+FIT this will prepare for such occasion.

Quoted 8 lines

Having them included here also prevents a possible issue in case someone in the future where to add a select/imply ROCKCHIP_COMMON_STACK_ADDR for these SoCs, else they may fallback to wrongly use 0x0.

Do you want me to drop them in a v2?

Regards,
Jonas

it is currently "safe" as it would of course be overwritten by the currently existing defconfigs. But if someone dares to use this symbol for a downstream/new board for either of these two SoCs, things go south.

How about adding some "extra security" by making it
    depends on TPL || ROCKCHIP_EXTERNAL_TPL

Quoted 6 lines

As I mentioned off-list: I'm not sure if any of these XXX_ROCKCHIP_COMMON_BORD belong here: I understand the goal of syncing configurations for the different SoCs, but I'm not sure if a symbol called ROCKCHIP_COMMON_STACK_ADDR is the right place for it (plus the XXX_ROCKCHIP_COMMON_BORD symbols (should) have no dependency on using ROCKCHIP_COMMON_STACK_ADDR, neither code-wise nor from semantics).

In principle I fully agree, and TPL_ROCKCHIP_COMMON_BOARD was moved away from being implied in first patch in this series. However, I left the implied SPL symbol as-is.

Adding the "depends on TPL ..." could be something for a v2.

The original intent of this symbol was to help move boards and SoCs that use common TPL+SPL to use safer addresses without having to affect all boards/SoCs all at once.

With this series it should be simple to move the remaining ARMv7 SoCs to use similar TPL/ROCKCHIP_EXTERNAL_TPL + SPL separation without having to worry about picking new SPL stack addresses in DRAM.

The Kconfig symbol is hidden from menuconfig so I do not expect end users to easily break anything by accidentally enabling this symbol.

I was hoping to be able to send a migration series for RK322x this weekend but unfortunately, I managed to brick the new RK3228A box I picked up after only a few hours, the box uses an eMCP and I have not found an exposed mmc clk pin yet, a new box should arrive soon :-)

Regards,
Jonas

Quoted 41 lines

Regards,
Alex

Quoted 37 lines
Quoted 37 lines

Regards,

Alex

Quoted 33 lines
arch/arm/mach-rockchip/Kconfig +12 -5
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108
+	default 0x00000000
 
   config SPL_HAS_BSS_LINKER_SECTION
   	default y if ARM64
 
   config SPL_BSS_START_ADDR
-	default 0x3f80000
+	default 0x63f80000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f80000 if SPL_TEXT_BASE = 0x00000000
 
   config SPL_BSS_MAX_SIZE
-	default 0x8000 if SPL_BSS_START_ADDR = 0x3f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x63f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x03f80000
 
   config SPL_STACK_R
-	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config SPL_STACK_R_ADDR
-	default 0x3e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x63e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x03e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
   config SPL_STACK_R_MALLOC_SIMPLE_LEN
-	default 0x200000 if SPL_STACK_R_ADDR = 0x3e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x63e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x03e00000
 
   endif
   endif
#7 lore raw

Re: [PATCH 2/5] rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

In reply to Jonas Karlman

Hi Jonas,

Quoted 1 line · Jonas Karlman

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of

Are there known exceptions? Among the list you provided I see RV1126 is missing but is ARMv7-based. Is it an oversight or done on purpose? I couldn't quickly find the TRM so no clue.

Quoted 16 lines

the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
  arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
  1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +0 -0
index 5aa9e0f1af3b..da20d3233fe3 100644

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 641

Quoted 6 lines
arch/arm/mach-rockchip/Kconfig +2 -1
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
  if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
  config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000

A bit sad we cannot do arithmetic here in Kconfig :(

Quoted 16 lines
arch/arm/mach-rockchip/Kconfig +6 -3
  config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 662

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +5 -2
  config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
  config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108

If applicable to all ARMv7 SoCs, maybe

if CPU_V7A

would be more future-proof?

Cheers,
Quentin

#8 lore raw

Re: [PATCH 2/5] rockchip: Improve ARMv7 support for ROCKCHIP_COMMON_STACK_ADDR

Hi Quentin,

Quoted 8 lines · Quentin Schulz

Hi Jonas,

Quoted 1 line · Jonas Karlman

A few Rockchip ARMv7 SoCs use 0x60000000 as DRAM base address instead of

Are there known exceptions? Among the list you provided I see RV1126 is missing but is ARMv7-based. Is it an oversight or done on purpose? I couldn't quickly find the TRM so no clue.

The default if tested SoCs below is the only 6 SoCs that seem to use the 0x60000000 base, both in mainline and vendor U-Boot. RV1126, RK3288 and incoming RK3506 all use 0x0 as base address.

Quoted 19 lines
Quoted 19 lines

the more common 0x0 DRAM base address used on AArch64 SoCs.

Add default options that should work for these ARMv7 SoCs. Same offsets as before are used, just below 64 MiB. Hex values have also been padded to improve alignment.

---
  arch/arm/mach-rockchip/Kconfig | 35 +++++++++++++++++++++++-----------
  1 file changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-rockchip/Kconfig +0 -0
index 5aa9e0f1af3b..da20d3233fe3 100644
@@ -637,40 +637,53 @@ source "arch/arm/mach-rockchip/rv1126/Kconfig"
  if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
Quoted 6 lines

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 641

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +2 -1
  config CUSTOM_SYS_INIT_SP_ADDR
-	default 0x3f00000
+	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000

A bit sad we cannot do arithmetic here in Kconfig :(

That would have been a really nice feature :-)

Quoted 30 lines
Quoted 17 lines
arch/arm/mach-rockchip/Kconfig +6 -3
  config SYS_MALLOC_F_LEN
-	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config SPL_SYS_MALLOC_F_LEN
-	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
  config TPL_SYS_MALLOC_F_LEN
-	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x3f00000
+	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 

arch/arm/mach-rockchip/Kconfig source "arch/arm/mach-rockchip/rv1126/Kconfig" · line 662

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +5 -2
  config TEXT_BASE
-	default 0x00200000 if ARM64
+	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
  config SPL_TEXT_BASE
-	default 0x0 if ARM64
+	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
+			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \
+			      ROCKCHIP_RK322X || ROCKCHIP_RV1108

If applicable to all ARMv7 SoCs, maybe

Quoted 3 lines

if CPU_V7A

would be more future-proof?

Unfortunately that does not seem to be the case, most new RK SoCs seem to use 0x0 as DRAM base, with RK3576 being the odd one, or possible start of a new trend.

Following ARMv7 SoCs seem to use 0x0 as DRAM base:
- RK3288
- RK3506
- RV1103B
- RV1106
- RV1126

For the RK3506 I have been playing with recently the OP-TEE (for psci) is instead placed at start of DRAM and SPL must be put somewhere else, vendor place it at 63 MiB offset, I decided to put SPL at 0.5 MiB instead of 0x0, so that could require a few more default lines :-S

Regards,
Jonas

Quoted 3 lines

Cheers,
Quentin

#9 lore raw

PATCH 3/5 rockchip: Move imply ROCKCHIP_COMMON_STACK_ADDR under SoC Kconfig symbol

In reply to Jonas Karlman

The ROCKCHIP_COMMON_STACK_ADDR Kconfig option was originally enabled in the SoC specific Kconfig files to ease during the initial migration to use common stack addresses.

All boards for the affected SoCs have been migrated to use common stack addresses. Migrate to use an imply under the SoC symbol instead of re-define the symbol in each SoC specific Kconfig file.

---
 arch/arm/mach-rockchip/Kconfig        | 6 ++++++
 arch/arm/mach-rockchip/px30/Kconfig   | 3 ---
 arch/arm/mach-rockchip/rk3308/Kconfig | 3 ---
 arch/arm/mach-rockchip/rk3328/Kconfig | 3 ---
 arch/arm/mach-rockchip/rk3399/Kconfig | 3 ---
 arch/arm/mach-rockchip/rk3568/Kconfig | 3 ---
 arch/arm/mach-rockchip/rk3588/Kconfig | 3 ---
 7 files changed, 6 insertions(+), 18 deletions(-)
arch/arm/mach-rockchip/Kconfig +6 -0
index da20d3233fe3..a71988485825 100644
@@ -15,6 +15,7 @@ config ROCKCHIP_PX30
 	select TPL_SERIAL
 	select DEBUG_UART_BOARD_INIT
 	imply ROCKCHIP_COMMON_BOARD
+	imply ROCKCHIP_COMMON_STACK_ADDR
 	imply SPL_ROCKCHIP_COMMON_BOARD
 	imply TPL_LIBGENERIC_SUPPORT
 	imply ARMV8_CRYPTO
@@ -176,6 +177,7 @@ config ROCKCHIP_RK3308
 	imply OF_UPSTREAM
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
+	imply ROCKCHIP_COMMON_STACK_ADDR
 	imply ROCKCHIP_OTP
 	imply SPL_CLK
 	imply SPL_DM_SEQ_ALIAS
@@ -208,6 +210,7 @@ config ROCKCHIP_RK3328
 	imply OF_UPSTREAM
 	imply PRE_CONSOLE_BUFFER
 	imply ROCKCHIP_COMMON_BOARD
+	imply ROCKCHIP_COMMON_STACK_ADDR
 	imply ROCKCHIP_EFUSE
 	imply ROCKCHIP_SDRAM_COMMON
 	imply SPL_ROCKCHIP_COMMON_BOARD
@@ -286,6 +289,7 @@ config ROCKCHIP_RK3399
 	imply PRE_CONSOLE_BUFFER
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
+	imply ROCKCHIP_COMMON_STACK_ADDR
 	imply ROCKCHIP_EFUSE
 	imply ROCKCHIP_SDRAM_COMMON
 	imply SPL_DM_SEQ_ALIAS
@@ -335,6 +339,7 @@ config ROCKCHIP_RK3568
 	imply PHY_GIGE if DWC_ETH_QOS_ROCKCHIP
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
+	imply ROCKCHIP_COMMON_STACK_ADDR
 	imply ROCKCHIP_OTP
 	imply SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
 	imply SPL_MMC_HS200_SUPPORT if SPL_MMC && MMC_HS200_SUPPORT
@@ -368,6 +373,7 @@ config ROCKCHIP_RK3588
 	imply PHY_GIGE if DWC_ETH_QOS_ROCKCHIP
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
+	imply ROCKCHIP_COMMON_STACK_ADDR
 	imply ROCKCHIP_OTP
 	imply SCMI_FIRMWARE
 	imply SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
arch/arm/mach-rockchip/px30/Kconfig +0 -3
index dcf9eb8144b8..2b57b1668942 100644
@@ -68,9 +68,6 @@ config ROCKCHIP_STIMER_BASE
 config SYS_SOC
 	default "px30"
 
-config ROCKCHIP_COMMON_STACK_ADDR
-	default y
-
 config SYS_MALLOC_F_LEN
 	default 0x400 if !SPL_SHARES_INIT_SP_ADDR
 
arch/arm/mach-rockchip/rk3308/Kconfig +0 -3
index fac966207a92..06572d545f6e 100644
@@ -17,9 +17,6 @@ config ROCKCHIP_STIMER_BASE
 config SYS_SOC
 	default "rk3308"
 
-config ROCKCHIP_COMMON_STACK_ADDR
-	default y
-
 config TEXT_BASE
 	default 0x00600000
 
arch/arm/mach-rockchip/rk3328/Kconfig +0 -3
index 70770da5fdf2..ec1dae8d413a 100644
@@ -21,9 +21,6 @@ config ROCKCHIP_STIMER_BASE
 config SYS_SOC
 	default "rk3328"
 
-config ROCKCHIP_COMMON_STACK_ADDR
-	default y
-
 config TPL_LDSCRIPT
 	default "arch/arm/mach-rockchip/u-boot-tpl-v8.lds"
 
arch/arm/mach-rockchip/rk3399/Kconfig +0 -3
index 500cfcd87afd..b2430207ee9d 100644
@@ -143,9 +143,6 @@ config ROCKCHIP_STIMER_BASE
 config SYS_SOC
 	default "rk3399"
 
-config ROCKCHIP_COMMON_STACK_ADDR
-	default y
-
 config TPL_LDSCRIPT
 	default "arch/arm/mach-rockchip/u-boot-tpl-v8.lds"
 
arch/arm/mach-rockchip/rk3568/Kconfig +0 -3
index ce327ed6f9e0..c589fd586993 100644
@@ -71,9 +71,6 @@ config ROCKCHIP_STIMER_BASE
 config SYS_SOC
 	default "rk3568"
 
-config ROCKCHIP_COMMON_STACK_ADDR
-	default y
-
 config TEXT_BASE
 	default 0x00a00000
 
arch/arm/mach-rockchip/rk3588/Kconfig +0 -3
index 155b8f00ca2c..efd192068ad1 100644
@@ -420,9 +420,6 @@ config ROCKCHIP_STIMER_BASE
 config SYS_SOC
 	default "rk3588"
 
-config ROCKCHIP_COMMON_STACK_ADDR
-	default y
-
 config TEXT_BASE
 	default 0x00a00000
 
Signature · 1 line
2.48.1
#10 lore raw

PATCH 4/5 rockchip: Move imply ROCKCHIP_EXTERNAL_TPL under SoC Kconfig symbol

In reply to Jonas Karlman

New Rockchip SoCs will typically require use or an external TPL when support for the SoC is added to U-Boot.

Move imply ROCKCHIP_EXTERNAL_TPL under SoC Kconfig symbol to remove a future likelihood of a long "default y if" line.

---
 arch/arm/mach-rockchip/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +3 -1
index a71988485825..ef5ad72dd089 100644
@@ -178,6 +178,7 @@ config ROCKCHIP_RK3308
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
 	imply ROCKCHIP_COMMON_STACK_ADDR
+	imply ROCKCHIP_EXTERNAL_TPL
 	imply ROCKCHIP_OTP
 	imply SPL_CLK
 	imply SPL_DM_SEQ_ALIAS
@@ -340,6 +341,7 @@ config ROCKCHIP_RK3568
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
 	imply ROCKCHIP_COMMON_STACK_ADDR
+	imply ROCKCHIP_EXTERNAL_TPL
 	imply ROCKCHIP_OTP
 	imply SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
 	imply SPL_MMC_HS200_SUPPORT if SPL_MMC && MMC_HS200_SUPPORT
@@ -374,6 +376,7 @@ config ROCKCHIP_RK3588
 	imply RNG_ROCKCHIP
 	imply ROCKCHIP_COMMON_BOARD
 	imply ROCKCHIP_COMMON_STACK_ADDR
+	imply ROCKCHIP_EXTERNAL_TPL
 	imply ROCKCHIP_OTP
 	imply SCMI_FIRMWARE
 	imply SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
@@ -500,7 +503,6 @@ config TPL_ROCKCHIP_COMMON_BOARD
 
 config ROCKCHIP_EXTERNAL_TPL
 	bool "Use external TPL binary"
-	default y if ROCKCHIP_RK3308 || ROCKCHIP_RK3568 || ROCKCHIP_RK3588
 	help
 	  Some Rockchip SoCs require an external TPL to initialize DRAM.
 	  Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
Signature · 1 line
2.48.1
#11 lore raw

PATCH 5/5 rockchip: Add RK3576 support for ROCKCHIP_COMMON_STACK_ADDR

In reply to Jonas Karlman

The Rockchip RK3576 SoC uses a different DRAM base address, 0x40000000, compared to prior SoCs.

Add default options that should work when 0x40000000 is used as DRAM base address. Use same offsets as before, just below 64 MiB.

---
Cc: Heiko Stuebner <[email protected]>

---
 arch/arm/mach-rockchip/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/mach-rockchip/Kconfig +11 -0
index ef5ad72dd089..2166807de5ce 100644
@@ -646,28 +646,34 @@ if ROCKCHIP_COMMON_STACK_ADDR && SPL_SHARES_INIT_SP_ADDR
 
 config CUSTOM_SYS_INIT_SP_ADDR
 	default 0x63f00000 if SPL_TEXT_BASE = 0x60000000
+	default 0x43f00000 if SPL_TEXT_BASE = 0x40000000
 	default 0x03f00000 if SPL_TEXT_BASE = 0x00000000
 
 config SYS_MALLOC_F_LEN
 	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x43f00000
 	default 0x10000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config SPL_SYS_MALLOC_F_LEN
 	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x43f00000
 	default 0x8000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config TPL_SYS_MALLOC_F_LEN
 	default 0x0800 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x43f00000
 	default 0x4000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config TEXT_BASE
 	default 0x60200000 if SPL_TEXT_BASE = 0x60000000
+	default 0x40200000 if SPL_TEXT_BASE = 0x40000000
 	default 0x00200000 if SPL_TEXT_BASE = 0x00000000
 
 config SPL_TEXT_BASE
 	default 0x60000000 if ROCKCHIP_RK3036 || ROCKCHIP_RK3066 || \
 			      ROCKCHIP_RK3128 || ROCKCHIP_RK3188 || \
 			      ROCKCHIP_RK322X || ROCKCHIP_RV1108
+	default 0x40000000 if ROCKCHIP_RK3576
 	default 0x00000000
 
 config SPL_HAS_BSS_LINKER_SECTION
@@ -675,22 +681,27 @@ config SPL_HAS_BSS_LINKER_SECTION
 
 config SPL_BSS_START_ADDR
 	default 0x63f80000 if SPL_TEXT_BASE = 0x60000000
+	default 0x43f80000 if SPL_TEXT_BASE = 0x40000000
 	default 0x03f80000 if SPL_TEXT_BASE = 0x00000000
 
 config SPL_BSS_MAX_SIZE
 	default 0x8000 if SPL_BSS_START_ADDR = 0x63f80000
+	default 0x8000 if SPL_BSS_START_ADDR = 0x43f80000
 	default 0x8000 if SPL_BSS_START_ADDR = 0x03f80000
 
 config SPL_STACK_R
 	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x43f00000
 	default y if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config SPL_STACK_R_ADDR
 	default 0x63e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x63f00000
+	default 0x43e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x43f00000
 	default 0x03e00000 if CUSTOM_SYS_INIT_SP_ADDR = 0x03f00000
 
 config SPL_STACK_R_MALLOC_SIMPLE_LEN
 	default 0x200000 if SPL_STACK_R_ADDR = 0x63e00000
+	default 0x200000 if SPL_STACK_R_ADDR = 0x43e00000
 	default 0x200000 if SPL_STACK_R_ADDR = 0x03e00000
 
 endif
Signature · 1 line
2.48.1