[PATCH v2 02/14] spl: ufs: add Kconfig choice for U-Boot location method

Varadarajan Narayanan varadarajan.narayanan at oss.qualcomm.com
Thu Jun 11 13:08:06 CEST 2026


On Sat, Jun 06, 2026 at 03:48:33PM +0530, Balaji Selvanathan wrote:
> Replace the single SPL_UFS_RAW_U_BOOT_SECTOR config with a Kconfig
> choice that lets the user select how U-Boot is located on the UFS
> LUN: by absolute sector offset or by partition.
>
> The sector-based path (SPL_UFS_RAW_U_BOOT_USE_SECTOR) retains the
> existing SPL_UFS_RAW_U_BOOT_SECTOR option with an explicit default
> of 0x0.
>
> The partition-based path (SPL_UFS_RAW_U_BOOT_USE_PARTITION) adds
> SPL_UFS_RAW_U_BOOT_PARTITION_NAME and
> SPL_UFS_RAW_U_BOOT_PARTITION_NUM, allowing U-Boot to be loaded by
> partition name (tried first) or partition number as a fallback.
> SPL_LIBDISK_SUPPORT is automatically selected when this path is
> chosen.
>
> Signed-off-by: Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
> ---
> Changes in v2:
> - Introduce SPL_UFS_RAW_U_BOOT_USE_SECTOR to clearly select between
>   sector based or partition based lookup
> ---
>  common/spl/Kconfig | 46 +++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 43 insertions(+), 3 deletions(-)
>
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 10dcb7b2f87..82b757d1efa 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -1634,13 +1634,53 @@ config SPL_UFS_RAW_U_BOOT_DEVNUM
>  	  SCSI device number, which might differ from the UFS LUN if you have
>  	  multiple SCSI devices attached and recognized by the SPL.
>
> -config SPL_UFS_RAW_U_BOOT_SECTOR
> -	hex "Address on the UFS to load U-Boot from"
> +choice
> +	prompt "Method for locating U-Boot on UFS"
>  	depends on SPL_UFS
> +	default SPL_UFS_RAW_U_BOOT_USE_SECTOR
> +
> +config SPL_UFS_RAW_U_BOOT_USE_SECTOR
> +	bool "UFS raw mode: by sector"
> +	help
> +	  Use absolute sector number for specifying U-Boot location on UFS LUN.
> +	  When selected, SPL_UFS_RAW_U_BOOT_SECTOR specifies the sector offset.
> +
> +config SPL_UFS_RAW_U_BOOT_USE_PARTITION
> +	bool "UFS raw mode: by partition"
> +	select SPL_LIBDISK_SUPPORT
> +	help
> +	  Use a partition for loading U-Boot when using UFS in raw mode.
> +	  You can specify either a partition name or partition number.
> +
> +endchoice
> +
> +config SPL_UFS_RAW_U_BOOT_SECTOR
> +	hex "Sector offset to load U-Boot from in UFS raw mode"
> +	depends on SPL_UFS_RAW_U_BOOT_USE_SECTOR
>  	default 0x800 if ARCH_ROCKCHIP
> +	default 0x0
>  	help
> -	  Address on the block device to load U-Boot from.
> +	  Absolute sector offset on the UFS LUN to load U-Boot from.
>  	  Units: UFS sectors (1 sector = 4096 bytes).
> +	  Note: Setting this to 0x0 will load from the start of the LUN.
> +
> +config SPL_UFS_RAW_U_BOOT_PARTITION_NAME
> +	string "Partition name to load U-Boot from"
> +	depends on SPL_UFS_RAW_U_BOOT_USE_PARTITION
> +	help
> +	  Name of the partition to load U-Boot from in UFS raw mode.
> +	  This is tried before partition number lookup.
> +	  Leave empty to skip name-based lookup.
> +	  Example: "boot", "uefi", "dtb_a"
> +
> +config SPL_UFS_RAW_U_BOOT_PARTITION_NUM
> +	int "Partition number to load U-Boot from"
> +	depends on SPL_UFS_RAW_U_BOOT_USE_PARTITION
> +	default 1
> +	help
> +	  Partition number to load U-Boot from when using UFS raw mode
> +	  with partition support. This is used if partition name is not
> +	  specified or not found.

Should PARTITION_NAME and PARTITION_NUM be mutually exclusive, or both are
allowed?

>
>  config SPL_WATCHDOG
>  	bool "Support watchdog drivers"

Can this be simplified?

config SPL_UFS_RAW_U_BOOT_USE_PARTITION
	bool "..."
	...

config SPL_UFS_RAW_U_BOOT_PARTITION_NAME
	...

config SPL_UFS_RAW_U_BOOT_PARTITION_NUM
	...

config SPL_UFS_RAW_U_BOOT_SECTOR
	hex "Address on the UFS to load U-Boot from"
	depends on SPL_UFS_SUPPORT && !SPL_UFS_RAW_U_BOOT_USE_PARTITION

-Varada


More information about the U-Boot mailing list