ti: boot: Register the MMC controllers in SPL in the same way as in u-boot

To keep a consistent MMC device mapping in SPL and in u-boot, let's
register the MMC controllers the same way in u-boot and in the SPL.
In terms of boot time, it doesn't hurt to register more controllers than
needed because the MMC device is initialized only prior being accessed for
the first time.
Having the same device mapping in SPL and u-boot allows us to use the
environment in SPL whatever the MMC boot device.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
This commit is contained in:
Jean-Jacques Hiblot 2017-02-01 11:39:14 +01:00 committed by Tom Rini
parent 02ccab1908
commit d5abcf94c7
27 changed files with 30 additions and 43 deletions

View file

@ -111,7 +111,7 @@ static const struct gpio_bank gpio_bank_am33xx[] = {
const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx;
#endif
#if defined(CONFIG_MMC_OMAP_HS) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_MMC_OMAP_HS)
int cpu_mmc_init(bd_t *bis)
{
int ret;

View file

@ -205,21 +205,6 @@ void spl_board_init(void)
#endif
}
__weak int board_mmc_init(bd_t *bis)
{
switch (spl_boot_device()) {
case BOOT_DEVICE_MMC1:
omap_mmc_init(0, 0, 0, -1, -1);
break;
case BOOT_DEVICE_MMC2:
case BOOT_DEVICE_MMC2_2:
omap_mmc_init(0, 0, 0, -1, -1);
omap_mmc_init(1, 0, 0, -1, -1);
break;
}
return 0;
}
void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
{
typedef void __noreturn (*image_entry_noargs_t)(u32 *);

View file

@ -684,7 +684,7 @@ int board_eth_init(bd_t *bis)
return rv;
}
#endif /* defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD) */
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(1, 0, 0, -1, -1);

View file

@ -166,12 +166,10 @@ int fb_set_reboot_flag(void)
return omap_reboot_mode_store("b");
}
#ifndef CONFIG_SPL_BUILD
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(1, 0, 0, -1, -1);
}
#endif
void board_mmc_power_init(void)
{

View file

@ -372,7 +372,7 @@ void set_muxconf_regs(void)
cm_t3730_set_muxconf();
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
#define SB_T35_WP_GPIO 59
int board_mmc_getcd(struct mmc *mmc)

View file

@ -115,7 +115,7 @@ int misc_init_r(void)
return 0;
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
#define SB_T35_CD_GPIO 144
#define SB_T35_WP_GPIO 59

View file

@ -96,7 +96,7 @@ uint mmc_get_env_part(struct mmc *mmc)
}
#endif
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
#define SB_T54_CD_GPIO 228
#define SB_T54_WP_GPIO 229

View file

@ -140,7 +140,7 @@ void set_muxconf_regs(void)
MUX_TRICORDER();
}
#if defined(CONFIG_GENERIC_MMC) && !(defined(CONFIG_SPL_BUILD))
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -110,17 +110,19 @@ void set_muxconf_regs(void)
sizeof(struct pad_conf_entry));
}
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);
}
#if !defined(CONFIG_SPL_BUILD)
void board_mmc_power_init(void)
{
twl6030_power_mmc_init(0);
}
#endif
#endif
#if defined(CONFIG_CMD_NET)

View file

@ -100,7 +100,7 @@ void set_muxconf_regs(void)
MUX_MCX();
}
#if defined(CONFIG_MMC_OMAP_HS) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_MMC_OMAP_HS)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -199,7 +199,7 @@ int board_eth_init(bd_t *bis)
static inline void setup_net_chip(void) {}
#endif
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -179,12 +179,10 @@ int fb_set_reboot_flag(void)
return omap_reboot_mode_store("b");
}
#ifndef CONFIG_SPL_BUILD
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(1, 0, 0, -1, -1);
}
#endif
void board_mmc_power_init(void)
{

View file

@ -152,7 +152,7 @@ void set_muxconf_regs(void)
MUX_AM3517EVM();
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -231,7 +231,7 @@ int board_late_init(void)
}
#endif
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -62,7 +62,7 @@ void set_muxconf_regs(void)
MUX_CAIRO();
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -179,7 +179,7 @@ void set_muxconf_regs(void)
#endif
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -63,7 +63,7 @@ void set_muxconf_regs(void)
MUX_AM3517CRANE();
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -559,7 +559,7 @@ err:
}
#endif
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -524,7 +524,7 @@ void set_muxconf_regs(void)
MUX_BEAGLE();
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -679,7 +679,7 @@ err:
}
#endif
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -259,7 +259,7 @@ int board_eth_init(bd_t *bis)
}
#endif /* CONFIG_CMD_NET */
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -102,7 +102,7 @@ s16 divn_val[16] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
if (psc_enable_module(KS2_LPSC_MMC)) {

View file

@ -211,7 +211,7 @@ void set_muxconf_regs(void)
sizeof(struct pad_conf_entry));
}
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
omap_mmc_init(0, 0, 0, -1, -1);

View file

@ -287,17 +287,19 @@ void set_muxconf_regs(void)
sizeof(struct pad_conf_entry));
}
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);
}
#if !defined(CONFIG_SPL_BUILD)
void board_mmc_power_init(void)
{
twl6030_power_mmc_init(0);
}
#endif
#endif
#ifdef CONFIG_USB_EHCI

View file

@ -73,7 +73,7 @@ void set_muxconf_regs(void)
sizeof(struct pad_conf_entry));
}
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
omap_mmc_init(0, 0, 0, -1, -1);
@ -81,12 +81,14 @@ int board_mmc_init(bd_t *bis)
return 0;
}
#if !defined(CONFIG_SPL_BUILD)
void board_mmc_power_init(void)
{
twl6030_power_mmc_init(0);
twl6030_power_mmc_init(1);
}
#endif
#endif
/*
* get_board_rev() - get board revision

View file

@ -111,7 +111,7 @@ int board_init(void)
return 0;
}
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
omap_mmc_init(1, 0, 0, -1, -1);

View file

@ -131,7 +131,7 @@ void set_muxconf_regs(void)
MUX_DEVKIT8000();
}
#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_GENERIC_MMC)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0, 0, 0, -1, -1);