summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2014-02-11 12:55:32 +0100
committerStefano Babic <sbabic@denx.de>2014-02-11 12:55:32 +0100
commit17998eff9021b7b579c0387e934d8c52603fe247 (patch)
treeedc3ef069db4cdaf9c718ae60e095caf42cd1d0d /common
parent6ba45cc0f8b46533965219cfd90864a60ec1009b (diff)
parente97f9d817e600cd6f43d1d0da76f5787e33a5c56 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'common')
-rw-r--r--common/Makefile4
-rw-r--r--common/board_r.c10
-rw-r--r--common/cmd_bootm.c21
-rw-r--r--common/cmd_sf.c14
-rw-r--r--common/cmd_usb_mass_storage.c24
-rw-r--r--common/command.c4
-rw-r--r--common/env_callback.c9
-rw-r--r--common/env_eeprom.c5
-rw-r--r--common/env_flags.c8
-rw-r--r--common/fdt_support.c4
-rw-r--r--common/image.c2
-rw-r--r--common/spl/Makefile2
-rw-r--r--common/spl/spl.c5
-rw-r--r--common/spl/spl_fat.c96
-rw-r--r--common/spl/spl_mmc.c68
-rw-r--r--common/spl/spl_usb.c58
16 files changed, 248 insertions, 86 deletions
diff --git a/common/Makefile b/common/Makefile
index d12cba5bf0d..4d99ecd6168 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -197,6 +197,10 @@ obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o
obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
+ifdef CONFIG_SPL_USB_HOST_SUPPORT
+obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
+obj-$(CONFIG_USB_STORAGE) += usb_storage.o
+endif
ifneq ($(CONFIG_SPL_NET_SUPPORT),y)
obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
diff --git a/common/board_r.c b/common/board_r.c
index 86ca1cbbd4e..c2d0763b576 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -903,9 +903,19 @@ init_fnc_t init_sequence_r[] = {
void board_init_r(gd_t *new_gd, ulong dest_addr)
{
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+ int i;
+#endif
+
#ifndef CONFIG_X86
gd = new_gd;
#endif
+
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+ for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
+ init_sequence_r[i] += gd->reloc_off;
+#endif
+
if (initcall_run_list(init_sequence_r))
hang();
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 3f576594d17..a59ee95a698 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -82,6 +82,9 @@ static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
static void fixup_silent_linux(void);
#endif
+static int do_bootm_standalone(int flag, int argc, char * const argv[],
+ bootm_headers_t *images);
+
static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[], bootm_headers_t *images,
ulong *os_data, ulong *os_len);
@@ -139,6 +142,7 @@ static boot_os_fn do_bootm_integrity;
#endif
static boot_os_fn *boot_os[] = {
+ [IH_OS_U_BOOT] = do_bootm_standalone,
#ifdef CONFIG_BOOTM_LINUX
[IH_OS_LINUX] = do_bootm_linux,
#endif
@@ -499,17 +503,18 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
return 0;
}
-static int bootm_start_standalone(int argc, char * const argv[])
+static int do_bootm_standalone(int flag, int argc, char * const argv[],
+ bootm_headers_t *images)
{
char *s;
int (*appl)(int, char * const []);
/* Don't start if "autostart" is set to "no" */
if (((s = getenv("autostart")) != NULL) && (strcmp(s, "no") == 0)) {
- setenv_hex("filesize", images.os.image_len);
+ setenv_hex("filesize", images->os.image_len);
return 0;
}
- appl = (int (*)(int, char * const []))(ulong)ntohl(images.ep);
+ appl = (int (*)(int, char * const []))(ulong)ntohl(images->ep);
(*appl)(argc, argv);
return 0;
}
@@ -535,14 +540,12 @@ static cmd_tbl_t cmd_bootm_sub[] = {
static int boot_selected_os(int argc, char * const argv[], int state,
bootm_headers_t *images, boot_os_fn *boot_fn)
{
- if (images->os.type == IH_TYPE_STANDALONE) {
- /* This may return when 'autostart' is 'no' */
- bootm_start_standalone(argc, argv);
- return 0;
- }
arch_preboot_os();
boot_fn(state, argc, argv, images);
- if (state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */
+
+ /* Stand-alone may return when 'autostart' is 'no' */
+ if (images->os.type == IH_TYPE_STANDALONE ||
+ state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */
return 0;
bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
#ifdef DEBUG
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index 3994b0651c5..b4ceb714663 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -358,7 +358,8 @@ static void show_time(struct test_info *test, int stage)
int bps; /* Bits per second */
speed = (long long)test->bytes * 1000;
- do_div(speed, test->time_ms[stage] * 1024);
+ if (test->time_ms[stage])
+ do_div(speed, test->time_ms[stage] * 1024);
bps = speed * 8;
printf("%d %s: %d ticks, %d KiB/s %d.%03d Mbps\n", stage,
@@ -446,11 +447,13 @@ static int do_spi_flash_test(int argc, char * const argv[])
{
unsigned long offset;
unsigned long len;
- uint8_t *buf = (uint8_t *)CONFIG_SYS_TEXT_BASE;
+ uint8_t *buf, *from;
char *endp;
uint8_t *vbuf;
int ret;
+ if (argc < 3)
+ return -1;
offset = simple_strtoul(argv[1], &endp, 16);
if (*argv[1] == 0 || *endp != 0)
return -1;
@@ -460,17 +463,18 @@ static int do_spi_flash_test(int argc, char * const argv[])
vbuf = malloc(len);
if (!vbuf) {
- printf("Cannot allocate memory\n");
+ printf("Cannot allocate memory (%lu bytes)\n", len);
return 1;
}
buf = malloc(len);
if (!buf) {
free(vbuf);
- printf("Cannot allocate memory\n");
+ printf("Cannot allocate memory (%lu bytes)\n", len);
return 1;
}
- memcpy(buf, (char *)CONFIG_SYS_TEXT_BASE, len);
+ from = map_sysmem(CONFIG_SYS_TEXT_BASE, 0);
+ memcpy(buf, from, len);
ret = spi_flash_test(flash, buf, len, offset, vbuf);
free(vbuf);
free(buf);
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 99487f4d0f6..5f557d5f857 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -42,6 +42,30 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
g_dnl_register("ums");
+ /* Timeout unit: seconds */
+ int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
+
+ if (!usb_cable_connected()) {
+ puts("Please connect USB cable.\n");
+
+ while (!usb_cable_connected()) {
+ if (ctrlc()) {
+ puts("\rCTRL+C - Operation aborted.\n");
+ goto exit;
+ }
+ if (!cable_ready_timeout) {
+ puts("\rUSB cable not detected.\n" \
+ "Command exit.\n");
+ goto exit;
+ }
+
+ printf("\rAuto exit in: %.2d s.", cable_ready_timeout);
+ mdelay(1000);
+ cable_ready_timeout--;
+ }
+ puts("\r\n");
+ }
+
while (1) {
usb_gadget_handle_interrupts();
diff --git a/common/command.c b/common/command.c
index 625571dd4d8..597ab4cb4d8 100644
--- a/common/command.c
+++ b/common/command.c
@@ -184,10 +184,10 @@ static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv
/* output full list of commands */
for (; cmdtp != cmdend; cmdtp++) {
if (n_found >= maxv - 2) {
- cmdv[n_found] = "...";
+ cmdv[n_found++] = "...";
break;
}
- cmdv[n_found] = cmdtp->name;
+ cmdv[n_found++] = cmdtp->name;
}
cmdv[n_found] = NULL;
return n_found;
diff --git a/common/env_callback.c b/common/env_callback.c
index 34bb58e4a98..d03fa03a436 100644
--- a/common/env_callback.c
+++ b/common/env_callback.c
@@ -35,6 +35,9 @@ static struct env_clbk_tbl *find_env_callback(const char *name)
return NULL;
}
+static int first_call = 1;
+static const char *callback_list;
+
/*
* Look for a possible callback for a newly added variable
* This is called specifically when the variable did not exist in the hash
@@ -43,11 +46,15 @@ static struct env_clbk_tbl *find_env_callback(const char *name)
void env_callback_init(ENTRY *var_entry)
{
const char *var_name = var_entry->key;
- const char *callback_list = getenv(ENV_CALLBACK_VAR);
char callback_name[256] = "";
struct env_clbk_tbl *clbkp;
int ret = 1;
+ if (first_call) {
+ callback_list = getenv(ENV_CALLBACK_VAR);
+ first_call = 0;
+ }
+
/* look in the ".callbacks" var for a reference to this variable */
if (callback_list != NULL)
ret = env_attr_lookup(callback_list, var_name, callback_name);
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index 0dcdd1fc808..0db2bb63fe1 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -24,7 +24,6 @@ DECLARE_GLOBAL_DATA_PTR;
env_t *env_ptr;
char *env_name_spec = "EEPROM";
-int env_eeprom_bus = -1;
static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
uchar *buffer, unsigned cnt)
@@ -40,8 +39,7 @@ static int eeprom_bus_read(unsigned dev_addr, unsigned offset,
rcode = eeprom_read(dev_addr, offset, buffer, cnt);
#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
- if (old_bus != env_eeprom_bus)
- i2c_set_bus_num(old_bus);
+ i2c_set_bus_num(old_bus);
#endif
return rcode;
@@ -63,6 +61,7 @@ static int eeprom_bus_write(unsigned dev_addr, unsigned offset,
#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
i2c_set_bus_num(old_bus);
#endif
+
return rcode;
}
diff --git a/common/env_flags.c b/common/env_flags.c
index e9b72e60a94..985f92e50e9 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -395,6 +395,9 @@ static int env_parse_flags_to_bin(const char *flags)
return binflags;
}
+static int first_call = 1;
+static const char *flags_list;
+
/*
* Look for possible flags for a newly added variable
* This is called specifically when the variable did not exist in the hash
@@ -403,10 +406,13 @@ static int env_parse_flags_to_bin(const char *flags)
void env_flags_init(ENTRY *var_entry)
{
const char *var_name = var_entry->key;
- const char *flags_list = getenv(ENV_FLAGS_VAR);
char flags[ENV_FLAGS_ATTR_MAX_LEN + 1] = "";
int ret = 1;
+ if (first_call) {
+ flags_list = getenv(ENV_FLAGS_VAR);
+ first_call = 0;
+ }
/* look in the ".flags" and static for a reference to this variable */
ret = env_flags_lookup(flags_list, var_name, flags);
diff --git a/common/fdt_support.c b/common/fdt_support.c
index b9dce994624..f9f358e7e83 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -204,7 +204,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
if ((path == NULL) || force) {
write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
err = fdt_setprop(fdt, nodeoffset,
- "linux,initrd-start", &tmp, sizeof(tmp));
+ "linux,initrd-start", &tmp, addr_cell_len);
if (err < 0) {
printf("WARNING: "
"could not set linux,initrd-start %s.\n",
@@ -213,7 +213,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
}
write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
err = fdt_setprop(fdt, nodeoffset,
- "linux,initrd-end", &tmp, sizeof(tmp));
+ "linux,initrd-end", &tmp, addr_cell_len);
if (err < 0) {
printf("WARNING: could not set linux,initrd-end %s.\n",
fdt_strerror(err));
diff --git a/common/image.c b/common/image.c
index 41453540f26..ae95c3f18aa 100644
--- a/common/image.c
+++ b/common/image.c
@@ -96,9 +96,9 @@ static const table_entry_t uimage_os[] = {
{ IH_OS_PLAN9, "plan9", "Plan 9", },
{ IH_OS_RTEMS, "rtems", "RTEMS", },
{ IH_OS_U_BOOT, "u-boot", "U-Boot", },
+ { IH_OS_VXWORKS, "vxworks", "VxWorks", },
#if defined(CONFIG_CMD_ELF) || defined(USE_HOSTCC)
{ IH_OS_QNX, "qnx", "QNX", },
- { IH_OS_VXWORKS, "vxworks", "VxWorks", },
#endif
#if defined(CONFIG_INTEGRITY) || defined(USE_HOSTCC)
{ IH_OS_INTEGRITY,"integrity", "INTEGRITY", },
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 5c0637b750b..65a1484fc4e 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -16,4 +16,6 @@ obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
obj-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
+obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
+obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
endif
diff --git a/common/spl/spl.c b/common/spl/spl.c
index da31457d5f0..0645cee789f 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -205,6 +205,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_net_load_image("usb_ether");
break;
#endif
+#ifdef CONFIG_SPL_USB_SUPPORT
+ case BOOT_DEVICE_USB:
+ spl_usb_load_image();
+ break;
+#endif
default:
debug("SPL: Un-supported Boot Device\n");
hang();
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
new file mode 100644
index 00000000000..1e532d5963e
--- /dev/null
+++ b/common/spl/spl_fat.c
@@ -0,0 +1,96 @@
+/*
+ * (C) Copyright 2014
+ * Texas Instruments, <www.ti.com>
+ *
+ * Dan Murphy <dmurphy@ti.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * FAT Image Functions copied from spl_mmc.c
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/u-boot.h>
+#include <fat.h>
+#include <image.h>
+
+static int fat_registered;
+
+#ifdef CONFIG_SPL_FAT_SUPPORT
+static int spl_register_fat_device(block_dev_desc_t *block_dev, int partition)
+{
+ int err = 0;
+
+ if (fat_registered)
+ return err;
+
+ err = fat_register_device(block_dev, partition);
+ if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ printf("%s: fat register err - %d\n", __func__, err);
+#endif
+ hang();
+ }
+
+ fat_registered = 1;
+
+ return err;
+}
+
+int spl_load_image_fat(block_dev_desc_t *block_dev,
+ int partition,
+ const char *filename)
+{
+ int err;
+ struct image_header *header;
+
+ err = spl_register_fat_device(block_dev, partition);
+ if (err)
+ goto end;
+
+ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
+ sizeof(struct image_header));
+
+ err = file_fat_read(filename, header, sizeof(struct image_header));
+ if (err <= 0)
+ goto end;
+
+ spl_parse_image_header(header);
+
+ err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
+
+end:
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ if (err <= 0)
+ printf("%s: error reading image %s, err - %d\n",
+ __func__, filename, err);
+#endif
+
+ return (err <= 0);
+}
+
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition)
+{
+ int err;
+
+ err = spl_register_fat_device(block_dev, partition);
+ 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("%s: error reading image %s, err - %d\n",
+ __func__, CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
+#endif
+ return -1;
+ }
+
+ return spl_load_image_fat(block_dev, partition,
+ CONFIG_SPL_FAT_LOAD_KERNEL_NAME);
+}
+#endif
+#endif
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index fc2f2260f88..13fbff082cf 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -10,7 +10,6 @@
#include <spl.h>
#include <asm/u-boot.h>
#include <mmc.h>
-#include <fat.h>
#include <version.h>
#include <image.h>
@@ -69,54 +68,6 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
}
#endif
-#ifdef CONFIG_SPL_FAT_SUPPORT
-static int mmc_load_image_fat(struct mmc *mmc, const char *filename)
-{
- int err;
- struct image_header *header;
-
- header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
- sizeof(struct image_header));
-
- err = file_fat_read(filename, header, sizeof(struct image_header));
- if (err <= 0)
- goto end;
-
- spl_parse_image_header(header);
-
- err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
-
-end:
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
- if (err <= 0)
- printf("spl: error reading image %s, err - %d\n",
- filename, err);
-#endif
-
- return (err <= 0);
-}
-
-#ifdef CONFIG_SPL_OS_BOOT
-static int mmc_load_image_fat_os(struct mmc *mmc)
-{
- int 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);
-#endif
- return -1;
- }
-
- return mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_KERNEL_NAME);
-}
-#endif
-
-#endif
-
void spl_mmc_load_image(void)
{
struct mmc *mmc;
@@ -148,24 +99,17 @@ void spl_mmc_load_image(void)
if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
#endif
err = mmc_load_image_raw(mmc,
- CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
#ifdef CONFIG_SPL_FAT_SUPPORT
} else if (boot_mode == MMCSD_MODE_FAT) {
debug("boot mode - FAT\n");
-
- err = fat_register_device(&mmc->block_dev,
- CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION);
- if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
- printf("spl: fat register err - %d\n", err);
-#endif
- hang();
- }
-
#ifdef CONFIG_SPL_OS_BOOT
- if (spl_start_uboot() || mmc_load_image_fat_os(mmc))
+ if (spl_start_uboot() || spl_load_image_fat_os(&mmc->block_dev,
+ CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION))
#endif
- err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+ err = spl_load_image_fat(&mmc->block_dev,
+ CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
+ CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
#endif
} else {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c
new file mode 100644
index 00000000000..53a9043795f
--- /dev/null
+++ b/common/spl/spl_usb.c
@@ -0,0 +1,58 @@
+/*
+ * (C) Copyright 2014
+ * Texas Instruments, <www.ti.com>
+ *
+ * Dan Murphy <dmurphy@ti.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * Derived work from spl_mmc.c
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/u-boot.h>
+#include <usb.h>
+#include <fat.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_USB_STORAGE
+static int usb_stor_curr_dev = -1; /* current device */
+#endif
+
+void spl_usb_load_image(void)
+{
+ int err;
+ block_dev_desc_t *stor_dev;
+
+ usb_stop();
+ err = usb_init();
+ if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ printf("%s: usb init failed: err - %d\n", __func__, err);
+#endif
+ hang();
+ }
+
+#ifdef CONFIG_USB_STORAGE
+ /* try to recognize storage devices immediately */
+ usb_stor_curr_dev = usb_stor_scan(1);
+ stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
+#endif
+
+ debug("boot mode - FAT\n");
+
+#ifdef CONFIG_SPL_OS_BOOT
+ if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
+ CONFIG_SYS_USB_FAT_BOOT_PARTITION))
+#endif
+ err = spl_load_image_fat(stor_dev,
+ CONFIG_SYS_USB_FAT_BOOT_PARTITION,
+ CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+
+ if (err) {
+ puts("Error loading USB device\n");
+ hang();
+ }
+}