SPDX: Convert all of our single license tags to Linux Kernel style
[oweals/u-boot.git] / common / spl / spl_usb.c
index 04fa66758cbc0255da1fa97632dd655aeb1dd918..c8d82318957940ec7d97155fdd66acdde6aefab5 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (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 <usb.h>
 #include <fat.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #ifdef CONFIG_USB_STORAGE
 static int usb_stor_curr_dev = -1; /* current device */
 #endif
 
-int spl_usb_load_image(void)
+static int spl_usb_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        int err;
        struct blk_desc *stor_dev;
@@ -47,12 +45,15 @@ int spl_usb_load_image(void)
        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))
+       if (spl_start_uboot() ||
+           spl_load_image_fat_os(spl_image, stor_dev,
+                                 CONFIG_SYS_USB_FAT_BOOT_PARTITION))
 #endif
-               err = spl_load_image_fat(stor_dev,
-                               CONFIG_SYS_USB_FAT_BOOT_PARTITION,
-                               CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
+       {
+               err = spl_load_image_fat(spl_image, stor_dev,
+                                       CONFIG_SYS_USB_FAT_BOOT_PARTITION,
+                                       CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
+       }
 
        if (err) {
                puts("Error loading from USB device\n");
@@ -61,3 +62,4 @@ int spl_usb_load_image(void)
 
        return 0;
 }
+SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_usb_load_image);