diff options
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-au1xxx.c | 23 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 9 | ||||
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 88 | ||||
-rw-r--r-- | drivers/usb/host/ohci-au1xxx.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ohci-ep93xx.c | 225 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hub.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/pci-quirks.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/uhci-q.c | 8 |
9 files changed, 321 insertions, 58 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 | |||
46 | extern int usb_disabled(void); | 44 | extern 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 | ||
231 | static int ehci_hcd_au1xxx_drv_probe(struct device *dev) | 229 | static 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 | ||
246 | static int ehci_hcd_au1xxx_drv_remove(struct device *dev) | 243 | static 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 | */ |
271 | MODULE_ALIAS("au1xxx-ehci"); | 267 | MODULE_ALIAS("au1xxx-ehci"); |
272 | /* FIXME use "struct platform_driver" */ | 268 | static struct platform_driver ehci_hcd_au1xxx_driver = { |
273 | static 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..d63177a8eaea 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 | ||
@@ -891,7 +892,7 @@ MODULE_LICENSE ("GPL"); | |||
891 | #define PCI_DRIVER ehci_pci_driver | 892 | #define PCI_DRIVER ehci_pci_driver |
892 | #endif | 893 | #endif |
893 | 894 | ||
894 | #ifdef CONFIG_PPC_83xx | 895 | #ifdef CONFIG_MPC834x |
895 | #include "ehci-fsl.c" | 896 | #include "ehci-fsl.c" |
896 | #define PLATFORM_DRIVER ehci_fsl_driver | 897 | #define PLATFORM_DRIVER ehci_fsl_driver |
897 | #endif | 898 | #endif |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index cdbafb710000..85cc059705a6 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2004 SAN People (Pty) Ltd. | 4 | * Copyright (C) 2004 SAN People (Pty) Ltd. |
5 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> | 5 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> |
6 | * | 6 | * |
7 | * AT91RM9200 Bus Glue | 7 | * AT91 Bus Glue |
8 | * | 8 | * |
9 | * Based on fragments of 2.4 driver by Rick Bronson. | 9 | * Based on fragments of 2.4 driver by Rick Bronson. |
10 | * Based on ohci-omap.c | 10 | * Based on ohci-omap.c |
@@ -19,12 +19,13 @@ | |||
19 | #include <asm/hardware.h> | 19 | #include <asm/hardware.h> |
20 | #include <asm/arch/board.h> | 20 | #include <asm/arch/board.h> |
21 | 21 | ||
22 | #ifndef CONFIG_ARCH_AT91RM9200 | 22 | #ifndef CONFIG_ARCH_AT91 |
23 | #error "CONFIG_ARCH_AT91RM9200 must be defined." | 23 | #error "CONFIG_ARCH_AT91 must be defined." |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | /* interface and function clocks */ | 26 | /* interface and function clocks */ |
27 | static struct clk *iclk, *fclk; | 27 | static struct clk *iclk, *fclk; |
28 | static int clocked; | ||
28 | 29 | ||
29 | extern int usb_disabled(void); | 30 | extern int usb_disabled(void); |
30 | 31 | ||
@@ -35,13 +36,14 @@ static void at91_start_hc(struct platform_device *pdev) | |||
35 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 36 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
36 | struct ohci_regs __iomem *regs = hcd->regs; | 37 | struct ohci_regs __iomem *regs = hcd->regs; |
37 | 38 | ||
38 | dev_dbg(&pdev->dev, "starting AT91RM9200 OHCI USB Controller\n"); | 39 | dev_dbg(&pdev->dev, "start\n"); |
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Start the USB clocks. | 42 | * Start the USB clocks. |
42 | */ | 43 | */ |
43 | clk_enable(iclk); | 44 | clk_enable(iclk); |
44 | clk_enable(fclk); | 45 | clk_enable(fclk); |
46 | clocked = 1; | ||
45 | 47 | ||
46 | /* | 48 | /* |
47 | * The USB host controller must remain in reset. | 49 | * The USB host controller must remain in reset. |
@@ -54,7 +56,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
54 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 56 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
55 | struct ohci_regs __iomem *regs = hcd->regs; | 57 | struct ohci_regs __iomem *regs = hcd->regs; |
56 | 58 | ||
57 | dev_dbg(&pdev->dev, "stopping AT91RM9200 OHCI USB Controller\n"); | 59 | dev_dbg(&pdev->dev, "stop\n"); |
58 | 60 | ||
59 | /* | 61 | /* |
60 | * Put the USB host controller into reset. | 62 | * Put the USB host controller into reset. |
@@ -66,6 +68,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
66 | */ | 68 | */ |
67 | clk_disable(fclk); | 69 | clk_disable(fclk); |
68 | clk_disable(iclk); | 70 | clk_disable(iclk); |
71 | clocked = 0; | ||
69 | } | 72 | } |
70 | 73 | ||
71 | 74 | ||
@@ -78,14 +81,15 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
78 | 81 | ||
79 | 82 | ||
80 | /** | 83 | /** |
81 | * usb_hcd_at91_probe - initialize AT91RM9200-based HCDs | 84 | * usb_hcd_at91_probe - initialize AT91-based HCDs |
82 | * Context: !in_interrupt() | 85 | * Context: !in_interrupt() |
83 | * | 86 | * |
84 | * Allocates basic resources for this USB host controller, and | 87 | * Allocates basic resources for this USB host controller, and |
85 | * then invokes the start() method for the HCD associated with it | 88 | * then invokes the start() method for the HCD associated with it |
86 | * through the hotplug entry's driver_data. | 89 | * through the hotplug entry's driver_data. |
87 | */ | 90 | */ |
88 | int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) | 91 | static int usb_hcd_at91_probe(const struct hc_driver *driver, |
92 | struct platform_device *pdev) | ||
89 | { | 93 | { |
90 | int retval; | 94 | int retval; |
91 | struct usb_hcd *hcd = NULL; | 95 | struct usb_hcd *hcd = NULL; |
@@ -95,12 +99,13 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
95 | return -ENODEV; | 99 | return -ENODEV; |
96 | } | 100 | } |
97 | 101 | ||
98 | if ((pdev->resource[0].flags != IORESOURCE_MEM) || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | 102 | if ((pdev->resource[0].flags != IORESOURCE_MEM) |
103 | || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | ||
99 | pr_debug("hcd probe: invalid resource type\n"); | 104 | pr_debug("hcd probe: invalid resource type\n"); |
100 | return -ENODEV; | 105 | return -ENODEV; |
101 | } | 106 | } |
102 | 107 | ||
103 | hcd = usb_create_hcd(driver, &pdev->dev, "at91rm9200"); | 108 | hcd = usb_create_hcd(driver, &pdev->dev, "at91"); |
104 | if (!hcd) | 109 | if (!hcd) |
105 | return -ENOMEM; | 110 | return -ENOMEM; |
106 | hcd->rsrc_start = pdev->resource[0].start; | 111 | hcd->rsrc_start = pdev->resource[0].start; |
@@ -149,21 +154,23 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
149 | /* may be called with controller, bus, and devices active */ | 154 | /* may be called with controller, bus, and devices active */ |
150 | 155 | ||
151 | /** | 156 | /** |
152 | * usb_hcd_at91_remove - shutdown processing for AT91RM9200-based HCDs | 157 | * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs |
153 | * @dev: USB Host Controller being removed | 158 | * @dev: USB Host Controller being removed |
154 | * Context: !in_interrupt() | 159 | * Context: !in_interrupt() |
155 | * | 160 | * |
156 | * Reverses the effect of usb_hcd_at91_probe(), first invoking | 161 | * Reverses the effect of usb_hcd_at91_probe(), first invoking |
157 | * the HCD's stop() method. It is always called from a thread | 162 | * the HCD's stop() method. It is always called from a thread |
158 | * context, normally "rmmod", "apmd", or something similar. | 163 | * context, "rmmod" or something similar. |
159 | * | 164 | * |
160 | */ | 165 | */ |
161 | static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pdev) | 166 | static int usb_hcd_at91_remove(struct usb_hcd *hcd, |
167 | struct platform_device *pdev) | ||
162 | { | 168 | { |
163 | usb_remove_hcd(hcd); | 169 | usb_remove_hcd(hcd); |
164 | at91_stop_hc(pdev); | 170 | at91_stop_hc(pdev); |
165 | iounmap(hcd->regs); | 171 | iounmap(hcd->regs); |
166 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 172 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
173 | disable_irq_wake(hcd->irq); | ||
167 | 174 | ||
168 | clk_put(fclk); | 175 | clk_put(fclk); |
169 | clk_put(iclk); | 176 | clk_put(iclk); |
@@ -178,19 +185,21 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde | |||
178 | static int __devinit | 185 | static int __devinit |
179 | ohci_at91_start (struct usb_hcd *hcd) | 186 | ohci_at91_start (struct usb_hcd *hcd) |
180 | { | 187 | { |
181 | // struct at91_ohci_data *board = hcd->self.controller->platform_data; | 188 | struct at91_usbh_data *board = hcd->self.controller->platform_data; |
182 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 189 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
190 | struct usb_device *root = hcd->self.root_hub; | ||
183 | int ret; | 191 | int ret; |
184 | 192 | ||
185 | if ((ret = ohci_init(ohci)) < 0) | 193 | if ((ret = ohci_init(ohci)) < 0) |
186 | return ret; | 194 | return ret; |
187 | 195 | ||
196 | root->maxchild = board->ports; | ||
197 | |||
188 | if ((ret = ohci_run(ohci)) < 0) { | 198 | if ((ret = ohci_run(ohci)) < 0) { |
189 | err("can't start %s", hcd->self.bus_name); | 199 | err("can't start %s", hcd->self.bus_name); |
190 | ohci_stop(hcd); | 200 | ohci_stop(hcd); |
191 | return ret; | 201 | return ret; |
192 | } | 202 | } |
193 | // hcd->self.root_hub->maxchild = board->ports; | ||
194 | return 0; | 203 | return 0; |
195 | } | 204 | } |
196 | 205 | ||
@@ -198,7 +207,7 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
198 | 207 | ||
199 | static const struct hc_driver ohci_at91_hc_driver = { | 208 | static const struct hc_driver ohci_at91_hc_driver = { |
200 | .description = hcd_name, | 209 | .description = hcd_name, |
201 | .product_desc = "AT91RM9200 OHCI", | 210 | .product_desc = "AT91 OHCI", |
202 | .hcd_priv_size = sizeof(struct ohci_hcd), | 211 | .hcd_priv_size = sizeof(struct ohci_hcd), |
203 | 212 | ||
204 | /* | 213 | /* |
@@ -240,33 +249,54 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
240 | 249 | ||
241 | /*-------------------------------------------------------------------------*/ | 250 | /*-------------------------------------------------------------------------*/ |
242 | 251 | ||
243 | static int ohci_hcd_at91_drv_probe(struct platform_device *dev) | 252 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
244 | { | 253 | { |
245 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, dev); | 254 | device_init_wakeup(&pdev->dev, 1); |
255 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | ||
246 | } | 256 | } |
247 | 257 | ||
248 | static int ohci_hcd_at91_drv_remove(struct platform_device *dev) | 258 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
249 | { | 259 | { |
250 | return usb_hcd_at91_remove(platform_get_drvdata(dev), dev); | 260 | device_init_wakeup(&pdev->dev, 0); |
261 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); | ||
251 | } | 262 | } |
252 | 263 | ||
253 | #ifdef CONFIG_PM | 264 | #ifdef CONFIG_PM |
254 | 265 | ||
255 | /* REVISIT suspend/resume look "too" simple here */ | ||
256 | |||
257 | static int | 266 | static int |
258 | ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) | 267 | ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) |
259 | { | 268 | { |
260 | clk_disable(fclk); | 269 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
261 | clk_disable(iclk); | 270 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
271 | |||
272 | if (device_may_wakeup(&pdev->dev)) | ||
273 | enable_irq_wake(hcd->irq); | ||
274 | else | ||
275 | disable_irq_wake(hcd->irq); | ||
276 | |||
277 | /* | ||
278 | * The integrated transceivers seem unable to notice disconnect, | ||
279 | * reconnect, or wakeup without the 48 MHz clock active. so for | ||
280 | * correctness, always discard connection state (using reset). | ||
281 | * | ||
282 | * REVISIT: some boards will be able to turn VBUS off... | ||
283 | */ | ||
284 | if (at91_suspend_entering_slow_clock()) { | ||
285 | ohci_usb_reset (ohci); | ||
286 | clk_disable(fclk); | ||
287 | clk_disable(iclk); | ||
288 | clocked = 0; | ||
289 | } | ||
262 | 290 | ||
263 | return 0; | 291 | return 0; |
264 | } | 292 | } |
265 | 293 | ||
266 | static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | 294 | static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) |
267 | { | 295 | { |
268 | clk_enable(iclk); | 296 | if (!clocked) { |
269 | clk_enable(fclk); | 297 | clk_enable(iclk); |
298 | clk_enable(fclk); | ||
299 | } | ||
270 | 300 | ||
271 | return 0; | 301 | return 0; |
272 | } | 302 | } |
@@ -275,7 +305,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | |||
275 | #define ohci_hcd_at91_drv_resume NULL | 305 | #define ohci_hcd_at91_drv_resume NULL |
276 | #endif | 306 | #endif |
277 | 307 | ||
278 | MODULE_ALIAS("at91rm9200-ohci"); | 308 | MODULE_ALIAS("at91_ohci"); |
279 | 309 | ||
280 | static struct platform_driver ohci_hcd_at91_driver = { | 310 | static struct platform_driver ohci_hcd_at91_driver = { |
281 | .probe = ohci_hcd_at91_drv_probe, | 311 | .probe = ohci_hcd_at91_drv_probe, |
@@ -283,7 +313,7 @@ static struct platform_driver ohci_hcd_at91_driver = { | |||
283 | .suspend = ohci_hcd_at91_drv_suspend, | 313 | .suspend = ohci_hcd_at91_drv_suspend, |
284 | .resume = ohci_hcd_at91_drv_resume, | 314 | .resume = ohci_hcd_at91_drv_resume, |
285 | .driver = { | 315 | .driver = { |
286 | .name = "at91rm9200-ohci", | 316 | .name = "at91_ohci", |
287 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
288 | }, | 318 | }, |
289 | }; | 319 | }; |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 689261e44018..f7a975d5db09 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -101,9 +101,11 @@ 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__ |
@@ -157,9 +159,9 @@ static int usb_ohci_au1xxx_probe(const struct hc_driver *driver, | |||
157 | /* Au1200 AB USB does not support coherent memory */ | 159 | /* Au1200 AB USB does not support coherent memory */ |
158 | if (!(read_c0_prid() & 0xff)) { | 160 | if (!(read_c0_prid() & 0xff)) { |
159 | pr_info("%s: this is chip revision AB !!\n", | 161 | pr_info("%s: this is chip revision AB !!\n", |
160 | dev->dev.name); | 162 | dev->name); |
161 | pr_info("%s: update your board or re-configure the kernel\n", | 163 | pr_info("%s: update your board or re-configure the kernel\n", |
162 | dev->dev.name); | 164 | dev->name); |
163 | return -ENODEV; | 165 | return -ENODEV; |
164 | } | 166 | } |
165 | #endif | 167 | #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 | |||
34 | static struct clk *usb_host_clock; | ||
35 | |||
36 | static void ep93xx_start_hc(struct device *dev) | ||
37 | { | ||
38 | clk_enable(usb_host_clock); | ||
39 | } | ||
40 | |||
41 | static void ep93xx_stop_hc(struct device *dev) | ||
42 | { | ||
43 | clk_disable(usb_host_clock); | ||
44 | } | ||
45 | |||
46 | static 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); | ||
87 | err2: | ||
88 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
89 | err1: | ||
90 | usb_put_hcd(hcd); | ||
91 | |||
92 | return retval; | ||
93 | } | ||
94 | |||
95 | static 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 | |||
106 | static 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 | |||
123 | static 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 | |||
144 | extern int usb_disabled(void); | ||
145 | |||
146 | static 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 | |||
157 | static 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 | ||
167 | static 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 | |||
183 | static 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 | |||
202 | static 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 | |||
214 | static int __init ohci_hcd_ep93xx_init(void) | ||
215 | { | ||
216 | return platform_driver_register(&ohci_hcd_ep93xx_driver); | ||
217 | } | ||
218 | |||
219 | static void __exit ohci_hcd_ep93xx_cleanup(void) | ||
220 | { | ||
221 | platform_driver_unregister(&ohci_hcd_ep93xx_driver); | ||
222 | } | ||
223 | |||
224 | module_init(ohci_hcd_ep93xx_init); | ||
225 | module_exit(ohci_hcd_ep93xx_cleanup); | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 8fb842ed5f6e..94d8cf4b36c1 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 |
@@ -909,7 +913,7 @@ MODULE_LICENSE ("GPL"); | |||
909 | #include "ohci-ppc-soc.c" | 913 | #include "ohci-ppc-soc.c" |
910 | #endif | 914 | #endif |
911 | 915 | ||
912 | #ifdef CONFIG_ARCH_AT91RM9200 | 916 | #if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261) |
913 | #include "ohci-at91.c" | 917 | #include "ohci-at91.c" |
914 | #endif | 918 | #endif |
915 | 919 | ||
@@ -919,9 +923,11 @@ 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) \ |
930 | || defined (CONFIG_ARCH_AT91SAM9261) \ | ||
925 | ) | 931 | ) |
926 | #error "missing bus glue for ohci-hcd" | 932 | #error "missing bus glue for ohci-hcd" |
927 | #endif | 933 | #endif |
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) | |||
167 | static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | 167 | static 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 | /* |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index c9d72ac0a1d7..431e8f31f1a9 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -372,7 +372,7 @@ static void uhci_fixup_toggles(struct uhci_qh *qh, int skip_first) | |||
372 | * need to change any toggles in this URB */ | 372 | * need to change any toggles in this URB */ |
373 | td = list_entry(urbp->td_list.next, struct uhci_td, list); | 373 | td = list_entry(urbp->td_list.next, struct uhci_td, list); |
374 | if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) { | 374 | if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) { |
375 | td = list_entry(urbp->td_list.next, struct uhci_td, | 375 | td = list_entry(urbp->td_list.prev, struct uhci_td, |
376 | list); | 376 | list); |
377 | toggle = uhci_toggle(td_token(td)) ^ 1; | 377 | toggle = uhci_toggle(td_token(td)) ^ 1; |
378 | 378 | ||
@@ -943,7 +943,9 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) | |||
943 | /* We received a short packet */ | 943 | /* We received a short packet */ |
944 | if (urb->transfer_flags & URB_SHORT_NOT_OK) | 944 | if (urb->transfer_flags & URB_SHORT_NOT_OK) |
945 | ret = -EREMOTEIO; | 945 | ret = -EREMOTEIO; |
946 | else if (ctrlstat & TD_CTRL_SPD) | 946 | |
947 | /* Fixup needed only if this isn't the URB's last TD */ | ||
948 | else if (&td->list != urbp->td_list.prev) | ||
947 | ret = 1; | 949 | ret = 1; |
948 | } | 950 | } |
949 | 951 | ||
@@ -1346,7 +1348,7 @@ static void uhci_scan_qh(struct uhci_hcd *uhci, struct uhci_qh *qh, | |||
1346 | } | 1348 | } |
1347 | 1349 | ||
1348 | uhci_giveback_urb(uhci, qh, urb, regs); | 1350 | uhci_giveback_urb(uhci, qh, urb, regs); |
1349 | if (status < 0) | 1351 | if (status < 0 && qh->type != USB_ENDPOINT_XFER_ISOC) |
1350 | break; | 1352 | break; |
1351 | } | 1353 | } |
1352 | 1354 | ||