Commit 3b9c1c5b authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

usb: gadget: dummy_hcd: add support for USB_DT_BOS on rh

Without a reply for USB_DT_BOS the USB3 mode does not work since
448b6eb1 ("USB: Make sure to fetch the BOS desc for roothubs.).

Cc: stable@vger.kernel.org #v3.5
Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 1b68a4ca
...@@ -1916,6 +1916,27 @@ static int dummy_hub_status(struct usb_hcd *hcd, char *buf) ...@@ -1916,6 +1916,27 @@ static int dummy_hub_status(struct usb_hcd *hcd, char *buf)
return retval; return retval;
} }
/* usb 3.0 root hub device descriptor */
struct {
struct usb_bos_descriptor bos;
struct usb_ss_cap_descriptor ss_cap;
} __packed usb3_bos_desc = {
.bos = {
.bLength = USB_DT_BOS_SIZE,
.bDescriptorType = USB_DT_BOS,
.wTotalLength = cpu_to_le16(sizeof(usb3_bos_desc)),
.bNumDeviceCaps = 1,
},
.ss_cap = {
.bLength = USB_DT_USB_SS_CAP_SIZE,
.bDescriptorType = USB_DT_DEVICE_CAPABILITY,
.bDevCapabilityType = USB_SS_CAP_TYPE,
.wSpeedSupported = cpu_to_le16(USB_5GBPS_OPERATION),
.bFunctionalitySupport = ilog2(USB_5GBPS_OPERATION),
},
};
static inline void static inline void
ss_hub_descriptor(struct usb_hub_descriptor *desc) ss_hub_descriptor(struct usb_hub_descriptor *desc)
{ {
...@@ -2006,6 +2027,18 @@ static int dummy_hub_control( ...@@ -2006,6 +2027,18 @@ static int dummy_hub_control(
else else
hub_descriptor((struct usb_hub_descriptor *) buf); hub_descriptor((struct usb_hub_descriptor *) buf);
break; break;
case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
if (hcd->speed != HCD_USB3)
goto error;
if ((wValue >> 8) != USB_DT_BOS)
goto error;
memcpy(buf, &usb3_bos_desc, sizeof(usb3_bos_desc));
retval = sizeof(usb3_bos_desc);
break;
case GetHubStatus: case GetHubStatus:
*(__le32 *) buf = cpu_to_le32(0); *(__le32 *) buf = cpu_to_le32(0);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment