3 * Texas Instruments, <www.ti.com>
5 * Dan Murphy <dmurphy@ti.com>
7 * SPDX-License-Identifier: GPL-2.0+
9 * Derived work from spl_mmc.c
14 #include <asm/u-boot.h>
18 DECLARE_GLOBAL_DATA_PTR;
20 #ifdef CONFIG_USB_STORAGE
21 static int usb_stor_curr_dev = -1; /* current device */
24 void spl_usb_load_image(void)
27 block_dev_desc_t *stor_dev;
32 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
33 printf("%s: usb init failed: err - %d\n", __func__, err);
38 #ifdef CONFIG_USB_STORAGE
39 /* try to recognize storage devices immediately */
40 usb_stor_curr_dev = usb_stor_scan(1);
41 stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
44 debug("boot mode - FAT\n");
46 #ifdef CONFIG_SPL_OS_BOOT
47 if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
48 CONFIG_SYS_USB_FAT_BOOT_PARTITION))
50 err = spl_load_image_fat(stor_dev,
51 CONFIG_SYS_USB_FAT_BOOT_PARTITION,
52 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
55 puts("Error loading USB device\n");