mmc: Probe DM based mmc devices in u-boot
During mmc initialize probe all devices with the MMC Uclass if build with CONFIG_DM_MMC Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
f2b3017c8e
commit
8e3332e223
|
|
@ -10,6 +10,8 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
|
#include <dm.h>
|
||||||
|
#include <dm/device-internal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
#include <part.h>
|
#include <part.h>
|
||||||
|
|
@ -1759,10 +1761,44 @@ static void do_preinit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_DM_MMC) && defined(CONFIG_SPL_BUILD)
|
||||||
|
static int mmc_probe(bd_t *bis)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_DM_MMC)
|
||||||
|
static int mmc_probe(bd_t *bis)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct uclass *uc;
|
||||||
|
struct udevice *m;
|
||||||
|
|
||||||
|
ret = uclass_get(UCLASS_MMC, &uc);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
uclass_foreach_dev(m, uc) {
|
||||||
|
ret = device_probe(m);
|
||||||
|
if (ret)
|
||||||
|
printf("%s - probe failed: %d\n", m->name, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static int mmc_probe(bd_t *bis)
|
||||||
|
{
|
||||||
|
if (board_mmc_init(bis) < 0)
|
||||||
|
cpu_mmc_init(bis);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int mmc_initialize(bd_t *bis)
|
int mmc_initialize(bd_t *bis)
|
||||||
{
|
{
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
|
int ret;
|
||||||
if (initialized) /* Avoid initializing mmc multiple times */
|
if (initialized) /* Avoid initializing mmc multiple times */
|
||||||
return 0;
|
return 0;
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
|
|
@ -1770,10 +1806,9 @@ int mmc_initialize(bd_t *bis)
|
||||||
INIT_LIST_HEAD (&mmc_devices);
|
INIT_LIST_HEAD (&mmc_devices);
|
||||||
cur_dev_num = 0;
|
cur_dev_num = 0;
|
||||||
|
|
||||||
#ifndef CONFIG_DM_MMC
|
ret = mmc_probe(bis);
|
||||||
if (board_mmc_init(bis) < 0)
|
if (ret)
|
||||||
cpu_mmc_init(bis);
|
return ret;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONFIG_SPL_BUILD
|
#ifndef CONFIG_SPL_BUILD
|
||||||
print_mmc_devices(',');
|
print_mmc_devices(',');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue