All of lore.kernel.org
 help / color / mirror / Atom feed
From: Faiz Abbas <faiz_abbas@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 02/13] spl: usb: Only init usb once
Date: Mon, 3 Aug 2020 11:35:05 +0530	[thread overview]
Message-ID: <20200803060516.20791-3-faiz_abbas@ti.com> (raw)
In-Reply-To: <20200803060516.20791-1-faiz_abbas@ti.com>

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 | 11 ++++++++---
 1 file 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);
-- 
2.17.1

  parent reply	other threads:[~2020-08-03  6:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  6:05 [PATCH v2 00/13] Add support for USB host and peripheral bootmodes on am65x-idk Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 01/13] spl: usb: Create an API spl_usb_load() Faiz Abbas
2020-08-03  6:05 ` Faiz Abbas [this message]
2020-08-03  6:05 ` [PATCH v2 03/13] armv7R: K3: am654: Use full malloc in SPL both pre and post reloc Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 04/13] arm: mach-k3: sysfw-loader: Add support to load SYSFW from USB Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 05/13] arm: mach-k3: am6_init: Gate mmc related configurations with the appropriate config Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 06/13] arm: mach-k3: am6_init: Do USB fixups to facilitate host and device boot modes Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 07/13] arm: mach-k3: am6_init: Add support for USB boot mode Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 08/13] arm: dts: k3-am654-r5-base-board: Add USB0 nodes Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 09/13] arm: dts: k3-am654-base-board: Add support for USB0 in SPL Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 10/13] configs: am65x_evm: Add support for DFU related configs Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 11/13] configs: am65x_evm_a53: Enable USB Mass storage and DFU boot modes Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 12/13] configs: Add defconfig for USB DFU bootmode Faiz Abbas
2020-08-03  6:05 ` [PATCH v2 13/13] configs: Add new config for supporting USB mass storage boot Faiz Abbas
2020-08-11 10:37 ` [PATCH v2 00/13] Add support for USB host and peripheral bootmodes on am65x-idk Lokesh Vutla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803060516.20791-3-faiz_abbas@ti.com \
    --to=faiz_abbas@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.