load.read = h_spl_load_read;
ret = spl_load(spl_image, bootdev, &load, 0, sector << bd->log2blksz);
if (ret) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
puts("mmc_load_image_raw_sector: mmc block read error\n");
-#endif
return -1;
}
return 1;
}
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("spl: unsupported mmc boot device.\n");
-#endif
return -ENODEV;
}
err = mmc_initialize(NULL);
#endif /* DM_MMC */
if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("spl: could not initialize mmc. error: %d\n", err);
-#endif
return err;
}
*mmcp = find_mmc_device(mmc_dev);
err = *mmcp ? 0 : -ENODEV;
if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("spl: could not find mmc device %d. error: %d\n",
mmc_dev, err);
-#endif
return err;
}
err = part_get_info(mmc_get_blk_desc(mmc), partition, &info);
if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
puts("spl: partition error\n");
-#endif
- return -1;
+ return -err;
}
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
(void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
puts("mmc_load_image_raw_os: mmc block read error\n");
-#endif
return -1;
}
#endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */
err = mmc_init(mmc);
if (err) {
mmc = NULL;
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("spl: mmc init failed with error: %d\n", err);
-#endif
return err;
}
}
err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
puts("spl: mmc partition switch failed\n");
-#endif
return err;
}
/* Fall through */
break;
#endif
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
default:
puts("spl: mmc: wrong boot mode\n");
-#endif
}
return err;