aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-04-22 07:34:25 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-22 07:34:25 -0400
commitf838bad1b3be8ca0c785ee0e0c570dfda74cf377 (patch)
tree5a842a8056a708cfad55a20fa8ab733dd94b0903 /drivers/usb
parentdd919660aacdf4adfcd279556aa03e595f7f0fc2 (diff)
parent807501475fce0ebe68baedf87f202c3e4ee0d12c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/atm/usbatm.h1
-rw-r--r--drivers/usb/class/cdc-acm.c10
-rw-r--r--drivers/usb/class/usblp.c1
-rw-r--r--drivers/usb/core/Kconfig9
-rw-r--r--drivers/usb/core/hub.c1
-rw-r--r--drivers/usb/core/message.c5
-rw-r--r--drivers/usb/core/quirks.c28
-rw-r--r--drivers/usb/core/usb.c8
-rw-r--r--drivers/usb/gadget/Kconfig6
-rw-r--r--drivers/usb/gadget/at91_udc.c1
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c158
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.h9
-rw-r--r--drivers/usb/gadget/ether.c1
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c1
-rw-r--r--drivers/usb/gadget/inode.c4
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c1
-rw-r--r--drivers/usb/gadget/m66592-udc.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c2
-rw-r--r--drivers/usb/gadget/printer.c3
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c90
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.h4
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c2
-rw-r--r--drivers/usb/host/Kconfig5
-rw-r--r--drivers/usb/host/ehci-hcd.c90
-rw-r--r--drivers/usb/host/ehci-hub.c5
-rw-r--r--drivers/usb/host/ehci-orion.c37
-rw-r--r--drivers/usb/host/ehci-pci.c14
-rw-r--r--drivers/usb/host/ehci-q.c2
-rw-r--r--drivers/usb/host/isp116x-hcd.c23
-rw-r--r--drivers/usb/host/isp116x.h1
-rw-r--r--drivers/usb/host/ohci-at91.c3
-rw-r--r--drivers/usb/host/ohci-au1xxx.c1
-rw-r--r--drivers/usb/host/ohci-ep93xx.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-lh7a404.c1
-rw-r--r--drivers/usb/host/ohci-omap.c1
-rw-r--r--drivers/usb/host/ohci-pnx4008.c4
-rw-r--r--drivers/usb/host/ohci-pnx8550.c5
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c1
-rw-r--r--drivers/usb/host/ohci-pxa27x.c3
-rw-r--r--drivers/usb/host/ohci-q.c2
-rw-r--r--drivers/usb/host/ohci-s3c2410.c1
-rw-r--r--drivers/usb/host/ohci-sh.c1
-rw-r--r--drivers/usb/host/ohci-sm501.c1
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/host/u132-hcd.c16
-rw-r--r--drivers/usb/misc/appledisplay.c1
-rw-r--r--drivers/usb/misc/ldusb.c2
-rw-r--r--drivers/usb/misc/trancevibrator.c4
-rw-r--r--drivers/usb/misc/usbtest.c3
-rw-r--r--drivers/usb/serial/cp2101.c1
-rw-r--r--drivers/usb/serial/cypress_m8.c2
-rw-r--r--drivers/usb/serial/cypress_m8.h4
-rw-r--r--drivers/usb/serial/ftdi_sio.c30
-rw-r--r--drivers/usb/serial/ftdi_sio.h10
-rw-r--r--drivers/usb/serial/generic.c10
-rw-r--r--drivers/usb/serial/io_ti.c1
-rw-r--r--drivers/usb/serial/keyspan.h4
-rw-r--r--drivers/usb/serial/mos7840.c15
-rw-r--r--drivers/usb/serial/option.c176
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h1
-rw-r--r--drivers/usb/serial/sierra.c19
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c5
-rw-r--r--drivers/usb/serial/usb-serial.c2
-rw-r--r--drivers/usb/serial/visor.c2
-rw-r--r--drivers/usb/storage/isd200.c6
-rw-r--r--drivers/usb/storage/protocol.c27
-rw-r--r--drivers/usb/storage/sddr55.c4
-rw-r--r--drivers/usb/storage/transport.c14
-rw-r--r--drivers/usb/storage/unusual_devs.h141
72 files changed, 772 insertions, 285 deletions
diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h
index ff8551e93372..fc6c2be5999c 100644
--- a/drivers/usb/atm/usbatm.h
+++ b/drivers/usb/atm/usbatm.h
@@ -24,7 +24,6 @@
24#ifndef _USBATM_H_ 24#ifndef _USBATM_H_
25#define _USBATM_H_ 25#define _USBATM_H_
26 26
27#include <asm/semaphore.h>
28#include <linux/atm.h> 27#include <linux/atm.h>
29#include <linux/atmdev.h> 28#include <linux/atmdev.h>
30#include <linux/completion.h> 29#include <linux/completion.h>
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index bcc42136c93f..0147ea39340e 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -496,13 +496,10 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
496 otherwise it is scheduled, and with high data rates data can get lost. */ 496 otherwise it is scheduled, and with high data rates data can get lost. */
497 tty->low_latency = 1; 497 tty->low_latency = 1;
498 498
499 if (usb_autopm_get_interface(acm->control)) { 499 if (usb_autopm_get_interface(acm->control) < 0)
500 mutex_unlock(&open_mutex); 500 goto early_bail;
501 return -EIO;
502 }
503 501
504 mutex_lock(&acm->mutex); 502 mutex_lock(&acm->mutex);
505 mutex_unlock(&open_mutex);
506 if (acm->used++) { 503 if (acm->used++) {
507 usb_autopm_put_interface(acm->control); 504 usb_autopm_put_interface(acm->control);
508 goto done; 505 goto done;
@@ -536,6 +533,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
536done: 533done:
537err_out: 534err_out:
538 mutex_unlock(&acm->mutex); 535 mutex_unlock(&acm->mutex);
536 mutex_unlock(&open_mutex);
539 return rv; 537 return rv;
540 538
541full_bailout: 539full_bailout:
@@ -544,6 +542,8 @@ bail_out:
544 usb_autopm_put_interface(acm->control); 542 usb_autopm_put_interface(acm->control);
545 acm->used--; 543 acm->used--;
546 mutex_unlock(&acm->mutex); 544 mutex_unlock(&acm->mutex);
545early_bail:
546 mutex_unlock(&open_mutex);
547 return -EIO; 547 return -EIO;
548} 548}
549 549
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index ad632f2d6f94..0647164d36db 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -428,6 +428,7 @@ static int usblp_open(struct inode *inode, struct file *file)
428 usblp->rcomplete = 0; 428 usblp->rcomplete = 0;
429 429
430 if (handle_bidir(usblp) < 0) { 430 if (handle_bidir(usblp) < 0) {
431 usb_autopm_put_interface(intf);
431 usblp->used = 0; 432 usblp->used = 0;
432 file->private_data = NULL; 433 file->private_data = NULL;
433 retval = -EIO; 434 retval = -EIO;
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 5c33cdb9cac7..a2b0aa48b8ea 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -87,12 +87,13 @@ config USB_DYNAMIC_MINORS
87 If you are unsure about this, say N here. 87 If you are unsure about this, say N here.
88 88
89config USB_SUSPEND 89config USB_SUSPEND
90 bool "USB selective suspend/resume and wakeup (EXPERIMENTAL)" 90 bool "USB selective suspend/resume and wakeup"
91 depends on USB && PM && EXPERIMENTAL 91 depends on USB && PM
92 help 92 help
93 If you say Y here, you can use driver calls or the sysfs 93 If you say Y here, you can use driver calls or the sysfs
94 "power/state" file to suspend or resume individual USB 94 "power/level" file to suspend or resume individual USB
95 peripherals. 95 peripherals and to enable or disable autosuspend (see
96 Documentation/usb/power-management.txt for more details).
96 97
97 Also, USB "remote wakeup" signaling is supported, whereby some 98 Also, USB "remote wakeup" signaling is supported, whereby some
98 USB devices (like keyboards and network adapters) can wake up 99 USB devices (like keyboards and network adapters) can wake up
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 68fc5219ca15..57aeca160f38 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -23,7 +23,6 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/freezer.h> 24#include <linux/freezer.h>
25 25
26#include <asm/semaphore.h>
27#include <asm/uaccess.h> 26#include <asm/uaccess.h>
28#include <asm/byteorder.h> 27#include <asm/byteorder.h>
29 28
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index fefb92296e8f..c311f67b7f08 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1206,7 +1206,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1206 return -EINVAL; 1206 return -EINVAL;
1207 } 1207 }
1208 1208
1209 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 1209 if (dev->quirks & USB_QUIRK_NO_SET_INTF)
1210 ret = -EPIPE;
1211 else
1212 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1210 USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, 1213 USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
1211 alternate, interface, NULL, 0, 5000); 1214 alternate, interface, NULL, 0, 5000);
1212 1215
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d42c561c75f1..dfc5418ea10c 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,21 +30,39 @@
30static const struct usb_device_id usb_quirk_list[] = { 30static const struct usb_device_id usb_quirk_list[] = {
31 /* CBM - Flash disk */ 31 /* CBM - Flash disk */
32 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, 32 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
33
33 /* HP 5300/5370C scanner */ 34 /* HP 5300/5370C scanner */
34 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, 35 { USB_DEVICE(0x03f0, 0x0701), .driver_info =
36 USB_QUIRK_STRING_FETCH_255 },
35 37
36 /* INTEL VALUE SSD */ 38 /* Creative SB Audigy 2 NX */
37 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, 39 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
40
41 /* Philips PSC805 audio device */
42 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
43
44 /* Roland SC-8820 */
45 { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },
46
47 /* Edirol SD-20 */
48 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
38 49
39 /* M-Systems Flash Disk Pioneers */ 50 /* M-Systems Flash Disk Pioneers */
40 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, 51 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
41 52
42 /* Philips PSC805 audio device */ 53 /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
43 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 54 { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
55
56 /* Action Semiconductor flash disk */
57 { USB_DEVICE(0x10d6, 0x2200), .driver_info =
58 USB_QUIRK_STRING_FETCH_255 },
44 59
45 /* SKYMEDI USB_DRIVE */ 60 /* SKYMEDI USB_DRIVE */
46 { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME }, 61 { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME },
47 62
63 /* INTEL VALUE SSD */
64 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
65
48 { } /* terminating entry must be last */ 66 { } /* terminating entry must be last */
49}; 67};
50 68
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4e984060c984..1f0db51190cc 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -99,8 +99,7 @@ struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
99EXPORT_SYMBOL_GPL(usb_ifnum_to_if); 99EXPORT_SYMBOL_GPL(usb_ifnum_to_if);
100 100
101/** 101/**
102 * usb_altnum_to_altsetting - get the altsetting structure with a given 102 * usb_altnum_to_altsetting - get the altsetting structure with a given alternate setting number.
103 * alternate setting number.
104 * @intf: the interface containing the altsetting in question 103 * @intf: the interface containing the altsetting in question
105 * @altnum: the desired alternate setting number 104 * @altnum: the desired alternate setting number
106 * 105 *
@@ -234,7 +233,7 @@ static int ksuspend_usb_init(void)
234 * singlethreaded. Its job doesn't justify running on more 233 * singlethreaded. Its job doesn't justify running on more
235 * than one CPU. 234 * than one CPU.
236 */ 235 */
237 ksuspend_usb_wq = create_singlethread_workqueue("ksuspend_usbd"); 236 ksuspend_usb_wq = create_freezeable_workqueue("ksuspend_usbd");
238 if (!ksuspend_usb_wq) 237 if (!ksuspend_usb_wq)
239 return -ENOMEM; 238 return -ENOMEM;
240 return 0; 239 return 0;
@@ -442,8 +441,7 @@ EXPORT_SYMBOL_GPL(usb_put_intf);
442 */ 441 */
443 442
444/** 443/**
445 * usb_lock_device_for_reset - cautiously acquire the lock for a 444 * usb_lock_device_for_reset - cautiously acquire the lock for a usb device structure
446 * usb device structure
447 * @udev: device that's being locked 445 * @udev: device that's being locked
448 * @iface: interface bound to the driver making the request (optional) 446 * @iface: interface bound to the driver making the request (optional)
449 * 447 *
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index c13955164686..d681bb27fa58 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -118,10 +118,10 @@ config USB_AMD5536UDC
118config USB_GADGET_ATMEL_USBA 118config USB_GADGET_ATMEL_USBA
119 boolean "Atmel USBA" 119 boolean "Atmel USBA"
120 select USB_GADGET_DUALSPEED 120 select USB_GADGET_DUALSPEED
121 depends on AVR32 121 depends on AVR32 || ARCH_AT91CAP9
122 help 122 help
123 USBA is the integrated high-speed USB Device controller on 123 USBA is the integrated high-speed USB Device controller on
124 the AT32AP700x processors from Atmel. 124 the AT32AP700x and AT91CAP9 processors from Atmel.
125 125
126config USB_ATMEL_USBA 126config USB_ATMEL_USBA
127 tristate 127 tristate
@@ -131,7 +131,7 @@ config USB_ATMEL_USBA
131 131
132config USB_GADGET_FSL_USB2 132config USB_GADGET_FSL_USB2
133 boolean "Freescale Highspeed USB DR Peripheral Controller" 133 boolean "Freescale Highspeed USB DR Peripheral Controller"
134 depends on MPC834x || PPC_MPC831x 134 depends on FSL_SOC
135 select USB_GADGET_DUALSPEED 135 select USB_GADGET_DUALSPEED
136 help 136 help
137 Some of Freescale PowerPC processors have a High Speed 137 Some of Freescale PowerPC processors have a High Speed
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index a83e8b798ec9..fd15ced899d8 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1884,3 +1884,4 @@ module_exit(udc_exit_module);
1884MODULE_DESCRIPTION("AT91 udc driver"); 1884MODULE_DESCRIPTION("AT91 udc driver");
1885MODULE_AUTHOR("Thomas Rathbone, David Brownell"); 1885MODULE_AUTHOR("Thomas Rathbone, David Brownell");
1886MODULE_LICENSE("GPL"); 1886MODULE_LICENSE("GPL");
1887MODULE_ALIAS("platform:at91_udc");
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index af8b2a3a2d4a..e756023362c2 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -18,6 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/usb/ch9.h> 19#include <linux/usb/ch9.h>
20#include <linux/usb/gadget.h> 20#include <linux/usb/gadget.h>
21#include <linux/usb/atmel_usba_udc.h>
21#include <linux/delay.h> 22#include <linux/delay.h>
22 23
23#include <asm/gpio.h> 24#include <asm/gpio.h>
@@ -27,6 +28,7 @@
27 28
28 29
29static struct usba_udc the_udc; 30static struct usba_udc the_udc;
31static struct usba_ep *usba_ep;
30 32
31#ifdef CONFIG_USB_GADGET_DEBUG_FS 33#ifdef CONFIG_USB_GADGET_DEBUG_FS
32#include <linux/debugfs.h> 34#include <linux/debugfs.h>
@@ -324,53 +326,28 @@ static int vbus_is_present(struct usba_udc *udc)
324 return 1; 326 return 1;
325} 327}
326 328
327static void copy_to_fifo(void __iomem *fifo, const void *buf, int len) 329#if defined(CONFIG_AVR32)
330
331static void toggle_bias(int is_on)
328{ 332{
329 unsigned long tmp;
330
331 DBG(DBG_FIFO, "copy to FIFO (len %d):\n", len);
332 for (; len > 0; len -= 4, buf += 4, fifo += 4) {
333 tmp = *(unsigned long *)buf;
334 if (len >= 4) {
335 DBG(DBG_FIFO, " -> %08lx\n", tmp);
336 __raw_writel(tmp, fifo);
337 } else {
338 do {
339 DBG(DBG_FIFO, " -> %02lx\n", tmp >> 24);
340 __raw_writeb(tmp >> 24, fifo);
341 fifo++;
342 tmp <<= 8;
343 } while (--len);
344 break;
345 }
346 }
347} 333}
348 334
349static void copy_from_fifo(void *buf, void __iomem *fifo, int len) 335#elif defined(CONFIG_ARCH_AT91)
336
337#include <asm/arch/at91_pmc.h>
338
339static void toggle_bias(int is_on)
350{ 340{
351 union { 341 unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR);
352 unsigned long *w; 342
353 unsigned char *b; 343 if (is_on)
354 } p; 344 at91_sys_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
355 unsigned long tmp; 345 else
356 346 at91_sys_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN));
357 DBG(DBG_FIFO, "copy from FIFO (len %d):\n", len);
358 for (p.w = buf; len > 0; len -= 4, p.w++, fifo += 4) {
359 if (len >= 4) {
360 tmp = __raw_readl(fifo);
361 *p.w = tmp;
362 DBG(DBG_FIFO, " -> %08lx\n", tmp);
363 } else {
364 do {
365 tmp = __raw_readb(fifo);
366 *p.b = tmp;
367 DBG(DBG_FIFO, " -> %02lx\n", tmp);
368 fifo++, p.b++;
369 } while (--len);
370 }
371 }
372} 347}
373 348
349#endif /* CONFIG_ARCH_AT91 */
350
374static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req) 351static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
375{ 352{
376 unsigned int transaction_len; 353 unsigned int transaction_len;
@@ -387,7 +364,7 @@ static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
387 ep->ep.name, req, transaction_len, 364 ep->ep.name, req, transaction_len,
388 req->last_transaction ? ", done" : ""); 365 req->last_transaction ? ", done" : "");
389 366
390 copy_to_fifo(ep->fifo, req->req.buf + req->req.actual, transaction_len); 367 memcpy_toio(ep->fifo, req->req.buf + req->req.actual, transaction_len);
391 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); 368 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY);
392 req->req.actual += transaction_len; 369 req->req.actual += transaction_len;
393} 370}
@@ -476,7 +453,7 @@ static void receive_data(struct usba_ep *ep)
476 bytecount = req->req.length - req->req.actual; 453 bytecount = req->req.length - req->req.actual;
477 } 454 }
478 455
479 copy_from_fifo(req->req.buf + req->req.actual, 456 memcpy_fromio(req->req.buf + req->req.actual,
480 ep->fifo, bytecount); 457 ep->fifo, bytecount);
481 req->req.actual += bytecount; 458 req->req.actual += bytecount;
482 459
@@ -1029,33 +1006,6 @@ static const struct usb_gadget_ops usba_udc_ops = {
1029 .set_selfpowered = usba_udc_set_selfpowered, 1006 .set_selfpowered = usba_udc_set_selfpowered,
1030}; 1007};
1031 1008
1032#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
1033{ \
1034 .ep = { \
1035 .ops = &usba_ep_ops, \
1036 .name = nam, \
1037 .maxpacket = maxpkt, \
1038 }, \
1039 .udc = &the_udc, \
1040 .queue = LIST_HEAD_INIT(usba_ep[idx].queue), \
1041 .fifo_size = maxpkt, \
1042 .nr_banks = maxbk, \
1043 .index = idx, \
1044 .can_dma = dma, \
1045 .can_isoc = isoc, \
1046}
1047
1048static struct usba_ep usba_ep[] = {
1049 EP("ep0", 0, 64, 1, 0, 0),
1050 EP("ep1in-bulk", 1, 512, 2, 1, 1),
1051 EP("ep2out-bulk", 2, 512, 2, 1, 1),
1052 EP("ep3in-int", 3, 64, 3, 1, 0),
1053 EP("ep4out-int", 4, 64, 3, 1, 0),
1054 EP("ep5in-iso", 5, 1024, 3, 1, 1),
1055 EP("ep6out-iso", 6, 1024, 3, 1, 1),
1056};
1057#undef EP
1058
1059static struct usb_endpoint_descriptor usba_ep0_desc = { 1009static struct usb_endpoint_descriptor usba_ep0_desc = {
1060 .bLength = USB_DT_ENDPOINT_SIZE, 1010 .bLength = USB_DT_ENDPOINT_SIZE,
1061 .bDescriptorType = USB_DT_ENDPOINT, 1011 .bDescriptorType = USB_DT_ENDPOINT,
@@ -1074,7 +1024,6 @@ static void nop_release(struct device *dev)
1074static struct usba_udc the_udc = { 1024static struct usba_udc the_udc = {
1075 .gadget = { 1025 .gadget = {
1076 .ops = &usba_udc_ops, 1026 .ops = &usba_udc_ops,
1077 .ep0 = &usba_ep[0].ep,
1078 .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list), 1027 .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list),
1079 .is_dualspeed = 1, 1028 .is_dualspeed = 1,
1080 .name = "atmel_usba_udc", 1029 .name = "atmel_usba_udc",
@@ -1231,7 +1180,7 @@ static int do_test_mode(struct usba_udc *udc)
1231 } else { 1180 } else {
1232 usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE); 1181 usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE);
1233 usba_writel(udc, TST, USBA_TST_PKT_MODE); 1182 usba_writel(udc, TST, USBA_TST_PKT_MODE);
1234 copy_to_fifo(ep->fifo, test_packet_buffer, 1183 memcpy_toio(ep->fifo, test_packet_buffer,
1235 sizeof(test_packet_buffer)); 1184 sizeof(test_packet_buffer));
1236 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY); 1185 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY);
1237 dev_info(dev, "Entering Test_Packet mode...\n"); 1186 dev_info(dev, "Entering Test_Packet mode...\n");
@@ -1530,13 +1479,13 @@ restart:
1530 DBG(DBG_HW, "Packet length: %u\n", pkt_len); 1479 DBG(DBG_HW, "Packet length: %u\n", pkt_len);
1531 if (pkt_len != sizeof(crq)) { 1480 if (pkt_len != sizeof(crq)) {
1532 pr_warning("udc: Invalid packet length %u " 1481 pr_warning("udc: Invalid packet length %u "
1533 "(expected %lu)\n", pkt_len, sizeof(crq)); 1482 "(expected %zu)\n", pkt_len, sizeof(crq));
1534 set_protocol_stall(udc, ep); 1483 set_protocol_stall(udc, ep);
1535 return; 1484 return;
1536 } 1485 }
1537 1486
1538 DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo); 1487 DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo);
1539 copy_from_fifo(crq.data, ep->fifo, sizeof(crq)); 1488 memcpy_fromio(crq.data, ep->fifo, sizeof(crq));
1540 1489
1541 /* Free up one bank in the FIFO so that we can 1490 /* Free up one bank in the FIFO so that we can
1542 * generate or receive a reply right away. */ 1491 * generate or receive a reply right away. */
@@ -1688,6 +1637,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
1688 DBG(DBG_INT, "irq, status=%#08x\n", status); 1637 DBG(DBG_INT, "irq, status=%#08x\n", status);
1689 1638
1690 if (status & USBA_DET_SUSPEND) { 1639 if (status & USBA_DET_SUSPEND) {
1640 toggle_bias(0);
1691 usba_writel(udc, INT_CLR, USBA_DET_SUSPEND); 1641 usba_writel(udc, INT_CLR, USBA_DET_SUSPEND);
1692 DBG(DBG_BUS, "Suspend detected\n"); 1642 DBG(DBG_BUS, "Suspend detected\n");
1693 if (udc->gadget.speed != USB_SPEED_UNKNOWN 1643 if (udc->gadget.speed != USB_SPEED_UNKNOWN
@@ -1699,6 +1649,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
1699 } 1649 }
1700 1650
1701 if (status & USBA_WAKE_UP) { 1651 if (status & USBA_WAKE_UP) {
1652 toggle_bias(1);
1702 usba_writel(udc, INT_CLR, USBA_WAKE_UP); 1653 usba_writel(udc, INT_CLR, USBA_WAKE_UP);
1703 DBG(DBG_BUS, "Wake Up CPU detected\n"); 1654 DBG(DBG_BUS, "Wake Up CPU detected\n");
1704 } 1655 }
@@ -1792,12 +1743,14 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
1792 vbus = gpio_get_value(udc->vbus_pin); 1743 vbus = gpio_get_value(udc->vbus_pin);
1793 if (vbus != udc->vbus_prev) { 1744 if (vbus != udc->vbus_prev) {
1794 if (vbus) { 1745 if (vbus) {
1795 usba_writel(udc, CTRL, USBA_EN_USBA); 1746 toggle_bias(1);
1747 usba_writel(udc, CTRL, USBA_ENABLE_MASK);
1796 usba_writel(udc, INT_ENB, USBA_END_OF_RESET); 1748 usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
1797 } else { 1749 } else {
1798 udc->gadget.speed = USB_SPEED_UNKNOWN; 1750 udc->gadget.speed = USB_SPEED_UNKNOWN;
1799 reset_all_endpoints(udc); 1751 reset_all_endpoints(udc);
1800 usba_writel(udc, CTRL, 0); 1752 toggle_bias(0);
1753 usba_writel(udc, CTRL, USBA_DISABLE_MASK);
1801 spin_unlock(&udc->lock); 1754 spin_unlock(&udc->lock);
1802 udc->driver->disconnect(&udc->gadget); 1755 udc->driver->disconnect(&udc->gadget);
1803 spin_lock(&udc->lock); 1756 spin_lock(&udc->lock);
@@ -1850,7 +1803,8 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1850 /* If Vbus is present, enable the controller and wait for reset */ 1803 /* If Vbus is present, enable the controller and wait for reset */
1851 spin_lock_irqsave(&udc->lock, flags); 1804 spin_lock_irqsave(&udc->lock, flags);
1852 if (vbus_is_present(udc) && udc->vbus_prev == 0) { 1805 if (vbus_is_present(udc) && udc->vbus_prev == 0) {
1853 usba_writel(udc, CTRL, USBA_EN_USBA); 1806 toggle_bias(1);
1807 usba_writel(udc, CTRL, USBA_ENABLE_MASK);
1854 usba_writel(udc, INT_ENB, USBA_END_OF_RESET); 1808 usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
1855 } 1809 }
1856 spin_unlock_irqrestore(&udc->lock, flags); 1810 spin_unlock_irqrestore(&udc->lock, flags);
@@ -1883,7 +1837,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1883 spin_unlock_irqrestore(&udc->lock, flags); 1837 spin_unlock_irqrestore(&udc->lock, flags);
1884 1838
1885 /* This will also disable the DP pullup */ 1839 /* This will also disable the DP pullup */
1886 usba_writel(udc, CTRL, 0); 1840 toggle_bias(0);
1841 usba_writel(udc, CTRL, USBA_DISABLE_MASK);
1887 1842
1888 driver->unbind(&udc->gadget); 1843 driver->unbind(&udc->gadget);
1889 udc->gadget.dev.driver = NULL; 1844 udc->gadget.dev.driver = NULL;
@@ -1908,7 +1863,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1908 1863
1909 regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); 1864 regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
1910 fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID); 1865 fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
1911 if (!regs || !fifo) 1866 if (!regs || !fifo || !pdata)
1912 return -ENXIO; 1867 return -ENXIO;
1913 1868
1914 irq = platform_get_irq(pdev, 0); 1869 irq = platform_get_irq(pdev, 0);
@@ -1953,19 +1908,48 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1953 1908
1954 /* Make sure we start from a clean slate */ 1909 /* Make sure we start from a clean slate */
1955 clk_enable(pclk); 1910 clk_enable(pclk);
1956 usba_writel(udc, CTRL, 0); 1911 toggle_bias(0);
1912 usba_writel(udc, CTRL, USBA_DISABLE_MASK);
1957 clk_disable(pclk); 1913 clk_disable(pclk);
1958 1914
1915 usba_ep = kmalloc(sizeof(struct usba_ep) * pdata->num_ep,
1916 GFP_KERNEL);
1917 if (!usba_ep)
1918 goto err_alloc_ep;
1919
1920 the_udc.gadget.ep0 = &usba_ep[0].ep;
1921
1959 INIT_LIST_HEAD(&usba_ep[0].ep.ep_list); 1922 INIT_LIST_HEAD(&usba_ep[0].ep.ep_list);
1960 usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0); 1923 usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0);
1961 usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0); 1924 usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0);
1962 usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0); 1925 usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0);
1963 for (i = 1; i < ARRAY_SIZE(usba_ep); i++) { 1926 usba_ep[0].ep.ops = &usba_ep_ops;
1927 usba_ep[0].ep.name = pdata->ep[0].name;
1928 usba_ep[0].ep.maxpacket = pdata->ep[0].fifo_size;
1929 usba_ep[0].udc = &the_udc;
1930 INIT_LIST_HEAD(&usba_ep[0].queue);
1931 usba_ep[0].fifo_size = pdata->ep[0].fifo_size;
1932 usba_ep[0].nr_banks = pdata->ep[0].nr_banks;
1933 usba_ep[0].index = pdata->ep[0].index;
1934 usba_ep[0].can_dma = pdata->ep[0].can_dma;
1935 usba_ep[0].can_isoc = pdata->ep[0].can_isoc;
1936
1937 for (i = 1; i < pdata->num_ep; i++) {
1964 struct usba_ep *ep = &usba_ep[i]; 1938 struct usba_ep *ep = &usba_ep[i];
1965 1939
1966 ep->ep_regs = udc->regs + USBA_EPT_BASE(i); 1940 ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
1967 ep->dma_regs = udc->regs + USBA_DMA_BASE(i); 1941 ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
1968 ep->fifo = udc->fifo + USBA_FIFO_BASE(i); 1942 ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
1943 ep->ep.ops = &usba_ep_ops;
1944 ep->ep.name = pdata->ep[i].name;
1945 ep->ep.maxpacket = pdata->ep[i].fifo_size;
1946 ep->udc = &the_udc;
1947 INIT_LIST_HEAD(&ep->queue);
1948 ep->fifo_size = pdata->ep[i].fifo_size;
1949 ep->nr_banks = pdata->ep[i].nr_banks;
1950 ep->index = pdata->ep[i].index;
1951 ep->can_dma = pdata->ep[i].can_dma;
1952 ep->can_isoc = pdata->ep[i].can_isoc;
1969 1953
1970 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); 1954 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
1971 } 1955 }
@@ -1984,7 +1968,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1984 goto err_device_add; 1968 goto err_device_add;
1985 } 1969 }
1986 1970
1987 if (pdata && pdata->vbus_pin != GPIO_PIN_NONE) { 1971 if (pdata->vbus_pin >= 0) {
1988 if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { 1972 if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
1989 udc->vbus_pin = pdata->vbus_pin; 1973 udc->vbus_pin = pdata->vbus_pin;
1990 1974
@@ -2004,7 +1988,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2004 } 1988 }
2005 1989
2006 usba_init_debugfs(udc); 1990 usba_init_debugfs(udc);
2007 for (i = 1; i < ARRAY_SIZE(usba_ep); i++) 1991 for (i = 1; i < pdata->num_ep; i++)
2008 usba_ep_init_debugfs(udc, &usba_ep[i]); 1992 usba_ep_init_debugfs(udc, &usba_ep[i]);
2009 1993
2010 return 0; 1994 return 0;
@@ -2012,6 +1996,8 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2012err_device_add: 1996err_device_add:
2013 free_irq(irq, udc); 1997 free_irq(irq, udc);
2014err_request_irq: 1998err_request_irq:
1999 kfree(usba_ep);
2000err_alloc_ep:
2015 iounmap(udc->fifo); 2001 iounmap(udc->fifo);
2016err_map_fifo: 2002err_map_fifo:
2017 iounmap(udc->regs); 2003 iounmap(udc->regs);
@@ -2029,10 +2015,11 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
2029{ 2015{
2030 struct usba_udc *udc; 2016 struct usba_udc *udc;
2031 int i; 2017 int i;
2018 struct usba_platform_data *pdata = pdev->dev.platform_data;
2032 2019
2033 udc = platform_get_drvdata(pdev); 2020 udc = platform_get_drvdata(pdev);
2034 2021
2035 for (i = 1; i < ARRAY_SIZE(usba_ep); i++) 2022 for (i = 1; i < pdata->num_ep; i++)
2036 usba_ep_cleanup_debugfs(&usba_ep[i]); 2023 usba_ep_cleanup_debugfs(&usba_ep[i]);
2037 usba_cleanup_debugfs(udc); 2024 usba_cleanup_debugfs(udc);
2038 2025
@@ -2040,6 +2027,7 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
2040 gpio_free(udc->vbus_pin); 2027 gpio_free(udc->vbus_pin);
2041 2028
2042 free_irq(udc->irq, udc); 2029 free_irq(udc->irq, udc);
2030 kfree(usba_ep);
2043 iounmap(udc->fifo); 2031 iounmap(udc->fifo);
2044 iounmap(udc->regs); 2032 iounmap(udc->regs);
2045 clk_put(udc->hclk); 2033 clk_put(udc->hclk);
@@ -2054,6 +2042,7 @@ static struct platform_driver udc_driver = {
2054 .remove = __exit_p(usba_udc_remove), 2042 .remove = __exit_p(usba_udc_remove),
2055 .driver = { 2043 .driver = {
2056 .name = "atmel_usba_udc", 2044 .name = "atmel_usba_udc",
2045 .owner = THIS_MODULE,
2057 }, 2046 },
2058}; 2047};
2059 2048
@@ -2072,3 +2061,4 @@ module_exit(udc_exit);
2072MODULE_DESCRIPTION("Atmel USBA UDC driver"); 2061MODULE_DESCRIPTION("Atmel USBA UDC driver");
2073MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>"); 2062MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
2074MODULE_LICENSE("GPL"); 2063MODULE_LICENSE("GPL");
2064MODULE_ALIAS("platform:atmel_usba_udc");
diff --git a/drivers/usb/gadget/atmel_usba_udc.h b/drivers/usb/gadget/atmel_usba_udc.h
index 08bf6f9aaf7e..f7baea307f0d 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -41,6 +41,15 @@
41#define USBA_EN_USBA (1 << 8) 41#define USBA_EN_USBA (1 << 8)
42#define USBA_DETACH (1 << 9) 42#define USBA_DETACH (1 << 9)
43#define USBA_REMOTE_WAKE_UP (1 << 10) 43#define USBA_REMOTE_WAKE_UP (1 << 10)
44#define USBA_PULLD_DIS (1 << 11)
45
46#if defined(CONFIG_AVR32)
47#define USBA_ENABLE_MASK USBA_EN_USBA
48#define USBA_DISABLE_MASK 0
49#elif defined(CONFIG_ARCH_AT91)
50#define USBA_ENABLE_MASK (USBA_EN_USBA | USBA_PULLD_DIS)
51#define USBA_DISABLE_MASK USBA_DETACH
52#endif /* CONFIG_ARCH_AT91 */
44 53
45/* Bitfields in FNUM */ 54/* Bitfields in FNUM */
46#define USBA_MICRO_FRAME_NUM_OFFSET 0 55#define USBA_MICRO_FRAME_NUM_OFFSET 0
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index a70e255402b8..e99872308144 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1561,6 +1561,7 @@ done_set_intf:
1561 memcpy(req->buf, buf, n); 1561 memcpy(req->buf, buf, n);
1562 req->complete = rndis_response_complete; 1562 req->complete = rndis_response_complete;
1563 rndis_free_response(dev->rndis_config, buf); 1563 rndis_free_response(dev->rndis_config, buf);
1564 value = n;
1564 } 1565 }
1565 /* else stalls ... spec says to avoid that */ 1566 /* else stalls ... spec says to avoid that */
1566 } 1567 }
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 63e8fa3a69e1..254012ad2b91 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -2475,3 +2475,4 @@ module_exit(udc_exit);
2475MODULE_DESCRIPTION(DRIVER_DESC); 2475MODULE_DESCRIPTION(DRIVER_DESC);
2476MODULE_AUTHOR(DRIVER_AUTHOR); 2476MODULE_AUTHOR(DRIVER_AUTHOR);
2477MODULE_LICENSE("GPL"); 2477MODULE_LICENSE("GPL");
2478MODULE_ALIAS("platform:fsl-usb2-udc");
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 805602a687cb..0a6feafc8d28 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1458,7 +1458,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1458 /* currently one config, two speeds */ 1458 /* currently one config, two speeds */
1459 case USB_REQ_SET_CONFIGURATION: 1459 case USB_REQ_SET_CONFIGURATION:
1460 if (ctrl->bRequestType != 0) 1460 if (ctrl->bRequestType != 0)
1461 break; 1461 goto unrecognized;
1462 if (0 == (u8) w_value) { 1462 if (0 == (u8) w_value) {
1463 value = 0; 1463 value = 0;
1464 dev->current_config = 0; 1464 dev->current_config = 0;
@@ -1505,7 +1505,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1505 /* PXA automagically handles this request too */ 1505 /* PXA automagically handles this request too */
1506 case USB_REQ_GET_CONFIGURATION: 1506 case USB_REQ_GET_CONFIGURATION:
1507 if (ctrl->bRequestType != 0x80) 1507 if (ctrl->bRequestType != 0x80)
1508 break; 1508 goto unrecognized;
1509 *(u8 *)req->buf = dev->current_config; 1509 *(u8 *)req->buf = dev->current_config;
1510 value = min (w_length, (u16) 1); 1510 value = min (w_length, (u16) 1);
1511 break; 1511 break;
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 37243ef7104e..078f72467671 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -2146,3 +2146,4 @@ module_exit(udc_exit);
2146MODULE_DESCRIPTION(DRIVER_DESC); 2146MODULE_DESCRIPTION(DRIVER_DESC);
2147MODULE_AUTHOR("Mikko Lahteenmaki, Bo Henriksen"); 2147MODULE_AUTHOR("Mikko Lahteenmaki, Bo Henriksen");
2148MODULE_LICENSE("GPL"); 2148MODULE_LICENSE("GPL");
2149MODULE_ALIAS("platform:lh7a40x_udc");
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 835948f0715a..ee6b35fa870f 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -35,6 +35,7 @@
35MODULE_DESCRIPTION("M66592 USB gadget driver"); 35MODULE_DESCRIPTION("M66592 USB gadget driver");
36MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
37MODULE_AUTHOR("Yoshihiro Shimoda"); 37MODULE_AUTHOR("Yoshihiro Shimoda");
38MODULE_ALIAS("platform:m66592_udc");
38 39
39#define DRIVER_VERSION "18 Oct 2007" 40#define DRIVER_VERSION "18 Oct 2007"
40 41
@@ -1671,6 +1672,7 @@ static struct platform_driver m66592_driver = {
1671 .remove = __exit_p(m66592_remove), 1672 .remove = __exit_p(m66592_remove),
1672 .driver = { 1673 .driver = {
1673 .name = (char *) udc_name, 1674 .name = (char *) udc_name,
1675 .owner = THIS_MODULE,
1674 }, 1676 },
1675}; 1677};
1676 1678
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index e6d68bda428a..ee1e9a314cd1 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -3109,4 +3109,4 @@ module_exit(udc_exit);
3109 3109
3110MODULE_DESCRIPTION(DRIVER_DESC); 3110MODULE_DESCRIPTION(DRIVER_DESC);
3111MODULE_LICENSE("GPL"); 3111MODULE_LICENSE("GPL");
3112 3112MODULE_ALIAS("platform:omap_udc");
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 9fdabc8fcac4..2c32bd08ee7d 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -92,7 +92,6 @@ struct printer_dev {
92 u8 *current_rx_buf; 92 u8 *current_rx_buf;
93 u8 printer_status; 93 u8 printer_status;
94 u8 reset_printer; 94 u8 reset_printer;
95 struct class_device *printer_class_dev;
96 struct cdev printer_cdev; 95 struct cdev printer_cdev;
97 struct device *pdev; 96 struct device *pdev;
98 u8 printer_cdev_open; 97 u8 printer_cdev_open;
@@ -1299,7 +1298,7 @@ printer_unbind(struct usb_gadget *gadget)
1299 printer_req_free(dev->in_ep, req); 1298 printer_req_free(dev->in_ep, req);
1300 } 1299 }
1301 1300
1302 if (dev->current_rx_req != NULL); 1301 if (dev->current_rx_req != NULL)
1303 printer_req_free(dev->out_ep, dev->current_rx_req); 1302 printer_req_free(dev->out_ep, dev->current_rx_req);
1304 1303
1305 while (!list_empty(&dev->rx_reqs)) { 1304 while (!list_empty(&dev->rx_reqs)) {
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 4402d6f042d9..c00cd8b9d3d1 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -103,6 +103,12 @@ static const char ep0name [] = "ep0";
103#error "Can't configure both IXP and PXA" 103#error "Can't configure both IXP and PXA"
104#endif 104#endif
105 105
106/* IXP doesn't yet support <linux/clk.h> */
107#define clk_get(dev,name) NULL
108#define clk_enable(clk) do { } while (0)
109#define clk_disable(clk) do { } while (0)
110#define clk_put(clk) do { } while (0)
111
106#endif 112#endif
107 113
108#include "pxa2xx_udc.h" 114#include "pxa2xx_udc.h"
@@ -934,20 +940,31 @@ static void udc_disable(struct pxa2xx_udc *);
934/* We disable the UDC -- and its 48 MHz clock -- whenever it's not 940/* We disable the UDC -- and its 48 MHz clock -- whenever it's not
935 * in active use. 941 * in active use.
936 */ 942 */
937static int pullup(struct pxa2xx_udc *udc, int is_active) 943static int pullup(struct pxa2xx_udc *udc)
938{ 944{
939 is_active = is_active && udc->vbus && udc->pullup; 945 int is_active = udc->vbus && udc->pullup && !udc->suspended;
940 DMSG("%s\n", is_active ? "active" : "inactive"); 946 DMSG("%s\n", is_active ? "active" : "inactive");
941 if (is_active) 947 if (is_active) {
942 udc_enable(udc); 948 if (!udc->active) {
943 else { 949 udc->active = 1;
944 if (udc->gadget.speed != USB_SPEED_UNKNOWN) { 950 /* Enable clock for USB device */
945 DMSG("disconnect %s\n", udc->driver 951 clk_enable(udc->clk);
946 ? udc->driver->driver.name 952 udc_enable(udc);
947 : "(no driver)");
948 stop_activity(udc, udc->driver);
949 } 953 }
950 udc_disable(udc); 954 } else {
955 if (udc->active) {
956 if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
957 DMSG("disconnect %s\n", udc->driver
958 ? udc->driver->driver.name
959 : "(no driver)");
960 stop_activity(udc, udc->driver);
961 }
962 udc_disable(udc);
963 /* Disable clock for USB device */
964 clk_disable(udc->clk);
965 udc->active = 0;
966 }
967
951 } 968 }
952 return 0; 969 return 0;
953} 970}
@@ -958,9 +975,9 @@ static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
958 struct pxa2xx_udc *udc; 975 struct pxa2xx_udc *udc;
959 976
960 udc = container_of(_gadget, struct pxa2xx_udc, gadget); 977 udc = container_of(_gadget, struct pxa2xx_udc, gadget);
961 udc->vbus = is_active = (is_active != 0); 978 udc->vbus = (is_active != 0);
962 DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); 979 DMSG("vbus %s\n", is_active ? "supplied" : "inactive");
963 pullup(udc, is_active); 980 pullup(udc);
964 return 0; 981 return 0;
965} 982}
966 983
@@ -975,9 +992,8 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active)
975 if (!udc->mach->gpio_pullup && !udc->mach->udc_command) 992 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
976 return -EOPNOTSUPP; 993 return -EOPNOTSUPP;
977 994
978 is_active = (is_active != 0); 995 udc->pullup = (is_active != 0);
979 udc->pullup = is_active; 996 pullup(udc);
980 pullup(udc, is_active);
981 return 0; 997 return 0;
982} 998}
983 999
@@ -997,7 +1013,7 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = {
997#ifdef CONFIG_USB_GADGET_DEBUG_FS 1013#ifdef CONFIG_USB_GADGET_DEBUG_FS
998 1014
999static int 1015static int
1000udc_seq_show(struct seq_file *m, void *d) 1016udc_seq_show(struct seq_file *m, void *_d)
1001{ 1017{
1002 struct pxa2xx_udc *dev = m->private; 1018 struct pxa2xx_udc *dev = m->private;
1003 unsigned long flags; 1019 unsigned long flags;
@@ -1146,11 +1162,6 @@ static void udc_disable(struct pxa2xx_udc *dev)
1146 1162
1147 udc_clear_mask_UDCCR(UDCCR_UDE); 1163 udc_clear_mask_UDCCR(UDCCR_UDE);
1148 1164
1149#ifdef CONFIG_ARCH_PXA
1150 /* Disable clock for USB device */
1151 clk_disable(dev->clk);
1152#endif
1153
1154 ep0_idle (dev); 1165 ep0_idle (dev);
1155 dev->gadget.speed = USB_SPEED_UNKNOWN; 1166 dev->gadget.speed = USB_SPEED_UNKNOWN;
1156} 1167}
@@ -1191,11 +1202,6 @@ static void udc_enable (struct pxa2xx_udc *dev)
1191{ 1202{
1192 udc_clear_mask_UDCCR(UDCCR_UDE); 1203 udc_clear_mask_UDCCR(UDCCR_UDE);
1193 1204
1194#ifdef CONFIG_ARCH_PXA
1195 /* Enable clock for USB device */
1196 clk_enable(dev->clk);
1197#endif
1198
1199 /* try to clear these bits before we enable the udc */ 1205 /* try to clear these bits before we enable the udc */
1200 udc_ack_int_UDCCR(UDCCR_SUSIR|/*UDCCR_RSTIR|*/UDCCR_RESIR); 1206 udc_ack_int_UDCCR(UDCCR_SUSIR|/*UDCCR_RSTIR|*/UDCCR_RESIR);
1201 1207
@@ -1286,7 +1292,7 @@ fail:
1286 * for set_configuration as well as eventual disconnect. 1292 * for set_configuration as well as eventual disconnect.
1287 */ 1293 */
1288 DMSG("registered gadget driver '%s'\n", driver->driver.name); 1294 DMSG("registered gadget driver '%s'\n", driver->driver.name);
1289 pullup(dev, 1); 1295 pullup(dev);
1290 dump_state(dev); 1296 dump_state(dev);
1291 return 0; 1297 return 0;
1292} 1298}
@@ -1329,7 +1335,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1329 return -EINVAL; 1335 return -EINVAL;
1330 1336
1331 local_irq_disable(); 1337 local_irq_disable();
1332 pullup(dev, 0); 1338 dev->pullup = 0;
1339 pullup(dev);
1333 stop_activity(dev, driver); 1340 stop_activity(dev, driver);
1334 local_irq_enable(); 1341 local_irq_enable();
1335 1342
@@ -2131,13 +2138,11 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2131 if (irq < 0) 2138 if (irq < 0)
2132 return -ENODEV; 2139 return -ENODEV;
2133 2140
2134#ifdef CONFIG_ARCH_PXA
2135 dev->clk = clk_get(&pdev->dev, "UDCCLK"); 2141 dev->clk = clk_get(&pdev->dev, "UDCCLK");
2136 if (IS_ERR(dev->clk)) { 2142 if (IS_ERR(dev->clk)) {
2137 retval = PTR_ERR(dev->clk); 2143 retval = PTR_ERR(dev->clk);
2138 goto err_clk; 2144 goto err_clk;
2139 } 2145 }
2140#endif
2141 2146
2142 pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, 2147 pr_debug("%s: IRQ %d%s%s\n", driver_name, irq,
2143 dev->has_cfr ? "" : " (!cfr)", 2148 dev->has_cfr ? "" : " (!cfr)",
@@ -2250,10 +2255,8 @@ lubbock_fail0:
2250 if (dev->mach->gpio_vbus) 2255 if (dev->mach->gpio_vbus)
2251 gpio_free(dev->mach->gpio_vbus); 2256 gpio_free(dev->mach->gpio_vbus);
2252 err_gpio_vbus: 2257 err_gpio_vbus:
2253#ifdef CONFIG_ARCH_PXA
2254 clk_put(dev->clk); 2258 clk_put(dev->clk);
2255 err_clk: 2259 err_clk:
2256#endif
2257 return retval; 2260 return retval;
2258} 2261}
2259 2262
@@ -2269,7 +2272,9 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
2269 if (dev->driver) 2272 if (dev->driver)
2270 return -EBUSY; 2273 return -EBUSY;
2271 2274
2272 udc_disable(dev); 2275 dev->pullup = 0;
2276 pullup(dev);
2277
2273 remove_debug_files(dev); 2278 remove_debug_files(dev);
2274 2279
2275 if (dev->got_irq) { 2280 if (dev->got_irq) {
@@ -2289,9 +2294,7 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
2289 if (dev->mach->gpio_pullup) 2294 if (dev->mach->gpio_pullup)
2290 gpio_free(dev->mach->gpio_pullup); 2295 gpio_free(dev->mach->gpio_pullup);
2291 2296
2292#ifdef CONFIG_ARCH_PXA
2293 clk_put(dev->clk); 2297 clk_put(dev->clk);
2294#endif
2295 2298
2296 platform_set_drvdata(pdev, NULL); 2299 platform_set_drvdata(pdev, NULL);
2297 the_controller = NULL; 2300 the_controller = NULL;
@@ -2317,10 +2320,15 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
2317static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) 2320static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2318{ 2321{
2319 struct pxa2xx_udc *udc = platform_get_drvdata(dev); 2322 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2323 unsigned long flags;
2320 2324
2321 if (!udc->mach->gpio_pullup && !udc->mach->udc_command) 2325 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
2322 WARN("USB host won't detect disconnect!\n"); 2326 WARN("USB host won't detect disconnect!\n");
2323 pullup(udc, 0); 2327 udc->suspended = 1;
2328
2329 local_irq_save(flags);
2330 pullup(udc);
2331 local_irq_restore(flags);
2324 2332
2325 return 0; 2333 return 0;
2326} 2334}
@@ -2328,8 +2336,12 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2328static int pxa2xx_udc_resume(struct platform_device *dev) 2336static int pxa2xx_udc_resume(struct platform_device *dev)
2329{ 2337{
2330 struct pxa2xx_udc *udc = platform_get_drvdata(dev); 2338 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2339 unsigned long flags;
2331 2340
2332 pullup(udc, 1); 2341 udc->suspended = 0;
2342 local_irq_save(flags);
2343 pullup(udc);
2344 local_irq_restore(flags);
2333 2345
2334 return 0; 2346 return 0;
2335} 2347}
@@ -2368,4 +2380,4 @@ module_exit(udc_exit);
2368MODULE_DESCRIPTION(DRIVER_DESC); 2380MODULE_DESCRIPTION(DRIVER_DESC);
2369MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); 2381MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell");
2370MODULE_LICENSE("GPL"); 2382MODULE_LICENSE("GPL");
2371 2383MODULE_ALIAS("platform:pxa2xx-udc");
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa2xx_udc.h
index b67e3ff5e4eb..e2c19e88c875 100644
--- a/drivers/usb/gadget/pxa2xx_udc.h
+++ b/drivers/usb/gadget/pxa2xx_udc.h
@@ -119,7 +119,9 @@ struct pxa2xx_udc {
119 has_cfr : 1, 119 has_cfr : 1,
120 req_pending : 1, 120 req_pending : 1,
121 req_std : 1, 121 req_std : 1,
122 req_config : 1; 122 req_config : 1,
123 suspended : 1,
124 active : 1;
123 125
124#define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200)) 126#define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200))
125 struct timer_list timer; 127 struct timer_list timer;
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index aadc4204d6f9..6b1ef488043b 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -2047,3 +2047,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
2047MODULE_DESCRIPTION(DRIVER_DESC); 2047MODULE_DESCRIPTION(DRIVER_DESC);
2048MODULE_VERSION(DRIVER_VERSION); 2048MODULE_VERSION(DRIVER_VERSION);
2049MODULE_LICENSE("GPL"); 2049MODULE_LICENSE("GPL");
2050MODULE_ALIAS("platform:s3c2410-usbgadget");
2051MODULE_ALIAS("platform:s3c2440-usbgadget");
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d97b16b52efa..bf8be2a41a4a 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -69,10 +69,9 @@ config USB_EHCI_BIG_ENDIAN_DESC
69 default y 69 default y
70 70
71config USB_EHCI_FSL 71config USB_EHCI_FSL
72 bool 72 bool "Support for Freescale on-chip EHCI USB controller"
73 depends on USB_EHCI_HCD 73 depends on USB_EHCI_HCD && FSL_SOC
74 select USB_EHCI_ROOT_HUB_TT 74 select USB_EHCI_ROOT_HUB_TT
75 default y if MPC834x || PPC_MPC831x
76 ---help--- 75 ---help---
77 Variation of ARC USB block used in some Freescale chips. 76 Variation of ARC USB block used in some Freescale chips.
78 77
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 4caa6a8b9a37..85074cb36f38 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -281,23 +281,44 @@ static void ehci_iaa_watchdog(unsigned long param)
281{ 281{
282 struct ehci_hcd *ehci = (struct ehci_hcd *) param; 282 struct ehci_hcd *ehci = (struct ehci_hcd *) param;
283 unsigned long flags; 283 unsigned long flags;
284 u32 status, cmd;
285 284
286 spin_lock_irqsave (&ehci->lock, flags); 285 spin_lock_irqsave (&ehci->lock, flags);
287 WARN_ON(!ehci->reclaim);
288 286
289 status = ehci_readl(ehci, &ehci->regs->status); 287 /* Lost IAA irqs wedge things badly; seen first with a vt8235.
290 cmd = ehci_readl(ehci, &ehci->regs->command); 288 * So we need this watchdog, but must protect it against both
291 ehci_dbg(ehci, "IAA watchdog: status %x cmd %x\n", status, cmd); 289 * (a) SMP races against real IAA firing and retriggering, and
292 290 * (b) clean HC shutdown, when IAA watchdog was pending.
293 /* lost IAA irqs wedge things badly; seen first with a vt8235 */ 291 */
294 if (ehci->reclaim) { 292 if (ehci->reclaim
295 if (status & STS_IAA) { 293 && !timer_pending(&ehci->iaa_watchdog)
296 ehci_vdbg (ehci, "lost IAA\n"); 294 && HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) {
295 u32 cmd, status;
296
297 /* If we get here, IAA is *REALLY* late. It's barely
298 * conceivable that the system is so busy that CMD_IAAD
299 * is still legitimately set, so let's be sure it's
300 * clear before we read STS_IAA. (The HC should clear
301 * CMD_IAAD when it sets STS_IAA.)
302 */
303 cmd = ehci_readl(ehci, &ehci->regs->command);
304 if (cmd & CMD_IAAD)
305 ehci_writel(ehci, cmd & ~CMD_IAAD,
306 &ehci->regs->command);
307
308 /* If IAA is set here it either legitimately triggered
309 * before we cleared IAAD above (but _way_ late, so we'll
310 * still count it as lost) ... or a silicon erratum:
311 * - VIA seems to set IAA without triggering the IRQ;
312 * - IAAD potentially cleared without setting IAA.
313 */
314 status = ehci_readl(ehci, &ehci->regs->status);
315 if ((status & STS_IAA) || !(cmd & CMD_IAAD)) {
297 COUNT (ehci->stats.lost_iaa); 316 COUNT (ehci->stats.lost_iaa);
298 ehci_writel(ehci, STS_IAA, &ehci->regs->status); 317 ehci_writel(ehci, STS_IAA, &ehci->regs->status);
299 } 318 }
300 ehci_writel(ehci, cmd & ~CMD_IAAD, &ehci->regs->command); 319
320 ehci_vdbg(ehci, "IAA watchdog: status %x cmd %x\n",
321 status, cmd);
301 end_unlink_async(ehci); 322 end_unlink_async(ehci);
302 } 323 }
303 324
@@ -631,7 +652,7 @@ static int ehci_run (struct usb_hcd *hcd)
631static irqreturn_t ehci_irq (struct usb_hcd *hcd) 652static irqreturn_t ehci_irq (struct usb_hcd *hcd)
632{ 653{
633 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 654 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
634 u32 status, pcd_status = 0; 655 u32 status, pcd_status = 0, cmd;
635 int bh; 656 int bh;
636 657
637 spin_lock (&ehci->lock); 658 spin_lock (&ehci->lock);
@@ -652,7 +673,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
652 673
653 /* clear (just) interrupts */ 674 /* clear (just) interrupts */
654 ehci_writel(ehci, status, &ehci->regs->status); 675 ehci_writel(ehci, status, &ehci->regs->status);
655 ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ 676 cmd = ehci_readl(ehci, &ehci->regs->command);
656 bh = 0; 677 bh = 0;
657 678
658#ifdef EHCI_VERBOSE_DEBUG 679#ifdef EHCI_VERBOSE_DEBUG
@@ -673,8 +694,17 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
673 694
674 /* complete the unlinking of some qh [4.15.2.3] */ 695 /* complete the unlinking of some qh [4.15.2.3] */
675 if (status & STS_IAA) { 696 if (status & STS_IAA) {
676 COUNT (ehci->stats.reclaim); 697 /* guard against (alleged) silicon errata */
677 end_unlink_async(ehci); 698 if (cmd & CMD_IAAD) {
699 ehci_writel(ehci, cmd & ~CMD_IAAD,
700 &ehci->regs->command);
701 ehci_dbg(ehci, "IAA with IAAD still set?\n");
702 }
703 if (ehci->reclaim) {
704 COUNT(ehci->stats.reclaim);
705 end_unlink_async(ehci);
706 } else
707 ehci_dbg(ehci, "IAA with nothing to reclaim?\n");
678 } 708 }
679 709
680 /* remote wakeup [4.3.1] */ 710 /* remote wakeup [4.3.1] */
@@ -781,7 +811,7 @@ static int ehci_urb_enqueue (
781static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) 811static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
782{ 812{
783 /* failfast */ 813 /* failfast */
784 if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) 814 if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state) && ehci->reclaim)
785 end_unlink_async(ehci); 815 end_unlink_async(ehci);
786 816
787 /* if it's not linked then there's nothing to do */ 817 /* if it's not linked then there's nothing to do */
@@ -862,18 +892,18 @@ static int ehci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
862 /* reschedule QH iff another request is queued */ 892 /* reschedule QH iff another request is queued */
863 if (!list_empty (&qh->qtd_list) 893 if (!list_empty (&qh->qtd_list)
864 && HC_IS_RUNNING (hcd->state)) { 894 && HC_IS_RUNNING (hcd->state)) {
865 int schedule_status; 895 rc = qh_schedule(ehci, qh);
866 896
867 schedule_status = qh_schedule (ehci, qh); 897 /* An error here likely indicates handshake failure
868 spin_unlock_irqrestore (&ehci->lock, flags); 898 * or no space left in the schedule. Neither fault
869 899 * should happen often ...
870 if (schedule_status != 0) { 900 *
871 // shouldn't happen often, but ... 901 * FIXME kill the now-dysfunctional queued urbs
872 // FIXME kill those tds' urbs 902 */
873 err ("can't reschedule qh %p, err %d", 903 if (rc != 0)
874 qh, schedule_status); 904 ehci_err(ehci,
875 } 905 "can't reschedule qh %p, err %d",
876 return status; 906 qh, rc);
877 } 907 }
878 break; 908 break;
879 909
@@ -1003,7 +1033,7 @@ MODULE_LICENSE ("GPL");
1003#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver 1033#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver
1004#endif 1034#endif
1005 1035
1006#ifdef CONFIG_ARCH_ORION 1036#ifdef CONFIG_PLAT_ORION
1007#include "ehci-orion.c" 1037#include "ehci-orion.c"
1008#define PLATFORM_DRIVER ehci_orion_driver 1038#define PLATFORM_DRIVER ehci_orion_driver
1009#endif 1039#endif
@@ -1014,7 +1044,7 @@ MODULE_LICENSE ("GPL");
1014#endif 1044#endif
1015 1045
1016#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ 1046#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
1017 !defined(PS3_SYSTEM_BUS_DRIVER) 1047 !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER)
1018#error "missing bus glue for ehci-hcd" 1048#error "missing bus glue for ehci-hcd"
1019#endif 1049#endif
1020 1050
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 40e8240b7851..4e065e556e4b 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -135,8 +135,6 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
135 hcd->state = HC_STATE_QUIESCING; 135 hcd->state = HC_STATE_QUIESCING;
136 } 136 }
137 ehci->command = ehci_readl(ehci, &ehci->regs->command); 137 ehci->command = ehci_readl(ehci, &ehci->regs->command);
138 if (ehci->reclaim)
139 end_unlink_async(ehci);
140 ehci_work(ehci); 138 ehci_work(ehci);
141 139
142 /* Unlike other USB host controller types, EHCI doesn't have 140 /* Unlike other USB host controller types, EHCI doesn't have
@@ -180,6 +178,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
180 ehci_halt (ehci); 178 ehci_halt (ehci);
181 hcd->state = HC_STATE_SUSPENDED; 179 hcd->state = HC_STATE_SUSPENDED;
182 180
181 if (ehci->reclaim)
182 end_unlink_async(ehci);
183
183 /* allow remote wakeup */ 184 /* allow remote wakeup */
184 mask = INTR_MASK; 185 mask = INTR_MASK;
185 if (!device_may_wakeup(&hcd->self.root_hub->dev)) 186 if (!device_may_wakeup(&hcd->self.root_hub->dev))
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index e129981f139f..d187d0313742 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -11,15 +11,18 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <asm/arch/orion.h> 14#include <linux/mbus.h>
15#include <asm/plat-orion/ehci-orion.h>
15 16
16#define rdl(off) __raw_readl(hcd->regs + (off)) 17#define rdl(off) __raw_readl(hcd->regs + (off))
17#define wrl(off, val) __raw_writel((val), hcd->regs + (off)) 18#define wrl(off, val) __raw_writel((val), hcd->regs + (off))
18 19
19#define USB_CAUSE 0x310
20#define USB_MASK 0x314
21#define USB_CMD 0x140 20#define USB_CMD 0x140
22#define USB_MODE 0x1a8 21#define USB_MODE 0x1a8
22#define USB_CAUSE 0x310
23#define USB_MASK 0x314
24#define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4))
25#define USB_WINDOW_BASE(i) (0x324 + ((i) << 4))
23#define USB_IPG 0x360 26#define USB_IPG 0x360
24#define USB_PHY_PWR_CTRL 0x400 27#define USB_PHY_PWR_CTRL 0x400
25#define USB_PHY_TX_CTRL 0x420 28#define USB_PHY_TX_CTRL 0x420
@@ -162,8 +165,30 @@ static const struct hc_driver ehci_orion_hc_driver = {
162 .bus_resume = ehci_bus_resume, 165 .bus_resume = ehci_bus_resume,
163}; 166};
164 167
168static void __init
169ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
170 struct mbus_dram_target_info *dram)
171{
172 int i;
173
174 for (i = 0; i < 4; i++) {
175 wrl(USB_WINDOW_CTRL(i), 0);
176 wrl(USB_WINDOW_BASE(i), 0);
177 }
178
179 for (i = 0; i < dram->num_cs; i++) {
180 struct mbus_dram_window *cs = dram->cs + i;
181
182 wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) |
183 (cs->mbus_attr << 8) |
184 (dram->mbus_dram_target_id << 4) | 1);
185 wrl(USB_WINDOW_BASE(i), cs->base);
186 }
187}
188
165static int __init ehci_orion_drv_probe(struct platform_device *pdev) 189static int __init ehci_orion_drv_probe(struct platform_device *pdev)
166{ 190{
191 struct orion_ehci_data *pd = pdev->dev.platform_data;
167 struct resource *res; 192 struct resource *res;
168 struct usb_hcd *hcd; 193 struct usb_hcd *hcd;
169 struct ehci_hcd *ehci; 194 struct ehci_hcd *ehci;
@@ -227,6 +252,12 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
227 ehci->sbrn = 0x20; 252 ehci->sbrn = 0x20;
228 253
229 /* 254 /*
255 * (Re-)program MBUS remapping windows if we are asked to.
256 */
257 if (pd != NULL && pd->dram != NULL)
258 ehci_orion_conf_mbus_windows(hcd, pd->dram);
259
260 /*
230 * setup Orion USB controller 261 * setup Orion USB controller
231 */ 262 */
232 orion_usb_setup(hcd); 263 orion_usb_setup(hcd);
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 3ba01664f821..72ccd56e36dd 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -152,6 +152,20 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
152 break; 152 break;
153 } 153 }
154 break; 154 break;
155 case PCI_VENDOR_ID_VIA:
156 if (pdev->device == 0x3104 && (pdev->revision & 0xf0) == 0x60) {
157 u8 tmp;
158
159 /* The VT6212 defaults to a 1 usec EHCI sleep time which
160 * hogs the PCI bus *badly*. Setting bit 5 of 0x4B makes
161 * that sleep time use the conventional 10 usec.
162 */
163 pci_read_config_byte(pdev, 0x4b, &tmp);
164 if (tmp & 0x20)
165 break;
166 pci_write_config_byte(pdev, 0x4b, tmp | 0x20);
167 }
168 break;
155 } 169 }
156 170
157 ehci_reset(ehci); 171 ehci_reset(ehci);
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 776a97f33914..2e49de820b14 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -319,10 +319,10 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
319 if (likely (last->urb != urb)) { 319 if (likely (last->urb != urb)) {
320 ehci_urb_done(ehci, last->urb, last_status); 320 ehci_urb_done(ehci, last->urb, last_status);
321 count++; 321 count++;
322 last_status = -EINPROGRESS;
322 } 323 }
323 ehci_qtd_free (ehci, last); 324 ehci_qtd_free (ehci, last);
324 last = NULL; 325 last = NULL;
325 last_status = -EINPROGRESS;
326 } 326 }
327 327
328 /* ignore urbs submitted during completions we reported */ 328 /* ignore urbs submitted during completions we reported */
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 0130fd8571e4..203a3359a648 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -911,8 +911,7 @@ static int isp116x_hub_status_data(struct usb_hcd *hcd, char *buf)
911 buf[0] = 0; 911 buf[0] = 0;
912 912
913 for (i = 0; i < ports; i++) { 913 for (i = 0; i < ports; i++) {
914 u32 status = isp116x->rhport[i] = 914 u32 status = isp116x_read_reg32(isp116x, i ? HCRHPORT2 : HCRHPORT1);
915 isp116x_read_reg32(isp116x, i ? HCRHPORT2 : HCRHPORT1);
916 915
917 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC 916 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
918 | RH_PS_OCIC | RH_PS_PRSC)) { 917 | RH_PS_OCIC | RH_PS_PRSC)) {
@@ -1031,7 +1030,9 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1031 DBG("GetPortStatus\n"); 1030 DBG("GetPortStatus\n");
1032 if (!wIndex || wIndex > ports) 1031 if (!wIndex || wIndex > ports)
1033 goto error; 1032 goto error;
1034 tmp = isp116x->rhport[--wIndex]; 1033 spin_lock_irqsave(&isp116x->lock, flags);
1034 tmp = isp116x_read_reg32(isp116x, (--wIndex) ? HCRHPORT2 : HCRHPORT1);
1035 spin_unlock_irqrestore(&isp116x->lock, flags);
1035 *(__le32 *) buf = cpu_to_le32(tmp); 1036 *(__le32 *) buf = cpu_to_le32(tmp);
1036 DBG("GetPortStatus: port[%d] %08x\n", wIndex + 1, tmp); 1037 DBG("GetPortStatus: port[%d] %08x\n", wIndex + 1, tmp);
1037 break; 1038 break;
@@ -1080,8 +1081,6 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1080 spin_lock_irqsave(&isp116x->lock, flags); 1081 spin_lock_irqsave(&isp116x->lock, flags);
1081 isp116x_write_reg32(isp116x, wIndex 1082 isp116x_write_reg32(isp116x, wIndex
1082 ? HCRHPORT2 : HCRHPORT1, tmp); 1083 ? HCRHPORT2 : HCRHPORT1, tmp);
1083 isp116x->rhport[wIndex] =
1084 isp116x_read_reg32(isp116x, wIndex ? HCRHPORT2 : HCRHPORT1);
1085 spin_unlock_irqrestore(&isp116x->lock, flags); 1084 spin_unlock_irqrestore(&isp116x->lock, flags);
1086 break; 1085 break;
1087 case SetPortFeature: 1086 case SetPortFeature:
@@ -1095,24 +1094,22 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1095 spin_lock_irqsave(&isp116x->lock, flags); 1094 spin_lock_irqsave(&isp116x->lock, flags);
1096 isp116x_write_reg32(isp116x, wIndex 1095 isp116x_write_reg32(isp116x, wIndex
1097 ? HCRHPORT2 : HCRHPORT1, RH_PS_PSS); 1096 ? HCRHPORT2 : HCRHPORT1, RH_PS_PSS);
1097 spin_unlock_irqrestore(&isp116x->lock, flags);
1098 break; 1098 break;
1099 case USB_PORT_FEAT_POWER: 1099 case USB_PORT_FEAT_POWER:
1100 DBG("USB_PORT_FEAT_POWER\n"); 1100 DBG("USB_PORT_FEAT_POWER\n");
1101 spin_lock_irqsave(&isp116x->lock, flags); 1101 spin_lock_irqsave(&isp116x->lock, flags);
1102 isp116x_write_reg32(isp116x, wIndex 1102 isp116x_write_reg32(isp116x, wIndex
1103 ? HCRHPORT2 : HCRHPORT1, RH_PS_PPS); 1103 ? HCRHPORT2 : HCRHPORT1, RH_PS_PPS);
1104 spin_unlock_irqrestore(&isp116x->lock, flags);
1104 break; 1105 break;
1105 case USB_PORT_FEAT_RESET: 1106 case USB_PORT_FEAT_RESET:
1106 DBG("USB_PORT_FEAT_RESET\n"); 1107 DBG("USB_PORT_FEAT_RESET\n");
1107 root_port_reset(isp116x, wIndex); 1108 root_port_reset(isp116x, wIndex);
1108 spin_lock_irqsave(&isp116x->lock, flags);
1109 break; 1109 break;
1110 default: 1110 default:
1111 goto error; 1111 goto error;
1112 } 1112 }
1113 isp116x->rhport[wIndex] =
1114 isp116x_read_reg32(isp116x, wIndex ? HCRHPORT2 : HCRHPORT1);
1115 spin_unlock_irqrestore(&isp116x->lock, flags);
1116 break; 1113 break;
1117 1114
1118 default: 1115 default:
@@ -1687,14 +1684,18 @@ static int isp116x_resume(struct platform_device *dev)
1687 1684
1688#endif 1685#endif
1689 1686
1687/* work with hotplug and coldplug */
1688MODULE_ALIAS("platform:isp116x-hcd");
1689
1690static struct platform_driver isp116x_driver = { 1690static struct platform_driver isp116x_driver = {
1691 .probe = isp116x_probe, 1691 .probe = isp116x_probe,
1692 .remove = isp116x_remove, 1692 .remove = isp116x_remove,
1693 .suspend = isp116x_suspend, 1693 .suspend = isp116x_suspend,
1694 .resume = isp116x_resume, 1694 .resume = isp116x_resume,
1695 .driver = { 1695 .driver = {
1696 .name = (char *)hcd_name, 1696 .name = (char *)hcd_name,
1697 }, 1697 .owner = THIS_MODULE,
1698 },
1698}; 1699};
1699 1700
1700/*-----------------------------------------------------------------*/ 1701/*-----------------------------------------------------------------*/
diff --git a/drivers/usb/host/isp116x.h b/drivers/usb/host/isp116x.h
index b91e2edd9c5c..595b90a99848 100644
--- a/drivers/usb/host/isp116x.h
+++ b/drivers/usb/host/isp116x.h
@@ -270,7 +270,6 @@ struct isp116x {
270 u32 rhdesca; 270 u32 rhdesca;
271 u32 rhdescb; 271 u32 rhdescb;
272 u32 rhstatus; 272 u32 rhstatus;
273 u32 rhport[2];
274 273
275 /* async schedule: control, bulk */ 274 /* async schedule: control, bulk */
276 struct list_head async; 275 struct list_head async;
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 126fcbdd6408..d72dc07dda01 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -355,7 +355,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
355#define ohci_hcd_at91_drv_resume NULL 355#define ohci_hcd_at91_drv_resume NULL
356#endif 356#endif
357 357
358MODULE_ALIAS("at91_ohci"); 358MODULE_ALIAS("platform:at91_ohci");
359 359
360static struct platform_driver ohci_hcd_at91_driver = { 360static struct platform_driver ohci_hcd_at91_driver = {
361 .probe = ohci_hcd_at91_drv_probe, 361 .probe = ohci_hcd_at91_drv_probe,
@@ -368,4 +368,3 @@ static struct platform_driver ohci_hcd_at91_driver = {
368 .owner = THIS_MODULE, 368 .owner = THIS_MODULE,
369 }, 369 },
370}; 370};
371
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 663a0600b6e7..f90fe0c7373f 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -345,3 +345,4 @@ static struct platform_driver ohci_hcd_au1xxx_driver = {
345 }, 345 },
346}; 346};
347 347
348MODULE_ALIAS("platform:au1xxx-ohci");
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index a68ce9d3c525..156e93a9d0df 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -211,6 +211,8 @@ static struct platform_driver ohci_hcd_ep93xx_driver = {
211#endif 211#endif
212 .driver = { 212 .driver = {
213 .name = "ep93xx-ohci", 213 .name = "ep93xx-ohci",
214 .owner = THIS_MODULE,
214 }, 215 },
215}; 216};
216 217
218MODULE_ALIAS("platform:ep93xx-ohci");
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index dd4798ee028e..33f1c1c32edf 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -467,7 +467,7 @@ static void unlink_watchdog_func(unsigned long _ohci)
467out: 467out:
468 kfree(seen); 468 kfree(seen);
469 if (ohci->eds_scheduled) 469 if (ohci->eds_scheduled)
470 mod_timer(&ohci->unlink_watchdog, round_jiffies_relative(HZ)); 470 mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
471done: 471done:
472 spin_unlock_irqrestore(&ohci->lock, flags); 472 spin_unlock_irqrestore(&ohci->lock, flags);
473} 473}
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 4a043abd85ea..13c12ed22252 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -251,3 +251,4 @@ static struct platform_driver ohci_hcd_lh7a404_driver = {
251 }, 251 },
252}; 252};
253 253
254MODULE_ALIAS("platform:lh7a404-ohci");
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 74e1f4be10bb..7bfca1ed1b58 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -544,3 +544,4 @@ static struct platform_driver ohci_hcd_omap_driver = {
544 }, 544 },
545}; 545};
546 546
547MODULE_ALIAS("platform:ohci");
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 6c52c66b659f..28b458f20cc3 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -456,9 +456,13 @@ static int usb_hcd_pnx4008_remove(struct platform_device *pdev)
456 return 0; 456 return 0;
457} 457}
458 458
459/* work with hotplug and coldplug */
460MODULE_ALIAS("platform:usb-ohci");
461
459static struct platform_driver usb_hcd_pnx4008_driver = { 462static struct platform_driver usb_hcd_pnx4008_driver = {
460 .driver = { 463 .driver = {
461 .name = "usb-ohci", 464 .name = "usb-ohci",
465 .owner = THIS_MODULE,
462 }, 466 },
463 .probe = usb_hcd_pnx4008_probe, 467 .probe = usb_hcd_pnx4008_probe,
464 .remove = usb_hcd_pnx4008_remove, 468 .remove = usb_hcd_pnx4008_remove,
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
index 85fdfd2a7ad0..605d59cba28e 100644
--- a/drivers/usb/host/ohci-pnx8550.c
+++ b/drivers/usb/host/ohci-pnx8550.c
@@ -230,11 +230,12 @@ static int ohci_hcd_pnx8550_drv_remove(struct platform_device *pdev)
230 return 0; 230 return 0;
231} 231}
232 232
233MODULE_ALIAS("pnx8550-ohci"); 233MODULE_ALIAS("platform:pnx8550-ohci");
234 234
235static struct platform_driver ohci_hcd_pnx8550_driver = { 235static struct platform_driver ohci_hcd_pnx8550_driver = {
236 .driver = { 236 .driver = {
237 .name = "pnx8550-ohci", 237 .name = "pnx8550-ohci",
238 .owner = THIS_MODULE,
238 }, 239 },
239 .probe = ohci_hcd_pnx8550_drv_probe, 240 .probe = ohci_hcd_pnx8550_drv_probe,
240 .remove = ohci_hcd_pnx8550_drv_remove, 241 .remove = ohci_hcd_pnx8550_drv_remove,
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index f95be1896b0d..523c30125577 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -213,3 +213,4 @@ static struct platform_driver ohci_hcd_ppc_soc_driver = {
213 }, 213 },
214}; 214};
215 215
216MODULE_ALIAS("platform:ppc-soc-ohci");
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index ff9a79843471..8ad9b3b604b5 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -364,6 +364,8 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
364} 364}
365#endif 365#endif
366 366
367/* work with hotplug and coldplug */
368MODULE_ALIAS("platform:pxa27x-ohci");
367 369
368static struct platform_driver ohci_hcd_pxa27x_driver = { 370static struct platform_driver ohci_hcd_pxa27x_driver = {
369 .probe = ohci_hcd_pxa27x_drv_probe, 371 .probe = ohci_hcd_pxa27x_drv_probe,
@@ -375,6 +377,7 @@ static struct platform_driver ohci_hcd_pxa27x_driver = {
375#endif 377#endif
376 .driver = { 378 .driver = {
377 .name = "pxa27x-ohci", 379 .name = "pxa27x-ohci",
380 .owner = THIS_MODULE,
378 }, 381 },
379}; 382};
380 383
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index 51817322232b..9c9f3b59186f 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -169,7 +169,7 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
169 if (quirk_zfmicro(ohci) 169 if (quirk_zfmicro(ohci)
170 && (ed->type == PIPE_INTERRUPT) 170 && (ed->type == PIPE_INTERRUPT)
171 && !(ohci->eds_scheduled++)) 171 && !(ohci->eds_scheduled++))
172 mod_timer(&ohci->unlink_watchdog, round_jiffies_relative(HZ)); 172 mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
173 wmb (); 173 wmb ();
174 174
175 /* we care about rm_list when setting CLE/BLE in case the HC was at 175 /* we care about rm_list when setting CLE/BLE in case the HC was at
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 44b79e8a6e25..ead4772f0f27 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -501,3 +501,4 @@ static struct platform_driver ohci_hcd_s3c2410_driver = {
501 }, 501 },
502}; 502};
503 503
504MODULE_ALIAS("platform:s3c2410-ohci");
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
index 5309ac039e15..e7ee607278fe 100644
--- a/drivers/usb/host/ohci-sh.c
+++ b/drivers/usb/host/ohci-sh.c
@@ -141,3 +141,4 @@ static struct platform_driver ohci_hcd_sh_driver = {
141 }, 141 },
142}; 142};
143 143
144MODULE_ALIAS("platform:sh_ohci");
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index a97070142869..4ea92762fb28 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -262,3 +262,4 @@ static struct platform_driver ohci_hcd_sm501_driver = {
262 .name = "sm501-usb", 262 .name = "sm501-usb",
263 }, 263 },
264}; 264};
265MODULE_ALIAS("platform:sm501-usb");
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 0ce2fc5e396b..9f80e5285575 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -44,6 +44,7 @@
44MODULE_DESCRIPTION("R8A66597 USB Host Controller Driver"); 44MODULE_DESCRIPTION("R8A66597 USB Host Controller Driver");
45MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
46MODULE_AUTHOR("Yoshihiro Shimoda"); 46MODULE_AUTHOR("Yoshihiro Shimoda");
47MODULE_ALIAS("platform:r8a66597_hcd");
47 48
48#define DRIVER_VERSION "29 May 2007" 49#define DRIVER_VERSION "29 May 2007"
49 50
@@ -2219,6 +2220,7 @@ static struct platform_driver r8a66597_driver = {
2219 .resume = r8a66597_resume, 2220 .resume = r8a66597_resume,
2220 .driver = { 2221 .driver = {
2221 .name = (char *) hcd_name, 2222 .name = (char *) hcd_name,
2223 .owner = THIS_MODULE,
2222 }, 2224 },
2223}; 2225};
2224 2226
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index ba370c56172c..629bca0ebe8f 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -58,6 +58,7 @@
58 58
59MODULE_DESCRIPTION("SL811HS USB Host Controller Driver"); 59MODULE_DESCRIPTION("SL811HS USB Host Controller Driver");
60MODULE_LICENSE("GPL"); 60MODULE_LICENSE("GPL");
61MODULE_ALIAS("platform:sl811-hcd");
61 62
62#define DRIVER_VERSION "19 May 2005" 63#define DRIVER_VERSION "19 May 2005"
63 64
@@ -1766,6 +1767,7 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state)
1766 retval = sl811h_bus_suspend(hcd); 1767 retval = sl811h_bus_suspend(hcd);
1767 break; 1768 break;
1768 case PM_EVENT_SUSPEND: 1769 case PM_EVENT_SUSPEND:
1770 case PM_EVENT_HIBERNATE:
1769 case PM_EVENT_PRETHAW: /* explicitly discard hw state */ 1771 case PM_EVENT_PRETHAW: /* explicitly discard hw state */
1770 port_power(sl811, 0); 1772 port_power(sl811, 0);
1771 break; 1773 break;
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index ac283b09a63f..8e117a795e93 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -3213,15 +3213,20 @@ static int u132_suspend(struct platform_device *pdev, pm_message_t state)
3213 dev_err(&u132->platform_dev->dev, "device is being removed\n"); 3213 dev_err(&u132->platform_dev->dev, "device is being removed\n");
3214 return -ESHUTDOWN; 3214 return -ESHUTDOWN;
3215 } else { 3215 } else {
3216 int retval = 0; 3216 int retval = 0, ports;
3217 if (state.event == PM_EVENT_FREEZE) { 3217
3218 switch (state.event) {
3219 case PM_EVENT_FREEZE:
3218 retval = u132_bus_suspend(hcd); 3220 retval = u132_bus_suspend(hcd);
3219 } else if (state.event == PM_EVENT_SUSPEND) { 3221 break;
3220 int ports = MAX_U132_PORTS; 3222 case PM_EVENT_SUSPEND:
3223 case PM_EVENT_HIBERNATE:
3224 ports = MAX_U132_PORTS;
3221 while (ports-- > 0) { 3225 while (ports-- > 0) {
3222 port_power(u132, ports, 0); 3226 port_power(u132, ports, 0);
3223 } 3227 }
3224 } 3228 break;
3229 }
3225 if (retval == 0) 3230 if (retval == 0)
3226 pdev->dev.power.power_state = state; 3231 pdev->dev.power.power_state = state;
3227 return retval; 3232 return retval;
@@ -3311,3 +3316,4 @@ static void __exit u132_hcd_exit(void)
3311 3316
3312module_exit(u132_hcd_exit); 3317module_exit(u132_hcd_exit);
3313MODULE_LICENSE("GPL"); 3318MODULE_LICENSE("GPL");
3319MODULE_ALIAS("platform:u132_hcd");
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 1cb56f2d5c84..a5e4c3545c72 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -29,7 +29,6 @@
29#include <linux/timer.h> 29#include <linux/timer.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <asm/atomic.h> 31#include <asm/atomic.h>
32#include <asm/semaphore.h>
33 32
34#define APPLE_VENDOR_ID 0x05AC 33#define APPLE_VENDOR_ID 0x05AC
35 34
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 8208496dfc63..c730d20eec66 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -61,6 +61,7 @@
61#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 61#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002
62#define USB_DEVICE_ID_VERNIER_SKIP 0x0003 62#define USB_DEVICE_ID_VERNIER_SKIP 0x0003
63#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 63#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
64#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
64 65
65#define USB_VENDOR_ID_MICROCHIP 0x04d8 66#define USB_VENDOR_ID_MICROCHIP 0x04d8
66#define USB_DEVICE_ID_PICDEM 0x000c 67#define USB_DEVICE_ID_PICDEM 0x000c
@@ -92,6 +93,7 @@ static struct usb_device_id ld_usb_table [] = {
92 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 93 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
93 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, 94 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) },
94 { USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) }, 95 { USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) },
96 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) },
95 { } /* Terminating entry */ 97 { } /* Terminating entry */
96}; 98};
97MODULE_DEVICE_TABLE(usb, ld_usb_table); 99MODULE_DEVICE_TABLE(usb, ld_usb_table);
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index 67e2fc20eeeb..03368edf3f22 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -59,13 +59,14 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
59{ 59{
60 struct usb_interface *intf = to_usb_interface(dev); 60 struct usb_interface *intf = to_usb_interface(dev);
61 struct trancevibrator *tv = usb_get_intfdata(intf); 61 struct trancevibrator *tv = usb_get_intfdata(intf);
62 int temp, retval; 62 int temp, retval, old;
63 63
64 temp = simple_strtoul(buf, NULL, 10); 64 temp = simple_strtoul(buf, NULL, 10);
65 if (temp > 255) 65 if (temp > 255)
66 temp = 255; 66 temp = 255;
67 else if (temp < 0) 67 else if (temp < 0)
68 temp = 0; 68 temp = 0;
69 old = tv->speed;
69 tv->speed = temp; 70 tv->speed = temp;
70 71
71 dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed); 72 dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed);
@@ -77,6 +78,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
77 tv->speed, /* speed value */ 78 tv->speed, /* speed value */
78 0, NULL, 0, USB_CTRL_GET_TIMEOUT); 79 0, NULL, 0, USB_CTRL_GET_TIMEOUT);
79 if (retval) { 80 if (retval) {
81 tv->speed = old;
80 dev_dbg(&tv->udev->dev, "retval = %d\n", retval); 82 dev_dbg(&tv->udev->dev, "retval = %d\n", retval);
81 return retval; 83 return retval;
82 } 84 }
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index da922dfc0dcc..b6b5b2affad1 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -378,6 +378,7 @@ alloc_sglist (int nents, int max, int vary)
378 sg = kmalloc (nents * sizeof *sg, GFP_KERNEL); 378 sg = kmalloc (nents * sizeof *sg, GFP_KERNEL);
379 if (!sg) 379 if (!sg)
380 return NULL; 380 return NULL;
381 sg_init_table(sg, nents);
381 382
382 for (i = 0; i < nents; i++) { 383 for (i = 0; i < nents; i++) {
383 char *buf; 384 char *buf;
@@ -390,7 +391,7 @@ alloc_sglist (int nents, int max, int vary)
390 } 391 }
391 392
392 /* kmalloc pages are always physically contiguous! */ 393 /* kmalloc pages are always physically contiguous! */
393 sg_init_one(&sg[i], buf, size); 394 sg_set_buf(&sg[i], buf, size);
394 395
395 switch (pattern) { 396 switch (pattern) {
396 case 0: 397 case 0:
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index f3ca66017a03..324bb61d68ff 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -75,6 +75,7 @@ static struct usb_device_id id_table [] = {
75 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ 75 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
76 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ 76 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
77 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 77 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
78 { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
78 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 79 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
79 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 80 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
80 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ 81 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 08c65c1a3771..779d07851a4d 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -94,6 +94,7 @@ static struct usb_device_id id_table_earthmate [] = {
94 94
95static struct usb_device_id id_table_cyphidcomrs232 [] = { 95static struct usb_device_id id_table_cyphidcomrs232 [] = {
96 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 96 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
97 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
97 { } /* Terminating entry */ 98 { } /* Terminating entry */
98}; 99};
99 100
@@ -106,6 +107,7 @@ static struct usb_device_id id_table_combined [] = {
106 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, 107 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) },
107 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, 108 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) },
108 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 109 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
110 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
109 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, 111 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) },
110 { } /* Terminating entry */ 112 { } /* Terminating entry */
111}; 113};
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
index e1c7c27e18b7..0388065bb794 100644
--- a/drivers/usb/serial/cypress_m8.h
+++ b/drivers/usb/serial/cypress_m8.h
@@ -19,6 +19,10 @@
19#define VENDOR_ID_CYPRESS 0x04b4 19#define VENDOR_ID_CYPRESS 0x04b4
20#define PRODUCT_ID_CYPHIDCOM 0x5500 20#define PRODUCT_ID_CYPHIDCOM 0x5500
21 21
22/* Powercom UPS, chip CY7C63723 */
23#define VENDOR_ID_POWERCOM 0x0d9f
24#define PRODUCT_ID_UPS 0x0002
25
22/* Nokia CA-42 USB to serial cable */ 26/* Nokia CA-42 USB to serial cable */
23#define VENDOR_ID_DAZZLE 0x07d0 27#define VENDOR_ID_DAZZLE 0x07d0
24#define PRODUCT_ID_CA42 0x4101 28#define PRODUCT_ID_CA42 0x4101
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 90dcc625f70d..3abb3c863647 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -92,6 +92,7 @@ struct ftdi_sio_quirk {
92}; 92};
93 93
94static int ftdi_jtag_probe (struct usb_serial *serial); 94static int ftdi_jtag_probe (struct usb_serial *serial);
95static int ftdi_mtxorb_hack_setup (struct usb_serial *serial);
95static void ftdi_USB_UIRT_setup (struct ftdi_private *priv); 96static void ftdi_USB_UIRT_setup (struct ftdi_private *priv);
96static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv); 97static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv);
97 98
@@ -99,6 +100,10 @@ static struct ftdi_sio_quirk ftdi_jtag_quirk = {
99 .probe = ftdi_jtag_probe, 100 .probe = ftdi_jtag_probe,
100}; 101};
101 102
103static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = {
104 .probe = ftdi_mtxorb_hack_setup,
105};
106
102static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { 107static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
103 .port_probe = ftdi_USB_UIRT_setup, 108 .port_probe = ftdi_USB_UIRT_setup,
104}; 109};
@@ -161,6 +166,8 @@ static struct usb_device_id id_table_combined [] = {
161 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, 166 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) },
162 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 167 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
163 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 168 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
169 { USB_DEVICE(MTXORB_VK_VID, MTXORB_VK_PID),
170 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
164 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 171 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
165 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 172 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
166 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, 173 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
@@ -274,6 +281,7 @@ static struct usb_device_id id_table_combined [] = {
274 { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) }, 281 { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) },
275 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, 282 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) },
276 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, 283 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
284 { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
277 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, 285 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
278 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, 286 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
279 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, 287 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
@@ -351,6 +359,7 @@ static struct usb_device_id id_table_combined [] = {
351 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 359 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
352 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 360 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
353 { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, 361 { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) },
362 { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) },
354 { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), 363 { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
355 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 364 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
356 { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), 365 { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
@@ -393,8 +402,8 @@ static const char *ftdi_chip_name[] = {
393#define FTDI_STATUS_B1_MASK (FTDI_RS_BI) 402#define FTDI_STATUS_B1_MASK (FTDI_RS_BI)
394/* End TIOCMIWAIT */ 403/* End TIOCMIWAIT */
395 404
396#define FTDI_IMPL_ASYNC_FLAGS = ( ASYNC_SPD_HI | ASYNC_SPD_VHI \ 405#define FTDI_IMPL_ASYNC_FLAGS = (ASYNC_SPD_HI | ASYNC_SPD_VHI \
397 ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP ) 406 | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP)
398 407
399/* function prototypes for a FTDI serial converter */ 408/* function prototypes for a FTDI serial converter */
400static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); 409static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id);
@@ -1088,6 +1097,23 @@ static int ftdi_jtag_probe(struct usb_serial *serial)
1088 return 0; 1097 return 0;
1089} 1098}
1090 1099
1100/*
1101 * The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
1102 * We have to correct it if we want to read from it.
1103 */
1104static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
1105{
1106 struct usb_host_endpoint *ep = serial->dev->ep_in[1];
1107 struct usb_endpoint_descriptor *ep_desc = &ep->desc;
1108
1109 if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
1110 ep_desc->wMaxPacketSize = 0x40;
1111 info("Fixing invalid wMaxPacketSize on read pipe");
1112 }
1113
1114 return 0;
1115}
1116
1091/* ftdi_shutdown is called from usbserial:usb_serial_disconnect 1117/* ftdi_shutdown is called from usbserial:usb_serial_disconnect
1092 * it is called when the usb device is disconnected 1118 * it is called when the usb device is disconnected
1093 * 1119 *
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 6eee2ab914ec..6da539ede0ee 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -102,6 +102,13 @@
102 * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */ 102 * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */
103#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ 103#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */
104 104
105/*
106 * The following are the values for the Matrix Orbital VK204-25-USB
107 * display, which use the FT232RL.
108 */
109#define MTXORB_VK_VID 0x1b3d
110#define MTXORB_VK_PID 0x0158
111
105/* Interbiometrics USB I/O Board */ 112/* Interbiometrics USB I/O Board */
106/* Developed for Interbiometrics by Rudolf Gugler */ 113/* Developed for Interbiometrics by Rudolf Gugler */
107#define INTERBIOMETRICS_VID 0x1209 114#define INTERBIOMETRICS_VID 0x1209
@@ -550,6 +557,9 @@
550#define TML_VID 0x1B91 /* Vendor ID */ 557#define TML_VID 0x1B91 /* Vendor ID */
551#define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ 558#define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */
552 559
560/* Propox devices */
561#define FTDI_PROPOX_JTAGCABLEII_PID 0xD738
562
553/* Commands */ 563/* Commands */
554#define FTDI_SIO_RESET 0 /* Reset the port */ 564#define FTDI_SIO_RESET 0 /* Reset the port */
555#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 565#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 97fa3c428435..7cfce9dabb90 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -323,7 +323,7 @@ static void flush_and_resubmit_read_urb (struct usb_serial_port *port)
323 room = tty_buffer_request_room(tty, urb->actual_length); 323 room = tty_buffer_request_room(tty, urb->actual_length);
324 if (room) { 324 if (room) {
325 tty_insert_flip_string(tty, urb->transfer_buffer, room); 325 tty_insert_flip_string(tty, urb->transfer_buffer, room);
326 tty_flip_buffer_push(tty); /* is this allowed from an URB callback ? */ 326 tty_flip_buffer_push(tty);
327 } 327 }
328 } 328 }
329 329
@@ -349,10 +349,12 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb)
349 349
350 /* Throttle the device if requested by tty */ 350 /* Throttle the device if requested by tty */
351 spin_lock_irqsave(&port->lock, flags); 351 spin_lock_irqsave(&port->lock, flags);
352 if (!(port->throttled = port->throttle_req)) 352 if (!(port->throttled = port->throttle_req)) {
353 /* Handle data and continue reading from device */ 353 spin_unlock_irqrestore(&port->lock, flags);
354 flush_and_resubmit_read_urb(port); 354 flush_and_resubmit_read_urb(port);
355 spin_unlock_irqrestore(&port->lock, flags); 355 } else {
356 spin_unlock_irqrestore(&port->lock, flags);
357 }
356} 358}
357EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); 359EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback);
358 360
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index cd3405953f74..e5ea5ef6335d 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -38,7 +38,6 @@
38#include <linux/serial.h> 38#include <linux/serial.h>
39#include <linux/ioctl.h> 39#include <linux/ioctl.h>
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/semaphore.h>
42#include <linux/usb.h> 41#include <linux/usb.h>
43#include <linux/usb/serial.h> 42#include <linux/usb/serial.h>
44 43
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index 8a0d17401529..74ce8bca3e66 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -637,6 +637,7 @@ static struct usb_serial_driver keyspan_pre_device = {
637 .description = "Keyspan - (without firmware)", 637 .description = "Keyspan - (without firmware)",
638 .id_table = keyspan_pre_ids, 638 .id_table = keyspan_pre_ids,
639 .num_interrupt_in = NUM_DONT_CARE, 639 .num_interrupt_in = NUM_DONT_CARE,
640 .num_interrupt_out = NUM_DONT_CARE,
640 .num_bulk_in = NUM_DONT_CARE, 641 .num_bulk_in = NUM_DONT_CARE,
641 .num_bulk_out = NUM_DONT_CARE, 642 .num_bulk_out = NUM_DONT_CARE,
642 .num_ports = 1, 643 .num_ports = 1,
@@ -651,6 +652,7 @@ static struct usb_serial_driver keyspan_1port_device = {
651 .description = "Keyspan 1 port adapter", 652 .description = "Keyspan 1 port adapter",
652 .id_table = keyspan_1port_ids, 653 .id_table = keyspan_1port_ids,
653 .num_interrupt_in = NUM_DONT_CARE, 654 .num_interrupt_in = NUM_DONT_CARE,
655 .num_interrupt_out = NUM_DONT_CARE,
654 .num_bulk_in = NUM_DONT_CARE, 656 .num_bulk_in = NUM_DONT_CARE,
655 .num_bulk_out = NUM_DONT_CARE, 657 .num_bulk_out = NUM_DONT_CARE,
656 .num_ports = 1, 658 .num_ports = 1,
@@ -678,6 +680,7 @@ static struct usb_serial_driver keyspan_2port_device = {
678 .description = "Keyspan 2 port adapter", 680 .description = "Keyspan 2 port adapter",
679 .id_table = keyspan_2port_ids, 681 .id_table = keyspan_2port_ids,
680 .num_interrupt_in = NUM_DONT_CARE, 682 .num_interrupt_in = NUM_DONT_CARE,
683 .num_interrupt_out = NUM_DONT_CARE,
681 .num_bulk_in = NUM_DONT_CARE, 684 .num_bulk_in = NUM_DONT_CARE,
682 .num_bulk_out = NUM_DONT_CARE, 685 .num_bulk_out = NUM_DONT_CARE,
683 .num_ports = 2, 686 .num_ports = 2,
@@ -705,6 +708,7 @@ static struct usb_serial_driver keyspan_4port_device = {
705 .description = "Keyspan 4 port adapter", 708 .description = "Keyspan 4 port adapter",
706 .id_table = keyspan_4port_ids, 709 .id_table = keyspan_4port_ids,
707 .num_interrupt_in = NUM_DONT_CARE, 710 .num_interrupt_in = NUM_DONT_CARE,
711 .num_interrupt_out = NUM_DONT_CARE,
708 .num_bulk_in = NUM_DONT_CARE, 712 .num_bulk_in = NUM_DONT_CARE,
709 .num_bulk_out = NUM_DONT_CARE, 713 .num_bulk_out = NUM_DONT_CARE,
710 .num_ports = 4, 714 .num_ports = 4,
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 869ecd374cb4..aeeb9cb20999 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -110,11 +110,20 @@
110 110
111/* vendor id and device id defines */ 111/* vendor id and device id defines */
112 112
113/* The native mos7840/7820 component */
113#define USB_VENDOR_ID_MOSCHIP 0x9710 114#define USB_VENDOR_ID_MOSCHIP 0x9710
114#define MOSCHIP_DEVICE_ID_7840 0x7840 115#define MOSCHIP_DEVICE_ID_7840 0x7840
115#define MOSCHIP_DEVICE_ID_7820 0x7820 116#define MOSCHIP_DEVICE_ID_7820 0x7820
117/* The native component can have its vendor/device id's overridden
118 * in vendor-specific implementations. Such devices can be handled
119 * by making a change here, in moschip_port_id_table, and in
120 * moschip_id_table_combined
121 */
122#define USB_VENDOR_ID_BANDB 0x0856
123#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44
124#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42
116 125
117/* Interrupt Rotinue Defines */ 126/* Interrupt Routine Defines */
118 127
119#define SERIAL_IIR_RLS 0x06 128#define SERIAL_IIR_RLS 0x06
120#define SERIAL_IIR_MS 0x00 129#define SERIAL_IIR_MS 0x00
@@ -159,12 +168,16 @@
159static struct usb_device_id moschip_port_id_table[] = { 168static struct usb_device_id moschip_port_id_table[] = {
160 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, 169 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
161 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, 170 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
171 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
172 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
162 {} /* terminating entry */ 173 {} /* terminating entry */
163}; 174};
164 175
165static __devinitdata struct usb_device_id moschip_id_table_combined[] = { 176static __devinitdata struct usb_device_id moschip_id_table_combined[] = {
166 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, 177 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
167 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, 178 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
179 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
180 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
168 {} /* terminating entry */ 181 {} /* terminating entry */
169}; 182};
170 183
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 5e8bf1bc1e50..d101025a4c63 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -109,18 +109,92 @@ static int option_send_setup(struct usb_serial_port *port);
109#define HUAWEI_PRODUCT_E600 0x1001 109#define HUAWEI_PRODUCT_E600 0x1001
110#define HUAWEI_PRODUCT_E220 0x1003 110#define HUAWEI_PRODUCT_E220 0x1003
111#define HUAWEI_PRODUCT_E220BIS 0x1004 111#define HUAWEI_PRODUCT_E220BIS 0x1004
112#define HUAWEI_PRODUCT_E1401 0x1401
113#define HUAWEI_PRODUCT_E1403 0x1403
114#define HUAWEI_PRODUCT_E1405 0x1405
115#define HUAWEI_PRODUCT_E1406 0x1406
116#define HUAWEI_PRODUCT_E1408 0x1408
117#define HUAWEI_PRODUCT_E1409 0x1409
118#define HUAWEI_PRODUCT_E1410 0x1410
119#define HUAWEI_PRODUCT_E1411 0x1411
120#define HUAWEI_PRODUCT_E1412 0x1412
121#define HUAWEI_PRODUCT_E1413 0x1413
122#define HUAWEI_PRODUCT_E1414 0x1414
123#define HUAWEI_PRODUCT_E1415 0x1415
124#define HUAWEI_PRODUCT_E1416 0x1416
125#define HUAWEI_PRODUCT_E1417 0x1417
126#define HUAWEI_PRODUCT_E1418 0x1418
127#define HUAWEI_PRODUCT_E1419 0x1419
112 128
113#define NOVATELWIRELESS_VENDOR_ID 0x1410 129#define NOVATELWIRELESS_VENDOR_ID 0x1410
130
131/* MERLIN EVDO PRODUCTS */
132#define NOVATELWIRELESS_PRODUCT_V640 0x1100
133#define NOVATELWIRELESS_PRODUCT_V620 0x1110
134#define NOVATELWIRELESS_PRODUCT_V740 0x1120
135#define NOVATELWIRELESS_PRODUCT_V720 0x1130
136
137/* MERLIN HSDPA/HSPA PRODUCTS */
138#define NOVATELWIRELESS_PRODUCT_U730 0x1400
139#define NOVATELWIRELESS_PRODUCT_U740 0x1410
140#define NOVATELWIRELESS_PRODUCT_U870 0x1420
141#define NOVATELWIRELESS_PRODUCT_XU870 0x1430
142#define NOVATELWIRELESS_PRODUCT_X950D 0x1450
143
144/* EXPEDITE PRODUCTS */
145#define NOVATELWIRELESS_PRODUCT_EV620 0x2100
146#define NOVATELWIRELESS_PRODUCT_ES720 0x2110
147#define NOVATELWIRELESS_PRODUCT_E725 0x2120
148#define NOVATELWIRELESS_PRODUCT_ES620 0x2130
149#define NOVATELWIRELESS_PRODUCT_EU730 0x2400
150#define NOVATELWIRELESS_PRODUCT_EU740 0x2410
151#define NOVATELWIRELESS_PRODUCT_EU870D 0x2420
152
153/* OVATION PRODUCTS */
154#define NOVATELWIRELESS_PRODUCT_MC727 0x4100
155#define NOVATELWIRELESS_PRODUCT_MC950D 0x4400
156
157#define NOVATELWIRELESS_PRODUCT_U727 0x5010
158
159/* FUTURE NOVATEL PRODUCTS */
160#define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000
161#define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000
162#define NOVATELWIRELESS_PRODUCT_EMBEDDED_1 0x8000
163#define NOVATELWIRELESS_PRODUCT_GLOBAL_1 0x9000
164#define NOVATELWIRELESS_PRODUCT_EVDO_2 0x6001
165#define NOVATELWIRELESS_PRODUCT_HSPA_2 0x7001
166#define NOVATELWIRELESS_PRODUCT_EMBEDDED_2 0x8001
167#define NOVATELWIRELESS_PRODUCT_GLOBAL_2 0x9001
168
169/* AMOI PRODUCTS */
170#define AMOI_VENDOR_ID 0x1614
171#define AMOI_PRODUCT_H01 0x0800
172#define AMOI_PRODUCT_H01A 0x7002
173#define AMOI_PRODUCT_H02 0x0802
174
114#define DELL_VENDOR_ID 0x413C 175#define DELL_VENDOR_ID 0x413C
115 176
177#define KYOCERA_VENDOR_ID 0x0c88
178#define KYOCERA_PRODUCT_KPC680 0x180a
179
116#define ANYDATA_VENDOR_ID 0x16d5 180#define ANYDATA_VENDOR_ID 0x16d5
117#define ANYDATA_PRODUCT_ADU_E100A 0x6501 181#define ANYDATA_PRODUCT_ADU_E100A 0x6501
118#define ANYDATA_PRODUCT_ADU_500A 0x6502 182#define ANYDATA_PRODUCT_ADU_500A 0x6502
119 183
184#define AXESSTEL_VENDOR_ID 0x1726
185#define AXESSTEL_PRODUCT_MV110H 0x1000
186
120#define BANDRICH_VENDOR_ID 0x1A8D 187#define BANDRICH_VENDOR_ID 0x1A8D
121#define BANDRICH_PRODUCT_C100_1 0x1002 188#define BANDRICH_PRODUCT_C100_1 0x1002
122#define BANDRICH_PRODUCT_C100_2 0x1003 189#define BANDRICH_PRODUCT_C100_2 0x1003
123 190
191#define AMOI_VENDOR_ID 0x1614
192#define AMOI_PRODUCT_9508 0x0800
193
194#define QUALCOMM_VENDOR_ID 0x05C6
195
196#define MAXON_VENDOR_ID 0x16d8
197
124static struct usb_device_id option_ids[] = { 198static struct usb_device_id option_ids[] = {
125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 199 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
126 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 200 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -160,32 +234,73 @@ static struct usb_device_id option_ids[] = {
160 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 234 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
161 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, 235 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
162 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, 236 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
163 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1100) }, /* Novatel Merlin XS620/S640 */ 237 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401) },
164 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1110) }, /* Novatel Merlin S620 */ 238 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403) },
165 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1120) }, /* Novatel Merlin EX720 */ 239 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405) },
166 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1130) }, /* Novatel Merlin S720 */ 240 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406) },
167 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1400) }, /* Novatel U730 */ 241 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408) },
168 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1410) }, /* Novatel U740 */ 242 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409) },
169 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1420) }, /* Novatel EU870 */ 243 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410) },
170 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */ 244 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411) },
171 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2100) }, /* Novatel EV620 CDMA/EV-DO */ 245 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412) },
172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ 246 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413) },
173 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ 247 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414) },
174 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ 248 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415) },
175 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4100) }, /* Novatel U727 */ 249 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416) },
176 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4400) }, /* Novatel MC950 */ 250 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417) },
251 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418) },
252 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419) },
253 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
254 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */
255 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */
256 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, /* Novatel Merlin EX720/V740/X720 */
257 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V720) }, /* Novatel Merlin V720/S720/PC720 */
258 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U730) }, /* Novatel U730/U740 (VF version) */
259 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U740) }, /* Novatel U740 */
260 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U870) }, /* Novatel U870 */
261 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_XU870) }, /* Novatel Merlin XU870 HSDPA/3G */
262 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_X950D) }, /* Novatel X950D */
263 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, /* Novatel EV620/ES620 CDMA/EV-DO */
264 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, /* Novatel ES620/ES720/U720/USB720 */
265 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, /* Novatel E725/E726 */
266 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES620) }, /* Novatel Merlin ES620 SM Bus */
267 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, /* Novatel EU730 and Vodafone EU740 */
268 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, /* Novatel non-Vodafone EU740 */
269 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */
270 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */
271 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */
272 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel U727 */
273 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */
274 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */
275 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */
276 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_1) }, /* Novatel Global product */
277 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_2) }, /* Novatel EVDO product */
278 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_2) }, /* Novatel HSPA product */
279 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */
280 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */
281
282 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
283 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
284 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) },
285
177 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ 286 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
178 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 287 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
179 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 288 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
180 { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */ 289 { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
181 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */ 290 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
182 { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */ 291 { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
292 { USB_DEVICE(DELL_VENDOR_ID, 0x8129) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite ET620 CDMA/EV-DO */
293 { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
183 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */ 294 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
184 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */ 295 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
185 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 296 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
186 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 297 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
298 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
187 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, 299 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) },
188 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, 300 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
301 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
302 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
303 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
189 { } /* Terminating entry */ 304 { } /* Terminating entry */
190}; 305};
191MODULE_DEVICE_TABLE(usb, option_ids); 306MODULE_DEVICE_TABLE(usb, option_ids);
@@ -247,10 +362,10 @@ static int debug;
247struct option_port_private { 362struct option_port_private {
248 /* Input endpoints and buffer for this port */ 363 /* Input endpoints and buffer for this port */
249 struct urb *in_urbs[N_IN_URB]; 364 struct urb *in_urbs[N_IN_URB];
250 char in_buffer[N_IN_URB][IN_BUFLEN]; 365 u8 *in_buffer[N_IN_URB];
251 /* Output endpoints and buffer for this port */ 366 /* Output endpoints and buffer for this port */
252 struct urb *out_urbs[N_OUT_URB]; 367 struct urb *out_urbs[N_OUT_URB];
253 char out_buffer[N_OUT_URB][OUT_BUFLEN]; 368 u8 *out_buffer[N_OUT_URB];
254 unsigned long out_busy; /* Bit vector of URBs in use */ 369 unsigned long out_busy; /* Bit vector of URBs in use */
255 370
256 /* Settings for the port */ 371 /* Settings for the port */
@@ -737,9 +852,10 @@ static int option_send_setup(struct usb_serial_port *port)
737 852
738static int option_startup(struct usb_serial *serial) 853static int option_startup(struct usb_serial *serial)
739{ 854{
740 int i, err; 855 int i, j, err;
741 struct usb_serial_port *port; 856 struct usb_serial_port *port;
742 struct option_port_private *portdata; 857 struct option_port_private *portdata;
858 u8 *buffer;
743 859
744 dbg("%s", __FUNCTION__); 860 dbg("%s", __FUNCTION__);
745 861
@@ -753,6 +869,20 @@ static int option_startup(struct usb_serial *serial)
753 return (1); 869 return (1);
754 } 870 }
755 871
872 for (j = 0; j < N_IN_URB; j++) {
873 buffer = (u8 *)__get_free_page(GFP_KERNEL);
874 if (!buffer)
875 goto bail_out_error;
876 portdata->in_buffer[j] = buffer;
877 }
878
879 for (j = 0; j < N_OUT_URB; j++) {
880 buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
881 if (!buffer)
882 goto bail_out_error2;
883 portdata->out_buffer[j] = buffer;
884 }
885
756 usb_set_serial_port_data(port, portdata); 886 usb_set_serial_port_data(port, portdata);
757 887
758 if (! port->interrupt_in_urb) 888 if (! port->interrupt_in_urb)
@@ -766,6 +896,16 @@ static int option_startup(struct usb_serial *serial)
766 option_setup_urbs(serial); 896 option_setup_urbs(serial);
767 897
768 return (0); 898 return (0);
899
900bail_out_error2:
901 for (j = 0; j < N_OUT_URB; j++)
902 kfree(portdata->out_buffer[j]);
903bail_out_error:
904 for (j = 0; j < N_IN_URB; j++)
905 if (portdata->in_buffer[j])
906 free_page((unsigned long)portdata->in_buffer[j]);
907 kfree(portdata);
908 return 1;
769} 909}
770 910
771static void option_shutdown(struct usb_serial *serial) 911static void option_shutdown(struct usb_serial *serial)
@@ -794,12 +934,14 @@ static void option_shutdown(struct usb_serial *serial)
794 for (j = 0; j < N_IN_URB; j++) { 934 for (j = 0; j < N_IN_URB; j++) {
795 if (portdata->in_urbs[j]) { 935 if (portdata->in_urbs[j]) {
796 usb_free_urb(portdata->in_urbs[j]); 936 usb_free_urb(portdata->in_urbs[j]);
937 free_page((unsigned long)portdata->in_buffer[j]);
797 portdata->in_urbs[j] = NULL; 938 portdata->in_urbs[j] = NULL;
798 } 939 }
799 } 940 }
800 for (j = 0; j < N_OUT_URB; j++) { 941 for (j = 0; j < N_OUT_URB; j++) {
801 if (portdata->out_urbs[j]) { 942 if (portdata->out_urbs[j]) {
802 usb_free_urb(portdata->out_urbs[j]); 943 usb_free_urb(portdata->out_urbs[j]);
944 kfree(portdata->out_buffer[j]);
803 portdata->out_urbs[j] = NULL; 945 portdata->out_urbs[j] = NULL;
804 } 946 }
805 } 947 }
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index ae3ec1a64008..2af778555bdc 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -55,6 +55,7 @@ static struct usb_device_id id_table [] = {
55 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, 55 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) },
56 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, 56 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) },
57 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, 57 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) },
58 { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) },
58 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 59 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
59 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, 60 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
60 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 61 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 237a41f6638a..10cf872e5ecb 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -13,6 +13,7 @@
13#define PL2303_PRODUCT_ID_DCU11 0x1234 13#define PL2303_PRODUCT_ID_DCU11 0x1234
14#define PL2303_PRODUCT_ID_PHAROS 0xaaa0 14#define PL2303_PRODUCT_ID_PHAROS 0xaaa0
15#define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 15#define PL2303_PRODUCT_ID_RSAQ3 0xaaa2
16#define PL2303_PRODUCT_ID_ALDIGA 0x0611
16 17
17#define ATEN_VENDOR_ID 0x0557 18#define ATEN_VENDOR_ID 0x0557
18#define ATEN_VENDOR_ID2 0x0547 19#define ATEN_VENDOR_ID2 0x0547
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 4c925e3e8a63..ed678811e6a6 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -14,7 +14,7 @@
14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> 14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
15*/ 15*/
16 16
17#define DRIVER_VERSION "v.1.2.7" 17#define DRIVER_VERSION "v.1.2.8"
18#define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" 18#define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>"
19#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" 19#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
20 20
@@ -163,6 +163,7 @@ static struct usb_device_id id_table [] = {
163 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ 163 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
164 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ 164 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
165 { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ 165 { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
166 { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */
166 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ 167 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
167 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ 168 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
168 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ 169 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
@@ -178,7 +179,6 @@ static struct usb_device_id id_table [] = {
178 179
179 { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless AirCard 580 */ 180 { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless AirCard 580 */
180 { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* Airprime/Sierra PC 5220 */ 181 { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* Airprime/Sierra PC 5220 */
181 { USB_DEVICE(0x05C6, 0x6613), .driver_info = DEVICE_1_PORT }, /* Onda H600/ZTE MF330 */
182 182
183 { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER}, 183 { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER},
184 { } 184 { }
@@ -197,9 +197,9 @@ struct sierra_port_private {
197 spinlock_t lock; /* lock the structure */ 197 spinlock_t lock; /* lock the structure */
198 int outstanding_urbs; /* number of out urbs in flight */ 198 int outstanding_urbs; /* number of out urbs in flight */
199 199
200 /* Input endpoints and buffer for this port */ 200 /* Input endpoints and buffers for this port */
201 struct urb *in_urbs[N_IN_URB]; 201 struct urb *in_urbs[N_IN_URB];
202 char in_buffer[N_IN_URB][IN_BUFLEN]; 202 char *in_buffer[N_IN_URB];
203 203
204 /* Settings for the port */ 204 /* Settings for the port */
205 int rts_state; /* Handshaking pins (outputs) */ 205 int rts_state; /* Handshaking pins (outputs) */
@@ -639,6 +639,15 @@ static int sierra_startup(struct usb_serial *serial)
639 return -ENOMEM; 639 return -ENOMEM;
640 } 640 }
641 spin_lock_init(&portdata->lock); 641 spin_lock_init(&portdata->lock);
642 for (j = 0; j < N_IN_URB; j++) {
643 portdata->in_buffer[j] = kmalloc(IN_BUFLEN, GFP_KERNEL);
644 if (!portdata->in_buffer[j]) {
645 for (--j; j >= 0; j--)
646 kfree(portdata->in_buffer[j]);
647 kfree(portdata);
648 return -ENOMEM;
649 }
650 }
642 651
643 usb_set_serial_port_data(port, portdata); 652 usb_set_serial_port_data(port, portdata);
644 653
@@ -682,7 +691,7 @@ static void sierra_shutdown(struct usb_serial *serial)
682 for (j = 0; j < N_IN_URB; j++) { 691 for (j = 0; j < N_IN_URB; j++) {
683 usb_kill_urb(portdata->in_urbs[j]); 692 usb_kill_urb(portdata->in_urbs[j]);
684 usb_free_urb(portdata->in_urbs[j]); 693 usb_free_urb(portdata->in_urbs[j]);
685 portdata->in_urbs[j] = NULL; 694 kfree(portdata->in_buffer[j]);
686 } 695 }
687 kfree(portdata); 696 kfree(portdata);
688 usb_set_serial_port_data(port, NULL); 697 usb_set_serial_port_data(port, NULL);
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index b517f93352ec..3a3776677339 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -82,7 +82,6 @@
82#include <linux/circ_buf.h> 82#include <linux/circ_buf.h>
83#include <linux/mutex.h> 83#include <linux/mutex.h>
84#include <asm/uaccess.h> 84#include <asm/uaccess.h>
85#include <asm/semaphore.h>
86#include <linux/usb.h> 85#include <linux/usb.h>
87#include <linux/usb/serial.h> 86#include <linux/usb/serial.h>
88 87
@@ -265,8 +264,8 @@ static struct usb_serial_driver ti_1port_device = {
265 .description = "TI USB 3410 1 port adapter", 264 .description = "TI USB 3410 1 port adapter",
266 .usb_driver = &ti_usb_driver, 265 .usb_driver = &ti_usb_driver,
267 .id_table = ti_id_table_3410, 266 .id_table = ti_id_table_3410,
268 .num_interrupt_in = 1, 267 .num_interrupt_in = NUM_DONT_CARE,
269 .num_bulk_in = 1, 268 .num_bulk_in = NUM_DONT_CARE,
270 .num_bulk_out = 1, 269 .num_bulk_out = 1,
271 .num_ports = 1, 270 .num_ports = 1,
272 .attach = ti_startup, 271 .attach = ti_startup,
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 3ce98e8d7bce..2138ba8aeb69 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -854,6 +854,7 @@ int usb_serial_probe(struct usb_interface *interface,
854 serial->num_interrupt_in = num_interrupt_in; 854 serial->num_interrupt_in = num_interrupt_in;
855 serial->num_interrupt_out = num_interrupt_out; 855 serial->num_interrupt_out = num_interrupt_out;
856 856
857#if 0
857 /* check that the device meets the driver's requirements */ 858 /* check that the device meets the driver's requirements */
858 if ((type->num_interrupt_in != NUM_DONT_CARE && 859 if ((type->num_interrupt_in != NUM_DONT_CARE &&
859 type->num_interrupt_in != num_interrupt_in) 860 type->num_interrupt_in != num_interrupt_in)
@@ -867,6 +868,7 @@ int usb_serial_probe(struct usb_interface *interface,
867 kfree(serial); 868 kfree(serial);
868 return -EIO; 869 return -EIO;
869 } 870 }
871#endif
870 872
871 /* found all that we need */ 873 /* found all that we need */
872 dev_info(&interface->dev, "%s converter detected\n", 874 dev_info(&interface->dev, "%s converter detected\n",
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 22b3f78a388c..c2b01f7c3197 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -191,7 +191,7 @@ static struct usb_serial_driver handspring_device = {
191 .id_table = id_table, 191 .id_table = id_table,
192 .num_interrupt_in = NUM_DONT_CARE, 192 .num_interrupt_in = NUM_DONT_CARE,
193 .num_bulk_in = 2, 193 .num_bulk_in = 2,
194 .num_bulk_out = 2, 194 .num_bulk_out = NUM_DONT_CARE,
195 .num_ports = 2, 195 .num_ports = 2,
196 .open = visor_open, 196 .open = visor_open,
197 .close = visor_close, 197 .close = visor_close,
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 2ae1e8673b19..971d13dd5e65 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -1230,6 +1230,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1230 1230
1231 /* Free driver structure */ 1231 /* Free driver structure */
1232 us->extra_destructor(info); 1232 us->extra_destructor(info);
1233 kfree(info);
1233 us->extra = NULL; 1234 us->extra = NULL;
1234 us->extra_destructor = NULL; 1235 us->extra_destructor = NULL;
1235 } 1236 }
@@ -1469,6 +1470,7 @@ static void isd200_free_info_ptrs(void *info_)
1469 if (info) { 1470 if (info) {
1470 kfree(info->id); 1471 kfree(info->id);
1471 kfree(info->RegsBuf); 1472 kfree(info->RegsBuf);
1473 kfree(info->srb.sense_buffer);
1472 } 1474 }
1473} 1475}
1474 1476
@@ -1494,7 +1496,9 @@ static int isd200_init_info(struct us_data *us)
1494 kzalloc(sizeof(struct hd_driveid), GFP_KERNEL); 1496 kzalloc(sizeof(struct hd_driveid), GFP_KERNEL);
1495 info->RegsBuf = (unsigned char *) 1497 info->RegsBuf = (unsigned char *)
1496 kmalloc(sizeof(info->ATARegs), GFP_KERNEL); 1498 kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
1497 if (!info->id || !info->RegsBuf) { 1499 info->srb.sense_buffer =
1500 kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
1501 if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) {
1498 isd200_free_info_ptrs(info); 1502 isd200_free_info_ptrs(info);
1499 kfree(info); 1503 kfree(info);
1500 retStatus = ISD200_ERROR; 1504 retStatus = ISD200_ERROR;
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index a41ce21c0697..b9b8ede61fb3 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -150,13 +150,14 @@ void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
150 150
151/* Copy a buffer of length buflen to/from the srb's transfer buffer. 151/* Copy a buffer of length buflen to/from the srb's transfer buffer.
152 * Update the **sgptr and *offset variables so that the next copy will 152 * Update the **sgptr and *offset variables so that the next copy will
153 * pick up from where this one left off. */ 153 * pick up from where this one left off.
154 154 */
155unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, 155unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
156 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr, 156 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr,
157 unsigned int *offset, enum xfer_buf_dir dir) 157 unsigned int *offset, enum xfer_buf_dir dir)
158{ 158{
159 unsigned int cnt; 159 unsigned int cnt;
160 struct scatterlist *sg = *sgptr;
160 161
161 /* We have to go through the list one entry 162 /* We have to go through the list one entry
162 * at a time. Each s-g entry contains some number of pages, and 163 * at a time. Each s-g entry contains some number of pages, and
@@ -164,22 +165,22 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
164 * in kernel-addressable memory then kmap() will return its address. 165 * in kernel-addressable memory then kmap() will return its address.
165 * If the page is not directly accessible -- such as a user buffer 166 * If the page is not directly accessible -- such as a user buffer
166 * located in high memory -- then kmap() will map it to a temporary 167 * located in high memory -- then kmap() will map it to a temporary
167 * position in the kernel's virtual address space. */ 168 * position in the kernel's virtual address space.
168 struct scatterlist *sg = *sgptr; 169 */
169 170
170 if (!sg) 171 if (!sg)
171 sg = scsi_sglist(srb); 172 sg = scsi_sglist(srb);
172 173
173 /* This loop handles a single s-g list entry, which may 174 /* This loop handles a single s-g list entry, which may
174 * include multiple pages. Find the initial page structure 175 * include multiple pages. Find the initial page structure
175 * and the starting offset within the page, and update 176 * and the starting offset within the page, and update
176 * the *offset and **sgptr values for the next loop. */ 177 * the *offset and **sgptr values for the next loop.
178 */
177 cnt = 0; 179 cnt = 0;
178 while (cnt < buflen) { 180 while (cnt < buflen && sg) {
179 struct page *page = sg_page(sg) + 181 struct page *page = sg_page(sg) +
180 ((sg->offset + *offset) >> PAGE_SHIFT); 182 ((sg->offset + *offset) >> PAGE_SHIFT);
181 unsigned int poff = 183 unsigned int poff = (sg->offset + *offset) & (PAGE_SIZE-1);
182 (sg->offset + *offset) & (PAGE_SIZE-1);
183 unsigned int sglen = sg->length - *offset; 184 unsigned int sglen = sg->length - *offset;
184 185
185 if (sglen > buflen - cnt) { 186 if (sglen > buflen - cnt) {
@@ -222,14 +223,16 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
222} 223}
223 224
224/* Store the contents of buffer into srb's transfer buffer and set the 225/* Store the contents of buffer into srb's transfer buffer and set the
225 * SCSI residue. */ 226 * SCSI residue.
227 */
226void usb_stor_set_xfer_buf(unsigned char *buffer, 228void usb_stor_set_xfer_buf(unsigned char *buffer,
227 unsigned int buflen, struct scsi_cmnd *srb) 229 unsigned int buflen, struct scsi_cmnd *srb)
228{ 230{
229 unsigned int offset = 0; 231 unsigned int offset = 0;
230 struct scatterlist *sg = NULL; 232 struct scatterlist *sg = NULL;
231 233
232 usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset, 234 buflen = min(buflen, scsi_bufflen(srb));
235 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
233 TO_XFER_BUF); 236 TO_XFER_BUF);
234 if (buflen < scsi_bufflen(srb)) 237 if (buflen < scsi_bufflen(srb))
235 scsi_set_resid(srb, scsi_bufflen(srb) - buflen); 238 scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index d43a3415e12f..6d14327c921d 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -522,8 +522,8 @@ int sddr55_reset(struct us_data *us) {
522 522
523static unsigned long sddr55_get_capacity(struct us_data *us) { 523static unsigned long sddr55_get_capacity(struct us_data *us) {
524 524
525 unsigned char manufacturerID; 525 unsigned char uninitialized_var(manufacturerID);
526 unsigned char deviceID; 526 unsigned char uninitialized_var(deviceID);
527 int result; 527 int result;
528 struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra; 528 struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
529 529
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index d9f4912f873d..bdd4334bed5a 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -891,17 +891,6 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
891 if (result > 0) 891 if (result > 0)
892 return us->iobuf[0]; 892 return us->iobuf[0];
893 893
894 /*
895 * Some devices (i.e. Iomega Zip100) need this -- apparently
896 * the bulk pipes get STALLed when the GetMaxLUN request is
897 * processed. This is, in theory, harmless to all other devices
898 * (regardless of if they stall or not).
899 */
900 if (result == -EPIPE) {
901 usb_stor_clear_halt(us, us->recv_bulk_pipe);
902 usb_stor_clear_halt(us, us->send_bulk_pipe);
903 }
904
905 /* 894 /*
906 * Some devices don't like GetMaxLUN. They may STALL the control 895 * Some devices don't like GetMaxLUN. They may STALL the control
907 * pipe, they may return a zero-length result, they may do nothing at 896 * pipe, they may return a zero-length result, they may do nothing at
@@ -1020,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
1020 US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", 1009 US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
1021 le32_to_cpu(bcs->Signature), bcs->Tag, 1010 le32_to_cpu(bcs->Signature), bcs->Tag,
1022 residue, bcs->Status); 1011 residue, bcs->Status);
1023 if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) { 1012 if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) ||
1013 bcs->Status > US_BULK_STAT_PHASE) {
1024 US_DEBUGP("Bulk logical error\n"); 1014 US_DEBUGP("Bulk logical error\n");
1025 return USB_STOR_TRANSPORT_ERROR; 1015 return USB_STOR_TRANSPORT_ERROR;
1026 } 1016 }
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index fe12737e0e2b..91252075e6e1 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -357,7 +357,7 @@ UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
357 US_FL_FIX_CAPACITY), 357 US_FL_FIX_CAPACITY),
358 358
359/* Reported by Emil Larsson <emil@swip.net> */ 359/* Reported by Emil Larsson <emil@swip.net> */
360UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, 360UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0110,
361 "NIKON", 361 "NIKON",
362 "NIKON DSC D80", 362 "NIKON DSC D80",
363 US_SC_DEVICE, US_PR_DEVICE, NULL, 363 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -759,6 +759,18 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
759 "Digital Camera EX-20 DSC", 759 "Digital Camera EX-20 DSC",
760 US_SC_8070, US_PR_DEVICE, NULL, 0 ), 760 US_SC_8070, US_PR_DEVICE, NULL, 0 ),
761 761
762/* Reported by Andre Welter <a.r.welter@gmx.de>
763 * This antique device predates the release of the Bulk-only Transport
764 * spec, and if it gets a Get-Max-LUN then it requires the host to do a
765 * Clear-Halt on the bulk endpoints. The SINGLE_LUN flag will prevent
766 * us from sending the request.
767 */
768UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100,
769 "Iomega",
770 "ZIP 100",
771 US_SC_DEVICE, US_PR_DEVICE, NULL,
772 US_FL_SINGLE_LUN ),
773
762/* Reported by <Hendryk.Pfeiffer@gmx.de> */ 774/* Reported by <Hendryk.Pfeiffer@gmx.de> */
763UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, 775UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000,
764 "LaCie", 776 "LaCie",
@@ -1412,6 +1424,17 @@ UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103,
1412 US_SC_DEVICE, US_PR_DEVICE, NULL, 1424 US_SC_DEVICE, US_PR_DEVICE, NULL,
1413 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), 1425 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64),
1414 1426
1427/* Patch by Leonid Petrov mail at lpetrov.net
1428 * Reported by Robert Spitzenpfeil <robert@spitzenpfeil.org>
1429 * http://www.qbik.ch/usb/devices/showdev.php?id=1705
1430 * Updated to 103 device by MJ Ray mjr at phonecoop.coop
1431 */
1432UNUSUAL_DEV( 0x0f19, 0x0103, 0x0100, 0x0100,
1433 "Oracom Co., Ltd",
1434 "ORC-200M",
1435 US_SC_DEVICE, US_PR_DEVICE, NULL,
1436 US_FL_IGNORE_RESIDUE ),
1437
1415/* David Kuehling <dvdkhlng@gmx.de>: 1438/* David Kuehling <dvdkhlng@gmx.de>:
1416 * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI 1439 * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI
1417 * errors when trying to write. 1440 * errors when trying to write.
@@ -1477,6 +1500,15 @@ UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x0110,
1477 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 1500 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
1478 0 ), 1501 0 ),
1479 1502
1503/* Reported by Fabio Venturi <f.venturi@tdnet.it>
1504 * The device reports a vendor-specific bDeviceClass.
1505 */
1506UNUSUAL_DEV( 0x10d6, 0x2200, 0x0100, 0x0100,
1507 "Actions Semiconductor",
1508 "Mtp device",
1509 US_SC_DEVICE, US_PR_DEVICE, NULL,
1510 0),
1511
1480/* Reported by Kevin Lloyd <linux@sierrawireless.com> 1512/* Reported by Kevin Lloyd <linux@sierrawireless.com>
1481 * Entry is needed for the initializer function override, 1513 * Entry is needed for the initializer function override,
1482 * which instructs the device to load as a modem 1514 * which instructs the device to load as a modem
@@ -1498,16 +1530,104 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100,
1498 US_SC_DEVICE, US_PR_DEVICE, NULL, 1530 US_SC_DEVICE, US_PR_DEVICE, NULL,
1499 US_FL_IGNORE_RESIDUE ), 1531 US_FL_IGNORE_RESIDUE ),
1500 1532
1501/* Reported by fangxiaozhi <fangxiaozhi60675@huawei.com> 1533/* Reported by fangxiaozhi <huananhu@huawei.com>
1502 * and by linlei <linlei83@huawei.com> 1534 * This brings the HUAWEI data card devices into multi-port mode
1503 * Patch reworked by Johann Wilhelm <johann.wilhelm@student.tugraz.at>
1504 * This brings the HUAWEI E220 devices into multi-port mode
1505 */ 1535 */
1536UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000,
1537 "HUAWEI MOBILE",
1538 "Mass Storage",
1539 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1540 0),
1506UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000, 1541UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
1507 "HUAWEI MOBILE", 1542 "HUAWEI MOBILE",
1508 "Mass Storage", 1543 "Mass Storage",
1509 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init, 1544 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1510 0), 1545 0),
1546UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000,
1547 "HUAWEI MOBILE",
1548 "Mass Storage",
1549 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1550 0),
1551UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000,
1552 "HUAWEI MOBILE",
1553 "Mass Storage",
1554 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1555 0),
1556UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000,
1557 "HUAWEI MOBILE",
1558 "Mass Storage",
1559 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1560 0),
1561UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000,
1562 "HUAWEI MOBILE",
1563 "Mass Storage",
1564 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1565 0),
1566UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000,
1567 "HUAWEI MOBILE",
1568 "Mass Storage",
1569 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1570 0),
1571UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000,
1572 "HUAWEI MOBILE",
1573 "Mass Storage",
1574 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1575 0),
1576UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000,
1577 "HUAWEI MOBILE",
1578 "Mass Storage",
1579 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1580 0),
1581UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000,
1582 "HUAWEI MOBILE",
1583 "Mass Storage",
1584 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1585 0),
1586UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000,
1587 "HUAWEI MOBILE",
1588 "Mass Storage",
1589 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1590 0),
1591UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000,
1592 "HUAWEI MOBILE",
1593 "Mass Storage",
1594 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1595 0),
1596UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000,
1597 "HUAWEI MOBILE",
1598 "Mass Storage",
1599 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1600 0),
1601UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000,
1602 "HUAWEI MOBILE",
1603 "Mass Storage",
1604 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1605 0),
1606UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000,
1607 "HUAWEI MOBILE",
1608 "Mass Storage",
1609 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1610 0),
1611UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000,
1612 "HUAWEI MOBILE",
1613 "Mass Storage",
1614 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1615 0),
1616UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000,
1617 "HUAWEI MOBILE",
1618 "Mass Storage",
1619 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1620 0),
1621UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000,
1622 "HUAWEI MOBILE",
1623 "Mass Storage",
1624 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1625 0),
1626UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000,
1627 "HUAWEI MOBILE",
1628 "Mass Storage",
1629 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1630 0),
1511 1631
1512/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ 1632/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
1513UNUSUAL_DEV( 0x132b, 0x000b, 0x0001, 0x0001, 1633UNUSUAL_DEV( 0x132b, 0x000b, 0x0001, 0x0001,
@@ -1557,6 +1677,17 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001,
1557 US_SC_DEVICE, US_PR_DEVICE, NULL, 1677 US_SC_DEVICE, US_PR_DEVICE, NULL,
1558 US_FL_FIX_CAPACITY), 1678 US_FL_FIX_CAPACITY),
1559 1679
1680/*
1681 * Patch by Constantin Baranov <const@tltsu.ru>
1682 * Report by Andreas Koenecke.
1683 * Motorola ROKR Z6.
1684 */
1685UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101,
1686 "Motorola",
1687 "MSnc.",
1688 US_SC_DEVICE, US_PR_DEVICE, NULL,
1689 US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),
1690
1560/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ 1691/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */
1561UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, 1692UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1562 "MPIO", 1693 "MPIO",