mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
spl: mmc: extend spl_mmc_boot_mode() to take mmc argument
Platforms can overwrite the weak definition of spl_mmc_boot_mode() to determine where to load U-Boot proper from. For most of them this is a trivial decision based on Kconfig variables, but it might be desirable the probe the actual device to answer this question. Pass the pointer to the mmc struct to that function, so implementations can make use of that. Compile-tested for all users changed. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Stefano Babic <sbabic@denx.de> Reviewed-by: Ley Foon Tan <ley.foon.tan@inte.com> (for SoCFPGA) Acked-by: Lokesh Vutla <lokeshvutla@ti.com> (for OMAP and K3) Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
35b786c1ba
commit
5907357322
14 changed files with 16 additions and 18 deletions
|
@ -201,7 +201,7 @@ int g_dnl_get_board_bcd_device_number(int gcnum)
|
|||
|
||||
#if defined(CONFIG_SPL_MMC)
|
||||
/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
#if defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8)
|
||||
switch (get_boot_device()) {
|
||||
|
|
|
@ -208,7 +208,7 @@ void board_init_f(ulong dummy)
|
|||
}
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
switch (boot_device) {
|
||||
case BOOT_DEVICE_MMC1:
|
||||
|
|
|
@ -269,7 +269,7 @@ void board_init_f(ulong dummy)
|
|||
spl_enable_dcache();
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
#if defined(CONFIG_SUPPORT_EMMC_BOOT)
|
||||
u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
|
||||
|
|
|
@ -291,7 +291,7 @@ void board_init_f(ulong dummy)
|
|||
spl_enable_dcache();
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
switch (boot_device) {
|
||||
case BOOT_DEVICE_MMC1:
|
||||
|
|
|
@ -173,7 +173,7 @@ void board_init_f(ulong dummy)
|
|||
spl_enable_dcache();
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
switch (boot_device) {
|
||||
case BOOT_DEVICE_MMC1:
|
||||
|
|
|
@ -96,7 +96,7 @@ struct kwbimage_main_hdr_v1 {
|
|||
} __packed;
|
||||
|
||||
#ifdef CONFIG_SPL_MMC
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
return MMCSD_MODE_RAW;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ u32 spl_boot_device(void)
|
|||
return gd->arch.omap_boot_device;
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
return gd->arch.omap_boot_mode;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ u32 spl_boot_device(void)
|
|||
return boot_device;
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
return MMCSD_MODE_RAW;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ u32 spl_boot_device(void)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_SPL_MMC
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
|
||||
return MMCSD_MODE_FS;
|
||||
|
|
|
@ -53,7 +53,7 @@ u32 spl_boot_device(void)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_SPL_MMC
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
|
||||
return MMCSD_MODE_FS;
|
||||
|
|
|
@ -55,7 +55,7 @@ u32 spl_boot_device(void)
|
|||
return BOOT_DEVICE_MMC1;
|
||||
}
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
return MMCSD_MODE_RAW;
|
||||
}
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
#include <mmc.h>
|
||||
#include <spl.h>
|
||||
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
struct mmc *mmc;
|
||||
|
||||
/*
|
||||
* work around a bug in the Boot ROM of LD4, Pro4, and sLD8:
|
||||
*
|
||||
|
@ -24,7 +22,6 @@ u32 spl_mmc_boot_mode(const u32 boot_device)
|
|||
* Fixup mmc->part_config here because it is used to determine the
|
||||
* partition which the U-Boot image is read from.
|
||||
*/
|
||||
mmc = find_mmc_device(0);
|
||||
mmc->part_config &= ~EXT_CSD_BOOT_PART_NUM(PART_ACCESS_MASK);
|
||||
mmc->part_config |= EXT_CSD_BOOT_PARTITION_ENABLE;
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image,
|
|||
}
|
||||
#endif
|
||||
|
||||
u32 __weak spl_mmc_boot_mode(const u32 boot_device)
|
||||
u32 __weak spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
|
||||
{
|
||||
#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
|
||||
return MMCSD_MODE_FS;
|
||||
|
@ -401,7 +401,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
|
|||
}
|
||||
}
|
||||
|
||||
boot_mode = spl_mmc_boot_mode(bootdev->boot_device);
|
||||
boot_mode = spl_mmc_boot_mode(mmc, bootdev->boot_device);
|
||||
err = -EINVAL;
|
||||
switch (boot_mode) {
|
||||
case MMCSD_MODE_EMMCBOOT:
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <asm/global_data.h>
|
||||
#include <asm/spl.h>
|
||||
#include <handoff.h>
|
||||
#include <mmc.h>
|
||||
|
||||
struct blk_desc;
|
||||
struct image_header;
|
||||
|
@ -375,7 +376,7 @@ u32 spl_boot_device(void);
|
|||
* Note: It is important to use the boot_device parameter instead of e.g.
|
||||
* spl_boot_device() as U-Boot is not always loaded from the same device as SPL.
|
||||
*/
|
||||
u32 spl_mmc_boot_mode(const u32 boot_device);
|
||||
u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device);
|
||||
|
||||
/**
|
||||
* spl_mmc_boot_partition() - MMC partition to load U-Boot from.
|
||||
|
|
Loading…
Add table
Reference in a new issue