OSDN Git Service

usb: dwc3: gadget: Use max speed if unspecified
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Tue, 9 Mar 2021 02:16:50 +0000 (18:16 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Mar 2021 12:21:24 +0000 (13:21 +0100)
commit93f1d43c5767d70a1af89f54ef16a7d3e99af048
treec5c2321483de8dba430905bd13fd3576f8deef20
parentcdb651b6021ee091abc24e9fbd9774d318ab96a6
usb: dwc3: gadget: Use max speed if unspecified

If the gadget driver doesn't specify a max_speed, then use the
controller's maximum supported speed as default. For DWC_usb32 IP, the
gadget's speed maybe limited to gen2x1 rate only if the driver's
max_speed is unknown. This scenario should not occur with the current
implementation since the default gadget driver's max_speed should always
be specified. However, to make the driver more robust and help with
readability, let's cover all the scenarios in __dwc3_gadget_set_speed().

Fixes: 450b9e9fabd8 ("usb: dwc3: gadget: Set speed only up to the max supported")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/55ac7001af73bfe9bc750c6446ef4ac8cf6f9313.1615254129.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c