Message ID | 20220402221701.18498-4-pali@kernel.org |
---|---|
State | Accepted |
Commit | 57d527e753bb5efe89fceea341e7d327bf58e312 |
Delegated to: | Priyanka Jain |
Headers | show |
Series | mmc: fsl_esdhc_spl: Fix booting P2020 from SD card | expand |
On 4/3/22 07:17, Pali Rohár wrote: > If env is stored on SD card then U-Boot SPL automatically calls mmc_init() > before it is going to load proper U-Boot from SD card. > > If env is not stored on SD card then U-Boot SPL fails to read proper U-Boot > from SD card due to missing mmc_init() call. > > So add missing mmc_init() call into fsl_esdhc_spl's mmc_boot() function. > It fixes booting from SD card on P2020 boards without env support in SPL. > > mmc_init() returns early if card was already initialized, so there is no > issue with calling this function more times. > > Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Best Regards, Jaehoon Chung > --- > drivers/mmc/fsl_esdhc_spl.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c > index b87597a88e1d..0146a231b221 100644 > --- a/drivers/mmc/fsl_esdhc_spl.c > +++ b/drivers/mmc/fsl_esdhc_spl.c > @@ -77,6 +77,11 @@ void __noreturn mmc_boot(void) > hang(); > } > > + if (mmc_init(mmc)) { > + puts("spl: mmc device init failed!\n"); > + hang(); > + } > + > #ifdef CONFIG_FSL_CORENET > offset = CONFIG_SYS_MMC_U_BOOT_OFFS; > #else
diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c index b87597a88e1d..0146a231b221 100644 --- a/drivers/mmc/fsl_esdhc_spl.c +++ b/drivers/mmc/fsl_esdhc_spl.c @@ -77,6 +77,11 @@ void __noreturn mmc_boot(void) hang(); } + if (mmc_init(mmc)) { + puts("spl: mmc device init failed!\n"); + hang(); + } + #ifdef CONFIG_FSL_CORENET offset = CONFIG_SYS_MMC_U_BOOT_OFFS; #else
If env is stored on SD card then U-Boot SPL automatically calls mmc_init() before it is going to load proper U-Boot from SD card. If env is not stored on SD card then U-Boot SPL fails to read proper U-Boot from SD card due to missing mmc_init() call. So add missing mmc_init() call into fsl_esdhc_spl's mmc_boot() function. It fixes booting from SD card on P2020 boards without env support in SPL. mmc_init() returns early if card was already initialized, so there is no issue with calling this function more times. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/mmc/fsl_esdhc_spl.c | 5 +++++ 1 file changed, 5 insertions(+)