From a47b1e165e69418ef66fe74b32b2df170fe68907 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 11 Dec 2025 17:34:55 +0100 Subject: spl: Kconfig: Add missing SPL_LOAD_BLOCK for SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE We need to explicitly select SPL_LOAD_BLOCK when USE_PARTITION_TYPE is enabled, just like the other choices do. Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") Signed-off-by: Jan Kiszka Reviewed-by: Tien Fong Chee --- common/spl/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'common') diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 3b7b6cafef8..142cdb34cd5 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -573,6 +573,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE bool "MMC raw mode: by partition type" + select SPL_LOAD_BLOCK depends on DOS_PARTITION help Use partition type for specifying U-Boot partition on MMC/SD in -- cgit v1.2.3 From 94d0c1d3edb4a71b49c1ff85f5f3990c727bcaba Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 11 Dec 2025 17:34:56 +0100 Subject: spl: mmc: Account for SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE being a choice Add SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE as condition where so far SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION was enough - though often by chance as both options were enabled. Reorder the #ifdef blocks at this chance to follow the order in the Kconfig menu. Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") Signed-off-by: Jan Kiszka Reviewed-by: Tien Fong Chee --- common/spl/spl_mmc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index d8ce3a84614..1942e417075 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -106,7 +106,8 @@ static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev) return 0; } -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \ + defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE) static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, struct spl_boot_device *bootdev, struct mmc *mmc, int partition, @@ -419,19 +420,19 @@ int spl_mmc_load(struct spl_image_info *spl_image, raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect); -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION - ret = mmc_load_image_raw_partition(spl_image, bootdev, - mmc, raw_part, - raw_sect); - if (!ret) - return 0; -#endif #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc, raw_sect + spl_mmc_raw_uboot_offset(part)); if (!ret) return 0; +#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \ + defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE) + ret = mmc_load_image_raw_partition(spl_image, bootdev, + mmc, raw_part, + raw_sect); + if (!ret) + return 0; #endif /* If RAW mode fails, try FS mode. */ fallthrough; -- cgit v1.2.3 From 62584916c9f7b029e8a43d7102189713b365d241 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 11 Dec 2025 17:34:57 +0100 Subject: spl: mmc: Respect sector value passed to mmc_load_image_raw_partition This function and the sector parameter evolved over the time. By now, sector is influenced by spl_mmc_get_uboot_raw_sector which allows to adjust the read sector with an offset that U-Boot proper may have inside the partition. That used to work by chance if both CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION were enabled. Since 2a00d73d081a they are a choice, and we need to drop the condition to maintain this feature. Signed-off-by: Jan Kiszka Reviewed-by: Tien Fong Chee --- common/spl/spl_mmc.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'common') diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 1942e417075..47cfe4aef58 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -137,11 +137,7 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, return ret; } -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start + sector); -#else - return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start); -#endif } #endif -- cgit v1.2.3