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.c369
-rw-r--r--drivers/usb/host/ehci-dbg.c4
-rw-r--r--drivers/usb/host/ehci-fsl.c17
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-ixp4xx.c8
-rw-r--r--drivers/usb/host/ehci-orion.c8
-rw-r--r--drivers/usb/host/ehci-ps3.c2
-rw-r--r--drivers/usb/host/ehci-q.c17
-rw-r--r--drivers/usb/host/ehci.h5
-rw-r--r--drivers/usb/host/isp116x-hcd.c25
-rw-r--r--drivers/usb/host/isp1760-hcd.c81
-rw-r--r--drivers/usb/host/isp1760-hcd.h20
-rw-r--r--drivers/usb/host/isp1760-if.c37
-rw-r--r--drivers/usb/host/ohci-at91.c9
-rw-r--r--drivers/usb/host/ohci-au1xxx.c327
-rw-r--r--drivers/usb/host/ohci-dbg.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-omap.c2
-rw-r--r--drivers/usb/host/ohci-pnx4008.c28
-rw-r--r--drivers/usb/host/ohci-ppc-of.c2
-rw-r--r--drivers/usb/host/ohci-ps3.c2
-rw-r--r--drivers/usb/host/ohci-q.c3
-rw-r--r--drivers/usb/host/ohci-sm501.c2
-rw-r--r--drivers/usb/host/ohci-ssb.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c44
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/host/u132-hcd.c2
-rw-r--r--drivers/usb/host/uhci-hub.c2
28 files changed, 586 insertions, 440 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 08a4335401a9..bf69f4739107 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -19,263 +19,304 @@
19#define USB_MCFG_RDCOMB (1<<30) 19#define USB_MCFG_RDCOMB (1<<30)
20#define USB_MCFG_SSDEN (1<<23) 20#define USB_MCFG_SSDEN (1<<23)
21#define USB_MCFG_PHYPLLEN (1<<19) 21#define USB_MCFG_PHYPLLEN (1<<19)
22#define USB_MCFG_UCECLKEN (1<<18)
22#define USB_MCFG_EHCCLKEN (1<<17) 23#define USB_MCFG_EHCCLKEN (1<<17)
24#ifdef CONFIG_DMA_COHERENT
23#define USB_MCFG_UCAM (1<<7) 25#define USB_MCFG_UCAM (1<<7)
26#else
27#define USB_MCFG_UCAM (0)
28#endif
24#define USB_MCFG_EBMEN (1<<3) 29#define USB_MCFG_EBMEN (1<<3)
25#define USB_MCFG_EMEMEN (1<<2) 30#define USB_MCFG_EMEMEN (1<<2)
26 31
27#define USBH_ENABLE_CE (USB_MCFG_PHYPLLEN | USB_MCFG_EHCCLKEN) 32#define USBH_ENABLE_CE (USB_MCFG_PHYPLLEN | USB_MCFG_EHCCLKEN)
33#define USBH_ENABLE_INIT (USB_MCFG_PFEN | USB_MCFG_RDCOMB | \
34 USBH_ENABLE_CE | USB_MCFG_SSDEN | \
35 USB_MCFG_UCAM | USB_MCFG_EBMEN | \
36 USB_MCFG_EMEMEN)
28 37
29#ifdef CONFIG_DMA_COHERENT
30#define USBH_ENABLE_INIT (USBH_ENABLE_CE \
31 | USB_MCFG_PFEN | USB_MCFG_RDCOMB \
32 | USB_MCFG_SSDEN | USB_MCFG_UCAM \
33 | USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
34#else
35#define USBH_ENABLE_INIT (USBH_ENABLE_CE \
36 | USB_MCFG_PFEN | USB_MCFG_RDCOMB \
37 | USB_MCFG_SSDEN \
38 | USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
39#endif
40#define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) 38#define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
41 39
42extern int usb_disabled(void); 40extern int usb_disabled(void);
43 41
44/*-------------------------------------------------------------------------*/ 42static void au1xxx_start_ehc(void)
45
46static void au1xxx_start_ehc(struct platform_device *dev)
47{ 43{
48 pr_debug(__FILE__ ": starting Au1xxx EHCI USB Controller\n"); 44 /* enable clock to EHCI block and HS PHY PLL*/
49 45 au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_CE, USB_HOST_CONFIG);
50 /* write HW defaults again in case Yamon cleared them */ 46 au_sync();
51 if (au_readl(USB_HOST_CONFIG) == 0) {
52 au_writel(0x00d02000, USB_HOST_CONFIG);
53 au_readl(USB_HOST_CONFIG);
54 udelay(1000);
55 }
56 /* enable host controller */
57 au_writel(USBH_ENABLE_CE | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG);
58 au_readl(USB_HOST_CONFIG);
59 udelay(1000);
60 au_writel(USBH_ENABLE_INIT | au_readl(USB_HOST_CONFIG),
61 USB_HOST_CONFIG);
62 au_readl(USB_HOST_CONFIG);
63 udelay(1000); 47 udelay(1000);
64 48
65 pr_debug(__FILE__ ": Clock to USB host has been enabled\n"); 49 /* enable EHCI mmio */
50 au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_INIT, USB_HOST_CONFIG);
51 au_sync();
52 udelay(1000);
66} 53}
67 54
68static void au1xxx_stop_ehc(struct platform_device *dev) 55static void au1xxx_stop_ehc(void)
69{ 56{
70 pr_debug(__FILE__ ": stopping Au1xxx EHCI USB Controller\n"); 57 unsigned long c;
71 58
72 /* Disable mem */ 59 /* Disable mem */
73 au_writel(~USBH_DISABLE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); 60 au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_DISABLE, USB_HOST_CONFIG);
61 au_sync();
74 udelay(1000); 62 udelay(1000);
75 /* Disable clock */ 63
76 au_writel(~USB_MCFG_EHCCLKEN & au_readl(USB_HOST_CONFIG), 64 /* Disable EHC clock. If the HS PHY is unused disable it too. */
77 USB_HOST_CONFIG); 65 c = au_readl(USB_HOST_CONFIG) & ~USB_MCFG_EHCCLKEN;
78 au_readl(USB_HOST_CONFIG); 66 if (!(c & USB_MCFG_UCECLKEN)) /* UDC disabled? */
67 c &= ~USB_MCFG_PHYPLLEN; /* yes: disable HS PHY PLL */
68 au_writel(c, USB_HOST_CONFIG);
69 au_sync();
79} 70}
80 71
81/*-------------------------------------------------------------------------*/ 72static const struct hc_driver ehci_au1xxx_hc_driver = {
73 .description = hcd_name,
74 .product_desc = "Au1xxx EHCI",
75 .hcd_priv_size = sizeof(struct ehci_hcd),
76
77 /*
78 * generic hardware linkage
79 */
80 .irq = ehci_irq,
81 .flags = HCD_MEMORY | HCD_USB2,
82
83 /*
84 * basic lifecycle operations
85 *
86 * FIXME -- ehci_init() doesn't do enough here.
87 * See ehci-ppc-soc for a complete implementation.
88 */
89 .reset = ehci_init,
90 .start = ehci_run,
91 .stop = ehci_stop,
92 .shutdown = ehci_shutdown,
82 93
83/* configure so an HC device and id are always provided */ 94 /*
84/* always called with process context; sleeping is OK */ 95 * managing i/o requests and associated device resources
96 */
97 .urb_enqueue = ehci_urb_enqueue,
98 .urb_dequeue = ehci_urb_dequeue,
99 .endpoint_disable = ehci_endpoint_disable,
85 100
86/** 101 /*
87 * usb_ehci_au1xxx_probe - initialize Au1xxx-based HCDs 102 * scheduling support
88 * Context: !in_interrupt() 103 */
89 * 104 .get_frame_number = ehci_get_frame,
90 * Allocates basic resources for this USB host controller, and 105
91 * then invokes the start() method for the HCD associated with it 106 /*
92 * through the hotplug entry's driver_data. 107 * root hub support
93 * 108 */
94 */ 109 .hub_status_data = ehci_hub_status_data,
95int usb_ehci_au1xxx_probe(const struct hc_driver *driver, 110 .hub_control = ehci_hub_control,
96 struct usb_hcd **hcd_out, struct platform_device *dev) 111 .bus_suspend = ehci_bus_suspend,
112 .bus_resume = ehci_bus_resume,
113 .relinquish_port = ehci_relinquish_port,
114 .port_handed_over = ehci_port_handed_over,
115};
116
117static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
97{ 118{
98 int retval;
99 struct usb_hcd *hcd; 119 struct usb_hcd *hcd;
100 struct ehci_hcd *ehci; 120 struct ehci_hcd *ehci;
121 int ret;
101 122
102#if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) 123 if (usb_disabled())
124 return -ENODEV;
103 125
126#if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT)
104 /* Au1200 AB USB does not support coherent memory */ 127 /* Au1200 AB USB does not support coherent memory */
105 if (!(read_c0_prid() & 0xff)) { 128 if (!(read_c0_prid() & 0xff)) {
106 pr_info("%s: this is chip revision AB!\n", dev->name); 129 printk(KERN_INFO "%s: this is chip revision AB!\n", pdev->name);
107 pr_info("%s: update your board or re-configure the kernel\n", 130 printk(KERN_INFO "%s: update your board or re-configure"
108 dev->name); 131 " the kernel\n", pdev->name);
109 return -ENODEV; 132 return -ENODEV;
110 } 133 }
111#endif 134#endif
112 135
113 au1xxx_start_ehc(dev); 136 if (pdev->resource[1].flags != IORESOURCE_IRQ) {
114
115 if (dev->resource[1].flags != IORESOURCE_IRQ) {
116 pr_debug("resource[1] is not IORESOURCE_IRQ"); 137 pr_debug("resource[1] is not IORESOURCE_IRQ");
117 retval = -ENOMEM; 138 return -ENOMEM;
118 } 139 }
119 hcd = usb_create_hcd(driver, &dev->dev, "Au1xxx"); 140 hcd = usb_create_hcd(&ehci_au1xxx_hc_driver, &pdev->dev, "Au1xxx");
120 if (!hcd) 141 if (!hcd)
121 return -ENOMEM; 142 return -ENOMEM;
122 hcd->rsrc_start = dev->resource[0].start; 143
123 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; 144 hcd->rsrc_start = pdev->resource[0].start;
145 hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
124 146
125 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 147 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
126 pr_debug("request_mem_region failed"); 148 pr_debug("request_mem_region failed");
127 retval = -EBUSY; 149 ret = -EBUSY;
128 goto err1; 150 goto err1;
129 } 151 }
130 152
131 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); 153 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
132 if (!hcd->regs) { 154 if (!hcd->regs) {
133 pr_debug("ioremap failed"); 155 pr_debug("ioremap failed");
134 retval = -ENOMEM; 156 ret = -ENOMEM;
135 goto err2; 157 goto err2;
136 } 158 }
137 159
160 au1xxx_start_ehc();
161
138 ehci = hcd_to_ehci(hcd); 162 ehci = hcd_to_ehci(hcd);
139 ehci->caps = hcd->regs; 163 ehci->caps = hcd->regs;
140 ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); 164 ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase));
141 /* cache this readonly data; minimize chip reads */ 165 /* cache this readonly data; minimize chip reads */
142 ehci->hcs_params = readl(&ehci->caps->hcs_params); 166 ehci->hcs_params = readl(&ehci->caps->hcs_params);
143 167
144 /* ehci_hcd_init(hcd_to_ehci(hcd)); */ 168 ret = usb_add_hcd(hcd, pdev->resource[1].start,
145 169 IRQF_DISABLED | IRQF_SHARED);
146 retval = 170 if (ret == 0) {
147 usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED); 171 platform_set_drvdata(pdev, hcd);
148 if (retval == 0) 172 return ret;
149 return retval; 173 }
150 174
151 au1xxx_stop_ehc(dev); 175 au1xxx_stop_ehc();
152 iounmap(hcd->regs); 176 iounmap(hcd->regs);
153err2: 177err2:
154 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 178 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
155err1: 179err1:
156 usb_put_hcd(hcd); 180 usb_put_hcd(hcd);
157 return retval; 181 return ret;
158} 182}
159 183
160/* may be called without controller electrically present */ 184static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
161/* may be called with controller, bus, and devices active */
162
163/**
164 * usb_ehci_hcd_au1xxx_remove - shutdown processing for Au1xxx-based HCDs
165 * @dev: USB Host Controller being removed
166 * Context: !in_interrupt()
167 *
168 * Reverses the effect of usb_ehci_hcd_au1xxx_probe(), first invoking
169 * the HCD's stop() method. It is always called from a thread
170 * context, normally "rmmod", "apmd", or something similar.
171 *
172 */
173void usb_ehci_au1xxx_remove(struct usb_hcd *hcd, struct platform_device *dev)
174{ 185{
186 struct usb_hcd *hcd = platform_get_drvdata(pdev);
187
175 usb_remove_hcd(hcd); 188 usb_remove_hcd(hcd);
176 iounmap(hcd->regs); 189 iounmap(hcd->regs);
177 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 190 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
178 usb_put_hcd(hcd); 191 usb_put_hcd(hcd);
179 au1xxx_stop_ehc(dev); 192 au1xxx_stop_ehc();
193 platform_set_drvdata(pdev, NULL);
194
195 return 0;
180} 196}
181 197
182/*-------------------------------------------------------------------------*/ 198#ifdef CONFIG_PM
199static int ehci_hcd_au1xxx_drv_suspend(struct platform_device *pdev,
200 pm_message_t message)
201{
202 struct usb_hcd *hcd = platform_get_drvdata(pdev);
203 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
204 unsigned long flags;
205 int rc;
183 206
184static const struct hc_driver ehci_au1xxx_hc_driver = { 207 return 0;
185 .description = hcd_name, 208 rc = 0;
186 .product_desc = "Au1xxx EHCI",
187 .hcd_priv_size = sizeof(struct ehci_hcd),
188 209
189 /* 210 if (time_before(jiffies, ehci->next_statechange))
190 * generic hardware linkage 211 msleep(10);
191 */
192 .irq = ehci_irq,
193 .flags = HCD_MEMORY | HCD_USB2,
194 212
195 /* 213 /* Root hub was already suspended. Disable irq emission and
196 * basic lifecycle operations 214 * mark HW unaccessible, bail out if RH has been resumed. Use
215 * the spinlock to properly synchronize with possible pending
216 * RH suspend or resume activity.
197 * 217 *
198 * FIXME -- ehci_init() doesn't do enough here. 218 * This is still racy as hcd->state is manipulated outside of
199 * See ehci-ppc-soc for a complete implementation. 219 * any locks =P But that will be a different fix.
200 */
201 .reset = ehci_init,
202 .start = ehci_run,
203 .stop = ehci_stop,
204 .shutdown = ehci_shutdown,
205
206 /*
207 * managing i/o requests and associated device resources
208 */ 220 */
209 .urb_enqueue = ehci_urb_enqueue, 221 spin_lock_irqsave(&ehci->lock, flags);
210 .urb_dequeue = ehci_urb_dequeue, 222 if (hcd->state != HC_STATE_SUSPENDED) {
211 .endpoint_disable = ehci_endpoint_disable, 223 rc = -EINVAL;
224 goto bail;
225 }
226 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
227 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
212 228
213 /* 229 /* make sure snapshot being resumed re-enumerates everything */
214 * scheduling support 230 if (message.event == PM_EVENT_PRETHAW) {
215 */ 231 ehci_halt(ehci);
216 .get_frame_number = ehci_get_frame, 232 ehci_reset(ehci);
233 }
217 234
218 /* 235 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
219 * root hub support
220 */
221 .hub_status_data = ehci_hub_status_data,
222 .hub_control = ehci_hub_control,
223 .bus_suspend = ehci_bus_suspend,
224 .bus_resume = ehci_bus_resume,
225 .relinquish_port = ehci_relinquish_port,
226 .port_handed_over = ehci_port_handed_over,
227};
228 236
229/*-------------------------------------------------------------------------*/ 237 au1xxx_stop_ehc();
230 238
231static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) 239bail:
232{ 240 spin_unlock_irqrestore(&ehci->lock, flags);
233 struct usb_hcd *hcd = NULL;
234 int ret;
235 241
236 pr_debug("In ehci_hcd_au1xxx_drv_probe\n"); 242 // could save FLADJ in case of Vaux power loss
243 // ... we'd only use it to handle clock skew
237 244
238 if (usb_disabled()) 245 return rc;
239 return -ENODEV;
240
241 /* FIXME we only want one one probe() not two */
242 ret = usb_ehci_au1xxx_probe(&ehci_au1xxx_hc_driver, &hcd, pdev);
243 return ret;
244} 246}
245 247
246static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) 248
249static int ehci_hcd_au1xxx_drv_resume(struct platform_device *pdev)
247{ 250{
248 struct usb_hcd *hcd = platform_get_drvdata(pdev); 251 struct usb_hcd *hcd = platform_get_drvdata(pdev);
252 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
249 253
250 /* FIXME we only want one one remove() not two */ 254 au1xxx_start_ehc();
251 usb_ehci_au1xxx_remove(hcd, pdev);
252 return 0;
253}
254 255
255 /*TBD*/ 256 // maybe restore FLADJ
256/*static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
257{
258 struct platform_device *pdev = to_platform_device(dev);
259 struct usb_hcd *hcd = dev_get_drvdata(dev);
260 257
261 return 0; 258 if (time_before(jiffies, ehci->next_statechange))
262} 259 msleep(100);
263static int ehci_hcd_au1xxx_drv_resume(struct device *dev) 260
264{ 261 /* Mark hardware accessible again as we are out of D3 state by now */
265 struct platform_device *pdev = to_platform_device(dev); 262 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
266 struct usb_hcd *hcd = dev_get_drvdata(dev); 263
264 /* If CF is still set, we maintained PCI Vaux power.
265 * Just undo the effect of ehci_pci_suspend().
266 */
267 if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF) {
268 int mask = INTR_MASK;
269
270 if (!hcd->self.root_hub->do_remote_wakeup)
271 mask &= ~STS_PCD;
272 ehci_writel(ehci, mask, &ehci->regs->intr_enable);
273 ehci_readl(ehci, &ehci->regs->intr_enable);
274 return 0;
275 }
276
277 ehci_dbg(ehci, "lost power, restarting\n");
278 usb_root_hub_lost_power(hcd->self.root_hub);
279
280 /* Else reset, to cope with power loss or flush-to-storage
281 * style "resume" having let BIOS kick in during reboot.
282 */
283 (void) ehci_halt(ehci);
284 (void) ehci_reset(ehci);
285
286 /* emptying the schedule aborts any urbs */
287 spin_lock_irq(&ehci->lock);
288 if (ehci->reclaim)
289 end_unlink_async(ehci);
290 ehci_work(ehci);
291 spin_unlock_irq(&ehci->lock);
292
293 ehci_writel(ehci, ehci->command, &ehci->regs->command);
294 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
295 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
296
297 /* here we "know" root ports should always stay powered */
298 ehci_port_power(ehci, 1);
299
300 hcd->state = HC_STATE_SUSPENDED;
267 301
268 return 0; 302 return 0;
269} 303}
270*/ 304
271MODULE_ALIAS("platform:au1xxx-ehci"); 305#else
306#define ehci_hcd_au1xxx_drv_suspend NULL
307#define ehci_hcd_au1xxx_drv_resume NULL
308#endif
309
272static struct platform_driver ehci_hcd_au1xxx_driver = { 310static struct platform_driver ehci_hcd_au1xxx_driver = {
273 .probe = ehci_hcd_au1xxx_drv_probe, 311 .probe = ehci_hcd_au1xxx_drv_probe,
274 .remove = ehci_hcd_au1xxx_drv_remove, 312 .remove = ehci_hcd_au1xxx_drv_remove,
275 .shutdown = usb_hcd_platform_shutdown, 313 .shutdown = usb_hcd_platform_shutdown,
276 /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ 314 .suspend = ehci_hcd_au1xxx_drv_suspend,
277 /*.resume = ehci_hcd_au1xxx_drv_resume, */ 315 .resume = ehci_hcd_au1xxx_drv_resume,
278 .driver = { 316 .driver = {
279 .name = "au1xxx-ehci", 317 .name = "au1xxx-ehci",
318 .owner = THIS_MODULE,
280 } 319 }
281}; 320};
321
322MODULE_ALIAS("platform:au1xxx-ehci");
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 0f82fdcaef09..b0f8ed5a7fb9 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -676,7 +676,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
676 "%s\n" 676 "%s\n"
677 "SUSPENDED (no register access)\n", 677 "SUSPENDED (no register access)\n",
678 hcd->self.controller->bus->name, 678 hcd->self.controller->bus->name,
679 hcd->self.controller->bus_id, 679 dev_name(hcd->self.controller),
680 hcd->product_desc); 680 hcd->product_desc);
681 goto done; 681 goto done;
682 } 682 }
@@ -688,7 +688,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
688 "%s\n" 688 "%s\n"
689 "EHCI %x.%02x, hcd state %d\n", 689 "EHCI %x.%02x, hcd state %d\n",
690 hcd->self.controller->bus->name, 690 hcd->self.controller->bus->name,
691 hcd->self.controller->bus_id, 691 dev_name(hcd->self.controller),
692 hcd->product_desc, 692 hcd->product_desc,
693 i >> 8, i & 0x0ff, hcd->state); 693 i >> 8, i & 0x0ff, hcd->state);
694 size -= temp; 694 size -= temp;
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 7370d6187c64..01c3da34f678 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -56,7 +56,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
56 pdata = (struct fsl_usb2_platform_data *)pdev->dev.platform_data; 56 pdata = (struct fsl_usb2_platform_data *)pdev->dev.platform_data;
57 if (!pdata) { 57 if (!pdata) {
58 dev_err(&pdev->dev, 58 dev_err(&pdev->dev,
59 "No platform data for %s.\n", pdev->dev.bus_id); 59 "No platform data for %s.\n", dev_name(&pdev->dev));
60 return -ENODEV; 60 return -ENODEV;
61 } 61 }
62 62
@@ -69,7 +69,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
69 (pdata->operating_mode == FSL_USB2_DR_OTG))) { 69 (pdata->operating_mode == FSL_USB2_DR_OTG))) {
70 dev_err(&pdev->dev, 70 dev_err(&pdev->dev,
71 "Non Host Mode configured for %s. Wrong driver linked.\n", 71 "Non Host Mode configured for %s. Wrong driver linked.\n",
72 pdev->dev.bus_id); 72 dev_name(&pdev->dev));
73 return -ENODEV; 73 return -ENODEV;
74 } 74 }
75 75
@@ -77,12 +77,12 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
77 if (!res) { 77 if (!res) {
78 dev_err(&pdev->dev, 78 dev_err(&pdev->dev,
79 "Found HC with no IRQ. Check %s setup!\n", 79 "Found HC with no IRQ. Check %s setup!\n",
80 pdev->dev.bus_id); 80 dev_name(&pdev->dev));
81 return -ENODEV; 81 return -ENODEV;
82 } 82 }
83 irq = res->start; 83 irq = res->start;
84 84
85 hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); 85 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
86 if (!hcd) { 86 if (!hcd) {
87 retval = -ENOMEM; 87 retval = -ENOMEM;
88 goto err1; 88 goto err1;
@@ -92,7 +92,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
92 if (!res) { 92 if (!res) {
93 dev_err(&pdev->dev, 93 dev_err(&pdev->dev,
94 "Found HC with no register addr. Check %s setup!\n", 94 "Found HC with no register addr. Check %s setup!\n",
95 pdev->dev.bus_id); 95 dev_name(&pdev->dev));
96 retval = -ENODEV; 96 retval = -ENODEV;
97 goto err2; 97 goto err2;
98 } 98 }
@@ -132,7 +132,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
132 err2: 132 err2:
133 usb_put_hcd(hcd); 133 usb_put_hcd(hcd);
134 err1: 134 err1:
135 dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, retval); 135 dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
136 return retval; 136 return retval;
137} 137}
138 138
@@ -230,8 +230,13 @@ static void mpc83xx_usb_setup(struct usb_hcd *hcd)
230 230
231 /* put controller in host mode. */ 231 /* put controller in host mode. */
232 ehci_writel(ehci, 0x00000003, non_ehci + FSL_SOC_USB_USBMODE); 232 ehci_writel(ehci, 0x00000003, non_ehci + FSL_SOC_USB_USBMODE);
233#ifdef CONFIG_PPC_85xx
234 out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x00000008);
235 out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000080);
236#else
233 out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x0000000c); 237 out_be32(non_ehci + FSL_SOC_USB_PRICTRL, 0x0000000c);
234 out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000040); 238 out_be32(non_ehci + FSL_SOC_USB_AGECNTTHRSH, 0x00000040);
239#endif
235 out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001); 240 out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001);
236} 241}
237 242
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 369a8a5ea7bb..d9d53f289caf 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -84,7 +84,7 @@ static const char hcd_name [] = "ehci_hcd";
84#define EHCI_IAA_MSECS 10 /* arbitrary */ 84#define EHCI_IAA_MSECS 10 /* arbitrary */
85#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */ 85#define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */
86#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */ 86#define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */
87#define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */ 87#define EHCI_SHRINK_FRAMES 5 /* async qh unlink delay */
88 88
89/* Initial IRQ latency: faster than hw default */ 89/* Initial IRQ latency: faster than hw default */
90static int log2_irq_thresh = 0; // 0 to 6 90static int log2_irq_thresh = 0; // 0 to 6
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
index 9d042f220097..f9575c409124 100644
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -77,12 +77,12 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev)
77 if (!res) { 77 if (!res) {
78 dev_err(&pdev->dev, 78 dev_err(&pdev->dev,
79 "Found HC with no IRQ. Check %s setup!\n", 79 "Found HC with no IRQ. Check %s setup!\n",
80 pdev->dev.bus_id); 80 dev_name(&pdev->dev));
81 return -ENODEV; 81 return -ENODEV;
82 } 82 }
83 irq = res->start; 83 irq = res->start;
84 84
85 hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); 85 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
86 if (!hcd) { 86 if (!hcd) {
87 retval = -ENOMEM; 87 retval = -ENOMEM;
88 goto fail_create_hcd; 88 goto fail_create_hcd;
@@ -92,7 +92,7 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev)
92 if (!res) { 92 if (!res) {
93 dev_err(&pdev->dev, 93 dev_err(&pdev->dev,
94 "Found HC with no register addr. Check %s setup!\n", 94 "Found HC with no register addr. Check %s setup!\n",
95 pdev->dev.bus_id); 95 dev_name(&pdev->dev));
96 retval = -ENODEV; 96 retval = -ENODEV;
97 goto fail_request_resource; 97 goto fail_request_resource;
98 } 98 }
@@ -126,7 +126,7 @@ fail_ioremap:
126fail_request_resource: 126fail_request_resource:
127 usb_put_hcd(hcd); 127 usb_put_hcd(hcd);
128fail_create_hcd: 128fail_create_hcd:
129 dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, retval); 129 dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
130 return retval; 130 return retval;
131} 131}
132 132
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index ab625f0ba1d9..5fbdc14e63b3 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -204,7 +204,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
204 if (irq <= 0) { 204 if (irq <= 0) {
205 dev_err(&pdev->dev, 205 dev_err(&pdev->dev,
206 "Found HC with no IRQ. Check %s setup!\n", 206 "Found HC with no IRQ. Check %s setup!\n",
207 pdev->dev.bus_id); 207 dev_name(&pdev->dev));
208 err = -ENODEV; 208 err = -ENODEV;
209 goto err1; 209 goto err1;
210 } 210 }
@@ -213,7 +213,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
213 if (!res) { 213 if (!res) {
214 dev_err(&pdev->dev, 214 dev_err(&pdev->dev,
215 "Found HC with no register addr. Check %s setup!\n", 215 "Found HC with no register addr. Check %s setup!\n",
216 pdev->dev.bus_id); 216 dev_name(&pdev->dev));
217 err = -ENODEV; 217 err = -ENODEV;
218 goto err1; 218 goto err1;
219 } 219 }
@@ -233,7 +233,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
233 } 233 }
234 234
235 hcd = usb_create_hcd(&ehci_orion_hc_driver, 235 hcd = usb_create_hcd(&ehci_orion_hc_driver,
236 &pdev->dev, pdev->dev.bus_id); 236 &pdev->dev, dev_name(&pdev->dev));
237 if (!hcd) { 237 if (!hcd) {
238 err = -ENOMEM; 238 err = -ENOMEM;
239 goto err3; 239 goto err3;
@@ -276,7 +276,7 @@ err2:
276 release_mem_region(res->start, res->end - res->start + 1); 276 release_mem_region(res->start, res->end - res->start + 1);
277err1: 277err1:
278 dev_err(&pdev->dev, "init %s fail, %d\n", 278 dev_err(&pdev->dev, "init %s fail, %d\n",
279 pdev->dev.bus_id, err); 279 dev_name(&pdev->dev), err);
280 280
281 return err; 281 return err;
282} 282}
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 37e6abeb794c..0eba894bcb01 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -128,7 +128,7 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
128 128
129 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ 129 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
130 130
131 hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev->core.bus_id); 131 hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev_name(&dev->core));
132 132
133 if (!hcd) { 133 if (!hcd) {
134 dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, 134 dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__,
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index b85b54160cda..2622b6596d7c 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1116,8 +1116,7 @@ static void scan_async (struct ehci_hcd *ehci)
1116 struct ehci_qh *qh; 1116 struct ehci_qh *qh;
1117 enum ehci_timer_action action = TIMER_IO_WATCHDOG; 1117 enum ehci_timer_action action = TIMER_IO_WATCHDOG;
1118 1118
1119 if (!++(ehci->stamp)) 1119 ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
1120 ehci->stamp++;
1121 timer_action_done (ehci, TIMER_ASYNC_SHRINK); 1120 timer_action_done (ehci, TIMER_ASYNC_SHRINK);
1122rescan: 1121rescan:
1123 qh = ehci->async->qh_next.qh; 1122 qh = ehci->async->qh_next.qh;
@@ -1142,18 +1141,20 @@ rescan:
1142 } 1141 }
1143 } 1142 }
1144 1143
1145 /* unlink idle entries, reducing HC PCI usage as well 1144 /* unlink idle entries, reducing DMA usage as well
1146 * as HCD schedule-scanning costs. delay for any qh 1145 * as HCD schedule-scanning costs. delay for any qh
1147 * we just scanned, there's a not-unusual case that it 1146 * we just scanned, there's a not-unusual case that it
1148 * doesn't stay idle for long. 1147 * doesn't stay idle for long.
1149 * (plus, avoids some kind of re-activation race.) 1148 * (plus, avoids some kind of re-activation race.)
1150 */ 1149 */
1151 if (list_empty (&qh->qtd_list)) { 1150 if (list_empty(&qh->qtd_list)
1152 if (qh->stamp == ehci->stamp) 1151 && qh->qh_state == QH_STATE_LINKED) {
1152 if (!ehci->reclaim
1153 && ((ehci->stamp - qh->stamp) & 0x1fff)
1154 >= (EHCI_SHRINK_FRAMES * 8))
1155 start_unlink_async(ehci, qh);
1156 else
1153 action = TIMER_ASYNC_SHRINK; 1157 action = TIMER_ASYNC_SHRINK;
1154 else if (!ehci->reclaim
1155 && qh->qh_state == QH_STATE_LINKED)
1156 start_unlink_async (ehci, qh);
1157 } 1158 }
1158 1159
1159 qh = qh->qh_next.qh; 1160 qh = qh->qh_next.qh;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 90245fd8bac4..5799298364fb 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -198,7 +198,10 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
198 break; 198 break;
199 // case TIMER_ASYNC_SHRINK: 199 // case TIMER_ASYNC_SHRINK:
200 default: 200 default:
201 t = EHCI_SHRINK_JIFFIES; 201 /* add a jiffie since we synch against the
202 * 8 KHz uframe counter.
203 */
204 t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
202 break; 205 break;
203 } 206 }
204 mod_timer(&ehci->watchdog, t + jiffies); 207 mod_timer(&ehci->watchdog, t + jiffies);
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 20b9a0d07420..31178e10cbbe 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -94,6 +94,10 @@ static void write_ptddata_to_fifo(struct isp116x *isp116x, void *buf, int len)
94 u16 w; 94 u16 w;
95 int quot = len % 4; 95 int quot = len % 4;
96 96
97 /* buffer is already in 'usb data order', which is LE. */
98 /* When reading buffer as u16, we have to take care byte order */
99 /* doesn't get mixed up */
100
97 if ((unsigned long)dp2 & 1) { 101 if ((unsigned long)dp2 & 1) {
98 /* not aligned */ 102 /* not aligned */
99 for (; len > 1; len -= 2) { 103 for (; len > 1; len -= 2) {
@@ -105,8 +109,11 @@ static void write_ptddata_to_fifo(struct isp116x *isp116x, void *buf, int len)
105 isp116x_write_data16(isp116x, (u16) * dp); 109 isp116x_write_data16(isp116x, (u16) * dp);
106 } else { 110 } else {
107 /* aligned */ 111 /* aligned */
108 for (; len > 1; len -= 2) 112 for (; len > 1; len -= 2) {
109 isp116x_raw_write_data16(isp116x, *dp2++); 113 /* Keep byte order ! */
114 isp116x_raw_write_data16(isp116x, cpu_to_le16(*dp2++));
115 }
116
110 if (len) 117 if (len)
111 isp116x_write_data16(isp116x, 0xff & *((u8 *) dp2)); 118 isp116x_write_data16(isp116x, 0xff & *((u8 *) dp2));
112 } 119 }
@@ -124,6 +131,10 @@ static void read_ptddata_from_fifo(struct isp116x *isp116x, void *buf, int len)
124 u16 w; 131 u16 w;
125 int quot = len % 4; 132 int quot = len % 4;
126 133
134 /* buffer is already in 'usb data order', which is LE. */
135 /* When reading buffer as u16, we have to take care byte order */
136 /* doesn't get mixed up */
137
127 if ((unsigned long)dp2 & 1) { 138 if ((unsigned long)dp2 & 1) {
128 /* not aligned */ 139 /* not aligned */
129 for (; len > 1; len -= 2) { 140 for (; len > 1; len -= 2) {
@@ -131,12 +142,16 @@ static void read_ptddata_from_fifo(struct isp116x *isp116x, void *buf, int len)
131 *dp++ = w & 0xff; 142 *dp++ = w & 0xff;
132 *dp++ = (w >> 8) & 0xff; 143 *dp++ = (w >> 8) & 0xff;
133 } 144 }
145
134 if (len) 146 if (len)
135 *dp = 0xff & isp116x_read_data16(isp116x); 147 *dp = 0xff & isp116x_read_data16(isp116x);
136 } else { 148 } else {
137 /* aligned */ 149 /* aligned */
138 for (; len > 1; len -= 2) 150 for (; len > 1; len -= 2) {
139 *dp2++ = isp116x_raw_read_data16(isp116x); 151 /* Keep byte order! */
152 *dp2++ = le16_to_cpu(isp116x_raw_read_data16(isp116x));
153 }
154
140 if (len) 155 if (len)
141 *(u8 *) dp2 = 0xff & isp116x_read_data16(isp116x); 156 *(u8 *) dp2 = 0xff & isp116x_read_data16(isp116x);
142 } 157 }
@@ -1592,7 +1607,7 @@ static int __devinit isp116x_probe(struct platform_device *pdev)
1592 } 1607 }
1593 1608
1594 /* allocate and initialize hcd */ 1609 /* allocate and initialize hcd */
1595 hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id); 1610 hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, dev_name(&pdev->dev));
1596 if (!hcd) { 1611 if (!hcd) {
1597 ret = -ENOMEM; 1612 ret = -ENOMEM;
1598 goto err5; 1613 goto err5;
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 65aa5ecf569a..c858f2adb929 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -38,6 +38,7 @@ struct isp1760_hcd {
38 unsigned i_thresh; 38 unsigned i_thresh;
39 unsigned long reset_done; 39 unsigned long reset_done;
40 unsigned long next_statechange; 40 unsigned long next_statechange;
41 unsigned int devflags;
41}; 42};
42 43
43static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) 44static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd)
@@ -378,9 +379,31 @@ static int isp1760_hc_setup(struct usb_hcd *hcd)
378{ 379{
379 struct isp1760_hcd *priv = hcd_to_priv(hcd); 380 struct isp1760_hcd *priv = hcd_to_priv(hcd);
380 int result; 381 int result;
381 u32 scratch; 382 u32 scratch, hwmode;
383
384 /* Setup HW Mode Control: This assumes a level active-low interrupt */
385 hwmode = HW_DATA_BUS_32BIT;
386
387 if (priv->devflags & ISP1760_FLAG_BUS_WIDTH_16)
388 hwmode &= ~HW_DATA_BUS_32BIT;
389 if (priv->devflags & ISP1760_FLAG_ANALOG_OC)
390 hwmode |= HW_ANA_DIGI_OC;
391 if (priv->devflags & ISP1760_FLAG_DACK_POL_HIGH)
392 hwmode |= HW_DACK_POL_HIGH;
393 if (priv->devflags & ISP1760_FLAG_DREQ_POL_HIGH)
394 hwmode |= HW_DREQ_POL_HIGH;
395
396 /*
397 * We have to set this first in case we're in 16-bit mode.
398 * Write it twice to ensure correct upper bits if switching
399 * to 16-bit mode.
400 */
401 isp1760_writel(hwmode, hcd->regs + HC_HW_MODE_CTRL);
402 isp1760_writel(hwmode, hcd->regs + HC_HW_MODE_CTRL);
382 403
383 isp1760_writel(0xdeadbabe, hcd->regs + HC_SCRATCH_REG); 404 isp1760_writel(0xdeadbabe, hcd->regs + HC_SCRATCH_REG);
405 /* Change bus pattern */
406 scratch = isp1760_readl(hcd->regs + HC_CHIP_ID_REG);
384 scratch = isp1760_readl(hcd->regs + HC_SCRATCH_REG); 407 scratch = isp1760_readl(hcd->regs + HC_SCRATCH_REG);
385 if (scratch != 0xdeadbabe) { 408 if (scratch != 0xdeadbabe) {
386 printk(KERN_ERR "ISP1760: Scratch test failed.\n"); 409 printk(KERN_ERR "ISP1760: Scratch test failed.\n");
@@ -403,17 +426,29 @@ static int isp1760_hc_setup(struct usb_hcd *hcd)
403 426
404 /* Step 11 passed */ 427 /* Step 11 passed */
405 428
406 isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_REG); 429 isp1760_info(priv, "bus width: %d, oc: %s\n",
407 isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_ENABLE); 430 (priv->devflags & ISP1760_FLAG_BUS_WIDTH_16) ?
431 16 : 32, (priv->devflags & ISP1760_FLAG_ANALOG_OC) ?
432 "analog" : "digital");
408 433
409 /* ATL reset */ 434 /* ATL reset */
410 scratch = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); 435 isp1760_writel(hwmode | ALL_ATX_RESET, hcd->regs + HC_HW_MODE_CTRL);
411 isp1760_writel(scratch | ALL_ATX_RESET, hcd->regs + HC_HW_MODE_CTRL);
412 mdelay(10); 436 mdelay(10);
413 isp1760_writel(scratch, hcd->regs + HC_HW_MODE_CTRL); 437 isp1760_writel(hwmode, hcd->regs + HC_HW_MODE_CTRL);
414 438
415 isp1760_writel(PORT1_POWER | PORT1_INIT2, hcd->regs + HC_PORT1_CTRL); 439 isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_REG);
416 mdelay(10); 440 isp1760_writel(INTERRUPT_ENABLE_MASK, hcd->regs + HC_INTERRUPT_ENABLE);
441
442 /*
443 * PORT 1 Control register of the ISP1760 is the OTG control
444 * register on ISP1761.
445 */
446 if (!(priv->devflags & ISP1760_FLAG_ISP1761) &&
447 !(priv->devflags & ISP1760_FLAG_PORT1_DIS)) {
448 isp1760_writel(PORT1_POWER | PORT1_INIT2,
449 hcd->regs + HC_PORT1_CTRL);
450 mdelay(10);
451 }
417 452
418 priv->hcs_params = isp1760_readl(hcd->regs + HC_HCSPARAMS); 453 priv->hcs_params = isp1760_readl(hcd->regs + HC_HCSPARAMS);
419 454
@@ -453,8 +488,7 @@ static int isp1760_run(struct usb_hcd *hcd)
453 hcd->state = HC_STATE_RUNNING; 488 hcd->state = HC_STATE_RUNNING;
454 isp1760_enable_interrupts(hcd); 489 isp1760_enable_interrupts(hcd);
455 temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL); 490 temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL);
456 temp |= FINAL_HW_CONFIG; 491 isp1760_writel(temp | HW_GLOBAL_INTR_EN, hcd->regs + HC_HW_MODE_CTRL);
457 isp1760_writel(temp, hcd->regs + HC_HW_MODE_CTRL);
458 492
459 command = isp1760_readl(hcd->regs + HC_USBCMD); 493 command = isp1760_readl(hcd->regs + HC_USBCMD);
460 command &= ~(CMD_LRESET|CMD_RESET); 494 command &= ~(CMD_LRESET|CMD_RESET);
@@ -782,8 +816,8 @@ static void enqueue_one_int_qtd(u32 int_regs, u32 payload,
782 qtd->status |= slot << 16; 816 qtd->status |= slot << 16;
783} 817}
784 818
785void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, 819static void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh,
786 struct isp1760_qtd *qtd) 820 struct isp1760_qtd *qtd)
787{ 821{
788 struct isp1760_hcd *priv = hcd_to_priv(hcd); 822 struct isp1760_hcd *priv = hcd_to_priv(hcd);
789 u32 skip_map, or_map; 823 u32 skip_map, or_map;
@@ -816,8 +850,8 @@ void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh,
816 isp1760_writel(buffstatus, hcd->regs + HC_BUFFER_STATUS_REG); 850 isp1760_writel(buffstatus, hcd->regs + HC_BUFFER_STATUS_REG);
817} 851}
818 852
819void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, 853static void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh,
820 struct isp1760_qtd *qtd) 854 struct isp1760_qtd *qtd)
821{ 855{
822 struct isp1760_hcd *priv = hcd_to_priv(hcd); 856 struct isp1760_hcd *priv = hcd_to_priv(hcd);
823 u32 skip_map, or_map; 857 u32 skip_map, or_map;
@@ -1592,7 +1626,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb,
1592 struct inter_packet_info *ints; 1626 struct inter_packet_info *ints;
1593 u32 i; 1627 u32 i;
1594 u32 reg_base, or_reg, skip_reg; 1628 u32 reg_base, or_reg, skip_reg;
1595 int flags; 1629 unsigned long flags;
1596 struct ptd ptd; 1630 struct ptd ptd;
1597 1631
1598 switch (usb_pipetype(urb->pipe)) { 1632 switch (usb_pipetype(urb->pipe)) {
@@ -2061,7 +2095,7 @@ static void isp1760_endpoint_disable(struct usb_hcd *usb_hcd,
2061 struct isp1760_hcd *priv = hcd_to_priv(usb_hcd); 2095 struct isp1760_hcd *priv = hcd_to_priv(usb_hcd);
2062 struct isp1760_qh *qh; 2096 struct isp1760_qh *qh;
2063 struct isp1760_qtd *qtd; 2097 struct isp1760_qtd *qtd;
2064 u32 flags; 2098 unsigned long flags;
2065 2099
2066 spin_lock_irqsave(&priv->lock, flags); 2100 spin_lock_irqsave(&priv->lock, flags);
2067 qh = ep->hcpriv; 2101 qh = ep->hcpriv;
@@ -2112,6 +2146,7 @@ static int isp1760_get_frame(struct usb_hcd *hcd)
2112static void isp1760_stop(struct usb_hcd *hcd) 2146static void isp1760_stop(struct usb_hcd *hcd)
2113{ 2147{
2114 struct isp1760_hcd *priv = hcd_to_priv(hcd); 2148 struct isp1760_hcd *priv = hcd_to_priv(hcd);
2149 u32 temp;
2115 2150
2116 isp1760_hub_control(hcd, ClearPortFeature, USB_PORT_FEAT_POWER, 1, 2151 isp1760_hub_control(hcd, ClearPortFeature, USB_PORT_FEAT_POWER, 1,
2117 NULL, 0); 2152 NULL, 0);
@@ -2120,7 +2155,8 @@ static void isp1760_stop(struct usb_hcd *hcd)
2120 spin_lock_irq(&priv->lock); 2155 spin_lock_irq(&priv->lock);
2121 ehci_reset(priv); 2156 ehci_reset(priv);
2122 /* Disable IRQ */ 2157 /* Disable IRQ */
2123 isp1760_writel(HW_DATA_BUS_32BIT, hcd->regs + HC_HW_MODE_CTRL); 2158 temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL);
2159 isp1760_writel(temp &= ~HW_GLOBAL_INTR_EN, hcd->regs + HC_HW_MODE_CTRL);
2124 spin_unlock_irq(&priv->lock); 2160 spin_unlock_irq(&priv->lock);
2125 2161
2126 isp1760_writel(0, hcd->regs + HC_CONFIGFLAG); 2162 isp1760_writel(0, hcd->regs + HC_CONFIGFLAG);
@@ -2128,10 +2164,11 @@ static void isp1760_stop(struct usb_hcd *hcd)
2128 2164
2129static void isp1760_shutdown(struct usb_hcd *hcd) 2165static void isp1760_shutdown(struct usb_hcd *hcd)
2130{ 2166{
2131 u32 command; 2167 u32 command, temp;
2132 2168
2133 isp1760_stop(hcd); 2169 isp1760_stop(hcd);
2134 isp1760_writel(HW_DATA_BUS_32BIT, hcd->regs + HC_HW_MODE_CTRL); 2170 temp = isp1760_readl(hcd->regs + HC_HW_MODE_CTRL);
2171 isp1760_writel(temp &= ~HW_GLOBAL_INTR_EN, hcd->regs + HC_HW_MODE_CTRL);
2135 2172
2136 command = isp1760_readl(hcd->regs + HC_USBCMD); 2173 command = isp1760_readl(hcd->regs + HC_USBCMD);
2137 command &= ~CMD_RUN; 2174 command &= ~CMD_RUN;
@@ -2183,7 +2220,8 @@ void deinit_kmem_cache(void)
2183} 2220}
2184 2221
2185struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, 2222struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq,
2186 u64 irqflags, struct device *dev, const char *busname) 2223 u64 irqflags, struct device *dev, const char *busname,
2224 unsigned int devflags)
2187{ 2225{
2188 struct usb_hcd *hcd; 2226 struct usb_hcd *hcd;
2189 struct isp1760_hcd *priv; 2227 struct isp1760_hcd *priv;
@@ -2195,11 +2233,12 @@ struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq,
2195 /* prevent usb-core allocating DMA pages */ 2233 /* prevent usb-core allocating DMA pages */
2196 dev->dma_mask = NULL; 2234 dev->dma_mask = NULL;
2197 2235
2198 hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev->bus_id); 2236 hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev));
2199 if (!hcd) 2237 if (!hcd)
2200 return ERR_PTR(-ENOMEM); 2238 return ERR_PTR(-ENOMEM);
2201 2239
2202 priv = hcd_to_priv(hcd); 2240 priv = hcd_to_priv(hcd);
2241 priv->devflags = devflags;
2203 init_memory(priv); 2242 init_memory(priv);
2204 hcd->regs = ioremap(res_start, res_len); 2243 hcd->regs = ioremap(res_start, res_len);
2205 if (!hcd->regs) { 2244 if (!hcd->regs) {
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h
index 3d86d0f6b147..6473dd86993c 100644
--- a/drivers/usb/host/isp1760-hcd.h
+++ b/drivers/usb/host/isp1760-hcd.h
@@ -3,7 +3,8 @@
3 3
4/* exports for if */ 4/* exports for if */
5struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, 5struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq,
6 u64 irqflags, struct device *dev, const char *busname); 6 u64 irqflags, struct device *dev, const char *busname,
7 unsigned int devflags);
7int init_kmem_once(void); 8int init_kmem_once(void);
8void deinit_kmem_cache(void); 9void deinit_kmem_cache(void);
9 10
@@ -31,6 +32,7 @@ void deinit_kmem_cache(void);
31/* Configuration Register */ 32/* Configuration Register */
32#define HC_HW_MODE_CTRL 0x300 33#define HC_HW_MODE_CTRL 0x300
33#define ALL_ATX_RESET (1 << 31) 34#define ALL_ATX_RESET (1 << 31)
35#define HW_ANA_DIGI_OC (1 << 15)
34#define HW_DATA_BUS_32BIT (1 << 8) 36#define HW_DATA_BUS_32BIT (1 << 8)
35#define HW_DACK_POL_HIGH (1 << 6) 37#define HW_DACK_POL_HIGH (1 << 6)
36#define HW_DREQ_POL_HIGH (1 << 5) 38#define HW_DREQ_POL_HIGH (1 << 5)
@@ -56,13 +58,14 @@ void deinit_kmem_cache(void);
56#define PORT1_POWER (3 << 3) 58#define PORT1_POWER (3 << 3)
57#define PORT1_INIT1 (1 << 7) 59#define PORT1_INIT1 (1 << 7)
58#define PORT1_INIT2 (1 << 23) 60#define PORT1_INIT2 (1 << 23)
61#define HW_OTG_CTRL_SET 0x374
62#define HW_OTG_CTRL_CLR 0x376
59 63
60/* Interrupt Register */ 64/* Interrupt Register */
61#define HC_INTERRUPT_REG 0x310 65#define HC_INTERRUPT_REG 0x310
62 66
63#define HC_INTERRUPT_ENABLE 0x314 67#define HC_INTERRUPT_ENABLE 0x314
64#define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT | HC_EOT_INT) 68#define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT | HC_EOT_INT)
65#define FINAL_HW_CONFIG (HW_GLOBAL_INTR_EN | HW_DATA_BUS_32BIT)
66 69
67#define HC_ISO_INT (1 << 9) 70#define HC_ISO_INT (1 << 9)
68#define HC_ATL_INT (1 << 8) 71#define HC_ATL_INT (1 << 8)
@@ -122,6 +125,19 @@ typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh,
122#define isp1760_err(priv, fmt, args...) \ 125#define isp1760_err(priv, fmt, args...) \
123 dev_err(priv_to_hcd(priv)->self.controller, fmt, ##args) 126 dev_err(priv_to_hcd(priv)->self.controller, fmt, ##args)
124 127
128/*
129 * Device flags that can vary from board to board. All of these
130 * indicate the most "atypical" case, so that a devflags of 0 is
131 * a sane default configuration.
132 */
133#define ISP1760_FLAG_PORT1_DIS 0x00000001 /* Port 1 disabled */
134#define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */
135#define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */
136#define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */
137#define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */
138#define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */
139#define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */
140
125/* chip memory management */ 141/* chip memory management */
126struct memory_chunk { 142struct memory_chunk {
127 unsigned int start; 143 unsigned int start;
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index c9db3fe98726..051ef7b6bdc6 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -35,13 +35,15 @@ static int of_isp1760_probe(struct of_device *dev,
35 int virq; 35 int virq;
36 u64 res_len; 36 u64 res_len;
37 int ret; 37 int ret;
38 const unsigned int *prop;
39 unsigned int devflags = 0;
38 40
39 ret = of_address_to_resource(dp, 0, &memory); 41 ret = of_address_to_resource(dp, 0, &memory);
40 if (ret) 42 if (ret)
41 return -ENXIO; 43 return -ENXIO;
42 44
43 res = request_mem_region(memory.start, memory.end - memory.start + 1, 45 res = request_mem_region(memory.start, memory.end - memory.start + 1,
44 dev->dev.bus_id); 46 dev_name(&dev->dev));
45 if (!res) 47 if (!res)
46 return -EBUSY; 48 return -EBUSY;
47 49
@@ -55,8 +57,32 @@ static int of_isp1760_probe(struct of_device *dev,
55 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 57 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
56 oirq.size); 58 oirq.size);
57 59
60 if (of_device_is_compatible(dp, "nxp,usb-isp1761"))
61 devflags |= ISP1760_FLAG_ISP1761;
62
63 if (of_get_property(dp, "port1-disable", NULL) != NULL)
64 devflags |= ISP1760_FLAG_PORT1_DIS;
65
66 /* Some systems wire up only 16 of the 32 data lines */
67 prop = of_get_property(dp, "bus-width", NULL);
68 if (prop && *prop == 16)
69 devflags |= ISP1760_FLAG_BUS_WIDTH_16;
70
71 if (of_get_property(dp, "port1-otg", NULL) != NULL)
72 devflags |= ISP1760_FLAG_OTG_EN;
73
74 if (of_get_property(dp, "analog-oc", NULL) != NULL)
75 devflags |= ISP1760_FLAG_ANALOG_OC;
76
77 if (of_get_property(dp, "dack-polarity", NULL) != NULL)
78 devflags |= ISP1760_FLAG_DACK_POL_HIGH;
79
80 if (of_get_property(dp, "dreq-polarity", NULL) != NULL)
81 devflags |= ISP1760_FLAG_DREQ_POL_HIGH;
82
58 hcd = isp1760_register(memory.start, res_len, virq, 83 hcd = isp1760_register(memory.start, res_len, virq,
59 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev->dev.bus_id); 84 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev),
85 devflags);
60 if (IS_ERR(hcd)) { 86 if (IS_ERR(hcd)) {
61 ret = PTR_ERR(hcd); 87 ret = PTR_ERR(hcd);
62 goto release_reg; 88 goto release_reg;
@@ -87,6 +113,9 @@ static struct of_device_id of_isp1760_match[] = {
87 { 113 {
88 .compatible = "nxp,usb-isp1760", 114 .compatible = "nxp,usb-isp1760",
89 }, 115 },
116 {
117 .compatible = "nxp,usb-isp1761",
118 },
90 { }, 119 { },
91}; 120};
92MODULE_DEVICE_TABLE(of, of_isp1760_match); 121MODULE_DEVICE_TABLE(of, of_isp1760_match);
@@ -116,6 +145,7 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
116 int length; 145 int length;
117 int status = 1; 146 int status = 1;
118 struct usb_hcd *hcd; 147 struct usb_hcd *hcd;
148 unsigned int devflags = 0;
119 149
120 if (usb_disabled()) 150 if (usb_disabled())
121 return -ENODEV; 151 return -ENODEV;
@@ -200,7 +230,8 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
200 230
201 dev->dev.dma_mask = NULL; 231 dev->dev.dma_mask = NULL;
202 hcd = isp1760_register(pci_mem_phy0, length, dev->irq, 232 hcd = isp1760_register(pci_mem_phy0, length, dev->irq,
203 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev->dev.bus_id); 233 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev),
234 devflags);
204 pci_set_drvdata(dev, hcd); 235 pci_set_drvdata(dev, hcd);
205 if (!hcd) 236 if (!hcd)
206 return 0; 237 return 0;
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index e534f9de0f05..a5d8e550d897 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -91,7 +91,7 @@ static void at91_stop_hc(struct platform_device *pdev)
91 91
92/*-------------------------------------------------------------------------*/ 92/*-------------------------------------------------------------------------*/
93 93
94static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); 94static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
95 95
96/* configure so an HC device and id are always provided */ 96/* configure so an HC device and id are always provided */
97/* always called with process context; sleeping is OK */ 97/* always called with process context; sleeping is OK */
@@ -184,13 +184,14 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
184 * context, "rmmod" or something similar. 184 * context, "rmmod" or something similar.
185 * 185 *
186 */ 186 */
187static int usb_hcd_at91_remove(struct usb_hcd *hcd, 187static void usb_hcd_at91_remove(struct usb_hcd *hcd,
188 struct platform_device *pdev) 188 struct platform_device *pdev)
189{ 189{
190 usb_remove_hcd(hcd); 190 usb_remove_hcd(hcd);
191 at91_stop_hc(pdev); 191 at91_stop_hc(pdev);
192 iounmap(hcd->regs); 192 iounmap(hcd->regs);
193 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 193 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
194 usb_put_hcd(hcd);
194 195
195 if (cpu_is_at91sam9261()) 196 if (cpu_is_at91sam9261())
196 clk_put(hclk); 197 clk_put(hclk);
@@ -199,7 +200,6 @@ static int usb_hcd_at91_remove(struct usb_hcd *hcd,
199 fclk = iclk = hclk = NULL; 200 fclk = iclk = hclk = NULL;
200 201
201 dev_set_drvdata(&pdev->dev, NULL); 202 dev_set_drvdata(&pdev->dev, NULL);
202 return 0;
203} 203}
204 204
205/*-------------------------------------------------------------------------*/ 205/*-------------------------------------------------------------------------*/
@@ -309,7 +309,8 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
309 } 309 }
310 310
311 device_init_wakeup(&pdev->dev, 0); 311 device_init_wakeup(&pdev->dev, 0);
312 return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); 312 usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev);
313 return 0;
313} 314}
314 315
315#ifdef CONFIG_PM 316#ifdef CONFIG_PM
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 68c17f5ea8ea..c0948008fe3d 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -34,7 +34,8 @@
34#ifdef __LITTLE_ENDIAN 34#ifdef __LITTLE_ENDIAN
35#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) 35#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C)
36#elif __BIG_ENDIAN 36#elif __BIG_ENDIAN
37#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | USBH_ENABLE_BE) 37#define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \
38 USBH_ENABLE_BE)
38#else 39#else
39#error not byte order defined 40#error not byte order defined
40#endif 41#endif
@@ -46,213 +47,87 @@
46#define USB_MCFG_RDCOMB (1<<30) 47#define USB_MCFG_RDCOMB (1<<30)
47#define USB_MCFG_SSDEN (1<<23) 48#define USB_MCFG_SSDEN (1<<23)
48#define USB_MCFG_OHCCLKEN (1<<16) 49#define USB_MCFG_OHCCLKEN (1<<16)
50#ifdef CONFIG_DMA_COHERENT
49#define USB_MCFG_UCAM (1<<7) 51#define USB_MCFG_UCAM (1<<7)
52#else
53#define USB_MCFG_UCAM (0)
54#endif
50#define USB_MCFG_OBMEN (1<<1) 55#define USB_MCFG_OBMEN (1<<1)
51#define USB_MCFG_OMEMEN (1<<0) 56#define USB_MCFG_OMEMEN (1<<0)
52 57
53#define USBH_ENABLE_CE USB_MCFG_OHCCLKEN 58#define USBH_ENABLE_CE USB_MCFG_OHCCLKEN
54#ifdef CONFIG_DMA_COHERENT 59
55#define USBH_ENABLE_INIT (USB_MCFG_OHCCLKEN \ 60#define USBH_ENABLE_INIT (USB_MCFG_PFEN | USB_MCFG_RDCOMB | \
56 | USB_MCFG_PFEN | USB_MCFG_RDCOMB \ 61 USBH_ENABLE_CE | USB_MCFG_SSDEN | \
57 | USB_MCFG_SSDEN | USB_MCFG_UCAM \ 62 USB_MCFG_UCAM | \
58 | USB_MCFG_OBMEN | USB_MCFG_OMEMEN) 63 USB_MCFG_OBMEN | USB_MCFG_OMEMEN)
59#else 64
60#define USBH_ENABLE_INIT (USB_MCFG_OHCCLKEN \
61 | USB_MCFG_PFEN | USB_MCFG_RDCOMB \
62 | USB_MCFG_SSDEN \
63 | USB_MCFG_OBMEN | USB_MCFG_OMEMEN)
64#endif
65#define USBH_DISABLE (USB_MCFG_OBMEN | USB_MCFG_OMEMEN) 65#define USBH_DISABLE (USB_MCFG_OBMEN | USB_MCFG_OMEMEN)
66 66
67#endif /* Au1200 */ 67#endif /* Au1200 */
68 68
69extern int usb_disabled(void); 69extern int usb_disabled(void);
70 70
71/*-------------------------------------------------------------------------*/ 71static void au1xxx_start_ohc(void)
72
73static void au1xxx_start_ohc(struct platform_device *dev)
74{ 72{
75 printk(KERN_DEBUG __FILE__
76 ": starting Au1xxx OHCI USB Controller\n");
77
78 /* enable host controller */ 73 /* enable host controller */
79
80#ifndef CONFIG_SOC_AU1200 74#ifndef CONFIG_SOC_AU1200
81
82 au_writel(USBH_ENABLE_CE, USB_HOST_CONFIG); 75 au_writel(USBH_ENABLE_CE, USB_HOST_CONFIG);
76 au_sync();
83 udelay(1000); 77 udelay(1000);
84 au_writel(USBH_ENABLE_INIT, USB_HOST_CONFIG);
85 udelay(1000);
86
87#else /* Au1200 */
88 78
89 /* write HW defaults again in case Yamon cleared them */ 79 au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_INIT, USB_HOST_CONFIG);
90 if (au_readl(USB_HOST_CONFIG) == 0) { 80 au_sync();
91 au_writel(0x00d02000, USB_HOST_CONFIG);
92 au_readl(USB_HOST_CONFIG);
93 udelay(1000);
94 }
95 au_writel(USBH_ENABLE_CE | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG);
96 au_readl(USB_HOST_CONFIG);
97 udelay(1000); 81 udelay(1000);
98 au_writel(USBH_ENABLE_INIT | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG);
99 au_readl(USB_HOST_CONFIG);
100 udelay(1000);
101
102#endif /* Au1200 */
103 82
104#ifndef CONFIG_SOC_AU1200
105 /* wait for reset complete (read register twice; see au1500 errata) */ 83 /* wait for reset complete (read register twice; see au1500 errata) */
106 while (au_readl(USB_HOST_CONFIG), 84 while (au_readl(USB_HOST_CONFIG),
107 !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) 85 !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD))
108#endif
109 udelay(1000); 86 udelay(1000);
110 87
111 printk(KERN_DEBUG __FILE__
112 ": Clock to USB host has been enabled \n");
113}
114
115static void au1xxx_stop_ohc(struct platform_device *dev)
116{
117 printk(KERN_DEBUG __FILE__
118 ": stopping Au1xxx OHCI USB Controller\n");
119
120#ifndef CONFIG_SOC_AU1200
121
122 /* Disable clock */
123 au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG);
124
125#else /* Au1200 */ 88#else /* Au1200 */
126 89 au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_CE, USB_HOST_CONFIG);
127 /* Disable mem */ 90 au_sync();
128 au_writel(~USBH_DISABLE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG);
129 udelay(1000); 91 udelay(1000);
130 /* Disable clock */ 92
131 au_writel(~USBH_ENABLE_CE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG); 93 au_writel(au_readl(USB_HOST_CONFIG) | USBH_ENABLE_INIT, USB_HOST_CONFIG);
132 au_readl(USB_HOST_CONFIG); 94 au_sync();
95 udelay(2000);
133#endif /* Au1200 */ 96#endif /* Au1200 */
134} 97}
135 98
136 99static void au1xxx_stop_ohc(void)
137/*-------------------------------------------------------------------------*/
138
139/* configure so an HC device and id are always provided */
140/* always called with process context; sleeping is OK */
141
142
143/**
144 * usb_ohci_au1xxx_probe - initialize Au1xxx-based HCDs
145 * Context: !in_interrupt()
146 *
147 * Allocates basic resources for this USB host controller, and
148 * then invokes the start() method for the HCD associated with it
149 * through the hotplug entry's driver_data.
150 *
151 */
152static int usb_ohci_au1xxx_probe(const struct hc_driver *driver,
153 struct platform_device *dev)
154{ 100{
155 int retval; 101#ifdef CONFIG_SOC_AU1200
156 struct usb_hcd *hcd; 102 /* Disable mem */
157 103 au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_DISABLE, USB_HOST_CONFIG);
158#if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) 104 au_sync();
159 /* Au1200 AB USB does not support coherent memory */ 105 udelay(1000);
160 if (!(read_c0_prid() & 0xff)) {
161 pr_info("%s: this is chip revision AB !!\n",
162 dev->name);
163 pr_info("%s: update your board or re-configure the kernel\n",
164 dev->name);
165 return -ENODEV;
166 }
167#endif 106#endif
168 107 /* Disable clock */
169 if (dev->resource[1].flags != IORESOURCE_IRQ) { 108 au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG);
170 pr_debug("resource[1] is not IORESOURCE_IRQ\n"); 109 au_sync();
171 return -ENOMEM;
172 }
173
174 hcd = usb_create_hcd(driver, &dev->dev, "au1xxx");
175 if (!hcd)
176 return -ENOMEM;
177 hcd->rsrc_start = dev->resource[0].start;
178 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
179
180 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
181 pr_debug("request_mem_region failed\n");
182 retval = -EBUSY;
183 goto err1;
184 }
185
186 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
187 if (!hcd->regs) {
188 pr_debug("ioremap failed\n");
189 retval = -ENOMEM;
190 goto err2;
191 }
192
193 au1xxx_start_ohc(dev);
194 ohci_hcd_init(hcd_to_ohci(hcd));
195
196 retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED);
197 if (retval == 0)
198 return retval;
199
200 au1xxx_stop_ohc(dev);
201 iounmap(hcd->regs);
202 err2:
203 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
204 err1:
205 usb_put_hcd(hcd);
206 return retval;
207}
208
209
210/* may be called without controller electrically present */
211/* may be called with controller, bus, and devices active */
212
213/**
214 * usb_hcd_au1xxx_remove - shutdown processing for Au1xxx-based HCDs
215 * @dev: USB Host Controller being removed
216 * Context: !in_interrupt()
217 *
218 * Reverses the effect of usb_hcd_au1xxx_probe(), first invoking
219 * the HCD's stop() method. It is always called from a thread
220 * context, normally "rmmod", "apmd", or something similar.
221 *
222 */
223static void usb_ohci_au1xxx_remove(struct usb_hcd *hcd, struct platform_device *dev)
224{
225 usb_remove_hcd(hcd);
226 au1xxx_stop_ohc(dev);
227 iounmap(hcd->regs);
228 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
229 usb_put_hcd(hcd);
230} 110}
231 111
232/*-------------------------------------------------------------------------*/ 112static int __devinit ohci_au1xxx_start(struct usb_hcd *hcd)
233
234static int __devinit
235ohci_au1xxx_start (struct usb_hcd *hcd)
236{ 113{
237 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 114 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
238 int ret; 115 int ret;
239 116
240 ohci_dbg (ohci, "ohci_au1xxx_start, ohci:%p", ohci); 117 ohci_dbg(ohci, "ohci_au1xxx_start, ohci:%p", ohci);
241 118
242 if ((ret = ohci_init (ohci)) < 0) 119 if ((ret = ohci_init(ohci)) < 0)
243 return ret; 120 return ret;
244 121
245 if ((ret = ohci_run (ohci)) < 0) { 122 if ((ret = ohci_run(ohci)) < 0) {
246 err ("can't start %s", hcd->self.bus_name); 123 err ("can't start %s", hcd->self.bus_name);
247 ohci_stop (hcd); 124 ohci_stop(hcd);
248 return ret; 125 return ret;
249 } 126 }
250 127
251 return 0; 128 return 0;
252} 129}
253 130
254/*-------------------------------------------------------------------------*/
255
256static const struct hc_driver ohci_au1xxx_hc_driver = { 131static const struct hc_driver ohci_au1xxx_hc_driver = {
257 .description = hcd_name, 132 .description = hcd_name,
258 .product_desc = "Au1xxx OHCI", 133 .product_desc = "Au1xxx OHCI",
@@ -296,18 +171,66 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
296 .start_port_reset = ohci_start_port_reset, 171 .start_port_reset = ohci_start_port_reset,
297}; 172};
298 173
299/*-------------------------------------------------------------------------*/
300
301static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) 174static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
302{ 175{
303 int ret; 176 int ret;
304 177 struct usb_hcd *hcd;
305 pr_debug ("In ohci_hcd_au1xxx_drv_probe");
306 178
307 if (usb_disabled()) 179 if (usb_disabled())
308 return -ENODEV; 180 return -ENODEV;
309 181
310 ret = usb_ohci_au1xxx_probe(&ohci_au1xxx_hc_driver, pdev); 182#if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT)
183 /* Au1200 AB USB does not support coherent memory */
184 if (!(read_c0_prid() & 0xff)) {
185 printk(KERN_INFO "%s: this is chip revision AB !!\n",
186 pdev->name);
187 printk(KERN_INFO "%s: update your board or re-configure "
188 "the kernel\n", pdev->name);
189 return -ENODEV;
190 }
191#endif
192
193 if (pdev->resource[1].flags != IORESOURCE_IRQ) {
194 pr_debug("resource[1] is not IORESOURCE_IRQ\n");
195 return -ENOMEM;
196 }
197
198 hcd = usb_create_hcd(&ohci_au1xxx_hc_driver, &pdev->dev, "au1xxx");
199 if (!hcd)
200 return -ENOMEM;
201
202 hcd->rsrc_start = pdev->resource[0].start;
203 hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
204
205 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
206 pr_debug("request_mem_region failed\n");
207 ret = -EBUSY;
208 goto err1;
209 }
210
211 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
212 if (!hcd->regs) {
213 pr_debug("ioremap failed\n");
214 ret = -ENOMEM;
215 goto err2;
216 }
217
218 au1xxx_start_ohc();
219 ohci_hcd_init(hcd_to_ohci(hcd));
220
221 ret = usb_add_hcd(hcd, pdev->resource[1].start,
222 IRQF_DISABLED | IRQF_SHARED);
223 if (ret == 0) {
224 platform_set_drvdata(pdev, hcd);
225 return ret;
226 }
227
228 au1xxx_stop_ohc();
229 iounmap(hcd->regs);
230err2:
231 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
232err1:
233 usb_put_hcd(hcd);
311 return ret; 234 return ret;
312} 235}
313 236
@@ -315,30 +238,78 @@ static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
315{ 238{
316 struct usb_hcd *hcd = platform_get_drvdata(pdev); 239 struct usb_hcd *hcd = platform_get_drvdata(pdev);
317 240
318 usb_ohci_au1xxx_remove(hcd, pdev); 241 usb_remove_hcd(hcd);
242 au1xxx_stop_ohc();
243 iounmap(hcd->regs);
244 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
245 usb_put_hcd(hcd);
246 platform_set_drvdata(pdev, NULL);
247
319 return 0; 248 return 0;
320} 249}
321 /*TBD*/ 250
322/*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev) 251#ifdef CONFIG_PM
252static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *pdev,
253 pm_message_t message)
323{ 254{
324 struct usb_hcd *hcd = platform_get_drvdata(dev); 255 struct usb_hcd *hcd = platform_get_drvdata(pdev);
256 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
257 unsigned long flags;
258 int rc;
259
260 rc = 0;
261
262 /* Root hub was already suspended. Disable irq emission and
263 * mark HW unaccessible, bail out if RH has been resumed. Use
264 * the spinlock to properly synchronize with possible pending
265 * RH suspend or resume activity.
266 *
267 * This is still racy as hcd->state is manipulated outside of
268 * any locks =P But that will be a different fix.
269 */
270 spin_lock_irqsave(&ohci->lock, flags);
271 if (hcd->state != HC_STATE_SUSPENDED) {
272 rc = -EINVAL;
273 goto bail;
274 }
275 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
276 (void)ohci_readl(ohci, &ohci->regs->intrdisable);
325 277
326 return 0; 278 /* make sure snapshot being resumed re-enumerates everything */
279 if (message.event == PM_EVENT_PRETHAW)
280 ohci_usb_reset(ohci);
281
282 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
283
284 au1xxx_stop_ohc();
285bail:
286 spin_unlock_irqrestore(&ohci->lock, flags);
287
288 return rc;
327} 289}
328static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) 290
291static int ohci_hcd_au1xxx_drv_resume(struct platform_device *pdev)
329{ 292{
330 struct usb_hcd *hcd = platform_get_drvdata(dev); 293 struct usb_hcd *hcd = platform_get_drvdata(pdev);
294
295 au1xxx_start_ohc();
296
297 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
298 ohci_finish_controller_resume(hcd);
331 299
332 return 0; 300 return 0;
333} 301}
334*/ 302#else
303#define ohci_hcd_au1xxx_drv_suspend NULL
304#define ohci_hcd_au1xxx_drv_resume NULL
305#endif
335 306
336static struct platform_driver ohci_hcd_au1xxx_driver = { 307static struct platform_driver ohci_hcd_au1xxx_driver = {
337 .probe = ohci_hcd_au1xxx_drv_probe, 308 .probe = ohci_hcd_au1xxx_drv_probe,
338 .remove = ohci_hcd_au1xxx_drv_remove, 309 .remove = ohci_hcd_au1xxx_drv_remove,
339 .shutdown = usb_hcd_platform_shutdown, 310 .shutdown = usb_hcd_platform_shutdown,
340 /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ 311 .suspend = ohci_hcd_au1xxx_drv_suspend,
341 /*.resume = ohci_hcd_au1xxx_drv_resume, */ 312 .resume = ohci_hcd_au1xxx_drv_resume,
342 .driver = { 313 .driver = {
343 .name = "au1xxx-ohci", 314 .name = "au1xxx-ohci",
344 .owner = THIS_MODULE, 315 .owner = THIS_MODULE,
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index e06bfaebec54..7cef1d2f7ccc 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -651,7 +651,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
651 "%s\n" 651 "%s\n"
652 "%s version " DRIVER_VERSION "\n", 652 "%s version " DRIVER_VERSION "\n",
653 hcd->self.controller->bus->name, 653 hcd->self.controller->bus->name,
654 hcd->self.controller->bus_id, 654 dev_name(hcd->self.controller),
655 hcd->product_desc, 655 hcd->product_desc,
656 hcd_name); 656 hcd_name);
657 657
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index a8160d65f32b..26bc47941d01 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -974,7 +974,7 @@ MODULE_LICENSE ("GPL");
974#define PCI_DRIVER ohci_pci_driver 974#define PCI_DRIVER ohci_pci_driver
975#endif 975#endif
976 976
977#ifdef CONFIG_SA1111 977#if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_SA1111)
978#include "ohci-sa1111.c" 978#include "ohci-sa1111.c"
979#define SA1111_DRIVER ohci_hcd_sa1111_driver 979#define SA1111_DRIVER ohci_hcd_sa1111_driver
980#endif 980#endif
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index a19a4f80a6e1..6e5e5f81ac90 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -329,7 +329,7 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver,
329 } 329 }
330 330
331 331
332 hcd = usb_create_hcd (driver, &pdev->dev, pdev->dev.bus_id); 332 hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev));
333 if (!hcd) { 333 if (!hcd) {
334 retval = -ENOMEM; 334 retval = -ENOMEM;
335 goto err0; 335 goto err0;
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 28b458f20cc3..6ad8f2fc57b9 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -109,8 +109,6 @@ static struct clk *usb_clk;
109 109
110static int isp1301_probe(struct i2c_adapter *adap); 110static int isp1301_probe(struct i2c_adapter *adap);
111static int isp1301_detach(struct i2c_client *client); 111static int isp1301_detach(struct i2c_client *client);
112static int isp1301_command(struct i2c_client *client, unsigned int cmd,
113 void *arg);
114 112
115static const unsigned short normal_i2c[] = 113static const unsigned short normal_i2c[] =
116 { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END }; 114 { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END };
@@ -123,30 +121,37 @@ static struct i2c_client_address_data addr_data = {
123}; 121};
124 122
125struct i2c_driver isp1301_driver = { 123struct i2c_driver isp1301_driver = {
126 .class = I2C_CLASS_HWMON, 124 .driver = {
125 .name = "isp1301_pnx",
126 },
127 .attach_adapter = isp1301_probe, 127 .attach_adapter = isp1301_probe,
128 .detach_client = isp1301_detach, 128 .detach_client = isp1301_detach,
129 .command = isp1301_command
130}; 129};
131 130
132static int isp1301_attach(struct i2c_adapter *adap, int addr, int kind) 131static int isp1301_attach(struct i2c_adapter *adap, int addr, int kind)
133{ 132{
134 struct i2c_client *c; 133 struct i2c_client *c;
134 int err;
135 135
136 c = kzalloc(sizeof(*c), GFP_KERNEL); 136 c = kzalloc(sizeof(*c), GFP_KERNEL);
137
138 if (!c) 137 if (!c)
139 return -ENOMEM; 138 return -ENOMEM;
140 139
141 strcpy(c->name, "isp1301"); 140 strlcpy(c->name, "isp1301_pnx", I2C_NAME_SIZE);
142 c->flags = 0; 141 c->flags = 0;
143 c->addr = addr; 142 c->addr = addr;
144 c->adapter = adap; 143 c->adapter = adap;
145 c->driver = &isp1301_driver; 144 c->driver = &isp1301_driver;
146 145
146 err = i2c_attach_client(c);
147 if (err) {
148 kfree(c);
149 return err;
150 }
151
147 isp1301_i2c_client = c; 152 isp1301_i2c_client = c;
148 153
149 return i2c_attach_client(c); 154 return 0;
150} 155}
151 156
152static int isp1301_probe(struct i2c_adapter *adap) 157static int isp1301_probe(struct i2c_adapter *adap)
@@ -161,13 +166,6 @@ static int isp1301_detach(struct i2c_client *client)
161 return 0; 166 return 0;
162} 167}
163 168
164/* No commands defined */
165static int isp1301_command(struct i2c_client *client, unsigned int cmd,
166 void *arg)
167{
168 return 0;
169}
170
171static void i2c_write(u8 buf, u8 subaddr) 169static void i2c_write(u8 buf, u8 subaddr)
172{ 170{
173 char tmpbuf[2]; 171 char tmpbuf[2];
@@ -389,7 +387,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
389 while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) != 387 while ((__raw_readl(USB_OTG_CLK_STAT) & USB_CLOCK_MASK) !=
390 USB_CLOCK_MASK) ; 388 USB_CLOCK_MASK) ;
391 389
392 hcd = usb_create_hcd (driver, &pdev->dev, pdev->dev.bus_id); 390 hcd = usb_create_hcd (driver, &pdev->dev, dev_name(&pdev->dev));
393 if (!hcd) { 391 if (!hcd) {
394 err("Failed to allocate HC buffer"); 392 err("Failed to allocate HC buffer");
395 ret = -ENOMEM; 393 ret = -ENOMEM;
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index a67252791223..91e6e101a4cc 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -14,8 +14,8 @@
14 */ 14 */
15 15
16#include <linux/signal.h> 16#include <linux/signal.h>
17#include <linux/of_platform.h>
17 18
18#include <asm/of_platform.h>
19#include <asm/prom.h> 19#include <asm/prom.h>
20 20
21 21
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index c1935ae537f8..55c95647f008 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -129,7 +129,7 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev)
129 129
130 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ 130 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
131 131
132 hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev->core.bus_id); 132 hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev_name(&dev->core));
133 133
134 if (!hcd) { 134 if (!hcd) {
135 dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, 135 dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__,
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index 9b547407c934..6a9b4c557953 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -159,9 +159,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
159{ 159{
160 int branch; 160 int branch;
161 161
162 if (ohci_to_hcd(ohci)->state == HC_STATE_QUIESCING)
163 return -EAGAIN;
164
165 ed->state = ED_OPER; 162 ed->state = ED_OPER;
166 ed->ed_prev = NULL; 163 ed->ed_prev = NULL;
167 ed->ed_next = NULL; 164 ed->ed_next = NULL;
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index e610698c6b60..21b164e4abeb 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -143,7 +143,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
143 goto err2; 143 goto err2;
144 } 144 }
145 145
146 hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id); 146 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
147 if (!hcd) { 147 if (!hcd) {
148 retval = -ENOMEM; 148 retval = -ENOMEM;
149 goto err2; 149 goto err2;
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index 7275186db315..3660c83d80af 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -113,7 +113,7 @@ static int ssb_ohci_attach(struct ssb_device *dev)
113 ssb_device_enable(dev, flags); 113 ssb_device_enable(dev, flags);
114 114
115 hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev, 115 hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
116 dev->dev->bus_id); 116 dev_name(dev->dev));
117 if (!hcd) 117 if (!hcd)
118 goto err_dev_disable; 118 goto err_dev_disable;
119 ohcidev = hcd_to_ssb_ohci(hcd); 119 ohcidev = hcd_to_ssb_ohci(hcd);
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 16667342b3c3..d5f02dddb120 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -312,9 +312,9 @@ static void put_child_connect_map(struct r8a66597 *r8a66597, int address)
312static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch) 312static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch)
313{ 313{
314 u16 pipenum = pipe->info.pipenum; 314 u16 pipenum = pipe->info.pipenum;
315 unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO}; 315 const unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO};
316 unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL}; 316 const unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL};
317 unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR}; 317 const unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR};
318 318
319 if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */ 319 if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */
320 dma_ch = R8A66597_PIPE_NO_DMA; 320 dma_ch = R8A66597_PIPE_NO_DMA;
@@ -863,6 +863,32 @@ static void disable_r8a66597_pipe_all(struct r8a66597 *r8a66597,
863 dev->dma_map = 0; 863 dev->dma_map = 0;
864} 864}
865 865
866static u16 get_interval(struct urb *urb, __u8 interval)
867{
868 u16 time = 1;
869 int i;
870
871 if (urb->dev->speed == USB_SPEED_HIGH) {
872 if (interval > IITV)
873 time = IITV;
874 else
875 time = interval ? interval - 1 : 0;
876 } else {
877 if (interval > 128) {
878 time = IITV;
879 } else {
880 /* calculate the nearest value for PIPEPERI */
881 for (i = 0; i < 7; i++) {
882 if ((1 << i) < interval &&
883 (1 << (i + 1) > interval))
884 time = 1 << i;
885 }
886 }
887 }
888
889 return time;
890}
891
866static unsigned long get_timer_interval(struct urb *urb, __u8 interval) 892static unsigned long get_timer_interval(struct urb *urb, __u8 interval)
867{ 893{
868 __u8 i; 894 __u8 i;
@@ -901,10 +927,7 @@ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb,
901 info.interval = 0; 927 info.interval = 0;
902 info.timer_interval = 0; 928 info.timer_interval = 0;
903 } else { 929 } else {
904 if (ep->bInterval > IITV) 930 info.interval = get_interval(urb, ep->bInterval);
905 info.interval = IITV;
906 else
907 info.interval = ep->bInterval ? ep->bInterval - 1 : 0;
908 info.timer_interval = get_timer_interval(urb, ep->bInterval); 931 info.timer_interval = get_timer_interval(urb, ep->bInterval);
909 } 932 }
910 if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) 933 if (ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
@@ -2244,6 +2267,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2244 struct r8a66597 *r8a66597; 2267 struct r8a66597 *r8a66597;
2245 int ret = 0; 2268 int ret = 0;
2246 int i; 2269 int i;
2270 unsigned long irq_trigger;
2247 2271
2248 if (pdev->dev.dma_mask) { 2272 if (pdev->dev.dma_mask) {
2249 ret = -EINVAL; 2273 ret = -EINVAL;
@@ -2302,7 +2326,11 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2302 INIT_LIST_HEAD(&r8a66597->child_device); 2326 INIT_LIST_HEAD(&r8a66597->child_device);
2303 2327
2304 hcd->rsrc_start = res->start; 2328 hcd->rsrc_start = res->start;
2305 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); 2329 if (irq_sense == INTL)
2330 irq_trigger = IRQF_TRIGGER_LOW;
2331 else
2332 irq_trigger = IRQF_TRIGGER_FALLING;
2333 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger);
2306 if (ret != 0) { 2334 if (ret != 0) {
2307 err("Failed to add hcd"); 2335 err("Failed to add hcd");
2308 goto clean_up; 2336 goto clean_up;
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 426575247b23..340d72da554a 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1674,7 +1674,7 @@ sl811h_probe(struct platform_device *dev)
1674 } 1674 }
1675 1675
1676 /* allocate and initialize hcd */ 1676 /* allocate and initialize hcd */
1677 hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id); 1677 hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev_name(&dev->dev));
1678 if (!hcd) { 1678 if (!hcd) {
1679 retval = -ENOMEM; 1679 retval = -ENOMEM;
1680 goto err5; 1680 goto err5;
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 9b6323f768b2..20ad3c48fcb2 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -3124,7 +3124,7 @@ static int __devinit u132_probe(struct platform_device *pdev)
3124 if (pdev->dev.dma_mask) 3124 if (pdev->dev.dma_mask)
3125 return -EINVAL; 3125 return -EINVAL;
3126 3126
3127 hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, pdev->dev.bus_id); 3127 hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, dev_name(&pdev->dev));
3128 if (!hcd) { 3128 if (!hcd) {
3129 printk(KERN_ERR "failed to create the usb hcd struct for U132\n" 3129 printk(KERN_ERR "failed to create the usb hcd struct for U132\n"
3130 ); 3130 );
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index 8e4427aebb14..885b585360b9 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -12,7 +12,7 @@
12 * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu 12 * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu
13 */ 13 */
14 14
15static __u8 root_hub_hub_des[] = 15static const __u8 root_hub_hub_des[] =
16{ 16{
17 0x09, /* __u8 bLength; */ 17 0x09, /* __u8 bLength; */
18 0x29, /* __u8 bDescriptorType; Hub-descriptor */ 18 0x29, /* __u8 bDescriptorType; Hub-descriptor */