aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/at91_udc.c6
-rw-r--r--drivers/usb/gadget/dummy_hcd.c41
-rw-r--r--drivers/usb/gadget/f_fs.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c3
-rw-r--r--drivers/usb/gadget/u_serial.c4
5 files changed, 49 insertions, 9 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index c9e66dfb02e6..1e35963bd4ed 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -475,8 +475,7 @@ static int at91_ep_enable(struct usb_ep *_ep,
475 unsigned long flags; 475 unsigned long flags;
476 476
477 if (!_ep || !ep 477 if (!_ep || !ep
478 || !desc || ep->ep.desc 478 || !desc || _ep->name == ep0name
479 || _ep->name == ep0name
480 || desc->bDescriptorType != USB_DT_ENDPOINT 479 || desc->bDescriptorType != USB_DT_ENDPOINT
481 || (maxpacket = usb_endpoint_maxp(desc)) == 0 480 || (maxpacket = usb_endpoint_maxp(desc)) == 0
482 || maxpacket > ep->maxpacket) { 481 || maxpacket > ep->maxpacket) {
@@ -530,7 +529,6 @@ ok:
530 tmp |= AT91_UDP_EPEDS; 529 tmp |= AT91_UDP_EPEDS;
531 __raw_writel(tmp, ep->creg); 530 __raw_writel(tmp, ep->creg);
532 531
533 ep->ep.desc = desc;
534 ep->ep.maxpacket = maxpacket; 532 ep->ep.maxpacket = maxpacket;
535 533
536 /* 534 /*
@@ -1635,7 +1633,6 @@ static int at91_start(struct usb_gadget *gadget,
1635 udc->driver = driver; 1633 udc->driver = driver;
1636 udc->gadget.dev.driver = &driver->driver; 1634 udc->gadget.dev.driver = &driver->driver;
1637 udc->gadget.dev.of_node = udc->pdev->dev.of_node; 1635 udc->gadget.dev.of_node = udc->pdev->dev.of_node;
1638 dev_set_drvdata(&udc->gadget.dev, &driver->driver);
1639 udc->enabled = 1; 1636 udc->enabled = 1;
1640 udc->selfpowered = 1; 1637 udc->selfpowered = 1;
1641 1638
@@ -1656,7 +1653,6 @@ static int at91_stop(struct usb_gadget *gadget,
1656 spin_unlock_irqrestore(&udc->lock, flags); 1653 spin_unlock_irqrestore(&udc->lock, flags);
1657 1654
1658 udc->gadget.dev.driver = NULL; 1655 udc->gadget.dev.driver = NULL;
1659 dev_set_drvdata(&udc->gadget.dev, NULL);
1660 udc->driver = NULL; 1656 udc->driver = NULL;
1661 1657
1662 DBG("unbound from %s\n", driver->driver.name); 1658 DBG("unbound from %s\n", driver->driver.name);
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index b799106027ad..afdbb1cbf5d9 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1916,6 +1916,27 @@ done:
1916 return retval; 1916 return retval;
1917} 1917}
1918 1918
1919/* usb 3.0 root hub device descriptor */
1920struct {
1921 struct usb_bos_descriptor bos;
1922 struct usb_ss_cap_descriptor ss_cap;
1923} __packed usb3_bos_desc = {
1924
1925 .bos = {
1926 .bLength = USB_DT_BOS_SIZE,
1927 .bDescriptorType = USB_DT_BOS,
1928 .wTotalLength = cpu_to_le16(sizeof(usb3_bos_desc)),
1929 .bNumDeviceCaps = 1,
1930 },
1931 .ss_cap = {
1932 .bLength = USB_DT_USB_SS_CAP_SIZE,
1933 .bDescriptorType = USB_DT_DEVICE_CAPABILITY,
1934 .bDevCapabilityType = USB_SS_CAP_TYPE,
1935 .wSpeedSupported = cpu_to_le16(USB_5GBPS_OPERATION),
1936 .bFunctionalitySupport = ilog2(USB_5GBPS_OPERATION),
1937 },
1938};
1939
1919static inline void 1940static inline void
1920ss_hub_descriptor(struct usb_hub_descriptor *desc) 1941ss_hub_descriptor(struct usb_hub_descriptor *desc)
1921{ 1942{
@@ -2006,6 +2027,18 @@ static int dummy_hub_control(
2006 else 2027 else
2007 hub_descriptor((struct usb_hub_descriptor *) buf); 2028 hub_descriptor((struct usb_hub_descriptor *) buf);
2008 break; 2029 break;
2030
2031 case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
2032 if (hcd->speed != HCD_USB3)
2033 goto error;
2034
2035 if ((wValue >> 8) != USB_DT_BOS)
2036 goto error;
2037
2038 memcpy(buf, &usb3_bos_desc, sizeof(usb3_bos_desc));
2039 retval = sizeof(usb3_bos_desc);
2040 break;
2041
2009 case GetHubStatus: 2042 case GetHubStatus:
2010 *(__le32 *) buf = cpu_to_le32(0); 2043 *(__le32 *) buf = cpu_to_le32(0);
2011 break; 2044 break;
@@ -2503,10 +2536,8 @@ static int dummy_hcd_probe(struct platform_device *pdev)
2503 hs_hcd->has_tt = 1; 2536 hs_hcd->has_tt = 1;
2504 2537
2505 retval = usb_add_hcd(hs_hcd, 0, 0); 2538 retval = usb_add_hcd(hs_hcd, 0, 0);
2506 if (retval != 0) { 2539 if (retval)
2507 usb_put_hcd(hs_hcd); 2540 goto put_usb2_hcd;
2508 return retval;
2509 }
2510 2541
2511 if (mod_data.is_super_speed) { 2542 if (mod_data.is_super_speed) {
2512 ss_hcd = usb_create_shared_hcd(&dummy_hcd, &pdev->dev, 2543 ss_hcd = usb_create_shared_hcd(&dummy_hcd, &pdev->dev,
@@ -2525,6 +2556,8 @@ static int dummy_hcd_probe(struct platform_device *pdev)
2525put_usb3_hcd: 2556put_usb3_hcd:
2526 usb_put_hcd(ss_hcd); 2557 usb_put_hcd(ss_hcd);
2527dealloc_usb2_hcd: 2558dealloc_usb2_hcd:
2559 usb_remove_hcd(hs_hcd);
2560put_usb2_hcd:
2528 usb_put_hcd(hs_hcd); 2561 usb_put_hcd(hs_hcd);
2529 the_controller.hs_hcd = the_controller.ss_hcd = NULL; 2562 the_controller.hs_hcd = the_controller.ss_hcd = NULL;
2530 return retval; 2563 return retval;
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 8adc79d1b402..829aba75a6df 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -34,11 +34,15 @@
34/* Debugging ****************************************************************/ 34/* Debugging ****************************************************************/
35 35
36#ifdef VERBOSE_DEBUG 36#ifdef VERBOSE_DEBUG
37#ifndef pr_vdebug
37# define pr_vdebug pr_debug 38# define pr_vdebug pr_debug
39#endif /* pr_vdebug */
38# define ffs_dump_mem(prefix, ptr, len) \ 40# define ffs_dump_mem(prefix, ptr, len) \
39 print_hex_dump_bytes(pr_fmt(prefix ": "), DUMP_PREFIX_NONE, ptr, len) 41 print_hex_dump_bytes(pr_fmt(prefix ": "), DUMP_PREFIX_NONE, ptr, len)
40#else 42#else
43#ifndef pr_vdebug
41# define pr_vdebug(...) do { } while (0) 44# define pr_vdebug(...) do { } while (0)
45#endif /* pr_vdebug */
42# define ffs_dump_mem(prefix, ptr, len) do { } while (0) 46# define ffs_dump_mem(prefix, ptr, len) do { } while (0)
43#endif /* VERBOSE_DEBUG */ 47#endif /* VERBOSE_DEBUG */
44 48
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index b13e0bb5f5b8..0bb617e1dda2 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -3599,6 +3599,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3599 3599
3600 if (hsotg->num_of_eps == 0) { 3600 if (hsotg->num_of_eps == 0) {
3601 dev_err(dev, "wrong number of EPs (zero)\n"); 3601 dev_err(dev, "wrong number of EPs (zero)\n");
3602 ret = -EINVAL;
3602 goto err_supplies; 3603 goto err_supplies;
3603 } 3604 }
3604 3605
@@ -3606,6 +3607,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3606 GFP_KERNEL); 3607 GFP_KERNEL);
3607 if (!eps) { 3608 if (!eps) {
3608 dev_err(dev, "cannot get memory\n"); 3609 dev_err(dev, "cannot get memory\n");
3610 ret = -ENOMEM;
3609 goto err_supplies; 3611 goto err_supplies;
3610 } 3612 }
3611 3613
@@ -3622,6 +3624,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3622 GFP_KERNEL); 3624 GFP_KERNEL);
3623 if (!hsotg->ctrl_req) { 3625 if (!hsotg->ctrl_req) {
3624 dev_err(dev, "failed to allocate ctrl req\n"); 3626 dev_err(dev, "failed to allocate ctrl req\n");
3627 ret = -ENOMEM;
3625 goto err_ep_mem; 3628 goto err_ep_mem;
3626 } 3629 }
3627 3630
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 5b3f5fffea92..da6d479ff9a6 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -132,11 +132,15 @@ static unsigned n_ports;
132 132
133 133
134#ifdef VERBOSE_DEBUG 134#ifdef VERBOSE_DEBUG
135#ifndef pr_vdebug
135#define pr_vdebug(fmt, arg...) \ 136#define pr_vdebug(fmt, arg...) \
136 pr_debug(fmt, ##arg) 137 pr_debug(fmt, ##arg)
138#endif /* pr_vdebug */
137#else 139#else
140#ifndef pr_vdebig
138#define pr_vdebug(fmt, arg...) \ 141#define pr_vdebug(fmt, arg...) \
139 ({ if (0) pr_debug(fmt, ##arg); }) 142 ({ if (0) pr_debug(fmt, ##arg); })
143#endif /* pr_vdebug */
140#endif 144#endif
141 145
142/*-------------------------------------------------------------------------*/ 146/*-------------------------------------------------------------------------*/