diff options
| author | Ye Li <[email protected]> | 2026-04-28 16:32:50 +0800 |
|---|---|---|
| committer | Fabio Estevam <[email protected]> | 2026-05-15 17:31:39 -0300 |
| commit | f745c1ab4eaaf16fe8b6df7c0a37c3068ad7331b (patch) | |
| tree | c36ebca043218c55f99545a933f27b20430b9dee /arch | |
| parent | 9dd6b95453b28426d081dfa21f600870fddd5c6f (diff) | |
imx9: scmi: Support iMX95/94/952 secondary boot
When ROM boots from secondary container set, SPL should select
correct offset to load u-boot-atf container.
The implementation uses ROM passover information:
1) For non-eMMC boot partition device, use image offset in ROM
passover data to get u-boot-atf container offset.
2) For eMMC boot partition device, use boot stage (secondary)
in ROM passover data to select correct eMMC boot partition
for u-boot-atf container.
Signed-off-by: Ye Li <[email protected]>
Reviewed-by: Peng Fan <[email protected]>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/include/asm/arch-imx9/sys_proto.h | 4 | ||||
| -rw-r--r-- | arch/arm/mach-imx/image-container.c | 27 | ||||
| -rw-r--r-- | arch/arm/mach-imx/imx9/scmi/soc.c | 30 |
3 files changed, 47 insertions, 14 deletions
diff --git a/arch/arm/include/asm/arch-imx9/sys_proto.h b/arch/arm/include/asm/arch-imx9/sys_proto.h index 73df8715f22..b5e7d7d6855 100644 --- a/arch/arm/include/asm/arch-imx9/sys_proto.h +++ b/arch/arm/include/asm/arch-imx9/sys_proto.h @@ -23,7 +23,9 @@ int low_drive_freq_update(void *blob); enum imx9_soc_voltage_mode soc_target_voltage_mode(void); int get_reset_reason(bool sys, bool lm); -u8 imx95_detect_secondary_image_boot(void); +int scmi_get_boot_device_offset(unsigned long *img_off); +int scmi_get_boot_stage(u8 *stage); +u8 scmi_get_imgset_sel(void); #define is_voltage_mode(mode) (soc_target_voltage_mode() == (mode)) diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c index 63cf8596316..bdb43d138f2 100644 --- a/arch/arm/mach-imx/image-container.c +++ b/arch/arm/mach-imx/image-container.c @@ -225,15 +225,9 @@ static bool check_secondary_cnt_set(unsigned long *set_off) } } } -#elif IS_ENABLED(CONFIG_IMX95) - u8 img_set_sel = imx95_detect_secondary_image_boot(); - - *set_off = img_set_sel ? 0x400000 : 0; +#endif - return !!img_set_sel; -#else return false; -#endif } static unsigned long get_boot_device_offset(void *dev, int dev_type) @@ -246,6 +240,14 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type) return offset; } +#if IS_ENABLED(CONFIG_ARCH_IMX9) && IS_ENABLED(CONFIG_SCMI_FIRMWARE) + int ret; + ret = scmi_get_boot_device_offset(&offset); + if (!ret) + return offset; + /* fall back to boot from primary set if get rom passover failed */ +#endif + sec_boot = check_secondary_cnt_set(&sec_set_off); if (sec_boot) printf("Secondary set selected\n"); @@ -372,10 +374,17 @@ int spl_mmc_emmc_boot_partition(struct mmc *mmc) part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); if (part == EMMC_BOOT_PART_BOOT1 || part == EMMC_BOOT_PART_BOOT2) { - unsigned long sec_set_off = 0; bool sec_boot = false; - +#if IS_ENABLED(CONFIG_ARCH_IMX9) && IS_ENABLED(CONFIG_SCMI_FIRMWARE) + u8 stage; + int ret; + ret = scmi_get_boot_stage(&stage); + if (!ret) + sec_boot = (stage == 0x9); +#else + unsigned long sec_set_off = 0; sec_boot = check_secondary_cnt_set(&sec_set_off); +#endif if (sec_boot) part = (part == EMMC_BOOT_PART_BOOT1) ? EMMC_HWPART_BOOT2 : EMMC_HWPART_BOOT1; } else if (part == EMMC_BOOT_PART_USER) { diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c index 47e8fc247df..60fdd577f55 100644 --- a/arch/arm/mach-imx/imx9/scmi/soc.c +++ b/arch/arm/mach-imx/imx9/scmi/soc.c @@ -745,8 +745,31 @@ void build_info(void) puts("\n"); } -#if IS_ENABLED(CONFIG_IMX95) -u8 imx95_detect_secondary_image_boot(void) +int scmi_get_boot_device_offset(unsigned long *img_off) +{ + int ret; + rom_passover_t rom_data = {0}; + + ret = scmi_get_rom_data(&rom_data); + if (!ret) + *img_off = rom_data.img_ofs; + + return 0; +} + +int scmi_get_boot_stage(u8 *stage) +{ + int ret; + rom_passover_t rom_data = {0}; + + ret = scmi_get_rom_data(&rom_data); + if (!ret) + *stage = rom_data.boot_stage; + + return ret; +} + +u8 scmi_get_imgset_sel(void) { rom_passover_t rdata = { 0 }; int ret = scmi_get_rom_data(&rdata); @@ -759,9 +782,8 @@ u8 imx95_detect_secondary_image_boot(void) int boot_mode_getprisec(void) { - return !!imx95_detect_secondary_image_boot(); + return !!scmi_get_imgset_sel(); } -#endif int arch_misc_init(void) { |
