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>2022-04-06 18:03:15 +0800
commit9517d599751612e55001e8717c1762cfd381df92 (patch)
treec0b78ac90814e39ea442f7e45c3d920f8f5cc9e9 /common
parent0a3c6ed9b356d9efd0564def2d2a359e6fd61199 (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) (cherry picked from commit 7c8e0606ea4aaeceae1f1d1e17db1503ac9f841e) (cherry picked from commit f680079db70dfb53a96dbafe0b3f6bf8f3f6ca42) (cherry picked from commit 6767d87d4db3947b62164a44f35280ea7daa8e0c)
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 9d590122b3..4c5aa07d53 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -15,7 +15,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);