spl: common: Support for USB MSD FAT image loading
Add SPL support to be able to detect a USB Mass Storage device
connected to a USB host. Once a USB Mass storage device is detected
the SPL will load the u-boot.img from a FAT partition to target address.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index 9b40584..1e532d5 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -28,7 +28,7 @@
err = fat_register_device(block_dev, partition);
if (err) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
- printf("spl: fat register err - %d\n", err);
+ printf("%s: fat register err - %d\n", __func__, err);
#endif
hang();
}
@@ -46,7 +46,7 @@
struct image_header *header;
err = spl_register_fat_device(block_dev, partition);
- if (err <= 0)
+ if (err)
goto end;
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
@@ -63,8 +63,8 @@
end:
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
if (err <= 0)
- printf("spl: error reading image %s, err - %d\n",
- filename, err);
+ printf("%s: error reading image %s, err - %d\n",
+ __func__, filename, err);
#endif
return (err <= 0);
@@ -76,15 +76,15 @@
int err;
err = spl_register_fat_device(block_dev, partition);
- if (err <= 0)
- return -1;
+ if (err)
+ return err;
err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME,
(void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
if (err <= 0) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
- printf("spl: error reading image %s, err - %d\n",
- CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
+ printf("%s: error reading image %s, err - %d\n",
+ __func__, CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
#endif
return -1;
}