mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
dm: mmc: Allow driver model to be used for MMC in SPL
Enable MMC using driver model in SPL for consistency with U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
1169299135
commit
dc3dedfeb1
1 changed files with 15 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
* SPDX-License-Identifier: GPL-2.0+
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
*/
|
*/
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <dm.h>
|
||||||
#include <spl.h>
|
#include <spl.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
#include <asm/u-boot.h>
|
#include <asm/u-boot.h>
|
||||||
|
@ -101,9 +102,18 @@ void spl_mmc_load_image(void)
|
||||||
{
|
{
|
||||||
struct mmc *mmc;
|
struct mmc *mmc;
|
||||||
u32 boot_mode;
|
u32 boot_mode;
|
||||||
int err;
|
int err = 0;
|
||||||
__maybe_unused int part;
|
__maybe_unused int part;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DM_MMC
|
||||||
|
struct udevice *dev;
|
||||||
|
|
||||||
|
mmc_initialize(NULL);
|
||||||
|
err = uclass_get_device(UCLASS_MMC, 0, &dev);
|
||||||
|
mmc = NULL;
|
||||||
|
if (!err)
|
||||||
|
mmc = mmc_get_mmc_dev(dev);
|
||||||
|
#else
|
||||||
mmc_initialize(gd->bd);
|
mmc_initialize(gd->bd);
|
||||||
|
|
||||||
/* We register only one device. So, the dev id is always 0 */
|
/* We register only one device. So, the dev id is always 0 */
|
||||||
|
@ -114,8 +124,11 @@ void spl_mmc_load_image(void)
|
||||||
#endif
|
#endif
|
||||||
hang();
|
hang();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!err)
|
||||||
err = mmc_init(mmc);
|
err = mmc_init(mmc);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
|
||||||
printf("spl: mmc init failed with error: %d\n", err);
|
printf("spl: mmc init failed with error: %d\n", err);
|
||||||
|
|
Loading…
Reference in a new issue