aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-04-12 13:49:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-12 13:49:28 -0400
commit8065248069097dddf9945acfb2081025e9618c16 (patch)
treeeddf3fb0372ba0f65c01382d386942ea8d18932d /drivers/usb
parente66a8ddff72e85605f2212a0ebc666c7e9116641 (diff)
parentb4838d12e1f3cb48c2489a0b08733b5dbf848297 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/core/inode.c10
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/amd5536udc.c1
-rw-r--r--drivers/usb/gadget/at91_udc.c41
-rw-r--r--drivers/usb/gadget/dummy_hcd.c1
-rw-r--r--drivers/usb/gadget/f_phonet.c2
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c1
-rw-r--r--drivers/usb/gadget/goku_udc.c1
-rw-r--r--drivers/usb/gadget/langwell_udc.c1
-rw-r--r--drivers/usb/gadget/mv_udc_core.c1
-rw-r--r--drivers/usb/gadget/net2272.c1
-rw-r--r--drivers/usb/gadget/net2280.c1
-rw-r--r--drivers/usb/gadget/omap_udc.c1
-rw-r--r--drivers/usb/gadget/printer.c1
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c1
-rw-r--r--drivers/usb/gadget/rndis.c1
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c1
-rw-r--r--drivers/usb/host/ehci-atmel.c25
-rw-r--r--drivers/usb/host/ehci-dbg.c9
-rw-r--r--drivers/usb/host/ehci-hcd.c1
-rw-r--r--drivers/usb/host/isp116x-hcd.c1
-rw-r--r--drivers/usb/host/isp1362-hcd.c1
-rw-r--r--drivers/usb/host/ohci-at91.c184
-rw-r--r--drivers/usb/host/ohci-hcd.c1
-rw-r--r--drivers/usb/host/ohci-sa1111.c297
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c1
-rw-r--r--drivers/usb/host/sl811-hcd.c1
-rw-r--r--drivers/usb/host/u132-hcd.c1
-rw-r--r--drivers/usb/host/uhci-hcd.c1
-rw-r--r--drivers/usb/musb/ux500_dma.c4
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c5
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/storage/Kconfig2
34 files changed, 362 insertions, 245 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 48ac6e781ba2..cbd8f5f80596 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -44,7 +44,7 @@ config USB_ARCH_HAS_EHCI
44 default y if PPC_MPC512x 44 default y if PPC_MPC512x
45 default y if ARCH_IXP4XX 45 default y if ARCH_IXP4XX
46 default y if ARCH_W90X900 46 default y if ARCH_W90X900
47 default y if ARCH_AT91SAM9G45 47 default y if ARCH_AT91
48 default y if ARCH_MXC 48 default y if ARCH_MXC
49 default y if ARCH_OMAP3 49 default y if ARCH_OMAP3
50 default y if ARCH_CNS3XXX 50 default y if ARCH_CNS3XXX
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index cefa0c8b5b6a..d2b9af59cba9 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -428,18 +428,10 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
428 return retval; 428 return retval;
429} 429}
430 430
431static int default_open (struct inode *inode, struct file *file)
432{
433 if (inode->i_private)
434 file->private_data = inode->i_private;
435
436 return 0;
437}
438
439static const struct file_operations default_file_operations = { 431static const struct file_operations default_file_operations = {
440 .read = default_read_file, 432 .read = default_read_file,
441 .write = default_write_file, 433 .write = default_write_file,
442 .open = default_open, 434 .open = simple_open,
443 .llseek = default_file_lseek, 435 .llseek = default_file_lseek,
444}; 436};
445 437
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 26c0b75f152e..2633f7595116 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -137,7 +137,7 @@ choice
137 137
138config USB_AT91 138config USB_AT91
139 tristate "Atmel AT91 USB Device Port" 139 tristate "Atmel AT91 USB Device Port"
140 depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91SAM9G45 140 depends on ARCH_AT91
141 help 141 help
142 Many Atmel AT91 processors (such as the AT91RM2000) have a 142 Many Atmel AT91 processors (such as the AT91RM2000) have a
143 full speed USB Device Port with support for five configurable 143 full speed USB Device Port with support for five configurable
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 2204a4c68d85..77779271f487 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -54,7 +54,6 @@
54#include <linux/prefetch.h> 54#include <linux/prefetch.h>
55 55
56#include <asm/byteorder.h> 56#include <asm/byteorder.h>
57#include <asm/system.h>
58#include <asm/unaligned.h> 57#include <asm/unaligned.h>
59 58
60/* gadget stack */ 59/* gadget stack */
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 2db5f68f7960..0c935d7c65bd 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -29,12 +29,13 @@
29#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/usb/ch9.h> 30#include <linux/usb/ch9.h>
31#include <linux/usb/gadget.h> 31#include <linux/usb/gadget.h>
32#include <linux/of.h>
33#include <linux/of_gpio.h>
32 34
33#include <asm/byteorder.h> 35#include <asm/byteorder.h>
34#include <mach/hardware.h> 36#include <mach/hardware.h>
35#include <asm/io.h> 37#include <asm/io.h>
36#include <asm/irq.h> 38#include <asm/irq.h>
37#include <asm/system.h>
38#include <asm/gpio.h> 39#include <asm/gpio.h>
39 40
40#include <mach/board.h> 41#include <mach/board.h>
@@ -1707,7 +1708,27 @@ static void at91udc_shutdown(struct platform_device *dev)
1707 spin_unlock_irqrestore(&udc->lock, flags); 1708 spin_unlock_irqrestore(&udc->lock, flags);
1708} 1709}
1709 1710
1710static int __init at91udc_probe(struct platform_device *pdev) 1711static void __devinit at91udc_of_init(struct at91_udc *udc,
1712 struct device_node *np)
1713{
1714 struct at91_udc_data *board = &udc->board;
1715 u32 val;
1716 enum of_gpio_flags flags;
1717
1718 if (of_property_read_u32(np, "atmel,vbus-polled", &val) == 0)
1719 board->vbus_polled = 1;
1720
1721 board->vbus_pin = of_get_named_gpio_flags(np, "atmel,vbus-gpio", 0,
1722 &flags);
1723 board->vbus_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
1724
1725 board->pullup_pin = of_get_named_gpio_flags(np, "atmel,pullup-gpio", 0,
1726 &flags);
1727
1728 board->pullup_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
1729}
1730
1731static int __devinit at91udc_probe(struct platform_device *pdev)
1711{ 1732{
1712 struct device *dev = &pdev->dev; 1733 struct device *dev = &pdev->dev;
1713 struct at91_udc *udc; 1734 struct at91_udc *udc;
@@ -1742,7 +1763,11 @@ static int __init at91udc_probe(struct platform_device *pdev)
1742 /* init software state */ 1763 /* init software state */
1743 udc = &controller; 1764 udc = &controller;
1744 udc->gadget.dev.parent = dev; 1765 udc->gadget.dev.parent = dev;
1745 udc->board = *(struct at91_udc_data *) dev->platform_data; 1766 if (pdev->dev.of_node)
1767 at91udc_of_init(udc, pdev->dev.of_node);
1768 else
1769 memcpy(&udc->board, dev->platform_data,
1770 sizeof(struct at91_udc_data));
1746 udc->pdev = pdev; 1771 udc->pdev = pdev;
1747 udc->enabled = 0; 1772 udc->enabled = 0;
1748 spin_lock_init(&udc->lock); 1773 spin_lock_init(&udc->lock);
@@ -1971,6 +1996,15 @@ static int at91udc_resume(struct platform_device *pdev)
1971#define at91udc_resume NULL 1996#define at91udc_resume NULL
1972#endif 1997#endif
1973 1998
1999#if defined(CONFIG_OF)
2000static const struct of_device_id at91_udc_dt_ids[] = {
2001 { .compatible = "atmel,at91rm9200-udc" },
2002 { /* sentinel */ }
2003};
2004
2005MODULE_DEVICE_TABLE(of, at91_udc_dt_ids);
2006#endif
2007
1974static struct platform_driver at91_udc_driver = { 2008static struct platform_driver at91_udc_driver = {
1975 .remove = __exit_p(at91udc_remove), 2009 .remove = __exit_p(at91udc_remove),
1976 .shutdown = at91udc_shutdown, 2010 .shutdown = at91udc_shutdown,
@@ -1979,6 +2013,7 @@ static struct platform_driver at91_udc_driver = {
1979 .driver = { 2013 .driver = {
1980 .name = (char *) driver_name, 2014 .name = (char *) driver_name,
1981 .owner = THIS_MODULE, 2015 .owner = THIS_MODULE,
2016 .of_match_table = of_match_ptr(at91_udc_dt_ids),
1982 }, 2017 },
1983}; 2018};
1984 2019
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index e1cd56c5e2a8..a6dfd2164166 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -44,7 +44,6 @@
44#include <asm/byteorder.h> 44#include <asm/byteorder.h>
45#include <linux/io.h> 45#include <linux/io.h>
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/system.h>
48#include <asm/unaligned.h> 47#include <asm/unaligned.h>
49 48
50#define DRIVER_DESC "USB Host+Gadget Emulator" 49#define DRIVER_DESC "USB Host+Gadget Emulator"
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index 85a5cebe96b3..965a6293206a 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -345,7 +345,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req)
345 } 345 }
346 346
347 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 347 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
348 skb->len <= 1, req->actual, req->actual); 348 skb->len <= 1, req->actual, PAGE_SIZE);
349 page = NULL; 349 page = NULL;
350 350
351 if (req->actual < req->length) { /* Last fragment */ 351 if (req->actual < req->length) { /* Last fragment */
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index b30e21fdbb1b..5f94e79cd6b9 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -43,7 +43,6 @@
43 43
44#include <asm/byteorder.h> 44#include <asm/byteorder.h>
45#include <asm/io.h> 45#include <asm/io.h>
46#include <asm/system.h>
47#include <asm/unaligned.h> 46#include <asm/unaligned.h>
48#include <asm/dma.h> 47#include <asm/dma.h>
49 48
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index e1dfd32dc805..e151d6b87dee 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -43,7 +43,6 @@
43#include <asm/byteorder.h> 43#include <asm/byteorder.h>
44#include <asm/io.h> 44#include <asm/io.h>
45#include <asm/irq.h> 45#include <asm/irq.h>
46#include <asm/system.h>
47#include <asm/unaligned.h> 46#include <asm/unaligned.h>
48 47
49 48
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index edd52d963f14..f9cedd52cf20 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -32,7 +32,6 @@
32#include <linux/pm.h> 32#include <linux/pm.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/irq.h> 34#include <linux/irq.h>
35#include <asm/system.h>
36#include <asm/unaligned.h> 35#include <asm/unaligned.h>
37 36
38#include "langwell_udc.h" 37#include "langwell_udc.h"
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 19bbe80c2f8c..a73cf406e2a4 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -34,7 +34,6 @@
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/platform_data/mv_usb.h> 36#include <linux/platform_data/mv_usb.h>
37#include <asm/system.h>
38#include <asm/unaligned.h> 37#include <asm/unaligned.h>
39 38
40#include "mv_udc.h" 39#include "mv_udc.h"
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c
index 01ae56f47174..43ac7482fa91 100644
--- a/drivers/usb/gadget/net2272.c
+++ b/drivers/usb/gadget/net2272.c
@@ -42,7 +42,6 @@
42#include <linux/usb/gadget.h> 42#include <linux/usb/gadget.h>
43 43
44#include <asm/byteorder.h> 44#include <asm/byteorder.h>
45#include <asm/system.h>
46#include <asm/unaligned.h> 45#include <asm/unaligned.h>
47 46
48#include "net2272.h" 47#include "net2272.h"
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index a5ccabc37f30..ac335af154ba 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -59,7 +59,6 @@
59#include <asm/byteorder.h> 59#include <asm/byteorder.h>
60#include <asm/io.h> 60#include <asm/io.h>
61#include <asm/irq.h> 61#include <asm/irq.h>
62#include <asm/system.h>
63#include <asm/unaligned.h> 62#include <asm/unaligned.h>
64 63
65 64
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index b44830df593e..3b4b6dd0f95a 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -40,7 +40,6 @@
40#include <asm/byteorder.h> 40#include <asm/byteorder.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/system.h>
44#include <asm/unaligned.h> 43#include <asm/unaligned.h>
45#include <asm/mach-types.h> 44#include <asm/mach-types.h>
46 45
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index d83134b0f78a..4e4dc1f5f388 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -34,7 +34,6 @@
34#include <asm/byteorder.h> 34#include <asm/byteorder.h>
35#include <linux/io.h> 35#include <linux/io.h>
36#include <linux/irq.h> 36#include <linux/irq.h>
37#include <asm/system.h>
38#include <linux/uaccess.h> 37#include <linux/uaccess.h>
39#include <asm/unaligned.h> 38#include <asm/unaligned.h>
40 39
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 1b33634f2736..41ed69c96d8c 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -41,7 +41,6 @@
41#include <asm/byteorder.h> 41#include <asm/byteorder.h>
42#include <asm/dma.h> 42#include <asm/dma.h>
43#include <asm/gpio.h> 43#include <asm/gpio.h>
44#include <asm/system.h>
45#include <asm/mach-types.h> 44#include <asm/mach-types.h>
46#include <asm/unaligned.h> 45#include <asm/unaligned.h>
47 46
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index d3cdffea9c8a..73a934a170d1 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -34,7 +34,6 @@
34 34
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/byteorder.h> 36#include <asm/byteorder.h>
37#include <asm/system.h>
38#include <asm/unaligned.h> 37#include <asm/unaligned.h>
39 38
40 39
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index ab9c65e2c1d5..195524cde6c3 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -37,7 +37,6 @@
37#include <asm/byteorder.h> 37#include <asm/byteorder.h>
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/system.h>
41#include <asm/unaligned.h> 40#include <asm/unaligned.h>
42#include <mach/irqs.h> 41#include <mach/irqs.h>
43 42
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index a5a3ef1f0096..cf14c95a6700 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -13,6 +13,8 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/of.h>
17#include <linux/of_platform.h>
16 18
17/* interface and function clocks */ 19/* interface and function clocks */
18static struct clk *iclk, *fclk; 20static struct clk *iclk, *fclk;
@@ -115,6 +117,8 @@ static const struct hc_driver ehci_atmel_hc_driver = {
115 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 117 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
116}; 118};
117 119
120static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32);
121
118static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) 122static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev)
119{ 123{
120 struct usb_hcd *hcd; 124 struct usb_hcd *hcd;
@@ -137,6 +141,13 @@ static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev)
137 goto fail_create_hcd; 141 goto fail_create_hcd;
138 } 142 }
139 143
144 /* Right now device-tree probed devices don't get dma_mask set.
145 * Since shared usb code relies on it, set it here for now.
146 * Once we have dma capability bindings this can go away.
147 */
148 if (!pdev->dev.dma_mask)
149 pdev->dev.dma_mask = &at91_ehci_dma_mask;
150
140 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 151 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
141 if (!hcd) { 152 if (!hcd) {
142 retval = -ENOMEM; 153 retval = -ENOMEM;
@@ -225,9 +236,21 @@ static int __devexit ehci_atmel_drv_remove(struct platform_device *pdev)
225 return 0; 236 return 0;
226} 237}
227 238
239#ifdef CONFIG_OF
240static const struct of_device_id atmel_ehci_dt_ids[] = {
241 { .compatible = "atmel,at91sam9g45-ehci" },
242 { /* sentinel */ }
243};
244
245MODULE_DEVICE_TABLE(of, atmel_ehci_dt_ids);
246#endif
247
228static struct platform_driver ehci_atmel_driver = { 248static struct platform_driver ehci_atmel_driver = {
229 .probe = ehci_atmel_drv_probe, 249 .probe = ehci_atmel_drv_probe,
230 .remove = __devexit_p(ehci_atmel_drv_remove), 250 .remove = __devexit_p(ehci_atmel_drv_remove),
231 .shutdown = usb_hcd_platform_shutdown, 251 .shutdown = usb_hcd_platform_shutdown,
232 .driver.name = "atmel-ehci", 252 .driver = {
253 .name = "atmel-ehci",
254 .of_match_table = of_match_ptr(atmel_ehci_dt_ids),
255 },
233}; 256};
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index fd9109d7eb0e..680e1a31fb87 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -352,7 +352,6 @@ static int debug_async_open(struct inode *, struct file *);
352static int debug_periodic_open(struct inode *, struct file *); 352static int debug_periodic_open(struct inode *, struct file *);
353static int debug_registers_open(struct inode *, struct file *); 353static int debug_registers_open(struct inode *, struct file *);
354static int debug_async_open(struct inode *, struct file *); 354static int debug_async_open(struct inode *, struct file *);
355static int debug_lpm_open(struct inode *, struct file *);
356static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, 355static ssize_t debug_lpm_read(struct file *file, char __user *user_buf,
357 size_t count, loff_t *ppos); 356 size_t count, loff_t *ppos);
358static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, 357static ssize_t debug_lpm_write(struct file *file, const char __user *buffer,
@@ -385,7 +384,7 @@ static const struct file_operations debug_registers_fops = {
385}; 384};
386static const struct file_operations debug_lpm_fops = { 385static const struct file_operations debug_lpm_fops = {
387 .owner = THIS_MODULE, 386 .owner = THIS_MODULE,
388 .open = debug_lpm_open, 387 .open = simple_open,
389 .read = debug_lpm_read, 388 .read = debug_lpm_read,
390 .write = debug_lpm_write, 389 .write = debug_lpm_write,
391 .release = debug_lpm_close, 390 .release = debug_lpm_close,
@@ -970,12 +969,6 @@ static int debug_registers_open(struct inode *inode, struct file *file)
970 return file->private_data ? 0 : -ENOMEM; 969 return file->private_data ? 0 : -ENOMEM;
971} 970}
972 971
973static int debug_lpm_open(struct inode *inode, struct file *file)
974{
975 file->private_data = inode->i_private;
976 return 0;
977}
978
979static int debug_lpm_close(struct inode *inode, struct file *file) 972static int debug_lpm_close(struct inode *inode, struct file *file)
980{ 973{
981 return 0; 974 return 0;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index aede6374e4b6..057cdda7a489 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -45,7 +45,6 @@
45#include <asm/byteorder.h> 45#include <asm/byteorder.h>
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/system.h>
49#include <asm/unaligned.h> 48#include <asm/unaligned.h>
50 49
51#if defined(CONFIG_PPC_PS3) 50#if defined(CONFIG_PPC_PS3)
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 924880087a74..9e65e3091c8a 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -70,7 +70,6 @@
70 70
71#include <asm/io.h> 71#include <asm/io.h>
72#include <asm/irq.h> 72#include <asm/irq.h>
73#include <asm/system.h>
74#include <asm/byteorder.h> 73#include <asm/byteorder.h>
75 74
76#include "isp116x.h" 75#include "isp116x.h"
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 9e63cdf1ab75..2ed112d3e159 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -84,7 +84,6 @@
84#include <linux/prefetch.h> 84#include <linux/prefetch.h>
85 85
86#include <asm/irq.h> 86#include <asm/irq.h>
87#include <asm/system.h>
88#include <asm/byteorder.h> 87#include <asm/byteorder.h>
89#include <asm/unaligned.h> 88#include <asm/unaligned.h>
90 89
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 8e855eb0bf89..09f597ad6e00 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/of_platform.h>
18#include <linux/of_gpio.h>
17 19
18#include <mach/hardware.h> 20#include <mach/hardware.h>
19#include <asm/gpio.h> 21#include <asm/gpio.h>
@@ -25,6 +27,10 @@
25#error "CONFIG_ARCH_AT91 must be defined." 27#error "CONFIG_ARCH_AT91 must be defined."
26#endif 28#endif
27 29
30#define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS)
31#define at91_for_each_port(index) \
32 for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++)
33
28/* interface and function clocks; sometimes also an AHB clock */ 34/* interface and function clocks; sometimes also an AHB clock */
29static struct clk *iclk, *fclk, *hclk; 35static struct clk *iclk, *fclk, *hclk;
30static int clocked; 36static int clocked;
@@ -238,26 +244,26 @@ ohci_at91_start (struct usb_hcd *hcd)
238 244
239static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable) 245static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
240{ 246{
241 if (port < 0 || port >= 2) 247 if (!valid_port(port))
242 return; 248 return;
243 249
244 if (!gpio_is_valid(pdata->vbus_pin[port])) 250 if (!gpio_is_valid(pdata->vbus_pin[port]))
245 return; 251 return;
246 252
247 gpio_set_value(pdata->vbus_pin[port], 253 gpio_set_value(pdata->vbus_pin[port],
248 !pdata->vbus_pin_active_low[port] ^ enable); 254 pdata->vbus_pin_active_low[port] ^ enable);
249} 255}
250 256
251static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) 257static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
252{ 258{
253 if (port < 0 || port >= 2) 259 if (!valid_port(port))
254 return -EINVAL; 260 return -EINVAL;
255 261
256 if (!gpio_is_valid(pdata->vbus_pin[port])) 262 if (!gpio_is_valid(pdata->vbus_pin[port]))
257 return -EINVAL; 263 return -EINVAL;
258 264
259 return gpio_get_value(pdata->vbus_pin[port]) ^ 265 return gpio_get_value(pdata->vbus_pin[port]) ^
260 !pdata->vbus_pin_active_low[port]; 266 pdata->vbus_pin_active_low[port];
261} 267}
262 268
263/* 269/*
@@ -269,9 +275,9 @@ static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
269 int length = ohci_hub_status_data(hcd, buf); 275 int length = ohci_hub_status_data(hcd, buf);
270 int port; 276 int port;
271 277
272 for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { 278 at91_for_each_port(port) {
273 if (pdata->overcurrent_changed[port]) { 279 if (pdata->overcurrent_changed[port]) {
274 if (! length) 280 if (!length)
275 length = 1; 281 length = 1;
276 buf[0] |= 1 << (port + 1); 282 buf[0] |= 1 << (port + 1);
277 } 283 }
@@ -295,11 +301,17 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
295 "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", 301 "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
296 hcd, typeReq, wValue, wIndex, buf, wLength); 302 hcd, typeReq, wValue, wIndex, buf, wLength);
297 303
304 wIndex--;
305
298 switch (typeReq) { 306 switch (typeReq) {
299 case SetPortFeature: 307 case SetPortFeature:
300 if (wValue == USB_PORT_FEAT_POWER) { 308 if (wValue == USB_PORT_FEAT_POWER) {
301 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); 309 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
302 ohci_at91_usb_set_power(pdata, wIndex - 1, 1); 310 if (valid_port(wIndex)) {
311 ohci_at91_usb_set_power(pdata, wIndex, 1);
312 ret = 0;
313 }
314
303 goto out; 315 goto out;
304 } 316 }
305 break; 317 break;
@@ -310,9 +322,9 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
310 dev_dbg(hcd->self.controller, 322 dev_dbg(hcd->self.controller,
311 "ClearPortFeature: C_OVER_CURRENT\n"); 323 "ClearPortFeature: C_OVER_CURRENT\n");
312 324
313 if (wIndex == 1 || wIndex == 2) { 325 if (valid_port(wIndex)) {
314 pdata->overcurrent_changed[wIndex-1] = 0; 326 pdata->overcurrent_changed[wIndex] = 0;
315 pdata->overcurrent_status[wIndex-1] = 0; 327 pdata->overcurrent_status[wIndex] = 0;
316 } 328 }
317 329
318 goto out; 330 goto out;
@@ -321,9 +333,8 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
321 dev_dbg(hcd->self.controller, 333 dev_dbg(hcd->self.controller,
322 "ClearPortFeature: OVER_CURRENT\n"); 334 "ClearPortFeature: OVER_CURRENT\n");
323 335
324 if (wIndex == 1 || wIndex == 2) { 336 if (valid_port(wIndex))
325 pdata->overcurrent_status[wIndex-1] = 0; 337 pdata->overcurrent_status[wIndex] = 0;
326 }
327 338
328 goto out; 339 goto out;
329 340
@@ -331,15 +342,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
331 dev_dbg(hcd->self.controller, 342 dev_dbg(hcd->self.controller,
332 "ClearPortFeature: POWER\n"); 343 "ClearPortFeature: POWER\n");
333 344
334 if (wIndex == 1 || wIndex == 2) { 345 if (valid_port(wIndex)) {
335 ohci_at91_usb_set_power(pdata, wIndex - 1, 0); 346 ohci_at91_usb_set_power(pdata, wIndex, 0);
336 return 0; 347 return 0;
337 } 348 }
338 } 349 }
339 break; 350 break;
340 } 351 }
341 352
342 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); 353 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength);
343 if (ret) 354 if (ret)
344 goto out; 355 goto out;
345 356
@@ -375,18 +386,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
375 386
376 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); 387 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
377 388
378 if (wIndex == 1 || wIndex == 2) { 389 if (valid_port(wIndex)) {
379 if (! ohci_at91_usb_get_power(pdata, wIndex-1)) { 390 if (!ohci_at91_usb_get_power(pdata, wIndex))
380 *data &= ~cpu_to_le32(RH_PS_PPS); 391 *data &= ~cpu_to_le32(RH_PS_PPS);
381 }
382 392
383 if (pdata->overcurrent_changed[wIndex-1]) { 393 if (pdata->overcurrent_changed[wIndex])
384 *data |= cpu_to_le32(RH_PS_OCIC); 394 *data |= cpu_to_le32(RH_PS_OCIC);
385 }
386 395
387 if (pdata->overcurrent_status[wIndex-1]) { 396 if (pdata->overcurrent_status[wIndex])
388 *data |= cpu_to_le32(RH_PS_POCI); 397 *data |= cpu_to_le32(RH_PS_POCI);
389 }
390 } 398 }
391 } 399 }
392 400
@@ -448,14 +456,14 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
448 456
449 /* From the GPIO notifying the over-current situation, find 457 /* From the GPIO notifying the over-current situation, find
450 * out the corresponding port */ 458 * out the corresponding port */
451 for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { 459 at91_for_each_port(port) {
452 if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { 460 if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
453 gpio = pdata->overcurrent_pin[port]; 461 gpio = pdata->overcurrent_pin[port];
454 break; 462 break;
455 } 463 }
456 } 464 }
457 465
458 if (port == ARRAY_SIZE(pdata->overcurrent_pin)) { 466 if (port == AT91_MAX_USBH_PORTS) {
459 dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n"); 467 dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n");
460 return IRQ_HANDLED; 468 return IRQ_HANDLED;
461 } 469 }
@@ -465,7 +473,7 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
465 /* When notified of an over-current situation, disable power 473 /* When notified of an over-current situation, disable power
466 on the corresponding port, and mark this port in 474 on the corresponding port, and mark this port in
467 over-current. */ 475 over-current. */
468 if (! val) { 476 if (!val) {
469 ohci_at91_usb_set_power(pdata, port, 0); 477 ohci_at91_usb_set_power(pdata, port, 0);
470 pdata->overcurrent_status[port] = 1; 478 pdata->overcurrent_status[port] = 1;
471 pdata->overcurrent_changed[port] = 1; 479 pdata->overcurrent_changed[port] = 1;
@@ -477,34 +485,133 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
477 return IRQ_HANDLED; 485 return IRQ_HANDLED;
478} 486}
479 487
488#ifdef CONFIG_OF
489static const struct of_device_id at91_ohci_dt_ids[] = {
490 { .compatible = "atmel,at91rm9200-ohci" },
491 { /* sentinel */ }
492};
493
494MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
495
496static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
497
498static int __devinit ohci_at91_of_init(struct platform_device *pdev)
499{
500 struct device_node *np = pdev->dev.of_node;
501 int i, gpio;
502 enum of_gpio_flags flags;
503 struct at91_usbh_data *pdata;
504 u32 ports;
505
506 if (!np)
507 return 0;
508
509 /* Right now device-tree probed devices don't get dma_mask set.
510 * Since shared usb code relies on it, set it here for now.
511 * Once we have dma capability bindings this can go away.
512 */
513 if (!pdev->dev.dma_mask)
514 pdev->dev.dma_mask = &at91_ohci_dma_mask;
515
516 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
517 if (!pdata)
518 return -ENOMEM;
519
520 if (!of_property_read_u32(np, "num-ports", &ports))
521 pdata->ports = ports;
522
523 at91_for_each_port(i) {
524 gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
525 pdata->vbus_pin[i] = gpio;
526 if (!gpio_is_valid(gpio))
527 continue;
528 pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
529 }
530
531 at91_for_each_port(i)
532 pdata->overcurrent_pin[i] =
533 of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
534
535 pdev->dev.platform_data = pdata;
536
537 return 0;
538}
539#else
540static int __devinit ohci_at91_of_init(struct platform_device *pdev)
541{
542 return 0;
543}
544#endif
545
480/*-------------------------------------------------------------------------*/ 546/*-------------------------------------------------------------------------*/
481 547
482static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) 548static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
483{ 549{
484 struct at91_usbh_data *pdata = pdev->dev.platform_data; 550 struct at91_usbh_data *pdata;
485 int i; 551 int i;
552 int gpio;
553 int ret;
554
555 ret = ohci_at91_of_init(pdev);
556 if (ret)
557 return ret;
558
559 pdata = pdev->dev.platform_data;
486 560
487 if (pdata) { 561 if (pdata) {
488 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 562 at91_for_each_port(i) {
489 if (!gpio_is_valid(pdata->vbus_pin[i])) 563 if (!gpio_is_valid(pdata->vbus_pin[i]))
490 continue; 564 continue;
491 gpio_request(pdata->vbus_pin[i], "ohci_vbus"); 565 gpio = pdata->vbus_pin[i];
566
567 ret = gpio_request(gpio, "ohci_vbus");
568 if (ret) {
569 dev_err(&pdev->dev,
570 "can't request vbus gpio %d\n", gpio);
571 continue;
572 }
573 ret = gpio_direction_output(gpio,
574 !pdata->vbus_pin_active_low[i]);
575 if (ret) {
576 dev_err(&pdev->dev,
577 "can't put vbus gpio %d as output %d\n",
578 gpio, !pdata->vbus_pin_active_low[i]);
579 gpio_free(gpio);
580 continue;
581 }
582
492 ohci_at91_usb_set_power(pdata, i, 1); 583 ohci_at91_usb_set_power(pdata, i, 1);
493 } 584 }
494 585
495 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { 586 at91_for_each_port(i) {
496 int ret;
497
498 if (!gpio_is_valid(pdata->overcurrent_pin[i])) 587 if (!gpio_is_valid(pdata->overcurrent_pin[i]))
499 continue; 588 continue;
500 gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); 589 gpio = pdata->overcurrent_pin[i];
590
591 ret = gpio_request(gpio, "ohci_overcurrent");
592 if (ret) {
593 dev_err(&pdev->dev,
594 "can't request overcurrent gpio %d\n",
595 gpio);
596 continue;
597 }
598
599 ret = gpio_direction_input(gpio);
600 if (ret) {
601 dev_err(&pdev->dev,
602 "can't configure overcurrent gpio %d as input\n",
603 gpio);
604 gpio_free(gpio);
605 continue;
606 }
501 607
502 ret = request_irq(gpio_to_irq(pdata->overcurrent_pin[i]), 608 ret = request_irq(gpio_to_irq(gpio),
503 ohci_hcd_at91_overcurrent_irq, 609 ohci_hcd_at91_overcurrent_irq,
504 IRQF_SHARED, "ohci_overcurrent", pdev); 610 IRQF_SHARED, "ohci_overcurrent", pdev);
505 if (ret) { 611 if (ret) {
506 gpio_free(pdata->overcurrent_pin[i]); 612 gpio_free(gpio);
507 dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); 613 dev_err(&pdev->dev,
614 "can't get gpio IRQ for overcurrent\n");
508 } 615 }
509 } 616 }
510 } 617 }
@@ -519,14 +626,14 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
519 int i; 626 int i;
520 627
521 if (pdata) { 628 if (pdata) {
522 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 629 at91_for_each_port(i) {
523 if (!gpio_is_valid(pdata->vbus_pin[i])) 630 if (!gpio_is_valid(pdata->vbus_pin[i]))
524 continue; 631 continue;
525 ohci_at91_usb_set_power(pdata, i, 0); 632 ohci_at91_usb_set_power(pdata, i, 0);
526 gpio_free(pdata->vbus_pin[i]); 633 gpio_free(pdata->vbus_pin[i]);
527 } 634 }
528 635
529 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { 636 at91_for_each_port(i) {
530 if (!gpio_is_valid(pdata->overcurrent_pin[i])) 637 if (!gpio_is_valid(pdata->overcurrent_pin[i]))
531 continue; 638 continue;
532 free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); 639 free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev);
@@ -596,5 +703,6 @@ static struct platform_driver ohci_hcd_at91_driver = {
596 .driver = { 703 .driver = {
597 .name = "at91_ohci", 704 .name = "at91_ohci",
598 .owner = THIS_MODULE, 705 .owner = THIS_MODULE,
706 .of_match_table = of_match_ptr(at91_ohci_dt_ids),
599 }, 707 },
600}; 708};
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 543e90e336b8..235171f29460 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -42,7 +42,6 @@
42 42
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/irq.h> 44#include <asm/irq.h>
45#include <asm/system.h>
46#include <asm/unaligned.h> 45#include <asm/unaligned.h>
47#include <asm/byteorder.h> 46#include <asm/byteorder.h>
48 47
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 4bde4f9821ba..e1004fb37bd9 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -16,29 +16,115 @@
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <mach/assabet.h> 18#include <mach/assabet.h>
19#include <mach/badge4.h>
20#include <asm/hardware/sa1111.h> 19#include <asm/hardware/sa1111.h>
21 20
22#ifndef CONFIG_SA1111 21#ifndef CONFIG_SA1111
23#error "This file is SA-1111 bus glue. CONFIG_SA1111 must be defined." 22#error "This file is SA-1111 bus glue. CONFIG_SA1111 must be defined."
24#endif 23#endif
25 24
26extern int usb_disabled(void); 25#define USB_STATUS 0x0118
26#define USB_RESET 0x011c
27#define USB_IRQTEST 0x0120
28
29#define USB_RESET_FORCEIFRESET (1 << 0)
30#define USB_RESET_FORCEHCRESET (1 << 1)
31#define USB_RESET_CLKGENRESET (1 << 2)
32#define USB_RESET_SIMSCALEDOWN (1 << 3)
33#define USB_RESET_USBINTTEST (1 << 4)
34#define USB_RESET_SLEEPSTBYEN (1 << 5)
35#define USB_RESET_PWRSENSELOW (1 << 6)
36#define USB_RESET_PWRCTRLLOW (1 << 7)
37
38#define USB_STATUS_IRQHCIRMTWKUP (1 << 7)
39#define USB_STATUS_IRQHCIBUFFACC (1 << 8)
40#define USB_STATUS_NIRQHCIM (1 << 9)
41#define USB_STATUS_NHCIMFCLR (1 << 10)
42#define USB_STATUS_USBPWRSENSE (1 << 11)
27 43
28/*-------------------------------------------------------------------------*/ 44#if 0
45static void dump_hci_status(struct usb_hcd *hcd, const char *label)
46{
47 unsigned long status = sa1111_readl(hcd->regs + USB_STATUS);
48
49 dbg("%s USB_STATUS = { %s%s%s%s%s}", label,
50 ((status & USB_STATUS_IRQHCIRMTWKUP) ? "IRQHCIRMTWKUP " : ""),
51 ((status & USB_STATUS_IRQHCIBUFFACC) ? "IRQHCIBUFFACC " : ""),
52 ((status & USB_STATUS_NIRQHCIM) ? "" : "IRQHCIM "),
53 ((status & USB_STATUS_NHCIMFCLR) ? "" : "HCIMFCLR "),
54 ((status & USB_STATUS_USBPWRSENSE) ? "USBPWRSENSE " : ""));
55}
56#endif
29 57
30static void sa1111_start_hc(struct sa1111_dev *dev) 58static int ohci_sa1111_reset(struct usb_hcd *hcd)
31{ 59{
32 unsigned int usb_rst = 0; 60 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
61
62 ohci_hcd_init(ohci);
63 return ohci_init(ohci);
64}
33 65
34 printk(KERN_DEBUG "%s: starting SA-1111 OHCI USB Controller\n", 66static int __devinit ohci_sa1111_start(struct usb_hcd *hcd)
35 __FILE__); 67{
68 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
69 int ret;
36 70
37#ifdef CONFIG_SA1100_BADGE4 71 ret = ohci_run(ohci);
38 if (machine_is_badge4()) { 72 if (ret < 0) {
39 badge4_set_5V(BADGE4_5V_USB, 1); 73 ohci_err(ohci, "can't start\n");
74 ohci_stop(hcd);
40 } 75 }
76 return ret;
77}
78
79static const struct hc_driver ohci_sa1111_hc_driver = {
80 .description = hcd_name,
81 .product_desc = "SA-1111 OHCI",
82 .hcd_priv_size = sizeof(struct ohci_hcd),
83
84 /*
85 * generic hardware linkage
86 */
87 .irq = ohci_irq,
88 .flags = HCD_USB11 | HCD_MEMORY,
89
90 /*
91 * basic lifecycle operations
92 */
93 .reset = ohci_sa1111_reset,
94 .start = ohci_sa1111_start,
95 .stop = ohci_stop,
96 .shutdown = ohci_shutdown,
97
98 /*
99 * managing i/o requests and associated device resources
100 */
101 .urb_enqueue = ohci_urb_enqueue,
102 .urb_dequeue = ohci_urb_dequeue,
103 .endpoint_disable = ohci_endpoint_disable,
104
105 /*
106 * scheduling support
107 */
108 .get_frame_number = ohci_get_frame,
109
110 /*
111 * root hub support
112 */
113 .hub_status_data = ohci_hub_status_data,
114 .hub_control = ohci_hub_control,
115#ifdef CONFIG_PM
116 .bus_suspend = ohci_bus_suspend,
117 .bus_resume = ohci_bus_resume,
41#endif 118#endif
119 .start_port_reset = ohci_start_port_reset,
120};
121
122static int sa1111_start_hc(struct sa1111_dev *dev)
123{
124 unsigned int usb_rst = 0;
125 int ret;
126
127 dev_dbg(&dev->dev, "starting SA-1111 OHCI USB Controller\n");
42 128
43 if (machine_is_xp860() || 129 if (machine_is_xp860() ||
44 machine_has_neponset() || 130 machine_has_neponset() ||
@@ -51,220 +137,121 @@ static void sa1111_start_hc(struct sa1111_dev *dev)
51 * host controller in reset. 137 * host controller in reset.
52 */ 138 */
53 sa1111_writel(usb_rst | USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET, 139 sa1111_writel(usb_rst | USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET,
54 dev->mapbase + SA1111_USB_RESET); 140 dev->mapbase + USB_RESET);
55 141
56 /* 142 /*
57 * Now, carefully enable the USB clock, and take 143 * Now, carefully enable the USB clock, and take
58 * the USB host controller out of reset. 144 * the USB host controller out of reset.
59 */ 145 */
60 sa1111_enable_device(dev); 146 ret = sa1111_enable_device(dev);
61 udelay(11); 147 if (ret == 0) {
62 sa1111_writel(usb_rst, dev->mapbase + SA1111_USB_RESET); 148 udelay(11);
149 sa1111_writel(usb_rst, dev->mapbase + USB_RESET);
150 }
151
152 return ret;
63} 153}
64 154
65static void sa1111_stop_hc(struct sa1111_dev *dev) 155static void sa1111_stop_hc(struct sa1111_dev *dev)
66{ 156{
67 unsigned int usb_rst; 157 unsigned int usb_rst;
68 printk(KERN_DEBUG "%s: stopping SA-1111 OHCI USB Controller\n", 158
69 __FILE__); 159 dev_dbg(&dev->dev, "stopping SA-1111 OHCI USB Controller\n");
70 160
71 /* 161 /*
72 * Put the USB host controller into reset. 162 * Put the USB host controller into reset.
73 */ 163 */
74 usb_rst = sa1111_readl(dev->mapbase + SA1111_USB_RESET); 164 usb_rst = sa1111_readl(dev->mapbase + USB_RESET);
75 sa1111_writel(usb_rst | USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET, 165 sa1111_writel(usb_rst | USB_RESET_FORCEIFRESET | USB_RESET_FORCEHCRESET,
76 dev->mapbase + SA1111_USB_RESET); 166 dev->mapbase + USB_RESET);
77 167
78 /* 168 /*
79 * Stop the USB clock. 169 * Stop the USB clock.
80 */ 170 */
81 sa1111_disable_device(dev); 171 sa1111_disable_device(dev);
82
83#ifdef CONFIG_SA1100_BADGE4
84 if (machine_is_badge4()) {
85 /* Disable power to the USB bus */
86 badge4_set_5V(BADGE4_5V_USB, 0);
87 }
88#endif
89}
90
91
92/*-------------------------------------------------------------------------*/
93
94#if 0
95static void dump_hci_status(struct usb_hcd *hcd, const char *label)
96{
97 unsigned long status = sa1111_readl(hcd->regs + SA1111_USB_STATUS);
98
99 dbg ("%s USB_STATUS = { %s%s%s%s%s}", label,
100 ((status & USB_STATUS_IRQHCIRMTWKUP) ? "IRQHCIRMTWKUP " : ""),
101 ((status & USB_STATUS_IRQHCIBUFFACC) ? "IRQHCIBUFFACC " : ""),
102 ((status & USB_STATUS_NIRQHCIM) ? "" : "IRQHCIM "),
103 ((status & USB_STATUS_NHCIMFCLR) ? "" : "HCIMFCLR "),
104 ((status & USB_STATUS_USBPWRSENSE) ? "USBPWRSENSE " : ""));
105} 172}
106#endif
107
108/*-------------------------------------------------------------------------*/
109
110/* configure so an HC device and id are always provided */
111/* always called with process context; sleeping is OK */
112
113 173
114/** 174/**
115 * usb_hcd_sa1111_probe - initialize SA-1111-based HCDs 175 * ohci_hcd_sa1111_probe - initialize SA-1111-based HCDs
116 * Context: !in_interrupt()
117 * 176 *
118 * Allocates basic resources for this USB host controller, and 177 * Allocates basic resources for this USB host controller, and
119 * then invokes the start() method for the HCD associated with it 178 * then invokes the start() method for the HCD associated with it.
120 * through the hotplug entry's driver_data.
121 *
122 * Store this function in the HCD's struct pci_driver as probe().
123 */ 179 */
124int usb_hcd_sa1111_probe (const struct hc_driver *driver, 180static int ohci_hcd_sa1111_probe(struct sa1111_dev *dev)
125 struct sa1111_dev *dev)
126{ 181{
127 struct usb_hcd *hcd; 182 struct usb_hcd *hcd;
128 int retval; 183 int ret;
129 184
130 hcd = usb_create_hcd (driver, &dev->dev, "sa1111"); 185 if (usb_disabled())
186 return -ENODEV;
187
188 hcd = usb_create_hcd(&ohci_sa1111_hc_driver, &dev->dev, "sa1111");
131 if (!hcd) 189 if (!hcd)
132 return -ENOMEM; 190 return -ENOMEM;
191
133 hcd->rsrc_start = dev->res.start; 192 hcd->rsrc_start = dev->res.start;
134 hcd->rsrc_len = resource_size(&dev->res); 193 hcd->rsrc_len = resource_size(&dev->res);
135 194
136 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 195 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
137 dbg("request_mem_region failed"); 196 dbg("request_mem_region failed");
138 retval = -EBUSY; 197 ret = -EBUSY;
139 goto err1; 198 goto err1;
140 } 199 }
200
141 hcd->regs = dev->mapbase; 201 hcd->regs = dev->mapbase;
142 202
143 sa1111_start_hc(dev); 203 ret = sa1111_start_hc(dev);
144 ohci_hcd_init(hcd_to_ohci(hcd)); 204 if (ret)
205 goto err2;
145 206
146 retval = usb_add_hcd(hcd, dev->irq[1], 0); 207 ret = usb_add_hcd(hcd, dev->irq[1], 0);
147 if (retval == 0) 208 if (ret == 0)
148 return retval; 209 return ret;
149 210
150 sa1111_stop_hc(dev); 211 sa1111_stop_hc(dev);
212 err2:
151 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 213 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
152 err1: 214 err1:
153 usb_put_hcd(hcd); 215 usb_put_hcd(hcd);
154 return retval; 216 return ret;
155} 217}
156 218
157
158/* may be called without controller electrically present */
159/* may be called with controller, bus, and devices active */
160
161/** 219/**
162 * usb_hcd_sa1111_remove - shutdown processing for SA-1111-based HCDs 220 * ohci_hcd_sa1111_remove - shutdown processing for SA-1111-based HCDs
163 * @dev: USB Host Controller being removed 221 * @dev: USB Host Controller being removed
164 * Context: !in_interrupt()
165 *
166 * Reverses the effect of usb_hcd_sa1111_probe(), first invoking
167 * the HCD's stop() method. It is always called from a thread
168 * context, normally "rmmod", "apmd", or something similar.
169 * 222 *
223 * Reverses the effect of ohci_hcd_sa1111_probe(), first invoking
224 * the HCD's stop() method.
170 */ 225 */
171void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev) 226static int ohci_hcd_sa1111_remove(struct sa1111_dev *dev)
172{ 227{
228 struct usb_hcd *hcd = sa1111_get_drvdata(dev);
229
173 usb_remove_hcd(hcd); 230 usb_remove_hcd(hcd);
174 sa1111_stop_hc(dev); 231 sa1111_stop_hc(dev);
175 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 232 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
176 usb_put_hcd(hcd); 233 usb_put_hcd(hcd);
177}
178
179/*-------------------------------------------------------------------------*/
180 234
181static int __devinit
182ohci_sa1111_start (struct usb_hcd *hcd)
183{
184 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
185 int ret;
186
187 if ((ret = ohci_init(ohci)) < 0)
188 return ret;
189
190 if ((ret = ohci_run (ohci)) < 0) {
191 err ("can't start %s", hcd->self.bus_name);
192 ohci_stop (hcd);
193 return ret;
194 }
195 return 0; 235 return 0;
196} 236}
197 237
198/*-------------------------------------------------------------------------*/ 238static void ohci_hcd_sa1111_shutdown(struct sa1111_dev *dev)
199
200static const struct hc_driver ohci_sa1111_hc_driver = {
201 .description = hcd_name,
202 .product_desc = "SA-1111 OHCI",
203 .hcd_priv_size = sizeof(struct ohci_hcd),
204
205 /*
206 * generic hardware linkage
207 */
208 .irq = ohci_irq,
209 .flags = HCD_USB11 | HCD_MEMORY,
210
211 /*
212 * basic lifecycle operations
213 */
214 .start = ohci_sa1111_start,
215 .stop = ohci_stop,
216
217 /*
218 * managing i/o requests and associated device resources
219 */
220 .urb_enqueue = ohci_urb_enqueue,
221 .urb_dequeue = ohci_urb_dequeue,
222 .endpoint_disable = ohci_endpoint_disable,
223
224 /*
225 * scheduling support
226 */
227 .get_frame_number = ohci_get_frame,
228
229 /*
230 * root hub support
231 */
232 .hub_status_data = ohci_hub_status_data,
233 .hub_control = ohci_hub_control,
234#ifdef CONFIG_PM
235 .bus_suspend = ohci_bus_suspend,
236 .bus_resume = ohci_bus_resume,
237#endif
238 .start_port_reset = ohci_start_port_reset,
239};
240
241/*-------------------------------------------------------------------------*/
242
243static int ohci_hcd_sa1111_drv_probe(struct sa1111_dev *dev)
244{
245 int ret;
246
247 if (usb_disabled())
248 return -ENODEV;
249
250 ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, dev);
251 return ret;
252}
253
254static int ohci_hcd_sa1111_drv_remove(struct sa1111_dev *dev)
255{ 239{
256 struct usb_hcd *hcd = sa1111_get_drvdata(dev); 240 struct usb_hcd *hcd = sa1111_get_drvdata(dev);
257 241
258 usb_hcd_sa1111_remove(hcd, dev); 242 if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
259 return 0; 243 hcd->driver->shutdown(hcd);
244 sa1111_stop_hc(dev);
245 }
260} 246}
261 247
262static struct sa1111_driver ohci_hcd_sa1111_driver = { 248static struct sa1111_driver ohci_hcd_sa1111_driver = {
263 .drv = { 249 .drv = {
264 .name = "sa1111-ohci", 250 .name = "sa1111-ohci",
251 .owner = THIS_MODULE,
265 }, 252 },
266 .devid = SA1111_DEVID_USB, 253 .devid = SA1111_DEVID_USB,
267 .probe = ohci_hcd_sa1111_drv_probe, 254 .probe = ohci_hcd_sa1111_probe,
268 .remove = ohci_hcd_sa1111_drv_remove, 255 .remove = ohci_hcd_sa1111_remove,
256 .shutdown = ohci_hcd_sa1111_shutdown,
269}; 257};
270
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 015c7c62ed49..3b38030b02a8 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -40,7 +40,6 @@
40#include <linux/io.h> 40#include <linux/io.h>
41 41
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/system.h>
44#include <asm/unaligned.h> 43#include <asm/unaligned.h>
45 44
46#include <linux/irq.h> 45#include <linux/irq.h>
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 2a2cce2d2fa7..91ce1c02e617 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -51,7 +51,6 @@
51 51
52#include <asm/io.h> 52#include <asm/io.h>
53#include <asm/irq.h> 53#include <asm/irq.h>
54#include <asm/system.h>
55#include <asm/byteorder.h> 54#include <asm/byteorder.h>
56#include <asm/unaligned.h> 55#include <asm/unaligned.h>
57 56
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 16dd6a6abf00..dbbd1ba25224 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -55,7 +55,6 @@
55#include <linux/mutex.h> 55#include <linux/mutex.h>
56#include <asm/io.h> 56#include <asm/io.h>
57#include <asm/irq.h> 57#include <asm/irq.h>
58#include <asm/system.h>
59#include <asm/byteorder.h> 58#include <asm/byteorder.h>
60 59
61 /* FIXME ohci.h is ONLY for internal use by the OHCI driver. 60 /* FIXME ohci.h is ONLY for internal use by the OHCI driver.
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index e37dea87bb56..e4db350602b8 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -45,7 +45,6 @@
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/system.h>
49 48
50#include "uhci-hcd.h" 49#include "uhci-hcd.h"
51 50
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index 97cb45916c43..d05c7fbbb703 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -115,12 +115,12 @@ static bool ux500_configure_channel(struct dma_channel *channel,
115 slave_conf.dst_addr = usb_fifo_addr; 115 slave_conf.dst_addr = usb_fifo_addr;
116 slave_conf.dst_addr_width = addr_width; 116 slave_conf.dst_addr_width = addr_width;
117 slave_conf.dst_maxburst = 16; 117 slave_conf.dst_maxburst = 16;
118 slave_conf.device_fc = false;
118 119
119 dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG, 120 dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG,
120 (unsigned long) &slave_conf); 121 (unsigned long) &slave_conf);
121 122
122 dma_desc = dma_chan->device-> 123 dma_desc = dmaengine_prep_slave_sg(dma_chan, &sg, 1, direction,
123 device_prep_slave_sg(dma_chan, &sg, 1, direction,
124 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 124 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
125 if (!dma_desc) 125 if (!dma_desc)
126 return false; 126 return false;
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 3648c82a17fe..6ec7f838d7fa 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -786,9 +786,8 @@ static void xfer_work(struct work_struct *work)
786 sg_dma_address(&sg) = pkt->dma + pkt->actual; 786 sg_dma_address(&sg) = pkt->dma + pkt->actual;
787 sg_dma_len(&sg) = pkt->trans; 787 sg_dma_len(&sg) = pkt->trans;
788 788
789 desc = chan->device->device_prep_slave_sg(chan, &sg, 1, dir, 789 desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir,
790 DMA_PREP_INTERRUPT | 790 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
791 DMA_CTRL_ACK);
792 if (!desc) 791 if (!desc)
793 return; 792 return;
794 793
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 7c229d304684..ff8605b4b4be 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1724,7 +1724,8 @@ static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
1724 1724
1725/* 1725/*
1726 * Module parameter to control latency timer for NDI FTDI-based USB devices. 1726 * Module parameter to control latency timer for NDI FTDI-based USB devices.
1727 * If this value is not set in modprobe.conf.local its value will be set to 1ms. 1727 * If this value is not set in /etc/modprobe.d/ its value will be set
1728 * to 1ms.
1728 */ 1729 */
1729static int ndi_latency_timer = 1; 1730static int ndi_latency_timer = 1;
1730 1731
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index fe2d803a6347..7691c866637b 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -222,7 +222,7 @@ config USB_LIBUSUAL
222 for usb-storage and ub drivers, and allows to switch binding 222 for usb-storage and ub drivers, and allows to switch binding
223 of these devices without rebuilding modules. 223 of these devices without rebuilding modules.
224 224
225 Typical syntax of /etc/modprobe.conf is: 225 Typical syntax of /etc/modprobe.d/*conf is:
226 226
227 options libusual bias="ub" 227 options libusual bias="ub"
228 228