[PATCH v2 06/10] mach-snapdragon: Kconfig: changes / additions to support SPL

michael.srba
2026-04-11T07:12:37Z

From: Michael Srba <Michael.Srba@seznam.cz>

An SoC to target has to be selected, e.g. SPL_TARGET_SDM845.
This will select reasonable defaults and enable per-SoC linker
script (if required).

Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
---
arch/arm/Kconfig | 31 +++++++++++++++++++++++++++-
arch/arm/mach-snapdragon/Kconfig | 44 ++++++++++++++++++++++++++++++++++------
2 files changed, 68 insertions(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 03416c55265..8490e336516 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1138,9 +1138,38 @@ config ARCH_SNAPDRAGON
select SAVE_PREV_BL_FDT_ADDR if !ENABLE_ARM_SOC_BOOT0_HOOK
select LINUX_KERNEL_IMAGE_HEADER if !ENABLE_ARM_SOC_BOOT0_HOOK
select SYSRESET
- select SYSRESET_PSCI
+ select SYSRESET_PSCI if !SPL
select ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR
select MMU_PGPROT
+ select SUPPORT_SPL
+ select ARMV8_SPL_EXCEPTION_VECTORS if SPL
+ select ENABLE_ARM_SOC_BOOT0_HOOK if SPL
+ select SPL_DM if SPL
+ select SPL_DM_GPIO if SPL
+ select SPL_DM_PMIC if SPL
+ select SPL_DM_USB_GADGET if SPL
+ select SPL_ENV_SUPPORT if SPL
+ select SPL_GPIO if SPL
+ select SPL_HAS_BSS_LINKER_SECTION if SPL
+ select SPL_LIBCOMMON_SUPPORT if SPL
+ select SPL_LIBDISK_SUPPORT if SPL
+ select SPL_LIBGENERIC_SUPPORT if SPL
+ select SPL_MMC if SPL
+ select SPL_OF_REAL if SPL
+ select SPL_OF_CONTROL if SPL
+ select SPL_PINCONF if SPL
+ select SPL_PINCTRL if SPL
+ select SPL_PINCTRL_FULL if SPL
+ select SPL_PINCTRL_GENERIC if SPL
+ select SPL_PINCONF_RECURSIVE if SPL
+ select SPL_PINMUX if SPL
+ select SPL_SPRINTF if SPL
+ select SPL_STRTO if SPL
+ select SPL_USB_GADGET if SPL
+ imply DM_EVENT if USB_DWC3_GENERIC || SPL_USB_DWC3_GENERIC
+ imply SPL_EVENT if SPL_USB_DWC3_GENERIC
+ imply OF_LIVE if USB_DWC3_GENERIC
+ imply SPL_OF_LIVE if SPL_USB_DWC3_GENERIC
imply OF_UPSTREAM
imply CMD_DM
imply DM_USB_GADGET
diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig
index 976c0e35fce..74d687ceee2 100644
--- a/arch/arm/mach-snapdragon/Kconfig
+++ b/arch/arm/mach-snapdragon/Kconfig
@@ -11,18 +11,12 @@ config SYS_VENDOR
Based on this option board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD>
will be used as the custom board directory.

-config SYS_MALLOC_LEN
- default 0x10000000
-
config SYS_MALLOC_F_LEN
default 0x2000

config SPL_SYS_MALLOC_F
default y

-config SPL_SYS_MALLOC_F_LEN
- default 0x2000
-
config SYS_MALLOC_LEN
default 0x800000

@@ -45,4 +39,42 @@ config SYS_CONFIG_NAME
Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
will be used for board configuration.

+config SPL_SHARES_INIT_SP_ADDR
+ default n
+
+config SPL_HAVE_INIT_STACK
+ default y
+
+# SPL targets
+
+config SPL_TARGET_SDM845
+ bool "Set reasonable default values for running SPL in SRAM on sdm845 devices"
+
+# config options selected based on target
+
+config SPL_REMAKE_ELF_LDSCRIPT
+ default "arch/arm/mach-snapdragon/u-boot-spl-elf-sdm845.lds" if SPL_TARGET_SDM845
+
+# Modern Qualcomm platforms have two sets of SRAM memory easily available to us,
+# BOOT_IMEM and OCIMEM. See doc/board/qualcomm/spl.rst for more info.
+
+config SPL_BSS_START_ADDR
+ default 0x14680000 if SPL_TARGET_SDM845 # start of OCIMEM
+
+config SPL_BSS_MAX_SIZE
+ default 0x2000 if SPL_TARGET_SDM845 # leaves 0x1e000 for the stack in worst case
+
+# this starts at the end of .bss
+config SPL_SYS_MALLOC_F_LEN
+ default 0x20000 if SPL_TARGET_SDM845 # arbitrarily half of OCIMEM size
+
+config SPL_STACK
+ default 0x146bffff if SPL_TARGET_SDM845 # end of OCIMEM
+
+config SPL_TEXT_BASE
+ default 0x1483f000 if SPL_TARGET_SDM845 # start of largest continuous block of BOOT_IMEM in BROM whitelist
+
+config SPL_MAX_SIZE
+ default 0xc1000 if SPL_TARGET_SDM845 # size of largest continuous block of BOOT_IMEM in BROM whitelist
+
endif

--
2.53.0