aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-au1xxx.c23
-rw-r--r--drivers/usb/host/ehci-hcd.c7
-rw-r--r--drivers/usb/host/ohci-au1xxx.c7
-rw-r--r--drivers/usb/host/ohci-ep93xx.c225
-rw-r--r--drivers/usb/host/ohci-hcd.c5
-rw-r--r--drivers/usb/host/ohci-hub.c4
-rw-r--r--drivers/usb/host/pci-quirks.c8
7 files changed, 255 insertions, 24 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index d66867aa527e..26ed757d22a6 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -41,8 +41,6 @@
41#endif 41#endif
42#define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) 42#define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
43 43
44#endif /* Au1200 */
45
46extern int usb_disabled(void); 44extern int usb_disabled(void);
47 45
48/*-------------------------------------------------------------------------*/ 46/*-------------------------------------------------------------------------*/
@@ -107,9 +105,9 @@ int usb_ehci_au1xxx_probe(const struct hc_driver *driver,
107 105
108 /* Au1200 AB USB does not support coherent memory */ 106 /* Au1200 AB USB does not support coherent memory */
109 if (!(read_c0_prid() & 0xff)) { 107 if (!(read_c0_prid() & 0xff)) {
110 pr_info("%s: this is chip revision AB!\n", dev->dev.name); 108 pr_info("%s: this is chip revision AB!\n", dev->name);
111 pr_info("%s: update your board or re-configure the kernel\n", 109 pr_info("%s: update your board or re-configure the kernel\n",
112 dev->dev.name); 110 dev->name);
113 return -ENODEV; 111 return -ENODEV;
114 } 112 }
115#endif 113#endif
@@ -228,9 +226,8 @@ static const struct hc_driver ehci_au1xxx_hc_driver = {
228 226
229/*-------------------------------------------------------------------------*/ 227/*-------------------------------------------------------------------------*/
230 228
231static int ehci_hcd_au1xxx_drv_probe(struct device *dev) 229static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
232{ 230{
233 struct platform_device *pdev = to_platform_device(dev);
234 struct usb_hcd *hcd = NULL; 231 struct usb_hcd *hcd = NULL;
235 int ret; 232 int ret;
236 233
@@ -243,10 +240,9 @@ static int ehci_hcd_au1xxx_drv_probe(struct device *dev)
243 return ret; 240 return ret;
244} 241}
245 242
246static int ehci_hcd_au1xxx_drv_remove(struct device *dev) 243static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
247{ 244{
248 struct platform_device *pdev = to_platform_device(dev); 245 struct usb_hcd *hcd = platform_get_drvdata(pdev);
249 struct usb_hcd *hcd = dev_get_drvdata(dev);
250 246
251 usb_ehci_au1xxx_remove(hcd, pdev); 247 usb_ehci_au1xxx_remove(hcd, pdev);
252 return 0; 248 return 0;
@@ -269,12 +265,13 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev)
269} 265}
270*/ 266*/
271MODULE_ALIAS("au1xxx-ehci"); 267MODULE_ALIAS("au1xxx-ehci");
272/* FIXME use "struct platform_driver" */ 268static struct platform_driver ehci_hcd_au1xxx_driver = {
273static struct device_driver ehci_hcd_au1xxx_driver = {
274 .name = "au1xxx-ehci",
275 .bus = &platform_bus_type,
276 .probe = ehci_hcd_au1xxx_drv_probe, 269 .probe = ehci_hcd_au1xxx_drv_probe,
277 .remove = ehci_hcd_au1xxx_drv_remove, 270 .remove = ehci_hcd_au1xxx_drv_remove,
278 /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ 271 /*.suspend = ehci_hcd_au1xxx_drv_suspend, */
279 /*.resume = ehci_hcd_au1xxx_drv_resume, */ 272 /*.resume = ehci_hcd_au1xxx_drv_resume, */
273 .driver = {
274 .name = "au1xxx-ehci",
275 .bus = &platform_bus_type
276 }
280}; 277};
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index cee6f538de0a..85b0b4ad4c16 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -625,10 +625,11 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
625 writel (status | CMD_RUN, &ehci->regs->command); 625 writel (status | CMD_RUN, &ehci->regs->command);
626 626
627 while (i--) { 627 while (i--) {
628 status = readl (&ehci->regs->port_status [i]); 628 int pstatus = readl (&ehci->regs->port_status [i]);
629 if (status & PORT_OWNER) 629
630 if (pstatus & PORT_OWNER)
630 continue; 631 continue;
631 if (!(status & PORT_RESUME) 632 if (!(pstatus & PORT_RESUME)
632 || ehci->reset_done [i] != 0) 633 || ehci->reset_done [i] != 0)
633 continue; 634 continue;
634 635
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 689261e44018..822914e2f43b 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -101,13 +101,16 @@ static void au1xxx_start_ohc(struct platform_device *dev)
101 101
102#endif /* Au1200 */ 102#endif /* Au1200 */
103 103
104#ifndef CONFIG_SOC_AU1200
104 /* wait for reset complete (read register twice; see au1500 errata) */ 105 /* wait for reset complete (read register twice; see au1500 errata) */
105 while (au_readl(USB_HOST_CONFIG), 106 while (au_readl(USB_HOST_CONFIG),
106 !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) 107 !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD))
108#endif
107 udelay(1000); 109 udelay(1000);
108 110
109 printk(KERN_DEBUG __FILE__ 111 printk(KERN_DEBUG __FILE__
110 ": Clock to USB host has been enabled \n"); 112 ": Clock to USB host has been enabled \n");
113#endif
111} 114}
112 115
113static void au1xxx_stop_ohc(struct platform_device *dev) 116static void au1xxx_stop_ohc(struct platform_device *dev)
@@ -157,9 +160,9 @@ static int usb_ohci_au1xxx_probe(const struct hc_driver *driver,
157 /* Au1200 AB USB does not support coherent memory */ 160 /* Au1200 AB USB does not support coherent memory */
158 if (!(read_c0_prid() & 0xff)) { 161 if (!(read_c0_prid() & 0xff)) {
159 pr_info("%s: this is chip revision AB !!\n", 162 pr_info("%s: this is chip revision AB !!\n",
160 dev->dev.name); 163 dev->name);
161 pr_info("%s: update your board or re-configure the kernel\n", 164 pr_info("%s: update your board or re-configure the kernel\n",
162 dev->dev.name); 165 dev->name);
163 return -ENODEV; 166 return -ENODEV;
164 } 167 }
165#endif 168#endif
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
new file mode 100644
index 000000000000..6531c4d26527
--- /dev/null
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -0,0 +1,225 @@
1/*
2 * OHCI HCD (Host Controller Driver) for USB.
3 *
4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
6 * (C) Copyright 2002 Hewlett-Packard Company
7 *
8 * Bus Glue for ep93xx.
9 *
10 * Written by Christopher Hoover <ch@hpl.hp.com>
11 * Based on fragments of previous driver by Russell King et al.
12 *
13 * Modified for LH7A404 from ohci-sa1111.c
14 * by Durgesh Pattamatta <pattamattad@sharpsec.com>
15 *
16 * Modified for pxa27x from ohci-lh7a404.c
17 * by Nick Bane <nick@cecomputing.co.uk> 26-8-2004
18 *
19 * Modified for ep93xx from ohci-pxa27x.c
20 * by Lennert Buytenhek <buytenh@wantstofly.org> 28-2-2006
21 * Based on an earlier driver by Ray Lehtiniemi
22 *
23 * This file is licenced under the GPL.
24 */
25
26#include <linux/clk.h>
27#include <linux/device.h>
28#include <linux/signal.h>
29#include <linux/platform_device.h>
30
31#include <asm/mach-types.h>
32#include <asm/hardware.h>
33
34static struct clk *usb_host_clock;
35
36static void ep93xx_start_hc(struct device *dev)
37{
38 clk_enable(usb_host_clock);
39}
40
41static void ep93xx_stop_hc(struct device *dev)
42{
43 clk_disable(usb_host_clock);
44}
45
46static int usb_hcd_ep93xx_probe(const struct hc_driver *driver,
47 struct platform_device *pdev)
48{
49 int retval;
50 struct usb_hcd *hcd;
51
52 if (pdev->resource[1].flags != IORESOURCE_IRQ) {
53 pr_debug("resource[1] is not IORESOURCE_IRQ");
54 return -ENOMEM;
55 }
56
57 hcd = usb_create_hcd(driver, &pdev->dev, "ep93xx");
58 if (hcd == NULL)
59 return -ENOMEM;
60
61 hcd->rsrc_start = pdev->resource[0].start;
62 hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
63 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
64 usb_put_hcd(hcd);
65 retval = -EBUSY;
66 goto err1;
67 }
68
69 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
70 if (hcd->regs == NULL) {
71 pr_debug("ioremap failed");
72 retval = -ENOMEM;
73 goto err2;
74 }
75
76 usb_host_clock = clk_get(&pdev->dev, "usb_host");
77 ep93xx_start_hc(&pdev->dev);
78
79 ohci_hcd_init(hcd_to_ohci(hcd));
80
81 retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT);
82 if (retval == 0)
83 return retval;
84
85 ep93xx_stop_hc(&pdev->dev);
86 iounmap(hcd->regs);
87err2:
88 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
89err1:
90 usb_put_hcd(hcd);
91
92 return retval;
93}
94
95static void usb_hcd_ep93xx_remove(struct usb_hcd *hcd,
96 struct platform_device *pdev)
97{
98 usb_remove_hcd(hcd);
99 ep93xx_stop_hc(&pdev->dev);
100 clk_put(usb_host_clock);
101 iounmap(hcd->regs);
102 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
103 usb_put_hcd(hcd);
104}
105
106static int __devinit ohci_ep93xx_start(struct usb_hcd *hcd)
107{
108 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
109 int ret;
110
111 if ((ret = ohci_init(ohci)) < 0)
112 return ret;
113
114 if ((ret = ohci_run(ohci)) < 0) {
115 err("can't start %s", hcd->self.bus_name);
116 ohci_stop(hcd);
117 return ret;
118 }
119
120 return 0;
121}
122
123static struct hc_driver ohci_ep93xx_hc_driver = {
124 .description = hcd_name,
125 .product_desc = "EP93xx OHCI",
126 .hcd_priv_size = sizeof(struct ohci_hcd),
127 .irq = ohci_irq,
128 .flags = HCD_USB11 | HCD_MEMORY,
129 .start = ohci_ep93xx_start,
130 .stop = ohci_stop,
131 .urb_enqueue = ohci_urb_enqueue,
132 .urb_dequeue = ohci_urb_dequeue,
133 .endpoint_disable = ohci_endpoint_disable,
134 .get_frame_number = ohci_get_frame,
135 .hub_status_data = ohci_hub_status_data,
136 .hub_control = ohci_hub_control,
137#ifdef CONFIG_PM
138 .bus_suspend = ohci_bus_suspend,
139 .bus_resume = ohci_bus_resume,
140#endif
141 .start_port_reset = ohci_start_port_reset,
142};
143
144extern int usb_disabled(void);
145
146static int ohci_hcd_ep93xx_drv_probe(struct platform_device *pdev)
147{
148 int ret;
149
150 ret = -ENODEV;
151 if (!usb_disabled())
152 ret = usb_hcd_ep93xx_probe(&ohci_ep93xx_hc_driver, pdev);
153
154 return ret;
155}
156
157static int ohci_hcd_ep93xx_drv_remove(struct platform_device *pdev)
158{
159 struct usb_hcd *hcd = platform_get_drvdata(pdev);
160
161 usb_hcd_ep93xx_remove(hcd, pdev);
162
163 return 0;
164}
165
166#ifdef CONFIG_PM
167static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_t state)
168{
169 struct usb_hcd *hcd = platform_get_drvdata(pdev);
170 struct ochi_hcd *ohci = hcd_to_ohci(hcd);
171
172 if (time_before(jiffies, ohci->next_statechange))
173 msleep(5);
174 ohci->next_statechange = jiffies;
175
176 ep93xx_stop_hc(&pdev->dev);
177 hcd->state = HC_STATE_SUSPENDED;
178 pdev->dev.power.power_state = PMSG_SUSPEND;
179
180 return 0;
181}
182
183static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
184{
185 struct usb_hcd *hcd = platform_get_drvdata(pdev);
186 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
187 int status;
188
189 if (time_before(jiffies, ohci->next_statechange))
190 msleep(5);
191 ohci->next_statechange = jiffies;
192
193 ep93xx_start_hc(&pdev->dev);
194 pdev->dev.power.power_state = PMSG_ON;
195 usb_hcd_resume_root_hub(hcd);
196
197 return 0;
198}
199#endif
200
201
202static struct platform_driver ohci_hcd_ep93xx_driver = {
203 .probe = ohci_hcd_ep93xx_drv_probe,
204 .remove = ohci_hcd_ep93xx_drv_remove,
205#ifdef CONFIG_PM
206 .suspend = ohci_hcd_ep93xx_drv_suspend,
207 .resume = ohci_hcd_ep93xx_drv_resume,
208#endif
209 .driver = {
210 .name = "ep93xx-ohci",
211 },
212};
213
214static int __init ohci_hcd_ep93xx_init(void)
215{
216 return platform_driver_register(&ohci_hcd_ep93xx_driver);
217}
218
219static void __exit ohci_hcd_ep93xx_cleanup(void)
220{
221 platform_driver_unregister(&ohci_hcd_ep93xx_driver);
222}
223
224module_init(ohci_hcd_ep93xx_init);
225module_exit(ohci_hcd_ep93xx_cleanup);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 8fb842ed5f6e..afef5ac35b4a 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -901,6 +901,10 @@ MODULE_LICENSE ("GPL");
901#include "ohci-pxa27x.c" 901#include "ohci-pxa27x.c"
902#endif 902#endif
903 903
904#ifdef CONFIG_ARCH_EP93XX
905#include "ohci-ep93xx.c"
906#endif
907
904#ifdef CONFIG_SOC_AU1X00 908#ifdef CONFIG_SOC_AU1X00
905#include "ohci-au1xxx.c" 909#include "ohci-au1xxx.c"
906#endif 910#endif
@@ -919,6 +923,7 @@ MODULE_LICENSE ("GPL");
919 || defined(CONFIG_ARCH_OMAP) \ 923 || defined(CONFIG_ARCH_OMAP) \
920 || defined (CONFIG_ARCH_LH7A404) \ 924 || defined (CONFIG_ARCH_LH7A404) \
921 || defined (CONFIG_PXA27x) \ 925 || defined (CONFIG_PXA27x) \
926 || defined (CONFIG_ARCH_EP93XX) \
922 || defined (CONFIG_SOC_AU1X00) \ 927 || defined (CONFIG_SOC_AU1X00) \
923 || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ 928 || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \
924 || defined (CONFIG_ARCH_AT91RM9200) \ 929 || defined (CONFIG_ARCH_AT91RM9200) \
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 0bb972b58336..5b0a23fd798b 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -581,14 +581,14 @@ static int ohci_hub_control (
581 break; 581 break;
582 case GetHubStatus: 582 case GetHubStatus:
583 temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE); 583 temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE);
584 *(__le32 *) buf = cpu_to_le32 (temp); 584 put_unaligned(cpu_to_le32 (temp), (__le32 *) buf);
585 break; 585 break;
586 case GetPortStatus: 586 case GetPortStatus:
587 if (!wIndex || wIndex > ports) 587 if (!wIndex || wIndex > ports)
588 goto error; 588 goto error;
589 wIndex--; 589 wIndex--;
590 temp = roothub_portstatus (ohci, wIndex); 590 temp = roothub_portstatus (ohci, wIndex);
591 *(__le32 *) buf = cpu_to_le32 (temp); 591 put_unaligned(cpu_to_le32 (temp), (__le32 *) buf);
592 592
593#ifndef OHCI_VERBOSE_DEBUG 593#ifndef OHCI_VERBOSE_DEBUG
594 if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ 594 if (*(u16*)(buf+2)) /* only if wPortChange is interesting */
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index dff60568b4a1..20861650905e 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -167,8 +167,6 @@ static int __devinit mmio_resource_enabled(struct pci_dev *pdev, int idx)
167static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) 167static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
168{ 168{
169 void __iomem *base; 169 void __iomem *base;
170 int wait_time;
171 u32 control;
172 170
173 if (!mmio_resource_enabled(pdev, 0)) 171 if (!mmio_resource_enabled(pdev, 0))
174 return; 172 return;
@@ -179,9 +177,10 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
179 177
180/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ 178/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
181#ifndef __hppa__ 179#ifndef __hppa__
182 control = readl(base + OHCI_CONTROL); 180{
181 u32 control = readl(base + OHCI_CONTROL);
183 if (control & OHCI_CTRL_IR) { 182 if (control & OHCI_CTRL_IR) {
184 wait_time = 500; /* arbitrary; 5 seconds */ 183 int wait_time = 500; /* arbitrary; 5 seconds */
185 writel(OHCI_INTR_OC, base + OHCI_INTRENABLE); 184 writel(OHCI_INTR_OC, base + OHCI_INTRENABLE);
186 writel(OHCI_OCR, base + OHCI_CMDSTATUS); 185 writel(OHCI_OCR, base + OHCI_CMDSTATUS);
187 while (wait_time > 0 && 186 while (wait_time > 0 &&
@@ -198,6 +197,7 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
198 /* reset controller, preserving RWC */ 197 /* reset controller, preserving RWC */
199 writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL); 198 writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL);
200 } 199 }
200}
201#endif 201#endif
202 202
203 /* 203 /*