summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSherry Sun <sherry.sun@nxp.com>2019-08-02 13:58:03 -0400
committerYe Li <ye.li@nxp.com>2020-04-26 23:36:23 -0700
commit3bc60e5c03c0474261f9e0666a9814c7ea592c5c (patch)
treeff4479c41bcc0a2609a86ac863cd7d398cea6904 /common
parent8e96b7197a91142c9f70d8fed7b994b2e3d8eb1a (diff)
MLK-22357-2 sdp/fastboot: Add board_usb_gadget_port_auto() to autodetect the connected usb port
On imx8 platform, the usb2 and usb3 ports are both supported. Which means we can use usb2(ci_udc_otg) and usb3(cdns3_generic_peripheral) gadget driver to run sdp/fastboot/ums at the same time. For sdp and the fastboot that runs automatically when uboot starts, board_usb_gadget_port_auto() is added to autodetect usb port, this means that we don't have to specify which USB port should be used to download in code, now we can just connect either usb port then it will download automatically. Signed-off-by: Sherry Sun <sherry.sun@nxp.com> (cherry picked from commit 2b6fd3da6fffae0732e8e91ef5c1f870ea393ca9)
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_sdp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index 644dfa8cc3..1bf63ce50c 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -14,7 +14,12 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
int ret;
- const int controller_index = CONFIG_SPL_SDP_USB_DEV;
+ int index;
+ int controller_index = CONFIG_SPL_SDP_USB_DEV;
+
+ index = board_usb_gadget_port_auto();
+ if (index >= 0)
+ controller_index = index;
usb_gadget_initialize(controller_index);