]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: usb: Only init usb once
authorFaiz Abbas <faiz_abbas@ti.com>
Mon, 3 Aug 2020 06:05:05 +0000 (11:35 +0530)
committerLokesh Vutla <lokeshvutla@ti.com>
Tue, 11 Aug 2020 15:04:46 +0000 (20:34 +0530)
usb_init() may be called multiple times for fetching multiple images
from SPL. Skip reinitializing USB if its already been done

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
common/spl/spl_usb.c

index 92ae96f66ef3fd77d41cb118b5df9c136d1248a3..3648de3492730857e9037719146e71a0b53976e3 100644 (file)
@@ -22,11 +22,16 @@ int spl_usb_load(struct spl_image_info *spl_image,
                 struct spl_boot_device *bootdev, int partition,
                 const char *filename)
 {
-       int err;
+       int err = 0;
        struct blk_desc *stor_dev;
+       static bool usb_init_pending = true;
+
+       if (usb_init_pending) {
+               usb_stop();
+               err = usb_init();
+               usb_init_pending = false;
+       }
 
-       usb_stop();
-       err = usb_init();
        if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                printf("%s: usb init failed: err - %d\n", __func__, err);