aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 91916f693ff7..0f7541be28f3 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1918,6 +1918,27 @@ done:
1918 return retval; 1918 return retval;
1919} 1919}
1920 1920
1921/* usb 3.0 root hub device descriptor */
1922struct {
1923 struct usb_bos_descriptor bos;
1924 struct usb_ss_cap_descriptor ss_cap;
1925} __packed usb3_bos_desc = {
1926
1927 .bos = {
1928 .bLength = USB_DT_BOS_SIZE,
1929 .bDescriptorType = USB_DT_BOS,
1930 .wTotalLength = cpu_to_le16(sizeof(usb3_bos_desc)),
1931 .bNumDeviceCaps = 1,
1932 },
1933 .ss_cap = {
1934 .bLength = USB_DT_USB_SS_CAP_SIZE,
1935 .bDescriptorType = USB_DT_DEVICE_CAPABILITY,
1936 .bDevCapabilityType = USB_SS_CAP_TYPE,
1937 .wSpeedSupported = cpu_to_le16(USB_5GBPS_OPERATION),
1938 .bFunctionalitySupport = ilog2(USB_5GBPS_OPERATION),
1939 },
1940};
1941
1921static inline void 1942static inline void
1922ss_hub_descriptor(struct usb_hub_descriptor *desc) 1943ss_hub_descriptor(struct usb_hub_descriptor *desc)
1923{ 1944{
@@ -2008,6 +2029,18 @@ static int dummy_hub_control(
2008 else 2029 else
2009 hub_descriptor((struct usb_hub_descriptor *) buf); 2030 hub_descriptor((struct usb_hub_descriptor *) buf);
2010 break; 2031 break;
2032
2033 case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
2034 if (hcd->speed != HCD_USB3)
2035 goto error;
2036
2037 if ((wValue >> 8) != USB_DT_BOS)
2038 goto error;
2039
2040 memcpy(buf, &usb3_bos_desc, sizeof(usb3_bos_desc));
2041 retval = sizeof(usb3_bos_desc);
2042 break;
2043
2011 case GetHubStatus: 2044 case GetHubStatus:
2012 *(__le32 *) buf = cpu_to_le32(0); 2045 *(__le32 *) buf = cpu_to_le32(0);
2013 break; 2046 break;
@@ -2505,10 +2538,8 @@ static int dummy_hcd_probe(struct platform_device *pdev)
2505 hs_hcd->has_tt = 1; 2538 hs_hcd->has_tt = 1;
2506 2539
2507 retval = usb_add_hcd(hs_hcd, 0, 0); 2540 retval = usb_add_hcd(hs_hcd, 0, 0);
2508 if (retval != 0) { 2541 if (retval)
2509 usb_put_hcd(hs_hcd); 2542 goto put_usb2_hcd;
2510 return retval;
2511 }
2512 2543
2513 if (mod_data.is_super_speed) { 2544 if (mod_data.is_super_speed) {
2514 ss_hcd = usb_create_shared_hcd(&dummy_hcd, &pdev->dev, 2545 ss_hcd = usb_create_shared_hcd(&dummy_hcd, &pdev->dev,
@@ -2527,6 +2558,8 @@ static int dummy_hcd_probe(struct platform_device *pdev)
2527put_usb3_hcd: 2558put_usb3_hcd:
2528 usb_put_hcd(ss_hcd); 2559 usb_put_hcd(ss_hcd);
2529dealloc_usb2_hcd: 2560dealloc_usb2_hcd:
2561 usb_remove_hcd(hs_hcd);
2562put_usb2_hcd:
2530 usb_put_hcd(hs_hcd); 2563 usb_put_hcd(hs_hcd);
2531 the_controller.hs_hcd = the_controller.ss_hcd = NULL; 2564 the_controller.hs_hcd = the_controller.ss_hcd = NULL;
2532 return retval; 2565 return retval;