diff options
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/Kconfig | 6 | ||||
-rw-r--r-- | drivers/usb/gadget/at91_udc.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 158 | ||||
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.h | 9 | ||||
-rw-r--r-- | drivers/usb/gadget/ether.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_usb2_udc.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/lh7a40x_udc.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/m66592-udc.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/omap_udc.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/printer.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 90 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.h | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/s3c2410_udc.c | 2 |
14 files changed, 152 insertions, 132 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index c13955164686..d681bb27fa58 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -118,10 +118,10 @@ config USB_AMD5536UDC | |||
118 | config USB_GADGET_ATMEL_USBA | 118 | config USB_GADGET_ATMEL_USBA |
119 | boolean "Atmel USBA" | 119 | boolean "Atmel USBA" |
120 | select USB_GADGET_DUALSPEED | 120 | select USB_GADGET_DUALSPEED |
121 | depends on AVR32 | 121 | depends on AVR32 || ARCH_AT91CAP9 |
122 | help | 122 | help |
123 | USBA is the integrated high-speed USB Device controller on | 123 | USBA is the integrated high-speed USB Device controller on |
124 | the AT32AP700x processors from Atmel. | 124 | the AT32AP700x and AT91CAP9 processors from Atmel. |
125 | 125 | ||
126 | config USB_ATMEL_USBA | 126 | config USB_ATMEL_USBA |
127 | tristate | 127 | tristate |
@@ -131,7 +131,7 @@ config USB_ATMEL_USBA | |||
131 | 131 | ||
132 | config USB_GADGET_FSL_USB2 | 132 | config USB_GADGET_FSL_USB2 |
133 | boolean "Freescale Highspeed USB DR Peripheral Controller" | 133 | boolean "Freescale Highspeed USB DR Peripheral Controller" |
134 | depends on MPC834x || PPC_MPC831x | 134 | depends on FSL_SOC |
135 | select USB_GADGET_DUALSPEED | 135 | select USB_GADGET_DUALSPEED |
136 | help | 136 | help |
137 | Some of Freescale PowerPC processors have a High Speed | 137 | Some of Freescale PowerPC processors have a High Speed |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index a83e8b798ec9..fd15ced899d8 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1884,3 +1884,4 @@ module_exit(udc_exit_module); | |||
1884 | MODULE_DESCRIPTION("AT91 udc driver"); | 1884 | MODULE_DESCRIPTION("AT91 udc driver"); |
1885 | MODULE_AUTHOR("Thomas Rathbone, David Brownell"); | 1885 | MODULE_AUTHOR("Thomas Rathbone, David Brownell"); |
1886 | MODULE_LICENSE("GPL"); | 1886 | MODULE_LICENSE("GPL"); |
1887 | MODULE_ALIAS("platform:at91_udc"); | ||
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index af8b2a3a2d4a..e756023362c2 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/usb/ch9.h> | 19 | #include <linux/usb/ch9.h> |
20 | #include <linux/usb/gadget.h> | 20 | #include <linux/usb/gadget.h> |
21 | #include <linux/usb/atmel_usba_udc.h> | ||
21 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
22 | 23 | ||
23 | #include <asm/gpio.h> | 24 | #include <asm/gpio.h> |
@@ -27,6 +28,7 @@ | |||
27 | 28 | ||
28 | 29 | ||
29 | static struct usba_udc the_udc; | 30 | static struct usba_udc the_udc; |
31 | static struct usba_ep *usba_ep; | ||
30 | 32 | ||
31 | #ifdef CONFIG_USB_GADGET_DEBUG_FS | 33 | #ifdef CONFIG_USB_GADGET_DEBUG_FS |
32 | #include <linux/debugfs.h> | 34 | #include <linux/debugfs.h> |
@@ -324,53 +326,28 @@ static int vbus_is_present(struct usba_udc *udc) | |||
324 | return 1; | 326 | return 1; |
325 | } | 327 | } |
326 | 328 | ||
327 | static void copy_to_fifo(void __iomem *fifo, const void *buf, int len) | 329 | #if defined(CONFIG_AVR32) |
330 | |||
331 | static void toggle_bias(int is_on) | ||
328 | { | 332 | { |
329 | unsigned long tmp; | ||
330 | |||
331 | DBG(DBG_FIFO, "copy to FIFO (len %d):\n", len); | ||
332 | for (; len > 0; len -= 4, buf += 4, fifo += 4) { | ||
333 | tmp = *(unsigned long *)buf; | ||
334 | if (len >= 4) { | ||
335 | DBG(DBG_FIFO, " -> %08lx\n", tmp); | ||
336 | __raw_writel(tmp, fifo); | ||
337 | } else { | ||
338 | do { | ||
339 | DBG(DBG_FIFO, " -> %02lx\n", tmp >> 24); | ||
340 | __raw_writeb(tmp >> 24, fifo); | ||
341 | fifo++; | ||
342 | tmp <<= 8; | ||
343 | } while (--len); | ||
344 | break; | ||
345 | } | ||
346 | } | ||
347 | } | 333 | } |
348 | 334 | ||
349 | static void copy_from_fifo(void *buf, void __iomem *fifo, int len) | 335 | #elif defined(CONFIG_ARCH_AT91) |
336 | |||
337 | #include <asm/arch/at91_pmc.h> | ||
338 | |||
339 | static void toggle_bias(int is_on) | ||
350 | { | 340 | { |
351 | union { | 341 | unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR); |
352 | unsigned long *w; | 342 | |
353 | unsigned char *b; | 343 | if (is_on) |
354 | } p; | 344 | at91_sys_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN); |
355 | unsigned long tmp; | 345 | else |
356 | 346 | at91_sys_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN)); | |
357 | DBG(DBG_FIFO, "copy from FIFO (len %d):\n", len); | ||
358 | for (p.w = buf; len > 0; len -= 4, p.w++, fifo += 4) { | ||
359 | if (len >= 4) { | ||
360 | tmp = __raw_readl(fifo); | ||
361 | *p.w = tmp; | ||
362 | DBG(DBG_FIFO, " -> %08lx\n", tmp); | ||
363 | } else { | ||
364 | do { | ||
365 | tmp = __raw_readb(fifo); | ||
366 | *p.b = tmp; | ||
367 | DBG(DBG_FIFO, " -> %02lx\n", tmp); | ||
368 | fifo++, p.b++; | ||
369 | } while (--len); | ||
370 | } | ||
371 | } | ||
372 | } | 347 | } |
373 | 348 | ||
349 | #endif /* CONFIG_ARCH_AT91 */ | ||
350 | |||
374 | static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) | 351 | static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) |
375 | { | 352 | { |
376 | unsigned int transaction_len; | 353 | unsigned int transaction_len; |
@@ -387,7 +364,7 @@ static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) | |||
387 | ep->ep.name, req, transaction_len, | 364 | ep->ep.name, req, transaction_len, |
388 | req->last_transaction ? ", done" : ""); | 365 | req->last_transaction ? ", done" : ""); |
389 | 366 | ||
390 | copy_to_fifo(ep->fifo, req->req.buf + req->req.actual, transaction_len); | 367 | memcpy_toio(ep->fifo, req->req.buf + req->req.actual, transaction_len); |
391 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); | 368 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); |
392 | req->req.actual += transaction_len; | 369 | req->req.actual += transaction_len; |
393 | } | 370 | } |
@@ -476,7 +453,7 @@ static void receive_data(struct usba_ep *ep) | |||
476 | bytecount = req->req.length - req->req.actual; | 453 | bytecount = req->req.length - req->req.actual; |
477 | } | 454 | } |
478 | 455 | ||
479 | copy_from_fifo(req->req.buf + req->req.actual, | 456 | memcpy_fromio(req->req.buf + req->req.actual, |
480 | ep->fifo, bytecount); | 457 | ep->fifo, bytecount); |
481 | req->req.actual += bytecount; | 458 | req->req.actual += bytecount; |
482 | 459 | ||
@@ -1029,33 +1006,6 @@ static const struct usb_gadget_ops usba_udc_ops = { | |||
1029 | .set_selfpowered = usba_udc_set_selfpowered, | 1006 | .set_selfpowered = usba_udc_set_selfpowered, |
1030 | }; | 1007 | }; |
1031 | 1008 | ||
1032 | #define EP(nam, idx, maxpkt, maxbk, dma, isoc) \ | ||
1033 | { \ | ||
1034 | .ep = { \ | ||
1035 | .ops = &usba_ep_ops, \ | ||
1036 | .name = nam, \ | ||
1037 | .maxpacket = maxpkt, \ | ||
1038 | }, \ | ||
1039 | .udc = &the_udc, \ | ||
1040 | .queue = LIST_HEAD_INIT(usba_ep[idx].queue), \ | ||
1041 | .fifo_size = maxpkt, \ | ||
1042 | .nr_banks = maxbk, \ | ||
1043 | .index = idx, \ | ||
1044 | .can_dma = dma, \ | ||
1045 | .can_isoc = isoc, \ | ||
1046 | } | ||
1047 | |||
1048 | static struct usba_ep usba_ep[] = { | ||
1049 | EP("ep0", 0, 64, 1, 0, 0), | ||
1050 | EP("ep1in-bulk", 1, 512, 2, 1, 1), | ||
1051 | EP("ep2out-bulk", 2, 512, 2, 1, 1), | ||
1052 | EP("ep3in-int", 3, 64, 3, 1, 0), | ||
1053 | EP("ep4out-int", 4, 64, 3, 1, 0), | ||
1054 | EP("ep5in-iso", 5, 1024, 3, 1, 1), | ||
1055 | EP("ep6out-iso", 6, 1024, 3, 1, 1), | ||
1056 | }; | ||
1057 | #undef EP | ||
1058 | |||
1059 | static struct usb_endpoint_descriptor usba_ep0_desc = { | 1009 | static struct usb_endpoint_descriptor usba_ep0_desc = { |
1060 | .bLength = USB_DT_ENDPOINT_SIZE, | 1010 | .bLength = USB_DT_ENDPOINT_SIZE, |
1061 | .bDescriptorType = USB_DT_ENDPOINT, | 1011 | .bDescriptorType = USB_DT_ENDPOINT, |
@@ -1074,7 +1024,6 @@ static void nop_release(struct device *dev) | |||
1074 | static struct usba_udc the_udc = { | 1024 | static struct usba_udc the_udc = { |
1075 | .gadget = { | 1025 | .gadget = { |
1076 | .ops = &usba_udc_ops, | 1026 | .ops = &usba_udc_ops, |
1077 | .ep0 = &usba_ep[0].ep, | ||
1078 | .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list), | 1027 | .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list), |
1079 | .is_dualspeed = 1, | 1028 | .is_dualspeed = 1, |
1080 | .name = "atmel_usba_udc", | 1029 | .name = "atmel_usba_udc", |
@@ -1231,7 +1180,7 @@ static int do_test_mode(struct usba_udc *udc) | |||
1231 | } else { | 1180 | } else { |
1232 | usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE); | 1181 | usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE); |
1233 | usba_writel(udc, TST, USBA_TST_PKT_MODE); | 1182 | usba_writel(udc, TST, USBA_TST_PKT_MODE); |
1234 | copy_to_fifo(ep->fifo, test_packet_buffer, | 1183 | memcpy_toio(ep->fifo, test_packet_buffer, |
1235 | sizeof(test_packet_buffer)); | 1184 | sizeof(test_packet_buffer)); |
1236 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); | 1185 | usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); |
1237 | dev_info(dev, "Entering Test_Packet mode...\n"); | 1186 | dev_info(dev, "Entering Test_Packet mode...\n"); |
@@ -1530,13 +1479,13 @@ restart: | |||
1530 | DBG(DBG_HW, "Packet length: %u\n", pkt_len); | 1479 | DBG(DBG_HW, "Packet length: %u\n", pkt_len); |
1531 | if (pkt_len != sizeof(crq)) { | 1480 | if (pkt_len != sizeof(crq)) { |
1532 | pr_warning("udc: Invalid packet length %u " | 1481 | pr_warning("udc: Invalid packet length %u " |
1533 | "(expected %lu)\n", pkt_len, sizeof(crq)); | 1482 | "(expected %zu)\n", pkt_len, sizeof(crq)); |
1534 | set_protocol_stall(udc, ep); | 1483 | set_protocol_stall(udc, ep); |
1535 | return; | 1484 | return; |
1536 | } | 1485 | } |
1537 | 1486 | ||
1538 | DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo); | 1487 | DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo); |
1539 | copy_from_fifo(crq.data, ep->fifo, sizeof(crq)); | 1488 | memcpy_fromio(crq.data, ep->fifo, sizeof(crq)); |
1540 | 1489 | ||
1541 | /* Free up one bank in the FIFO so that we can | 1490 | /* Free up one bank in the FIFO so that we can |
1542 | * generate or receive a reply right away. */ | 1491 | * generate or receive a reply right away. */ |
@@ -1688,6 +1637,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) | |||
1688 | DBG(DBG_INT, "irq, status=%#08x\n", status); | 1637 | DBG(DBG_INT, "irq, status=%#08x\n", status); |
1689 | 1638 | ||
1690 | if (status & USBA_DET_SUSPEND) { | 1639 | if (status & USBA_DET_SUSPEND) { |
1640 | toggle_bias(0); | ||
1691 | usba_writel(udc, INT_CLR, USBA_DET_SUSPEND); | 1641 | usba_writel(udc, INT_CLR, USBA_DET_SUSPEND); |
1692 | DBG(DBG_BUS, "Suspend detected\n"); | 1642 | DBG(DBG_BUS, "Suspend detected\n"); |
1693 | if (udc->gadget.speed != USB_SPEED_UNKNOWN | 1643 | if (udc->gadget.speed != USB_SPEED_UNKNOWN |
@@ -1699,6 +1649,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) | |||
1699 | } | 1649 | } |
1700 | 1650 | ||
1701 | if (status & USBA_WAKE_UP) { | 1651 | if (status & USBA_WAKE_UP) { |
1652 | toggle_bias(1); | ||
1702 | usba_writel(udc, INT_CLR, USBA_WAKE_UP); | 1653 | usba_writel(udc, INT_CLR, USBA_WAKE_UP); |
1703 | DBG(DBG_BUS, "Wake Up CPU detected\n"); | 1654 | DBG(DBG_BUS, "Wake Up CPU detected\n"); |
1704 | } | 1655 | } |
@@ -1792,12 +1743,14 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid) | |||
1792 | vbus = gpio_get_value(udc->vbus_pin); | 1743 | vbus = gpio_get_value(udc->vbus_pin); |
1793 | if (vbus != udc->vbus_prev) { | 1744 | if (vbus != udc->vbus_prev) { |
1794 | if (vbus) { | 1745 | if (vbus) { |
1795 | usba_writel(udc, CTRL, USBA_EN_USBA); | 1746 | toggle_bias(1); |
1747 | usba_writel(udc, CTRL, USBA_ENABLE_MASK); | ||
1796 | usba_writel(udc, INT_ENB, USBA_END_OF_RESET); | 1748 | usba_writel(udc, INT_ENB, USBA_END_OF_RESET); |
1797 | } else { | 1749 | } else { |
1798 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1750 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1799 | reset_all_endpoints(udc); | 1751 | reset_all_endpoints(udc); |
1800 | usba_writel(udc, CTRL, 0); | 1752 | toggle_bias(0); |
1753 | usba_writel(udc, CTRL, USBA_DISABLE_MASK); | ||
1801 | spin_unlock(&udc->lock); | 1754 | spin_unlock(&udc->lock); |
1802 | udc->driver->disconnect(&udc->gadget); | 1755 | udc->driver->disconnect(&udc->gadget); |
1803 | spin_lock(&udc->lock); | 1756 | spin_lock(&udc->lock); |
@@ -1850,7 +1803,8 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
1850 | /* If Vbus is present, enable the controller and wait for reset */ | 1803 | /* If Vbus is present, enable the controller and wait for reset */ |
1851 | spin_lock_irqsave(&udc->lock, flags); | 1804 | spin_lock_irqsave(&udc->lock, flags); |
1852 | if (vbus_is_present(udc) && udc->vbus_prev == 0) { | 1805 | if (vbus_is_present(udc) && udc->vbus_prev == 0) { |
1853 | usba_writel(udc, CTRL, USBA_EN_USBA); | 1806 | toggle_bias(1); |
1807 | usba_writel(udc, CTRL, USBA_ENABLE_MASK); | ||
1854 | usba_writel(udc, INT_ENB, USBA_END_OF_RESET); | 1808 | usba_writel(udc, INT_ENB, USBA_END_OF_RESET); |
1855 | } | 1809 | } |
1856 | spin_unlock_irqrestore(&udc->lock, flags); | 1810 | spin_unlock_irqrestore(&udc->lock, flags); |
@@ -1883,7 +1837,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1883 | spin_unlock_irqrestore(&udc->lock, flags); | 1837 | spin_unlock_irqrestore(&udc->lock, flags); |
1884 | 1838 | ||
1885 | /* This will also disable the DP pullup */ | 1839 | /* This will also disable the DP pullup */ |
1886 | usba_writel(udc, CTRL, 0); | 1840 | toggle_bias(0); |
1841 | usba_writel(udc, CTRL, USBA_DISABLE_MASK); | ||
1887 | 1842 | ||
1888 | driver->unbind(&udc->gadget); | 1843 | driver->unbind(&udc->gadget); |
1889 | udc->gadget.dev.driver = NULL; | 1844 | udc->gadget.dev.driver = NULL; |
@@ -1908,7 +1863,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1908 | 1863 | ||
1909 | regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); | 1864 | regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); |
1910 | fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID); | 1865 | fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID); |
1911 | if (!regs || !fifo) | 1866 | if (!regs || !fifo || !pdata) |
1912 | return -ENXIO; | 1867 | return -ENXIO; |
1913 | 1868 | ||
1914 | irq = platform_get_irq(pdev, 0); | 1869 | irq = platform_get_irq(pdev, 0); |
@@ -1953,19 +1908,48 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1953 | 1908 | ||
1954 | /* Make sure we start from a clean slate */ | 1909 | /* Make sure we start from a clean slate */ |
1955 | clk_enable(pclk); | 1910 | clk_enable(pclk); |
1956 | usba_writel(udc, CTRL, 0); | 1911 | toggle_bias(0); |
1912 | usba_writel(udc, CTRL, USBA_DISABLE_MASK); | ||
1957 | clk_disable(pclk); | 1913 | clk_disable(pclk); |
1958 | 1914 | ||
1915 | usba_ep = kmalloc(sizeof(struct usba_ep) * pdata->num_ep, | ||
1916 | GFP_KERNEL); | ||
1917 | if (!usba_ep) | ||
1918 | goto err_alloc_ep; | ||
1919 | |||
1920 | the_udc.gadget.ep0 = &usba_ep[0].ep; | ||
1921 | |||
1959 | INIT_LIST_HEAD(&usba_ep[0].ep.ep_list); | 1922 | INIT_LIST_HEAD(&usba_ep[0].ep.ep_list); |
1960 | usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0); | 1923 | usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0); |
1961 | usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0); | 1924 | usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0); |
1962 | usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0); | 1925 | usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0); |
1963 | for (i = 1; i < ARRAY_SIZE(usba_ep); i++) { | 1926 | usba_ep[0].ep.ops = &usba_ep_ops; |
1927 | usba_ep[0].ep.name = pdata->ep[0].name; | ||
1928 | usba_ep[0].ep.maxpacket = pdata->ep[0].fifo_size; | ||
1929 | usba_ep[0].udc = &the_udc; | ||
1930 | INIT_LIST_HEAD(&usba_ep[0].queue); | ||
1931 | usba_ep[0].fifo_size = pdata->ep[0].fifo_size; | ||
1932 | usba_ep[0].nr_banks = pdata->ep[0].nr_banks; | ||
1933 | usba_ep[0].index = pdata->ep[0].index; | ||
1934 | usba_ep[0].can_dma = pdata->ep[0].can_dma; | ||
1935 | usba_ep[0].can_isoc = pdata->ep[0].can_isoc; | ||
1936 | |||
1937 | for (i = 1; i < pdata->num_ep; i++) { | ||
1964 | struct usba_ep *ep = &usba_ep[i]; | 1938 | struct usba_ep *ep = &usba_ep[i]; |
1965 | 1939 | ||
1966 | ep->ep_regs = udc->regs + USBA_EPT_BASE(i); | 1940 | ep->ep_regs = udc->regs + USBA_EPT_BASE(i); |
1967 | ep->dma_regs = udc->regs + USBA_DMA_BASE(i); | 1941 | ep->dma_regs = udc->regs + USBA_DMA_BASE(i); |
1968 | ep->fifo = udc->fifo + USBA_FIFO_BASE(i); | 1942 | ep->fifo = udc->fifo + USBA_FIFO_BASE(i); |
1943 | ep->ep.ops = &usba_ep_ops; | ||
1944 | ep->ep.name = pdata->ep[i].name; | ||
1945 | ep->ep.maxpacket = pdata->ep[i].fifo_size; | ||
1946 | ep->udc = &the_udc; | ||
1947 | INIT_LIST_HEAD(&ep->queue); | ||
1948 | ep->fifo_size = pdata->ep[i].fifo_size; | ||
1949 | ep->nr_banks = pdata->ep[i].nr_banks; | ||
1950 | ep->index = pdata->ep[i].index; | ||
1951 | ep->can_dma = pdata->ep[i].can_dma; | ||
1952 | ep->can_isoc = pdata->ep[i].can_isoc; | ||
1969 | 1953 | ||
1970 | list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); | 1954 | list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); |
1971 | } | 1955 | } |
@@ -1984,7 +1968,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1984 | goto err_device_add; | 1968 | goto err_device_add; |
1985 | } | 1969 | } |
1986 | 1970 | ||
1987 | if (pdata && pdata->vbus_pin != GPIO_PIN_NONE) { | 1971 | if (pdata->vbus_pin >= 0) { |
1988 | if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { | 1972 | if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { |
1989 | udc->vbus_pin = pdata->vbus_pin; | 1973 | udc->vbus_pin = pdata->vbus_pin; |
1990 | 1974 | ||
@@ -2004,7 +1988,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
2004 | } | 1988 | } |
2005 | 1989 | ||
2006 | usba_init_debugfs(udc); | 1990 | usba_init_debugfs(udc); |
2007 | for (i = 1; i < ARRAY_SIZE(usba_ep); i++) | 1991 | for (i = 1; i < pdata->num_ep; i++) |
2008 | usba_ep_init_debugfs(udc, &usba_ep[i]); | 1992 | usba_ep_init_debugfs(udc, &usba_ep[i]); |
2009 | 1993 | ||
2010 | return 0; | 1994 | return 0; |
@@ -2012,6 +1996,8 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
2012 | err_device_add: | 1996 | err_device_add: |
2013 | free_irq(irq, udc); | 1997 | free_irq(irq, udc); |
2014 | err_request_irq: | 1998 | err_request_irq: |
1999 | kfree(usba_ep); | ||
2000 | err_alloc_ep: | ||
2015 | iounmap(udc->fifo); | 2001 | iounmap(udc->fifo); |
2016 | err_map_fifo: | 2002 | err_map_fifo: |
2017 | iounmap(udc->regs); | 2003 | iounmap(udc->regs); |
@@ -2029,10 +2015,11 @@ static int __exit usba_udc_remove(struct platform_device *pdev) | |||
2029 | { | 2015 | { |
2030 | struct usba_udc *udc; | 2016 | struct usba_udc *udc; |
2031 | int i; | 2017 | int i; |
2018 | struct usba_platform_data *pdata = pdev->dev.platform_data; | ||
2032 | 2019 | ||
2033 | udc = platform_get_drvdata(pdev); | 2020 | udc = platform_get_drvdata(pdev); |
2034 | 2021 | ||
2035 | for (i = 1; i < ARRAY_SIZE(usba_ep); i++) | 2022 | for (i = 1; i < pdata->num_ep; i++) |
2036 | usba_ep_cleanup_debugfs(&usba_ep[i]); | 2023 | usba_ep_cleanup_debugfs(&usba_ep[i]); |
2037 | usba_cleanup_debugfs(udc); | 2024 | usba_cleanup_debugfs(udc); |
2038 | 2025 | ||
@@ -2040,6 +2027,7 @@ static int __exit usba_udc_remove(struct platform_device *pdev) | |||
2040 | gpio_free(udc->vbus_pin); | 2027 | gpio_free(udc->vbus_pin); |
2041 | 2028 | ||
2042 | free_irq(udc->irq, udc); | 2029 | free_irq(udc->irq, udc); |
2030 | kfree(usba_ep); | ||
2043 | iounmap(udc->fifo); | 2031 | iounmap(udc->fifo); |
2044 | iounmap(udc->regs); | 2032 | iounmap(udc->regs); |
2045 | clk_put(udc->hclk); | 2033 | clk_put(udc->hclk); |
@@ -2054,6 +2042,7 @@ static struct platform_driver udc_driver = { | |||
2054 | .remove = __exit_p(usba_udc_remove), | 2042 | .remove = __exit_p(usba_udc_remove), |
2055 | .driver = { | 2043 | .driver = { |
2056 | .name = "atmel_usba_udc", | 2044 | .name = "atmel_usba_udc", |
2045 | .owner = THIS_MODULE, | ||
2057 | }, | 2046 | }, |
2058 | }; | 2047 | }; |
2059 | 2048 | ||
@@ -2072,3 +2061,4 @@ module_exit(udc_exit); | |||
2072 | MODULE_DESCRIPTION("Atmel USBA UDC driver"); | 2061 | MODULE_DESCRIPTION("Atmel USBA UDC driver"); |
2073 | MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>"); | 2062 | MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>"); |
2074 | MODULE_LICENSE("GPL"); | 2063 | MODULE_LICENSE("GPL"); |
2064 | MODULE_ALIAS("platform:atmel_usba_udc"); | ||
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h index 08bf6f9aaf7e..f7baea307f0d 100644 --- a/drivers/usb/gadget/atmel_usba_udc.h +++ b/drivers/usb/gadget/atmel_usba_udc.h | |||
@@ -41,6 +41,15 @@ | |||
41 | #define USBA_EN_USBA (1 << 8) | 41 | #define USBA_EN_USBA (1 << 8) |
42 | #define USBA_DETACH (1 << 9) | 42 | #define USBA_DETACH (1 << 9) |
43 | #define USBA_REMOTE_WAKE_UP (1 << 10) | 43 | #define USBA_REMOTE_WAKE_UP (1 << 10) |
44 | #define USBA_PULLD_DIS (1 << 11) | ||
45 | |||
46 | #if defined(CONFIG_AVR32) | ||
47 | #define USBA_ENABLE_MASK USBA_EN_USBA | ||
48 | #define USBA_DISABLE_MASK 0 | ||
49 | #elif defined(CONFIG_ARCH_AT91) | ||
50 | #define USBA_ENABLE_MASK (USBA_EN_USBA | USBA_PULLD_DIS) | ||
51 | #define USBA_DISABLE_MASK USBA_DETACH | ||
52 | #endif /* CONFIG_ARCH_AT91 */ | ||
44 | 53 | ||
45 | /* Bitfields in FNUM */ | 54 | /* Bitfields in FNUM */ |
46 | #define USBA_MICRO_FRAME_NUM_OFFSET 0 | 55 | #define USBA_MICRO_FRAME_NUM_OFFSET 0 |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a70e255402b8..e99872308144 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -1561,6 +1561,7 @@ done_set_intf: | |||
1561 | memcpy(req->buf, buf, n); | 1561 | memcpy(req->buf, buf, n); |
1562 | req->complete = rndis_response_complete; | 1562 | req->complete = rndis_response_complete; |
1563 | rndis_free_response(dev->rndis_config, buf); | 1563 | rndis_free_response(dev->rndis_config, buf); |
1564 | value = n; | ||
1564 | } | 1565 | } |
1565 | /* else stalls ... spec says to avoid that */ | 1566 | /* else stalls ... spec says to avoid that */ |
1566 | } | 1567 | } |
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 63e8fa3a69e1..254012ad2b91 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -2475,3 +2475,4 @@ module_exit(udc_exit); | |||
2475 | MODULE_DESCRIPTION(DRIVER_DESC); | 2475 | MODULE_DESCRIPTION(DRIVER_DESC); |
2476 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2476 | MODULE_AUTHOR(DRIVER_AUTHOR); |
2477 | MODULE_LICENSE("GPL"); | 2477 | MODULE_LICENSE("GPL"); |
2478 | MODULE_ALIAS("platform:fsl-usb2-udc"); | ||
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 805602a687cb..0a6feafc8d28 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1458,7 +1458,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1458 | /* currently one config, two speeds */ | 1458 | /* currently one config, two speeds */ |
1459 | case USB_REQ_SET_CONFIGURATION: | 1459 | case USB_REQ_SET_CONFIGURATION: |
1460 | if (ctrl->bRequestType != 0) | 1460 | if (ctrl->bRequestType != 0) |
1461 | break; | 1461 | goto unrecognized; |
1462 | if (0 == (u8) w_value) { | 1462 | if (0 == (u8) w_value) { |
1463 | value = 0; | 1463 | value = 0; |
1464 | dev->current_config = 0; | 1464 | dev->current_config = 0; |
@@ -1505,7 +1505,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1505 | /* PXA automagically handles this request too */ | 1505 | /* PXA automagically handles this request too */ |
1506 | case USB_REQ_GET_CONFIGURATION: | 1506 | case USB_REQ_GET_CONFIGURATION: |
1507 | if (ctrl->bRequestType != 0x80) | 1507 | if (ctrl->bRequestType != 0x80) |
1508 | break; | 1508 | goto unrecognized; |
1509 | *(u8 *)req->buf = dev->current_config; | 1509 | *(u8 *)req->buf = dev->current_config; |
1510 | value = min (w_length, (u16) 1); | 1510 | value = min (w_length, (u16) 1); |
1511 | break; | 1511 | break; |
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index 37243ef7104e..078f72467671 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -2146,3 +2146,4 @@ module_exit(udc_exit); | |||
2146 | MODULE_DESCRIPTION(DRIVER_DESC); | 2146 | MODULE_DESCRIPTION(DRIVER_DESC); |
2147 | MODULE_AUTHOR("Mikko Lahteenmaki, Bo Henriksen"); | 2147 | MODULE_AUTHOR("Mikko Lahteenmaki, Bo Henriksen"); |
2148 | MODULE_LICENSE("GPL"); | 2148 | MODULE_LICENSE("GPL"); |
2149 | MODULE_ALIAS("platform:lh7a40x_udc"); | ||
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 835948f0715a..ee6b35fa870f 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -35,6 +35,7 @@ | |||
35 | MODULE_DESCRIPTION("M66592 USB gadget driver"); | 35 | MODULE_DESCRIPTION("M66592 USB gadget driver"); |
36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
37 | MODULE_AUTHOR("Yoshihiro Shimoda"); | 37 | MODULE_AUTHOR("Yoshihiro Shimoda"); |
38 | MODULE_ALIAS("platform:m66592_udc"); | ||
38 | 39 | ||
39 | #define DRIVER_VERSION "18 Oct 2007" | 40 | #define DRIVER_VERSION "18 Oct 2007" |
40 | 41 | ||
@@ -1671,6 +1672,7 @@ static struct platform_driver m66592_driver = { | |||
1671 | .remove = __exit_p(m66592_remove), | 1672 | .remove = __exit_p(m66592_remove), |
1672 | .driver = { | 1673 | .driver = { |
1673 | .name = (char *) udc_name, | 1674 | .name = (char *) udc_name, |
1675 | .owner = THIS_MODULE, | ||
1674 | }, | 1676 | }, |
1675 | }; | 1677 | }; |
1676 | 1678 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index e6d68bda428a..ee1e9a314cd1 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -3109,4 +3109,4 @@ module_exit(udc_exit); | |||
3109 | 3109 | ||
3110 | MODULE_DESCRIPTION(DRIVER_DESC); | 3110 | MODULE_DESCRIPTION(DRIVER_DESC); |
3111 | MODULE_LICENSE("GPL"); | 3111 | MODULE_LICENSE("GPL"); |
3112 | 3112 | MODULE_ALIAS("platform:omap_udc"); | |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 9fdabc8fcac4..2c32bd08ee7d 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -92,7 +92,6 @@ struct printer_dev { | |||
92 | u8 *current_rx_buf; | 92 | u8 *current_rx_buf; |
93 | u8 printer_status; | 93 | u8 printer_status; |
94 | u8 reset_printer; | 94 | u8 reset_printer; |
95 | struct class_device *printer_class_dev; | ||
96 | struct cdev printer_cdev; | 95 | struct cdev printer_cdev; |
97 | struct device *pdev; | 96 | struct device *pdev; |
98 | u8 printer_cdev_open; | 97 | u8 printer_cdev_open; |
@@ -1299,7 +1298,7 @@ printer_unbind(struct usb_gadget *gadget) | |||
1299 | printer_req_free(dev->in_ep, req); | 1298 | printer_req_free(dev->in_ep, req); |
1300 | } | 1299 | } |
1301 | 1300 | ||
1302 | if (dev->current_rx_req != NULL); | 1301 | if (dev->current_rx_req != NULL) |
1303 | printer_req_free(dev->out_ep, dev->current_rx_req); | 1302 | printer_req_free(dev->out_ep, dev->current_rx_req); |
1304 | 1303 | ||
1305 | while (!list_empty(&dev->rx_reqs)) { | 1304 | while (!list_empty(&dev->rx_reqs)) { |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 4402d6f042d9..c00cd8b9d3d1 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -103,6 +103,12 @@ static const char ep0name [] = "ep0"; | |||
103 | #error "Can't configure both IXP and PXA" | 103 | #error "Can't configure both IXP and PXA" |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | /* IXP doesn't yet support <linux/clk.h> */ | ||
107 | #define clk_get(dev,name) NULL | ||
108 | #define clk_enable(clk) do { } while (0) | ||
109 | #define clk_disable(clk) do { } while (0) | ||
110 | #define clk_put(clk) do { } while (0) | ||
111 | |||
106 | #endif | 112 | #endif |
107 | 113 | ||
108 | #include "pxa2xx_udc.h" | 114 | #include "pxa2xx_udc.h" |
@@ -934,20 +940,31 @@ static void udc_disable(struct pxa2xx_udc *); | |||
934 | /* We disable the UDC -- and its 48 MHz clock -- whenever it's not | 940 | /* We disable the UDC -- and its 48 MHz clock -- whenever it's not |
935 | * in active use. | 941 | * in active use. |
936 | */ | 942 | */ |
937 | static int pullup(struct pxa2xx_udc *udc, int is_active) | 943 | static int pullup(struct pxa2xx_udc *udc) |
938 | { | 944 | { |
939 | is_active = is_active && udc->vbus && udc->pullup; | 945 | int is_active = udc->vbus && udc->pullup && !udc->suspended; |
940 | DMSG("%s\n", is_active ? "active" : "inactive"); | 946 | DMSG("%s\n", is_active ? "active" : "inactive"); |
941 | if (is_active) | 947 | if (is_active) { |
942 | udc_enable(udc); | 948 | if (!udc->active) { |
943 | else { | 949 | udc->active = 1; |
944 | if (udc->gadget.speed != USB_SPEED_UNKNOWN) { | 950 | /* Enable clock for USB device */ |
945 | DMSG("disconnect %s\n", udc->driver | 951 | clk_enable(udc->clk); |
946 | ? udc->driver->driver.name | 952 | udc_enable(udc); |
947 | : "(no driver)"); | ||
948 | stop_activity(udc, udc->driver); | ||
949 | } | 953 | } |
950 | udc_disable(udc); | 954 | } else { |
955 | if (udc->active) { | ||
956 | if (udc->gadget.speed != USB_SPEED_UNKNOWN) { | ||
957 | DMSG("disconnect %s\n", udc->driver | ||
958 | ? udc->driver->driver.name | ||
959 | : "(no driver)"); | ||
960 | stop_activity(udc, udc->driver); | ||
961 | } | ||
962 | udc_disable(udc); | ||
963 | /* Disable clock for USB device */ | ||
964 | clk_disable(udc->clk); | ||
965 | udc->active = 0; | ||
966 | } | ||
967 | |||
951 | } | 968 | } |
952 | return 0; | 969 | return 0; |
953 | } | 970 | } |
@@ -958,9 +975,9 @@ static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
958 | struct pxa2xx_udc *udc; | 975 | struct pxa2xx_udc *udc; |
959 | 976 | ||
960 | udc = container_of(_gadget, struct pxa2xx_udc, gadget); | 977 | udc = container_of(_gadget, struct pxa2xx_udc, gadget); |
961 | udc->vbus = is_active = (is_active != 0); | 978 | udc->vbus = (is_active != 0); |
962 | DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); | 979 | DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); |
963 | pullup(udc, is_active); | 980 | pullup(udc); |
964 | return 0; | 981 | return 0; |
965 | } | 982 | } |
966 | 983 | ||
@@ -975,9 +992,8 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) | |||
975 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 992 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) |
976 | return -EOPNOTSUPP; | 993 | return -EOPNOTSUPP; |
977 | 994 | ||
978 | is_active = (is_active != 0); | 995 | udc->pullup = (is_active != 0); |
979 | udc->pullup = is_active; | 996 | pullup(udc); |
980 | pullup(udc, is_active); | ||
981 | return 0; | 997 | return 0; |
982 | } | 998 | } |
983 | 999 | ||
@@ -997,7 +1013,7 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = { | |||
997 | #ifdef CONFIG_USB_GADGET_DEBUG_FS | 1013 | #ifdef CONFIG_USB_GADGET_DEBUG_FS |
998 | 1014 | ||
999 | static int | 1015 | static int |
1000 | udc_seq_show(struct seq_file *m, void *d) | 1016 | udc_seq_show(struct seq_file *m, void *_d) |
1001 | { | 1017 | { |
1002 | struct pxa2xx_udc *dev = m->private; | 1018 | struct pxa2xx_udc *dev = m->private; |
1003 | unsigned long flags; | 1019 | unsigned long flags; |
@@ -1146,11 +1162,6 @@ static void udc_disable(struct pxa2xx_udc *dev) | |||
1146 | 1162 | ||
1147 | udc_clear_mask_UDCCR(UDCCR_UDE); | 1163 | udc_clear_mask_UDCCR(UDCCR_UDE); |
1148 | 1164 | ||
1149 | #ifdef CONFIG_ARCH_PXA | ||
1150 | /* Disable clock for USB device */ | ||
1151 | clk_disable(dev->clk); | ||
1152 | #endif | ||
1153 | |||
1154 | ep0_idle (dev); | 1165 | ep0_idle (dev); |
1155 | dev->gadget.speed = USB_SPEED_UNKNOWN; | 1166 | dev->gadget.speed = USB_SPEED_UNKNOWN; |
1156 | } | 1167 | } |
@@ -1191,11 +1202,6 @@ static void udc_enable (struct pxa2xx_udc *dev) | |||
1191 | { | 1202 | { |
1192 | udc_clear_mask_UDCCR(UDCCR_UDE); | 1203 | udc_clear_mask_UDCCR(UDCCR_UDE); |
1193 | 1204 | ||
1194 | #ifdef CONFIG_ARCH_PXA | ||
1195 | /* Enable clock for USB device */ | ||
1196 | clk_enable(dev->clk); | ||
1197 | #endif | ||
1198 | |||
1199 | /* try to clear these bits before we enable the udc */ | 1205 | /* try to clear these bits before we enable the udc */ |
1200 | udc_ack_int_UDCCR(UDCCR_SUSIR|/*UDCCR_RSTIR|*/UDCCR_RESIR); | 1206 | udc_ack_int_UDCCR(UDCCR_SUSIR|/*UDCCR_RSTIR|*/UDCCR_RESIR); |
1201 | 1207 | ||
@@ -1286,7 +1292,7 @@ fail: | |||
1286 | * for set_configuration as well as eventual disconnect. | 1292 | * for set_configuration as well as eventual disconnect. |
1287 | */ | 1293 | */ |
1288 | DMSG("registered gadget driver '%s'\n", driver->driver.name); | 1294 | DMSG("registered gadget driver '%s'\n", driver->driver.name); |
1289 | pullup(dev, 1); | 1295 | pullup(dev); |
1290 | dump_state(dev); | 1296 | dump_state(dev); |
1291 | return 0; | 1297 | return 0; |
1292 | } | 1298 | } |
@@ -1329,7 +1335,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1329 | return -EINVAL; | 1335 | return -EINVAL; |
1330 | 1336 | ||
1331 | local_irq_disable(); | 1337 | local_irq_disable(); |
1332 | pullup(dev, 0); | 1338 | dev->pullup = 0; |
1339 | pullup(dev); | ||
1333 | stop_activity(dev, driver); | 1340 | stop_activity(dev, driver); |
1334 | local_irq_enable(); | 1341 | local_irq_enable(); |
1335 | 1342 | ||
@@ -2131,13 +2138,11 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2131 | if (irq < 0) | 2138 | if (irq < 0) |
2132 | return -ENODEV; | 2139 | return -ENODEV; |
2133 | 2140 | ||
2134 | #ifdef CONFIG_ARCH_PXA | ||
2135 | dev->clk = clk_get(&pdev->dev, "UDCCLK"); | 2141 | dev->clk = clk_get(&pdev->dev, "UDCCLK"); |
2136 | if (IS_ERR(dev->clk)) { | 2142 | if (IS_ERR(dev->clk)) { |
2137 | retval = PTR_ERR(dev->clk); | 2143 | retval = PTR_ERR(dev->clk); |
2138 | goto err_clk; | 2144 | goto err_clk; |
2139 | } | 2145 | } |
2140 | #endif | ||
2141 | 2146 | ||
2142 | pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, | 2147 | pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, |
2143 | dev->has_cfr ? "" : " (!cfr)", | 2148 | dev->has_cfr ? "" : " (!cfr)", |
@@ -2250,10 +2255,8 @@ lubbock_fail0: | |||
2250 | if (dev->mach->gpio_vbus) | 2255 | if (dev->mach->gpio_vbus) |
2251 | gpio_free(dev->mach->gpio_vbus); | 2256 | gpio_free(dev->mach->gpio_vbus); |
2252 | err_gpio_vbus: | 2257 | err_gpio_vbus: |
2253 | #ifdef CONFIG_ARCH_PXA | ||
2254 | clk_put(dev->clk); | 2258 | clk_put(dev->clk); |
2255 | err_clk: | 2259 | err_clk: |
2256 | #endif | ||
2257 | return retval; | 2260 | return retval; |
2258 | } | 2261 | } |
2259 | 2262 | ||
@@ -2269,7 +2272,9 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) | |||
2269 | if (dev->driver) | 2272 | if (dev->driver) |
2270 | return -EBUSY; | 2273 | return -EBUSY; |
2271 | 2274 | ||
2272 | udc_disable(dev); | 2275 | dev->pullup = 0; |
2276 | pullup(dev); | ||
2277 | |||
2273 | remove_debug_files(dev); | 2278 | remove_debug_files(dev); |
2274 | 2279 | ||
2275 | if (dev->got_irq) { | 2280 | if (dev->got_irq) { |
@@ -2289,9 +2294,7 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) | |||
2289 | if (dev->mach->gpio_pullup) | 2294 | if (dev->mach->gpio_pullup) |
2290 | gpio_free(dev->mach->gpio_pullup); | 2295 | gpio_free(dev->mach->gpio_pullup); |
2291 | 2296 | ||
2292 | #ifdef CONFIG_ARCH_PXA | ||
2293 | clk_put(dev->clk); | 2297 | clk_put(dev->clk); |
2294 | #endif | ||
2295 | 2298 | ||
2296 | platform_set_drvdata(pdev, NULL); | 2299 | platform_set_drvdata(pdev, NULL); |
2297 | the_controller = NULL; | 2300 | the_controller = NULL; |
@@ -2317,10 +2320,15 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) | |||
2317 | static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) | 2320 | static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) |
2318 | { | 2321 | { |
2319 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); | 2322 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2323 | unsigned long flags; | ||
2320 | 2324 | ||
2321 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 2325 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) |
2322 | WARN("USB host won't detect disconnect!\n"); | 2326 | WARN("USB host won't detect disconnect!\n"); |
2323 | pullup(udc, 0); | 2327 | udc->suspended = 1; |
2328 | |||
2329 | local_irq_save(flags); | ||
2330 | pullup(udc); | ||
2331 | local_irq_restore(flags); | ||
2324 | 2332 | ||
2325 | return 0; | 2333 | return 0; |
2326 | } | 2334 | } |
@@ -2328,8 +2336,12 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) | |||
2328 | static int pxa2xx_udc_resume(struct platform_device *dev) | 2336 | static int pxa2xx_udc_resume(struct platform_device *dev) |
2329 | { | 2337 | { |
2330 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); | 2338 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2339 | unsigned long flags; | ||
2331 | 2340 | ||
2332 | pullup(udc, 1); | 2341 | udc->suspended = 0; |
2342 | local_irq_save(flags); | ||
2343 | pullup(udc); | ||
2344 | local_irq_restore(flags); | ||
2333 | 2345 | ||
2334 | return 0; | 2346 | return 0; |
2335 | } | 2347 | } |
@@ -2368,4 +2380,4 @@ module_exit(udc_exit); | |||
2368 | MODULE_DESCRIPTION(DRIVER_DESC); | 2380 | MODULE_DESCRIPTION(DRIVER_DESC); |
2369 | MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); | 2381 | MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); |
2370 | MODULE_LICENSE("GPL"); | 2382 | MODULE_LICENSE("GPL"); |
2371 | 2383 | MODULE_ALIAS("platform:pxa2xx-udc"); | |
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa2xx_udc.h index b67e3ff5e4eb..e2c19e88c875 100644 --- a/drivers/usb/gadget/pxa2xx_udc.h +++ b/drivers/usb/gadget/pxa2xx_udc.h | |||
@@ -119,7 +119,9 @@ struct pxa2xx_udc { | |||
119 | has_cfr : 1, | 119 | has_cfr : 1, |
120 | req_pending : 1, | 120 | req_pending : 1, |
121 | req_std : 1, | 121 | req_std : 1, |
122 | req_config : 1; | 122 | req_config : 1, |
123 | suspended : 1, | ||
124 | active : 1; | ||
123 | 125 | ||
124 | #define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200)) | 126 | #define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200)) |
125 | struct timer_list timer; | 127 | struct timer_list timer; |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index aadc4204d6f9..6b1ef488043b 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -2047,3 +2047,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); | |||
2047 | MODULE_DESCRIPTION(DRIVER_DESC); | 2047 | MODULE_DESCRIPTION(DRIVER_DESC); |
2048 | MODULE_VERSION(DRIVER_VERSION); | 2048 | MODULE_VERSION(DRIVER_VERSION); |
2049 | MODULE_LICENSE("GPL"); | 2049 | MODULE_LICENSE("GPL"); |
2050 | MODULE_ALIAS("platform:s3c2410-usbgadget"); | ||
2051 | MODULE_ALIAS("platform:s3c2440-usbgadget"); | ||