diff options
author | Li Jun <jun.li@nxp.com> | 2021-01-25 21:43:57 +0800 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2021-01-31 14:08:56 +0100 |
commit | 4df50f89f5769732c6cce67f956371140680ff5d (patch) | |
tree | c645ea93c2e28160342afe95e5bf90079f63a267 /drivers | |
parent | 429e2f299f3a978cf248c3597f60308c5d636ad8 (diff) | |
download | u-boot-4df50f89f5769732c6cce67f956371140680ff5d.tar.gz u-boot-4df50f89f5769732c6cce67f956371140680ff5d.tar.bz2 u-boot-4df50f89f5769732c6cce67f956371140680ff5d.zip |
usb: composite: force gadget to be USB2 for HS only function
If one of functions is not super speed capable, we need force the udc
to be high speed, this is an equivalent implementation of
usb_gadget_udc_set_speed() in kernel but simple, which set the gadget
max_speed to be high speed, so afterwards when start gadget duc can
set the HW to be USB 2.0 mode.
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/composite.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1063c571d8..2a309e624e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -532,6 +532,19 @@ int usb_add_config(struct usb_composite_dev *cdev, } } + /* + * If one function of config is not super speed capable, + * force the gadget to be high speed so controller driver + * can init HW to be USB 2.0 + */ + if (gadget_is_superspeed(cdev->gadget)) { + list_for_each_entry(f, &config->functions, list) { + if (!f->ss_descriptors) + cdev->gadget->max_speed = + USB_SPEED_HIGH; + } + } + usb_ep_autoconfig_reset(cdev->gadget); os_desc_config = config; |