summaryrefslogtreecommitdiffstats
path: root/common/spl/spl_usb.c
diff options
context:
space:
mode:
authorFaiz Abbas <faiz_abbas@ti.com>2020-08-03 11:35:05 +0530
committerLokesh Vutla <lokeshvutla@ti.com>2020-08-11 20:34:46 +0530
commit39388aebed67a64d1bac8cd6652e8f418c116252 (patch)
tree0e8bb44450f06a8ac84c70db20d475687a4f4522 /common/spl/spl_usb.c
parentc3ab97c1dd48ef8f4f737f1e83b3e39ccf13a532 (diff)
downloadu-boot-39388aebed67a64d1bac8cd6652e8f418c116252.tar.gz
u-boot-39388aebed67a64d1bac8cd6652e8f418c116252.tar.xz
u-boot-39388aebed67a64d1bac8cd6652e8f418c116252.zip
spl: usb: Only init usb once
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>
Diffstat (limited to 'common/spl/spl_usb.c')
-rw-r--r--common/spl/spl_usb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c
index 92ae96f66e..3648de3492 100644
--- a/common/spl/spl_usb.c
+++ b/common/spl/spl_usb.c
@@ -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);