--- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -7,6 +7,8 @@ * Based vaguely on the Linux code */ +#define DEBUG + #include #include #include @@ -3105,11 +3107,14 @@ int mmc_init_device(int num) struct udevice *dev; struct mmc *m; int ret; - + debug("mmc_init_device: num: %d\n", num); if (uclass_get_device_by_seq(UCLASS_MMC, num, &dev)) { + debug("mmc_init_device: uclass_get_device_by_seq\n"); ret = uclass_get_device(UCLASS_MMC, num, &dev); - if (ret) + if (ret) { + debug("mmc_init_device: uclass_get_device ret : %d\n", ret); return ret; + } } m = mmc_get_mmc_dev(dev); --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -6,6 +6,8 @@ * Aneesh V */ +#define DEBUG + #include #include #include @@ -750,11 +752,13 @@ void board_init_r(gd_t *dummy1, ulong dummy2) debug(">>" SPL_TPL_PROMPT "board_init_r()\n"); + debug("boot_init_r\n"); spl_set_bd(); #if defined(CONFIG_SYS_SPL_MALLOC) mem_malloc_init(SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE); gd->flags |= GD_FLG_FULL_MALLOC_INIT; + debug("boot_init_r: SYS_SPL_MALLOC\n"); #endif if (!(gd->flags & GD_FLG_SPL_INIT)) { if (spl_init()) --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -5,6 +5,9 @@ * * Aneesh V */ + +#define DEBUG + #include #include #include @@ -155,6 +158,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) int err, mmc_dev; mmc_dev = spl_mmc_get_device_index(boot_device); + printf("spl: mmc get device index : %d\n", mmc_dev); if (mmc_dev < 0) return mmc_dev; @@ -305,6 +309,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, #endif #ifdef CONFIG_SPL_FS_FAT + debug("spl: spl_start_uboot ...\n"); if (!spl_start_uboot()) { err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc), partition); @@ -312,6 +317,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME + debug("spl: spl_load_image_fat (%s)...\n", filename); err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc), partition, filename); @@ -423,10 +429,13 @@ int spl_mmc_load(struct spl_image_info *spl_image, /* Perform peripheral init only once for an mmc device */ mmc_dev = spl_mmc_get_device_index(bootdev->boot_device); + printf("spl: mmc_dev: %d\n", mmc_dev); if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) { err = spl_mmc_find_device(&mmc, bootdev->boot_device); - if (err) + if (err) { + printf("spl: mmc find device failed: %d\n", err); return err; + } err = mmc_init(mmc); if (err) { --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -8,6 +8,8 @@ * FAT Image Functions copied from spl_mmc.c */ +#define DEBUG + #include #include #include @@ -62,18 +64,22 @@ int spl_load_image_fat(struct spl_image_info *spl_image, int err; struct legacy_img_hdr *header; + debug("spl: spl_register_fat_device ...\n"); err = spl_register_fat_device(block_dev, partition); if (err) goto end; + debug("spl: spl_get_load_buffer ...\n"); header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); + debug("spl: file_fat_read ...\n"); err = file_fat_read(filename, header, sizeof(struct legacy_img_hdr)); if (err <= 0) goto end; if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) && image_get_magic(header) == FDT_MAGIC) { + debug("spl: Load FIT Full ... filename: %s\n", filename); err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0); if (err <= 0) goto end; @@ -87,14 +93,16 @@ int spl_load_image_fat(struct spl_image_info *spl_image, image_get_magic(header) == FDT_MAGIC) { struct spl_load_info load; - debug("Found FIT\n"); + debug("spl: Found FIT - filename: %s\n", filename); load.read = spl_fit_read; load.bl_len = 1; load.filename = (void *)filename; load.priv = NULL; + debug("spl: spl_load_simple_fit ...\n"); return spl_load_simple_fit(spl_image, &load, 0, header); } else { + debug("spl_parse_image_header ...\n"); err = spl_parse_image_header(spl_image, bootdev, header); if (err) goto end;