Skip to content

Commit

Permalink
usb: gadget: dwc2_udc_otg: Fix dwc2_gadget_start() and usb_gadget_reg…
Browse files Browse the repository at this point in the history
…ister_driver()

Since commit 8745b9e ("usb: gadget: add super speed support")
ums was no more functional on platform which use dwc2_udc_otg driver.

This was due to a too restrictive test which checked that the gadget
driver speed was either FS or HS.

So all gadget driver with max speed set to speed higher than
HS (SS in case of composite gadget driver in our case) are not
allowed, which is wrong.

Update the speed test in usb_gadget_register_driver() and in
dwc2_gadget_start() to allow all gadget driver speed equal or higher
than FS.

Tested on stm32mp157c-ev1 board.

Fixes: c791c84 ("usb: dwc2: convert driver to DM_USB_GADGET")

Signed-off-by: Patrice Chotard <[email protected]>
  • Loading branch information
Patrice Chotard authored and Marek Vasut committed Feb 26, 2021
1 parent ba0b984 commit 0a7e5e5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/usb/gadget/dwc2_udc_otg.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)

debug_cond(DEBUG_SETUP != 0, "%s: %s\n", __func__, "no name");

if (!driver
|| (driver->speed != USB_SPEED_FULL
&& driver->speed != USB_SPEED_HIGH)
if (!driver || driver->speed < USB_SPEED_FULL
|| !driver->bind || !driver->disconnect || !driver->setup)
return -EINVAL;
if (!dev)
Expand Down Expand Up @@ -320,9 +318,7 @@ static int dwc2_gadget_start(struct usb_gadget *g,

debug_cond(DEBUG_SETUP != 0, "%s: %s\n", __func__, "no name");

if (!driver ||
(driver->speed != USB_SPEED_FULL &&
driver->speed != USB_SPEED_HIGH) ||
if (!driver || driver->speed < USB_SPEED_FULL ||
!driver->bind || !driver->disconnect || !driver->setup)
return -EINVAL;

Expand Down

0 comments on commit 0a7e5e5

Please sign in to comment.