diff mbox series

[3/5] spl: sdp: Add CONFIG_SPL_SDP_USB_DEV for USB device

Message ID 20200429023514.9008-3-peng.fan@nxp.com
State New
Headers show
Series [1/5] spl: sdp: call board_usb_init at spl_sdp_load_image | expand

Commit Message

Peng Fan April 29, 2020, 2:35 a.m. UTC
From: Ye Li <ye.li at nxp.com>

Add a new configuration CONFIG_SPL_SDP_USB_DEV to specify the
usb index for spl sdp driver, so that we change use different device.
The default value is 0.

Signed-off-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 common/spl/Kconfig   | 8 ++++++++
 common/spl/spl_sdp.c | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Stefano Babic May 4, 2020, 7:35 a.m. UTC | #1
> From: Ye Li <ye.li at nxp.com>
> Add a new configuration CONFIG_SPL_SDP_USB_DEV to specify the
> usb index for spl sdp driver, so that we change use different device.
> The default value is 0.
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index ef5bf66696..8c44274992 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1181,6 +1181,14 @@  config SPL_USB_SDP_SUPPORT
 	  Enable Serial Download Protocol (SDP) device support in SPL. This
 	  allows to download images into memory and execute (jump to) them
 	  using the same protocol as implemented by the i.MX family's boot ROM.
+
+config SPL_SDP_USB_DEV
+	int "SDP USB controller index"
+	default 0
+	depends on SPL_USB_SDP_SUPPORT
+	help
+	  Some boards have USB controller other than 0. Define this option
+	  so it can be used in compiled environment.
 endif
 
 config SPL_WATCHDOG_SUPPORT
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index a54c7479d0..82bce0bd2e 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -14,9 +14,9 @@  static int spl_sdp_load_image(struct spl_image_info *spl_image,
 			      struct spl_boot_device *bootdev)
 {
 	int ret;
-	const int controller_index = 0;
+	const int controller_index = CONFIG_SPL_SDP_USB_DEV;
 
-	board_usb_init(0, USB_INIT_DEVICE);
+	board_usb_init(controller_index, USB_INIT_DEVICE);
 
 	g_dnl_clear_detach();
 	ret = g_dnl_register("usb_dnl_sdp");