diff options
author | Thinh Nguyen <Thinh.Nguyen@synopsys.com> | 2021-01-14 03:53:07 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-18 18:40:08 +0100 |
commit | ead4c124852e66b6aa033e34cf9c4f08d40aeffc (patch) | |
tree | 81931a1eb770559d9d826acbfc1f57af1cd0e971 /drivers/usb | |
parent | usb: gadget: Introduce SSP rates and lanes (diff) | |
download | linux-ead4c124852e66b6aa033e34cf9c4f08d40aeffc.tar.xz linux-ead4c124852e66b6aa033e34cf9c4f08d40aeffc.zip |
usb: gadget: Introduce udc_set_ssp_rate() for SSP
A SuperSpeed Plus device may operate at different speed and lane count
(i.e. gen2x2, gen1x2, or gen2x1). Introduce gadget ops
udc_set_ssp_rate() to set the desire corresponding usb_ssp_rate for
SuperSpeed Plus capable devices.
If the USB device supports different speeds at SuperSpeed Plus, set the
device to operate with the maximum number of lanes and speed.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/9b85357cdadc02e3f0d653fd05f89eb46af836e1.1610592135.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/udc/core.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 98cf9216f3cb..4173acdcd35b 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1133,12 +1133,18 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc) static inline void usb_gadget_udc_set_speed(struct usb_udc *udc, enum usb_device_speed speed) { - if (udc->gadget->ops->udc_set_speed) { - enum usb_device_speed s; + struct usb_gadget *gadget = udc->gadget; + enum usb_device_speed s; - s = min(speed, udc->gadget->max_speed); - udc->gadget->ops->udc_set_speed(udc->gadget, s); - } + if (speed == USB_SPEED_UNKNOWN) + s = gadget->max_speed; + else + s = min(speed, gadget->max_speed); + + if (s == USB_SPEED_SUPER_PLUS && gadget->ops->udc_set_ssp_rate) + gadget->ops->udc_set_ssp_rate(gadget, gadget->max_ssp_rate); + else if (gadget->ops->udc_set_speed) + gadget->ops->udc_set_speed(gadget, s); } /** |