The max speed was always being set to USB_SUPER_SPEED
even when the phy was only capable of HIGH_SPEED. This
uses the value set for the phy to set the max for the
gadget. It resolves an issue with Window PCs where they
report that using a USB3.0 port would result in better
performance even when connecting through a 3.0 port. A
follow on patch will be needed to add USB_SPEED_HIGH_LPM
to support High Speed devices which also support LPM.

Signed-off-by: McCauley, Ben <ben.mccau...@garmin.com>
---
 drivers/usb/dwc3/gadget.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 333a7c0..72d1a0e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2709,7 +2709,15 @@ int dwc3_gadget_init(struct dwc3 *dwc)
        }

        dwc->gadget.ops                 = &dwc3_gadget_ops;
-       dwc->gadget.max_speed           = USB_SPEED_SUPER;
+       /*
+        * FIXME A new enumeration USB_SPEED_HIGH_LPM needs to be added
+        * to support USB 2.10. Setting max_speed to dwc->maximum_speed
+        * disables LPM support for devices which do not support
+        * SuperSpeed but are LPM capable.
+        */
+       if (dwc->maximum_speed < USB_SPEED_SUPER)
+               dev_info(dwc->dev, "SuperSpeed not supported.\n");
+       dwc->gadget.max_speed           = dwc->maximum_speed;
        dwc->gadget.speed               = USB_SPEED_UNKNOWN;
        dwc->gadget.sg_supported        = true;
        dwc->gadget.name                = "dwc3-gadget";
--
1.9.1

________________________________

CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of 
the intended recipient(s) and contain information that may be confidential 
and/or legally privileged. If you have received this email in error, please 
notify the sender by reply email and delete the message. Any disclosure, 
copying, distribution or use of this communication (including attachments) by 
someone other than the intended recipient is prohibited. Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to