aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/core/devio.c20
-rw-r--r--drivers/usb/core/file.c13
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/at91_udc.c176
-rw-r--r--drivers/usb/gadget/at91_udc.h1
-rw-r--r--drivers/usb/gadget/dummy_hcd.c6
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-at91.c88
-rw-r--r--drivers/usb/host/ohci-au1xxx.c1
-rw-r--r--drivers/usb/host/ohci-hcd.c3
-rw-r--r--drivers/usb/host/uhci-q.c4
-rw-r--r--drivers/usb/input/appletouch.c2
-rw-r--r--drivers/usb/input/ati_remote.c174
-rw-r--r--drivers/usb/input/hid-input.c3
-rw-r--r--drivers/usb/input/hiddev.c72
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c11
-rw-r--r--drivers/usb/misc/usbtest.c5
-rw-r--r--drivers/usb/net/rtl8150.c83
-rw-r--r--drivers/usb/serial/Kconfig24
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/anydata.c123
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.h10
-rw-r--r--drivers/usb/serial/ipaq.c3
-rw-r--r--drivers/usb/serial/option.c76
-rw-r--r--drivers/usb/serial/pl2303.c2
-rw-r--r--drivers/usb/serial/pl2303.h8
-rw-r--r--drivers/usb/storage/unusual_devs.h41
-rw-r--r--drivers/usb/storage/usb.c13
30 files changed, 498 insertions, 474 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 2ee742d40c43..005043197527 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -24,7 +24,7 @@ config USB_ARCH_HAS_OHCI
24 default y if ARCH_S3C2410 24 default y if ARCH_S3C2410
25 default y if PXA27x 25 default y if PXA27x
26 default y if ARCH_EP93XX 26 default y if ARCH_EP93XX
27 default y if ARCH_AT91RM9200 27 default y if (ARCH_AT91RM9200 || ARCH_AT91SAM9261)
28 # PPC: 28 # PPC:
29 default y if STB03xxx 29 default y if STB03xxx
30 default y if PPC_MPC52xx 30 default y if PPC_MPC52xx
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index f7bdd94b3aa8..218621b9958e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -517,19 +517,19 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
517 517
518static struct usb_device *usbdev_lookup_minor(int minor) 518static struct usb_device *usbdev_lookup_minor(int minor)
519{ 519{
520 struct device *device; 520 struct class_device *class_dev;
521 struct usb_device *udev = NULL; 521 struct usb_device *dev = NULL;
522 522
523 down(&usb_device_class->sem); 523 down(&usb_device_class->sem);
524 list_for_each_entry(device, &usb_device_class->devices, node) { 524 list_for_each_entry(class_dev, &usb_device_class->children, node) {
525 if (device->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { 525 if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
526 udev = device->platform_data; 526 dev = class_dev->class_data;
527 break; 527 break;
528 } 528 }
529 } 529 }
530 up(&usb_device_class->sem); 530 up(&usb_device_class->sem);
531 531
532 return udev; 532 return dev;
533}; 533};
534 534
535/* 535/*
@@ -1580,16 +1580,16 @@ static void usbdev_add(struct usb_device *dev)
1580{ 1580{
1581 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); 1581 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
1582 1582
1583 dev->usbfs_dev = device_create(usb_device_class, &dev->dev, 1583 dev->class_dev = class_device_create(usb_device_class, NULL,
1584 MKDEV(USB_DEVICE_MAJOR, minor), 1584 MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
1585 "usbdev%d.%d", dev->bus->busnum, dev->devnum); 1585 "usbdev%d.%d", dev->bus->busnum, dev->devnum);
1586 1586
1587 dev->usbfs_dev->platform_data = dev; 1587 dev->class_dev->class_data = dev;
1588} 1588}
1589 1589
1590static void usbdev_remove(struct usb_device *dev) 1590static void usbdev_remove(struct usb_device *dev)
1591{ 1591{
1592 device_unregister(dev->usbfs_dev); 1592 class_device_unregister(dev->class_dev);
1593} 1593}
1594 1594
1595static int usbdev_notify(struct notifier_block *self, unsigned long action, 1595static int usbdev_notify(struct notifier_block *self, unsigned long action,
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index abee0f5b6a66..8de4f8c99d61 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -194,13 +194,14 @@ int usb_register_dev(struct usb_interface *intf,
194 ++temp; 194 ++temp;
195 else 195 else
196 temp = name; 196 temp = name;
197 intf->usb_dev = device_create(usb_class->class, &intf->dev, 197 intf->class_dev = class_device_create(usb_class->class, NULL,
198 MKDEV(USB_MAJOR, minor), "%s", temp); 198 MKDEV(USB_MAJOR, minor),
199 if (IS_ERR(intf->usb_dev)) { 199 &intf->dev, "%s", temp);
200 if (IS_ERR(intf->class_dev)) {
200 spin_lock (&minor_lock); 201 spin_lock (&minor_lock);
201 usb_minors[intf->minor] = NULL; 202 usb_minors[intf->minor] = NULL;
202 spin_unlock (&minor_lock); 203 spin_unlock (&minor_lock);
203 retval = PTR_ERR(intf->usb_dev); 204 retval = PTR_ERR(intf->class_dev);
204 } 205 }
205exit: 206exit:
206 return retval; 207 return retval;
@@ -241,8 +242,8 @@ void usb_deregister_dev(struct usb_interface *intf,
241 spin_unlock (&minor_lock); 242 spin_unlock (&minor_lock);
242 243
243 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); 244 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
244 device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); 245 class_device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor));
245 intf->usb_dev = NULL; 246 intf->class_dev = NULL;
246 intf->minor = -1; 247 intf->minor = -1;
247 destroy_usb_class(); 248 destroy_usb_class();
248} 249}
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 363b2ad74ae6..1a32d96774b4 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -207,7 +207,7 @@ config USB_AT91
207 207
208config USB_GADGET_DUMMY_HCD 208config USB_GADGET_DUMMY_HCD
209 boolean "Dummy HCD (DEVELOPMENT)" 209 boolean "Dummy HCD (DEVELOPMENT)"
210 depends on USB && EXPERIMENTAL 210 depends on (USB=y || (USB=m && USB_GADGET=m)) && EXPERIMENTAL
211 select USB_GADGET_DUALSPEED 211 select USB_GADGET_DUALSPEED
212 help 212 help
213 This host controller driver emulates USB, looping all data transfer 213 This host controller driver emulates USB, looping all data transfer
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 1c459ff037ce..cfebca05ead5 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -57,19 +57,23 @@
57 57
58/* 58/*
59 * This controller is simple and PIO-only. It's used in many AT91-series 59 * This controller is simple and PIO-only. It's used in many AT91-series
60 * ARMv4T controllers, including the at91rm9200 (arm920T, with MMU), 60 * full speed USB controllers, including the at91rm9200 (arm920T, with MMU),
61 * at91sam9261 (arm926ejs, with MMU), and several no-mmu versions. 61 * at91sam926x (arm926ejs, with MMU), and several no-mmu versions.
62 * 62 *
63 * This driver expects the board has been wired with two GPIOs suppporting 63 * This driver expects the board has been wired with two GPIOs suppporting
64 * a VBUS sensing IRQ, and a D+ pullup. (They may be omitted, but the 64 * a VBUS sensing IRQ, and a D+ pullup. (They may be omitted, but the
65 * testing hasn't covered such cases.) The pullup is most important; it 65 * testing hasn't covered such cases.)
66 *
67 * The pullup is most important (so it's integrated on sam926x parts). It
66 * provides software control over whether the host enumerates the device. 68 * provides software control over whether the host enumerates the device.
69 *
67 * The VBUS sensing helps during enumeration, and allows both USB clocks 70 * The VBUS sensing helps during enumeration, and allows both USB clocks
68 * (and the transceiver) to stay gated off until they're necessary, saving 71 * (and the transceiver) to stay gated off until they're necessary, saving
69 * power. During USB suspend, the 48 MHz clock is gated off. 72 * power. During USB suspend, the 48 MHz clock is gated off in hardware;
73 * it may also be gated off by software during some Linux sleep states.
70 */ 74 */
71 75
72#define DRIVER_VERSION "8 March 2005" 76#define DRIVER_VERSION "3 May 2006"
73 77
74static const char driver_name [] = "at91_udc"; 78static const char driver_name [] = "at91_udc";
75static const char ep0name[] = "ep0"; 79static const char ep0name[] = "ep0";
@@ -316,9 +320,15 @@ static void done(struct at91_ep *ep, struct at91_request *req, int status)
316 * 320 *
317 * There are also state bits like FORCESTALL, EPEDS, DIR, and EPTYPE 321 * There are also state bits like FORCESTALL, EPEDS, DIR, and EPTYPE
318 * that shouldn't normally be changed. 322 * that shouldn't normally be changed.
323 *
324 * NOTE at91sam9260 docs mention synch between UDPCK and MCK clock domains,
325 * implying a need to wait for one write to complete (test relevant bits)
326 * before starting the next write. This shouldn't be an issue given how
327 * infrequently we write, except maybe for write-then-read idioms.
319 */ 328 */
320#define SET_FX (AT91_UDP_TXPKTRDY) 329#define SET_FX (AT91_UDP_TXPKTRDY)
321#define CLR_FX (RX_DATA_READY | AT91_UDP_RXSETUP | AT91_UDP_STALLSENT | AT91_UDP_TXCOMP) 330#define CLR_FX (RX_DATA_READY | AT91_UDP_RXSETUP \
331 | AT91_UDP_STALLSENT | AT91_UDP_TXCOMP)
322 332
323/* pull OUT packet data from the endpoint's fifo */ 333/* pull OUT packet data from the endpoint's fifo */
324static int read_fifo (struct at91_ep *ep, struct at91_request *req) 334static int read_fifo (struct at91_ep *ep, struct at91_request *req)
@@ -472,7 +482,8 @@ static void nuke(struct at91_ep *ep, int status)
472 482
473/*-------------------------------------------------------------------------*/ 483/*-------------------------------------------------------------------------*/
474 484
475static int at91_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) 485static int at91_ep_enable(struct usb_ep *_ep,
486 const struct usb_endpoint_descriptor *desc)
476{ 487{
477 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); 488 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep);
478 struct at91_udc *dev = ep->udc; 489 struct at91_udc *dev = ep->udc;
@@ -582,11 +593,12 @@ static int at91_ep_disable (struct usb_ep * _ep)
582 * interesting for request or buffer allocation. 593 * interesting for request or buffer allocation.
583 */ 594 */
584 595
585static struct usb_request *at91_ep_alloc_request (struct usb_ep *_ep, unsigned int gfp_flags) 596static struct usb_request *
597at91_ep_alloc_request(struct usb_ep *_ep, unsigned int gfp_flags)
586{ 598{
587 struct at91_request *req; 599 struct at91_request *req;
588 600
589 req = kcalloc(1, sizeof (struct at91_request), SLAB_KERNEL); 601 req = kcalloc(1, sizeof (struct at91_request), gfp_flags);
590 if (!req) 602 if (!req)
591 return NULL; 603 return NULL;
592 604
@@ -862,6 +874,7 @@ static void stop_activity(struct at91_udc *udc)
862 if (udc->gadget.speed == USB_SPEED_UNKNOWN) 874 if (udc->gadget.speed == USB_SPEED_UNKNOWN)
863 driver = NULL; 875 driver = NULL;
864 udc->gadget.speed = USB_SPEED_UNKNOWN; 876 udc->gadget.speed = USB_SPEED_UNKNOWN;
877 udc->suspended = 0;
865 878
866 for (i = 0; i < NUM_ENDPOINTS; i++) { 879 for (i = 0; i < NUM_ENDPOINTS; i++) {
867 struct at91_ep *ep = &udc->ep[i]; 880 struct at91_ep *ep = &udc->ep[i];
@@ -889,8 +902,8 @@ static void clk_off(struct at91_udc *udc)
889 return; 902 return;
890 udc->clocked = 0; 903 udc->clocked = 0;
891 udc->gadget.speed = USB_SPEED_UNKNOWN; 904 udc->gadget.speed = USB_SPEED_UNKNOWN;
892 clk_disable(udc->iclk);
893 clk_disable(udc->fclk); 905 clk_disable(udc->fclk);
906 clk_disable(udc->iclk);
894} 907}
895 908
896/* 909/*
@@ -911,9 +924,6 @@ static void pullup(struct at91_udc *udc, int is_on)
911 at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); 924 at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
912 at91_set_gpio_value(udc->board.pullup_pin, 0); 925 at91_set_gpio_value(udc->board.pullup_pin, 0);
913 clk_off(udc); 926 clk_off(udc);
914
915 // REVISIT: with transceiver disabled, will D- float
916 // so that a host would falsely detect a device?
917 } 927 }
918} 928}
919 929
@@ -1290,7 +1300,8 @@ static void handle_ep0(struct at91_udc *udc)
1290 if (udc->wait_for_addr_ack) { 1300 if (udc->wait_for_addr_ack) {
1291 u32 tmp; 1301 u32 tmp;
1292 1302
1293 at91_udp_write(AT91_UDP_FADDR, AT91_UDP_FEN | udc->addr); 1303 at91_udp_write(AT91_UDP_FADDR,
1304 AT91_UDP_FEN | udc->addr);
1294 tmp = at91_udp_read(AT91_UDP_GLB_STAT); 1305 tmp = at91_udp_read(AT91_UDP_GLB_STAT);
1295 tmp &= ~AT91_UDP_FADDEN; 1306 tmp &= ~AT91_UDP_FADDEN;
1296 if (udc->addr) 1307 if (udc->addr)
@@ -1361,9 +1372,10 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r)
1361 u32 rescans = 5; 1372 u32 rescans = 5;
1362 1373
1363 while (rescans--) { 1374 while (rescans--) {
1364 u32 status = at91_udp_read(AT91_UDP_ISR); 1375 u32 status;
1365 1376
1366 status &= at91_udp_read(AT91_UDP_IMR); 1377 status = at91_udp_read(AT91_UDP_ISR)
1378 & at91_udp_read(AT91_UDP_IMR);
1367 if (!status) 1379 if (!status)
1368 break; 1380 break;
1369 1381
@@ -1379,18 +1391,17 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r)
1379 stop_activity(udc); 1391 stop_activity(udc);
1380 1392
1381 /* enable ep0 */ 1393 /* enable ep0 */
1382 at91_udp_write(AT91_UDP_CSR(0), AT91_UDP_EPEDS | AT91_UDP_EPTYPE_CTRL); 1394 at91_udp_write(AT91_UDP_CSR(0),
1395 AT91_UDP_EPEDS | AT91_UDP_EPTYPE_CTRL);
1383 udc->gadget.speed = USB_SPEED_FULL; 1396 udc->gadget.speed = USB_SPEED_FULL;
1384 udc->suspended = 0; 1397 udc->suspended = 0;
1385 at91_udp_write(AT91_UDP_IER, AT91_UDP_EP(0)); 1398 at91_udp_write(AT91_UDP_IER, AT91_UDP_EP(0));
1386 1399
1387 /* 1400 /*
1388 * NOTE: this driver keeps clocks off unless the 1401 * NOTE: this driver keeps clocks off unless the
1389 * USB host is present. That saves power, and also 1402 * USB host is present. That saves power, but for
1390 * eliminates IRQs (reset, resume, suspend) that can 1403 * boards that don't support VBUS detection, both
1391 * otherwise flood from the controller. If your 1404 * clocks need to be active most of the time.
1392 * board doesn't support VBUS detection, suspend and
1393 * resume irq logic may need more attention...
1394 */ 1405 */
1395 1406
1396 /* host initiated suspend (3+ms bus idle) */ 1407 /* host initiated suspend (3+ms bus idle) */
@@ -1452,13 +1463,19 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r)
1452 1463
1453/*-------------------------------------------------------------------------*/ 1464/*-------------------------------------------------------------------------*/
1454 1465
1466static void nop_release(struct device *dev)
1467{
1468 /* nothing to free */
1469}
1470
1455static struct at91_udc controller = { 1471static struct at91_udc controller = {
1456 .gadget = { 1472 .gadget = {
1457 .ops = &at91_udc_ops, 1473 .ops = &at91_udc_ops,
1458 .ep0 = &controller.ep[0].ep, 1474 .ep0 = &controller.ep[0].ep,
1459 .name = driver_name, 1475 .name = driver_name,
1460 .dev = { 1476 .dev = {
1461 .bus_id = "gadget" 1477 .bus_id = "gadget",
1478 .release = nop_release,
1462 } 1479 }
1463 }, 1480 },
1464 .ep[0] = { 1481 .ep[0] = {
@@ -1468,7 +1485,8 @@ static struct at91_udc controller = {
1468 }, 1485 },
1469 .udc = &controller, 1486 .udc = &controller,
1470 .maxpacket = 8, 1487 .maxpacket = 8,
1471 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(0)), 1488 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1489 + AT91_UDP_CSR(0)),
1472 .int_mask = 1 << 0, 1490 .int_mask = 1 << 0,
1473 }, 1491 },
1474 .ep[1] = { 1492 .ep[1] = {
@@ -1479,7 +1497,8 @@ static struct at91_udc controller = {
1479 .udc = &controller, 1497 .udc = &controller,
1480 .is_pingpong = 1, 1498 .is_pingpong = 1,
1481 .maxpacket = 64, 1499 .maxpacket = 64,
1482 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(1)), 1500 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1501 + AT91_UDP_CSR(1)),
1483 .int_mask = 1 << 1, 1502 .int_mask = 1 << 1,
1484 }, 1503 },
1485 .ep[2] = { 1504 .ep[2] = {
@@ -1490,7 +1509,8 @@ static struct at91_udc controller = {
1490 .udc = &controller, 1509 .udc = &controller,
1491 .is_pingpong = 1, 1510 .is_pingpong = 1,
1492 .maxpacket = 64, 1511 .maxpacket = 64,
1493 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(2)), 1512 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1513 + AT91_UDP_CSR(2)),
1494 .int_mask = 1 << 2, 1514 .int_mask = 1 << 2,
1495 }, 1515 },
1496 .ep[3] = { 1516 .ep[3] = {
@@ -1501,7 +1521,8 @@ static struct at91_udc controller = {
1501 }, 1521 },
1502 .udc = &controller, 1522 .udc = &controller,
1503 .maxpacket = 8, 1523 .maxpacket = 8,
1504 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(3)), 1524 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1525 + AT91_UDP_CSR(3)),
1505 .int_mask = 1 << 3, 1526 .int_mask = 1 << 3,
1506 }, 1527 },
1507 .ep[4] = { 1528 .ep[4] = {
@@ -1512,7 +1533,8 @@ static struct at91_udc controller = {
1512 .udc = &controller, 1533 .udc = &controller,
1513 .is_pingpong = 1, 1534 .is_pingpong = 1,
1514 .maxpacket = 256, 1535 .maxpacket = 256,
1515 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(4)), 1536 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1537 + AT91_UDP_CSR(4)),
1516 .int_mask = 1 << 4, 1538 .int_mask = 1 << 4,
1517 }, 1539 },
1518 .ep[5] = { 1540 .ep[5] = {
@@ -1523,10 +1545,11 @@ static struct at91_udc controller = {
1523 .udc = &controller, 1545 .udc = &controller,
1524 .is_pingpong = 1, 1546 .is_pingpong = 1,
1525 .maxpacket = 256, 1547 .maxpacket = 256,
1526 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(5)), 1548 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1549 + AT91_UDP_CSR(5)),
1527 .int_mask = 1 << 5, 1550 .int_mask = 1 << 5,
1528 }, 1551 },
1529 /* ep6 and ep7 are also reserved */ 1552 /* ep6 and ep7 are also reserved (custom silicon might use them) */
1530}; 1553};
1531 1554
1532static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r) 1555static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r)
@@ -1593,6 +1616,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
1593 1616
1594 local_irq_disable(); 1617 local_irq_disable();
1595 udc->enabled = 0; 1618 udc->enabled = 0;
1619 at91_udp_write(AT91_UDP_IDR, ~0);
1596 pullup(udc, 0); 1620 pullup(udc, 0);
1597 local_irq_enable(); 1621 local_irq_enable();
1598 1622
@@ -1624,6 +1648,16 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1624 return -ENODEV; 1648 return -ENODEV;
1625 } 1649 }
1626 1650
1651 if (pdev->num_resources != 2) {
1652 DBG("invalid num_resources");
1653 return -ENODEV;
1654 }
1655 if ((pdev->resource[0].flags != IORESOURCE_MEM)
1656 || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
1657 DBG("invalid resource type");
1658 return -ENODEV;
1659 }
1660
1627 if (!request_mem_region(AT91_BASE_UDP, SZ_16K, driver_name)) { 1661 if (!request_mem_region(AT91_BASE_UDP, SZ_16K, driver_name)) {
1628 DBG("someone's using UDC memory\n"); 1662 DBG("someone's using UDC memory\n");
1629 return -EBUSY; 1663 return -EBUSY;
@@ -1649,19 +1683,26 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1649 if (retval < 0) 1683 if (retval < 0)
1650 goto fail0; 1684 goto fail0;
1651 1685
1652 /* disable everything until there's a gadget driver and vbus */ 1686 /* don't do anything until we have both gadget driver and VBUS */
1653 pullup(udc, 0); 1687 clk_enable(udc->iclk);
1688 at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
1689 at91_udp_write(AT91_UDP_IDR, 0xffffffff);
1690 clk_disable(udc->iclk);
1654 1691
1655 /* request UDC and maybe VBUS irqs */ 1692 /* request UDC and maybe VBUS irqs */
1656 if (request_irq(AT91_ID_UDP, at91_udc_irq, IRQF_DISABLED, driver_name, udc)) { 1693 udc->udp_irq = platform_get_irq(pdev, 0);
1657 DBG("request irq %d failed\n", AT91_ID_UDP); 1694 if (request_irq(udc->udp_irq, at91_udc_irq,
1695 IRQF_DISABLED, driver_name, udc)) {
1696 DBG("request irq %d failed\n", udc->udp_irq);
1658 retval = -EBUSY; 1697 retval = -EBUSY;
1659 goto fail1; 1698 goto fail1;
1660 } 1699 }
1661 if (udc->board.vbus_pin > 0) { 1700 if (udc->board.vbus_pin > 0) {
1662 if (request_irq(udc->board.vbus_pin, at91_vbus_irq, IRQF_DISABLED, driver_name, udc)) { 1701 if (request_irq(udc->board.vbus_pin, at91_vbus_irq,
1663 DBG("request vbus irq %d failed\n", udc->board.vbus_pin); 1702 IRQF_DISABLED, driver_name, udc)) {
1664 free_irq(AT91_ID_UDP, udc); 1703 DBG("request vbus irq %d failed\n",
1704 udc->board.vbus_pin);
1705 free_irq(udc->udp_irq, udc);
1665 retval = -EBUSY; 1706 retval = -EBUSY;
1666 goto fail1; 1707 goto fail1;
1667 } 1708 }
@@ -1670,6 +1711,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1670 udc->vbus = 1; 1711 udc->vbus = 1;
1671 } 1712 }
1672 dev_set_drvdata(dev, udc); 1713 dev_set_drvdata(dev, udc);
1714 device_init_wakeup(dev, 1);
1673 create_debug_file(udc); 1715 create_debug_file(udc);
1674 1716
1675 INFO("%s version %s\n", driver_name, DRIVER_VERSION); 1717 INFO("%s version %s\n", driver_name, DRIVER_VERSION);
@@ -1678,14 +1720,14 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1678fail1: 1720fail1:
1679 device_unregister(&udc->gadget.dev); 1721 device_unregister(&udc->gadget.dev);
1680fail0: 1722fail0:
1681 release_mem_region(AT91_VA_BASE_UDP, SZ_16K); 1723 release_mem_region(AT91_BASE_UDP, SZ_16K);
1682 DBG("%s probe failed, %d\n", driver_name, retval); 1724 DBG("%s probe failed, %d\n", driver_name, retval);
1683 return retval; 1725 return retval;
1684} 1726}
1685 1727
1686static int __devexit at91udc_remove(struct platform_device *dev) 1728static int __devexit at91udc_remove(struct platform_device *pdev)
1687{ 1729{
1688 struct at91_udc *udc = platform_get_drvdata(dev); 1730 struct at91_udc *udc = platform_get_drvdata(pdev);
1689 1731
1690 DBG("remove\n"); 1732 DBG("remove\n");
1691 1733
@@ -1694,10 +1736,11 @@ static int __devexit at91udc_remove(struct platform_device *dev)
1694 if (udc->driver != 0) 1736 if (udc->driver != 0)
1695 usb_gadget_unregister_driver(udc->driver); 1737 usb_gadget_unregister_driver(udc->driver);
1696 1738
1739 device_init_wakeup(&pdev->dev, 0);
1697 remove_debug_file(udc); 1740 remove_debug_file(udc);
1698 if (udc->board.vbus_pin > 0) 1741 if (udc->board.vbus_pin > 0)
1699 free_irq(udc->board.vbus_pin, udc); 1742 free_irq(udc->board.vbus_pin, udc);
1700 free_irq(AT91_ID_UDP, udc); 1743 free_irq(udc->udp_irq, udc);
1701 device_unregister(&udc->gadget.dev); 1744 device_unregister(&udc->gadget.dev);
1702 release_mem_region(AT91_BASE_UDP, SZ_16K); 1745 release_mem_region(AT91_BASE_UDP, SZ_16K);
1703 1746
@@ -1708,31 +1751,36 @@ static int __devexit at91udc_remove(struct platform_device *dev)
1708} 1751}
1709 1752
1710#ifdef CONFIG_PM 1753#ifdef CONFIG_PM
1711static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg) 1754static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg)
1712{ 1755{
1713 struct at91_udc *udc = platform_get_drvdata(dev); 1756 struct at91_udc *udc = platform_get_drvdata(pdev);
1757 int wake = udc->driver && device_may_wakeup(&pdev->dev);
1714 1758
1715 /* 1759 /* Unless we can act normally to the host (letting it wake us up
1716 * The "safe" suspend transitions are opportunistic ... e.g. when 1760 * whenever it has work for us) force disconnect. Wakeup requires
1717 * the USB link is suspended (48MHz clock autogated off), or when 1761 * PLLB for USB events (signaling for reset, wakeup, or incoming
1718 * it's disconnected (programmatically gated off, elsewhere). 1762 * tokens) and VBUS irqs (on systems which support them).
1719 * Then we can suspend, and the chip can enter slow clock mode.
1720 *
1721 * The problem case is some component (user mode?) suspending this
1722 * device while it's active, with the 48 MHz clock in use. There
1723 * are two basic approaches: (a) veto suspend levels involving slow
1724 * clock mode, (b) disconnect, so 48 MHz will no longer be in use
1725 * and we can enter slow clock mode. This uses (b) for now, since
1726 * it's simplest until AT91 PM exists and supports the other option.
1727 */ 1763 */
1728 if (udc->vbus && !udc->suspended) 1764 if ((!udc->suspended && udc->addr)
1765 || !wake
1766 || at91_suspend_entering_slow_clock()) {
1729 pullup(udc, 0); 1767 pullup(udc, 0);
1768 disable_irq_wake(udc->udp_irq);
1769 } else
1770 enable_irq_wake(udc->udp_irq);
1771
1772 if (udc->board.vbus_pin > 0) {
1773 if (wake)
1774 enable_irq_wake(udc->board.vbus_pin);
1775 else
1776 disable_irq_wake(udc->board.vbus_pin);
1777 }
1730 return 0; 1778 return 0;
1731} 1779}
1732 1780
1733static int at91udc_resume(struct platform_device *dev) 1781static int at91udc_resume(struct platform_device *pdev)
1734{ 1782{
1735 struct at91_udc *udc = platform_get_drvdata(dev); 1783 struct at91_udc *udc = platform_get_drvdata(pdev);
1736 1784
1737 /* maybe reconnect to host; if so, clocks on */ 1785 /* maybe reconnect to host; if so, clocks on */
1738 pullup(udc, 1); 1786 pullup(udc, 1);
@@ -1748,7 +1796,7 @@ static struct platform_driver at91_udc = {
1748 .remove = __devexit_p(at91udc_remove), 1796 .remove = __devexit_p(at91udc_remove),
1749 .shutdown = at91udc_shutdown, 1797 .shutdown = at91udc_shutdown,
1750 .suspend = at91udc_suspend, 1798 .suspend = at91udc_suspend,
1751 .resume = at91udc_resume, 1799 .resume = at91udc_resume,
1752 .driver = { 1800 .driver = {
1753 .name = (char *) driver_name, 1801 .name = (char *) driver_name,
1754 .owner = THIS_MODULE, 1802 .owner = THIS_MODULE,
@@ -1767,6 +1815,6 @@ static void __devexit udc_exit_module(void)
1767} 1815}
1768module_exit(udc_exit_module); 1816module_exit(udc_exit_module);
1769 1817
1770MODULE_DESCRIPTION("AT91RM9200 udc driver"); 1818MODULE_DESCRIPTION("AT91 udc driver");
1771MODULE_AUTHOR("Thomas Rathbone, David Brownell"); 1819MODULE_AUTHOR("Thomas Rathbone, David Brownell");
1772MODULE_LICENSE("GPL"); 1820MODULE_LICENSE("GPL");
diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h
index 5a4799cedd19..882af42e86cc 100644
--- a/drivers/usb/gadget/at91_udc.h
+++ b/drivers/usb/gadget/at91_udc.h
@@ -141,6 +141,7 @@ struct at91_udc {
141 struct clk *iclk, *fclk; 141 struct clk *iclk, *fclk;
142 struct platform_device *pdev; 142 struct platform_device *pdev;
143 struct proc_dir_entry *pde; 143 struct proc_dir_entry *pde;
144 int udp_irq;
144}; 145};
145 146
146static inline struct at91_udc *to_udc(struct usb_gadget *g) 147static inline struct at91_udc *to_udc(struct usb_gadget *g)
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 4be47195bd38..7d1c22c34957 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -609,7 +609,8 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
609 if (!dum->driver) 609 if (!dum->driver)
610 return -ESHUTDOWN; 610 return -ESHUTDOWN;
611 611
612 spin_lock_irqsave (&dum->lock, flags); 612 local_irq_save (flags);
613 spin_lock (&dum->lock);
613 list_for_each_entry (req, &ep->queue, queue) { 614 list_for_each_entry (req, &ep->queue, queue) {
614 if (&req->req == _req) { 615 if (&req->req == _req) {
615 list_del_init (&req->queue); 616 list_del_init (&req->queue);
@@ -618,7 +619,7 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
618 break; 619 break;
619 } 620 }
620 } 621 }
621 spin_unlock_irqrestore (&dum->lock, flags); 622 spin_unlock (&dum->lock);
622 623
623 if (retval == 0) { 624 if (retval == 0) {
624 dev_dbg (udc_dev(dum), 625 dev_dbg (udc_dev(dum),
@@ -626,6 +627,7 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
626 req, _ep->name, _req->length, _req->buf); 627 req, _ep->name, _req->length, _req->buf);
627 _req->complete (_ep, _req); 628 _req->complete (_ep, _req);
628 } 629 }
630 local_irq_restore (flags);
629 return retval; 631 return retval;
630} 632}
631 633
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 85b0b4ad4c16..d63177a8eaea 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -892,7 +892,7 @@ MODULE_LICENSE ("GPL");
892#define PCI_DRIVER ehci_pci_driver 892#define PCI_DRIVER ehci_pci_driver
893#endif 893#endif
894 894
895#ifdef CONFIG_PPC_83xx 895#ifdef CONFIG_MPC834x
896#include "ehci-fsl.c" 896#include "ehci-fsl.c"
897#define PLATFORM_DRIVER ehci_fsl_driver 897#define PLATFORM_DRIVER ehci_fsl_driver
898#endif 898#endif
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index cdbafb710000..85cc059705a6 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -4,7 +4,7 @@
4 * Copyright (C) 2004 SAN People (Pty) Ltd. 4 * Copyright (C) 2004 SAN People (Pty) Ltd.
5 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> 5 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
6 * 6 *
7 * AT91RM9200 Bus Glue 7 * AT91 Bus Glue
8 * 8 *
9 * Based on fragments of 2.4 driver by Rick Bronson. 9 * Based on fragments of 2.4 driver by Rick Bronson.
10 * Based on ohci-omap.c 10 * Based on ohci-omap.c
@@ -19,12 +19,13 @@
19#include <asm/hardware.h> 19#include <asm/hardware.h>
20#include <asm/arch/board.h> 20#include <asm/arch/board.h>
21 21
22#ifndef CONFIG_ARCH_AT91RM9200 22#ifndef CONFIG_ARCH_AT91
23#error "CONFIG_ARCH_AT91RM9200 must be defined." 23#error "CONFIG_ARCH_AT91 must be defined."
24#endif 24#endif
25 25
26/* interface and function clocks */ 26/* interface and function clocks */
27static struct clk *iclk, *fclk; 27static struct clk *iclk, *fclk;
28static int clocked;
28 29
29extern int usb_disabled(void); 30extern int usb_disabled(void);
30 31
@@ -35,13 +36,14 @@ static void at91_start_hc(struct platform_device *pdev)
35 struct usb_hcd *hcd = platform_get_drvdata(pdev); 36 struct usb_hcd *hcd = platform_get_drvdata(pdev);
36 struct ohci_regs __iomem *regs = hcd->regs; 37 struct ohci_regs __iomem *regs = hcd->regs;
37 38
38 dev_dbg(&pdev->dev, "starting AT91RM9200 OHCI USB Controller\n"); 39 dev_dbg(&pdev->dev, "start\n");
39 40
40 /* 41 /*
41 * Start the USB clocks. 42 * Start the USB clocks.
42 */ 43 */
43 clk_enable(iclk); 44 clk_enable(iclk);
44 clk_enable(fclk); 45 clk_enable(fclk);
46 clocked = 1;
45 47
46 /* 48 /*
47 * The USB host controller must remain in reset. 49 * The USB host controller must remain in reset.
@@ -54,7 +56,7 @@ static void at91_stop_hc(struct platform_device *pdev)
54 struct usb_hcd *hcd = platform_get_drvdata(pdev); 56 struct usb_hcd *hcd = platform_get_drvdata(pdev);
55 struct ohci_regs __iomem *regs = hcd->regs; 57 struct ohci_regs __iomem *regs = hcd->regs;
56 58
57 dev_dbg(&pdev->dev, "stopping AT91RM9200 OHCI USB Controller\n"); 59 dev_dbg(&pdev->dev, "stop\n");
58 60
59 /* 61 /*
60 * Put the USB host controller into reset. 62 * Put the USB host controller into reset.
@@ -66,6 +68,7 @@ static void at91_stop_hc(struct platform_device *pdev)
66 */ 68 */
67 clk_disable(fclk); 69 clk_disable(fclk);
68 clk_disable(iclk); 70 clk_disable(iclk);
71 clocked = 0;
69} 72}
70 73
71 74
@@ -78,14 +81,15 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
78 81
79 82
80/** 83/**
81 * usb_hcd_at91_probe - initialize AT91RM9200-based HCDs 84 * usb_hcd_at91_probe - initialize AT91-based HCDs
82 * Context: !in_interrupt() 85 * Context: !in_interrupt()
83 * 86 *
84 * Allocates basic resources for this USB host controller, and 87 * Allocates basic resources for this USB host controller, and
85 * then invokes the start() method for the HCD associated with it 88 * then invokes the start() method for the HCD associated with it
86 * through the hotplug entry's driver_data. 89 * through the hotplug entry's driver_data.
87 */ 90 */
88int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) 91static int usb_hcd_at91_probe(const struct hc_driver *driver,
92 struct platform_device *pdev)
89{ 93{
90 int retval; 94 int retval;
91 struct usb_hcd *hcd = NULL; 95 struct usb_hcd *hcd = NULL;
@@ -95,12 +99,13 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *
95 return -ENODEV; 99 return -ENODEV;
96 } 100 }
97 101
98 if ((pdev->resource[0].flags != IORESOURCE_MEM) || (pdev->resource[1].flags != IORESOURCE_IRQ)) { 102 if ((pdev->resource[0].flags != IORESOURCE_MEM)
103 || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
99 pr_debug("hcd probe: invalid resource type\n"); 104 pr_debug("hcd probe: invalid resource type\n");
100 return -ENODEV; 105 return -ENODEV;
101 } 106 }
102 107
103 hcd = usb_create_hcd(driver, &pdev->dev, "at91rm9200"); 108 hcd = usb_create_hcd(driver, &pdev->dev, "at91");
104 if (!hcd) 109 if (!hcd)
105 return -ENOMEM; 110 return -ENOMEM;
106 hcd->rsrc_start = pdev->resource[0].start; 111 hcd->rsrc_start = pdev->resource[0].start;
@@ -149,21 +154,23 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *
149/* may be called with controller, bus, and devices active */ 154/* may be called with controller, bus, and devices active */
150 155
151/** 156/**
152 * usb_hcd_at91_remove - shutdown processing for AT91RM9200-based HCDs 157 * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs
153 * @dev: USB Host Controller being removed 158 * @dev: USB Host Controller being removed
154 * Context: !in_interrupt() 159 * Context: !in_interrupt()
155 * 160 *
156 * Reverses the effect of usb_hcd_at91_probe(), first invoking 161 * Reverses the effect of usb_hcd_at91_probe(), first invoking
157 * the HCD's stop() method. It is always called from a thread 162 * the HCD's stop() method. It is always called from a thread
158 * context, normally "rmmod", "apmd", or something similar. 163 * context, "rmmod" or something similar.
159 * 164 *
160 */ 165 */
161static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pdev) 166static int usb_hcd_at91_remove(struct usb_hcd *hcd,
167 struct platform_device *pdev)
162{ 168{
163 usb_remove_hcd(hcd); 169 usb_remove_hcd(hcd);
164 at91_stop_hc(pdev); 170 at91_stop_hc(pdev);
165 iounmap(hcd->regs); 171 iounmap(hcd->regs);
166 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 172 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
173 disable_irq_wake(hcd->irq);
167 174
168 clk_put(fclk); 175 clk_put(fclk);
169 clk_put(iclk); 176 clk_put(iclk);
@@ -178,19 +185,21 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde
178static int __devinit 185static int __devinit
179ohci_at91_start (struct usb_hcd *hcd) 186ohci_at91_start (struct usb_hcd *hcd)
180{ 187{
181// struct at91_ohci_data *board = hcd->self.controller->platform_data; 188 struct at91_usbh_data *board = hcd->self.controller->platform_data;
182 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 189 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
190 struct usb_device *root = hcd->self.root_hub;
183 int ret; 191 int ret;
184 192
185 if ((ret = ohci_init(ohci)) < 0) 193 if ((ret = ohci_init(ohci)) < 0)
186 return ret; 194 return ret;
187 195
196 root->maxchild = board->ports;
197
188 if ((ret = ohci_run(ohci)) < 0) { 198 if ((ret = ohci_run(ohci)) < 0) {
189 err("can't start %s", hcd->self.bus_name); 199 err("can't start %s", hcd->self.bus_name);
190 ohci_stop(hcd); 200 ohci_stop(hcd);
191 return ret; 201 return ret;
192 } 202 }
193// hcd->self.root_hub->maxchild = board->ports;
194 return 0; 203 return 0;
195} 204}
196 205
@@ -198,7 +207,7 @@ ohci_at91_start (struct usb_hcd *hcd)
198 207
199static const struct hc_driver ohci_at91_hc_driver = { 208static const struct hc_driver ohci_at91_hc_driver = {
200 .description = hcd_name, 209 .description = hcd_name,
201 .product_desc = "AT91RM9200 OHCI", 210 .product_desc = "AT91 OHCI",
202 .hcd_priv_size = sizeof(struct ohci_hcd), 211 .hcd_priv_size = sizeof(struct ohci_hcd),
203 212
204 /* 213 /*
@@ -240,33 +249,54 @@ static const struct hc_driver ohci_at91_hc_driver = {
240 249
241/*-------------------------------------------------------------------------*/ 250/*-------------------------------------------------------------------------*/
242 251
243static int ohci_hcd_at91_drv_probe(struct platform_device *dev) 252static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
244{ 253{
245 return usb_hcd_at91_probe(&ohci_at91_hc_driver, dev); 254 device_init_wakeup(&pdev->dev, 1);
255 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
246} 256}
247 257
248static int ohci_hcd_at91_drv_remove(struct platform_device *dev) 258static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
249{ 259{
250 return usb_hcd_at91_remove(platform_get_drvdata(dev), dev); 260 device_init_wakeup(&pdev->dev, 0);
261 return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev);
251} 262}
252 263
253#ifdef CONFIG_PM 264#ifdef CONFIG_PM
254 265
255/* REVISIT suspend/resume look "too" simple here */
256
257static int 266static int
258ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) 267ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
259{ 268{
260 clk_disable(fclk); 269 struct usb_hcd *hcd = platform_get_drvdata(pdev);
261 clk_disable(iclk); 270 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
271
272 if (device_may_wakeup(&pdev->dev))
273 enable_irq_wake(hcd->irq);
274 else
275 disable_irq_wake(hcd->irq);
276
277 /*
278 * The integrated transceivers seem unable to notice disconnect,
279 * reconnect, or wakeup without the 48 MHz clock active. so for
280 * correctness, always discard connection state (using reset).
281 *
282 * REVISIT: some boards will be able to turn VBUS off...
283 */
284 if (at91_suspend_entering_slow_clock()) {
285 ohci_usb_reset (ohci);
286 clk_disable(fclk);
287 clk_disable(iclk);
288 clocked = 0;
289 }
262 290
263 return 0; 291 return 0;
264} 292}
265 293
266static int ohci_hcd_at91_drv_resume(struct platform_device *dev) 294static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
267{ 295{
268 clk_enable(iclk); 296 if (!clocked) {
269 clk_enable(fclk); 297 clk_enable(iclk);
298 clk_enable(fclk);
299 }
270 300
271 return 0; 301 return 0;
272} 302}
@@ -275,7 +305,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev)
275#define ohci_hcd_at91_drv_resume NULL 305#define ohci_hcd_at91_drv_resume NULL
276#endif 306#endif
277 307
278MODULE_ALIAS("at91rm9200-ohci"); 308MODULE_ALIAS("at91_ohci");
279 309
280static struct platform_driver ohci_hcd_at91_driver = { 310static struct platform_driver ohci_hcd_at91_driver = {
281 .probe = ohci_hcd_at91_drv_probe, 311 .probe = ohci_hcd_at91_drv_probe,
@@ -283,7 +313,7 @@ static struct platform_driver ohci_hcd_at91_driver = {
283 .suspend = ohci_hcd_at91_drv_suspend, 313 .suspend = ohci_hcd_at91_drv_suspend,
284 .resume = ohci_hcd_at91_drv_resume, 314 .resume = ohci_hcd_at91_drv_resume,
285 .driver = { 315 .driver = {
286 .name = "at91rm9200-ohci", 316 .name = "at91_ohci",
287 .owner = THIS_MODULE, 317 .owner = THIS_MODULE,
288 }, 318 },
289}; 319};
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 822914e2f43b..f7a975d5db09 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -110,7 +110,6 @@ static void au1xxx_start_ohc(struct platform_device *dev)
110 110
111 printk(KERN_DEBUG __FILE__ 111 printk(KERN_DEBUG __FILE__
112 ": Clock to USB host has been enabled \n"); 112 ": Clock to USB host has been enabled \n");
113#endif
114} 113}
115 114
116static void au1xxx_stop_ohc(struct platform_device *dev) 115static void au1xxx_stop_ohc(struct platform_device *dev)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index afef5ac35b4a..94d8cf4b36c1 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -913,7 +913,7 @@ MODULE_LICENSE ("GPL");
913#include "ohci-ppc-soc.c" 913#include "ohci-ppc-soc.c"
914#endif 914#endif
915 915
916#ifdef CONFIG_ARCH_AT91RM9200 916#if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261)
917#include "ohci-at91.c" 917#include "ohci-at91.c"
918#endif 918#endif
919 919
@@ -927,6 +927,7 @@ MODULE_LICENSE ("GPL");
927 || defined (CONFIG_SOC_AU1X00) \ 927 || defined (CONFIG_SOC_AU1X00) \
928 || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ 928 || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \
929 || defined (CONFIG_ARCH_AT91RM9200) \ 929 || defined (CONFIG_ARCH_AT91RM9200) \
930 || defined (CONFIG_ARCH_AT91SAM9261) \
930 ) 931 )
931#error "missing bus glue for ohci-hcd" 932#error "missing bus glue for ohci-hcd"
932#endif 933#endif
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index c9d72ac0a1d7..66c3f61bc9d1 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -943,7 +943,9 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
943 /* We received a short packet */ 943 /* We received a short packet */
944 if (urb->transfer_flags & URB_SHORT_NOT_OK) 944 if (urb->transfer_flags & URB_SHORT_NOT_OK)
945 ret = -EREMOTEIO; 945 ret = -EREMOTEIO;
946 else if (ctrlstat & TD_CTRL_SPD) 946
947 /* Fixup needed only if this isn't the URB's last TD */
948 else if (&td->list != urbp->td_list.prev)
947 ret = 1; 949 ret = 1;
948 } 950 }
949 951
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c
index 9e3f13903371..044faa07e297 100644
--- a/drivers/usb/input/appletouch.c
+++ b/drivers/usb/input/appletouch.c
@@ -597,9 +597,9 @@ static void atp_disconnect(struct usb_interface *iface)
597 if (dev) { 597 if (dev) {
598 usb_kill_urb(dev->urb); 598 usb_kill_urb(dev->urb);
599 input_unregister_device(dev->input); 599 input_unregister_device(dev->input);
600 usb_free_urb(dev->urb);
601 usb_buffer_free(dev->udev, dev->datalen, 600 usb_buffer_free(dev->udev, dev->datalen,
602 dev->data, dev->urb->transfer_dma); 601 dev->data, dev->urb->transfer_dma);
602 usb_free_urb(dev->urb);
603 kfree(dev); 603 kfree(dev);
604 } 604 }
605 printk(KERN_INFO "input: appletouch disconnected\n"); 605 printk(KERN_INFO "input: appletouch disconnected\n");
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 05d2d6012eb2..3719fcb04b8f 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -111,14 +111,28 @@
111#define NAME_BUFSIZE 80 /* size of product name, path buffers */ 111#define NAME_BUFSIZE 80 /* size of product name, path buffers */
112#define DATA_BUFSIZE 63 /* size of URB data buffers */ 112#define DATA_BUFSIZE 63 /* size of URB data buffers */
113 113
114/*
115 * Duplicate event filtering time.
116 * Sequential, identical KIND_FILTERED inputs with less than
117 * FILTER_TIME milliseconds between them are considered as repeat
118 * events. The hardware generates 5 events for the first keypress
119 * and we have to take this into account for an accurate repeat
120 * behaviour.
121 */
122#define FILTER_TIME 60 /* msec */
123
114static unsigned long channel_mask; 124static unsigned long channel_mask;
115module_param(channel_mask, ulong, 0444); 125module_param(channel_mask, ulong, 0644);
116MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); 126MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore");
117 127
118static int debug; 128static int debug;
119module_param(debug, int, 0444); 129module_param(debug, int, 0644);
120MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); 130MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
121 131
132static int repeat_filter = FILTER_TIME;
133module_param(repeat_filter, int, 0644);
134MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec");
135
122#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) 136#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
123#undef err 137#undef err
124#define err(format, arg...) printk(KERN_ERR format , ## arg) 138#define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -143,19 +157,6 @@ MODULE_DEVICE_TABLE(usb, ati_remote_table);
143static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; 157static char init1[] = { 0x01, 0x00, 0x20, 0x14 };
144static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; 158static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
145 159
146/* Acceleration curve for directional control pad */
147static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
148
149/* Duplicate event filtering time.
150 * Sequential, identical KIND_FILTERED inputs with less than
151 * FILTER_TIME jiffies between them are considered as repeat
152 * events. The hardware generates 5 events for the first keypress
153 * and we have to take this into account for an accurate repeat
154 * behaviour.
155 * (HZ / 20) == 50 ms and works well for me.
156 */
157#define FILTER_TIME (HZ / 20)
158
159struct ati_remote { 160struct ati_remote {
160 struct input_dev *idev; 161 struct input_dev *idev;
161 struct usb_device *udev; 162 struct usb_device *udev;
@@ -413,6 +414,43 @@ static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2)
413} 414}
414 415
415/* 416/*
417 * ati_remote_compute_accel
418 *
419 * Implements acceleration curve for directional control pad
420 * If elapsed time since last event is > 1/4 second, user "stopped",
421 * so reset acceleration. Otherwise, user is probably holding the control
422 * pad down, so we increase acceleration, ramping up over two seconds to
423 * a maximum speed.
424 */
425static int ati_remote_compute_accel(struct ati_remote *ati_remote)
426{
427 static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
428 unsigned long now = jiffies;
429 int acc;
430
431 if (time_after(now, ati_remote->old_jiffies + msecs_to_jiffies(250))) {
432 acc = 1;
433 ati_remote->acc_jiffies = now;
434 }
435 else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(125)))
436 acc = accel[0];
437 else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(250)))
438 acc = accel[1];
439 else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(500)))
440 acc = accel[2];
441 else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1000)))
442 acc = accel[3];
443 else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1500)))
444 acc = accel[4];
445 else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(2000)))
446 acc = accel[5];
447 else
448 acc = accel[6];
449
450 return acc;
451}
452
453/*
416 * ati_remote_report_input 454 * ati_remote_report_input
417 */ 455 */
418static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) 456static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
@@ -465,9 +503,9 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
465 503
466 if (ati_remote_tbl[index].kind == KIND_FILTERED) { 504 if (ati_remote_tbl[index].kind == KIND_FILTERED) {
467 /* Filter duplicate events which happen "too close" together. */ 505 /* Filter duplicate events which happen "too close" together. */
468 if ((ati_remote->old_data[0] == data[1]) && 506 if (ati_remote->old_data[0] == data[1] &&
469 (ati_remote->old_data[1] == data[2]) && 507 ati_remote->old_data[1] == data[2] &&
470 time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) { 508 time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) {
471 ati_remote->repeat_count++; 509 ati_remote->repeat_count++;
472 } else { 510 } else {
473 ati_remote->repeat_count = 0; 511 ati_remote->repeat_count = 0;
@@ -477,75 +515,61 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
477 ati_remote->old_data[1] = data[2]; 515 ati_remote->old_data[1] = data[2];
478 ati_remote->old_jiffies = jiffies; 516 ati_remote->old_jiffies = jiffies;
479 517
480 if ((ati_remote->repeat_count > 0) 518 if (ati_remote->repeat_count > 0 &&
481 && (ati_remote->repeat_count < 5)) 519 ati_remote->repeat_count < 5)
482 return; 520 return;
483 521
484 522
485 input_regs(dev, regs); 523 input_regs(dev, regs);
486 input_event(dev, ati_remote_tbl[index].type, 524 input_event(dev, ati_remote_tbl[index].type,
487 ati_remote_tbl[index].code, 1); 525 ati_remote_tbl[index].code, 1);
526 input_sync(dev);
488 input_event(dev, ati_remote_tbl[index].type, 527 input_event(dev, ati_remote_tbl[index].type,
489 ati_remote_tbl[index].code, 0); 528 ati_remote_tbl[index].code, 0);
490 input_sync(dev); 529 input_sync(dev);
491 530
492 return; 531 } else {
493 }
494 532
495 /* 533 /*
496 * Other event kinds are from the directional control pad, and have an 534 * Other event kinds are from the directional control pad, and have an
497 * acceleration factor applied to them. Without this acceleration, the 535 * acceleration factor applied to them. Without this acceleration, the
498 * control pad is mostly unusable. 536 * control pad is mostly unusable.
499 * 537 */
500 * If elapsed time since last event is > 1/4 second, user "stopped", 538 acc = ati_remote_compute_accel(ati_remote);
501 * so reset acceleration. Otherwise, user is probably holding the control 539
502 * pad down, so we increase acceleration, ramping up over two seconds to 540 input_regs(dev, regs);
503 * a maximum speed. The acceleration curve is #defined above. 541 switch (ati_remote_tbl[index].kind) {
504 */ 542 case KIND_ACCEL:
505 if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) { 543 input_event(dev, ati_remote_tbl[index].type,
506 acc = 1; 544 ati_remote_tbl[index].code,
507 ati_remote->acc_jiffies = jiffies; 545 ati_remote_tbl[index].value * acc);
508 } 546 break;
509 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3))) acc = accel[0]; 547 case KIND_LU:
510 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2))) acc = accel[1]; 548 input_report_rel(dev, REL_X, -acc);
511 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1))) acc = accel[2]; 549 input_report_rel(dev, REL_Y, -acc);
512 else if (time_before(jiffies, ati_remote->acc_jiffies + HZ)) acc = accel[3]; 550 break;
513 else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1))) acc = accel[4]; 551 case KIND_RU:
514 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1))) acc = accel[5]; 552 input_report_rel(dev, REL_X, acc);
515 else acc = accel[6]; 553 input_report_rel(dev, REL_Y, -acc);
516 554 break;
517 input_regs(dev, regs); 555 case KIND_LD:
518 switch (ati_remote_tbl[index].kind) { 556 input_report_rel(dev, REL_X, -acc);
519 case KIND_ACCEL: 557 input_report_rel(dev, REL_Y, acc);
520 input_event(dev, ati_remote_tbl[index].type, 558 break;
521 ati_remote_tbl[index].code, 559 case KIND_RD:
522 ati_remote_tbl[index].value * acc); 560 input_report_rel(dev, REL_X, acc);
523 break; 561 input_report_rel(dev, REL_Y, acc);
524 case KIND_LU: 562 break;
525 input_report_rel(dev, REL_X, -acc); 563 default:
526 input_report_rel(dev, REL_Y, -acc); 564 dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n",
527 break; 565 ati_remote_tbl[index].kind);
528 case KIND_RU: 566 }
529 input_report_rel(dev, REL_X, acc); 567 input_sync(dev);
530 input_report_rel(dev, REL_Y, -acc);
531 break;
532 case KIND_LD:
533 input_report_rel(dev, REL_X, -acc);
534 input_report_rel(dev, REL_Y, acc);
535 break;
536 case KIND_RD:
537 input_report_rel(dev, REL_X, acc);
538 input_report_rel(dev, REL_Y, acc);
539 break;
540 default:
541 dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n",
542 ati_remote_tbl[index].kind);
543 }
544 input_sync(dev);
545 568
546 ati_remote->old_jiffies = jiffies; 569 ati_remote->old_jiffies = jiffies;
547 ati_remote->old_data[0] = data[1]; 570 ati_remote->old_data[0] = data[1];
548 ati_remote->old_data[1] = data[2]; 571 ati_remote->old_data[1] = data[2];
572 }
549} 573}
550 574
551/* 575/*
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 028e1ad89f5d..7208839f2dbf 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -607,7 +607,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
607 607
608 } 608 }
609 609
610 if (usage->hat_min < usage->hat_max || usage->hat_dir) { 610 if (usage->type == EV_ABS &&
611 (usage->hat_min < usage->hat_max || usage->hat_dir)) {
611 int i; 612 int i;
612 for (i = usage->code; i < usage->code + 2 && i <= max; i++) { 613 for (i = usage->code; i < usage->code + 2 && i <= max; i++) {
613 input_set_abs_params(input, i, -1, 1, 0, 0); 614 input_set_abs_params(input, i, -1, 1, 0, 0);
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
index 70477f02cc29..f6b839c257a7 100644
--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -49,7 +49,7 @@ struct hiddev {
49 int open; 49 int open;
50 wait_queue_head_t wait; 50 wait_queue_head_t wait;
51 struct hid_device *hid; 51 struct hid_device *hid;
52 struct hiddev_list *list; 52 struct list_head list;
53}; 53};
54 54
55struct hiddev_list { 55struct hiddev_list {
@@ -59,7 +59,7 @@ struct hiddev_list {
59 unsigned flags; 59 unsigned flags;
60 struct fasync_struct *fasync; 60 struct fasync_struct *fasync;
61 struct hiddev *hiddev; 61 struct hiddev *hiddev;
62 struct hiddev_list *next; 62 struct list_head node;
63}; 63};
64 64
65static struct hiddev *hiddev_table[HIDDEV_MINORS]; 65static struct hiddev *hiddev_table[HIDDEV_MINORS];
@@ -73,12 +73,15 @@ static struct hiddev *hiddev_table[HIDDEV_MINORS];
73static struct hid_report * 73static struct hid_report *
74hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) 74hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
75{ 75{
76 unsigned flags = rinfo->report_id & ~HID_REPORT_ID_MASK; 76 unsigned int flags = rinfo->report_id & ~HID_REPORT_ID_MASK;
77 unsigned int rid = rinfo->report_id & HID_REPORT_ID_MASK;
77 struct hid_report_enum *report_enum; 78 struct hid_report_enum *report_enum;
79 struct hid_report *report;
78 struct list_head *list; 80 struct list_head *list;
79 81
80 if (rinfo->report_type < HID_REPORT_TYPE_MIN || 82 if (rinfo->report_type < HID_REPORT_TYPE_MIN ||
81 rinfo->report_type > HID_REPORT_TYPE_MAX) return NULL; 83 rinfo->report_type > HID_REPORT_TYPE_MAX)
84 return NULL;
82 85
83 report_enum = hid->report_enum + 86 report_enum = hid->report_enum +
84 (rinfo->report_type - HID_REPORT_TYPE_MIN); 87 (rinfo->report_type - HID_REPORT_TYPE_MIN);
@@ -88,21 +91,25 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
88 break; 91 break;
89 92
90 case HID_REPORT_ID_FIRST: 93 case HID_REPORT_ID_FIRST:
91 list = report_enum->report_list.next; 94 if (list_empty(&report_enum->report_list))
92 if (list == &report_enum->report_list)
93 return NULL; 95 return NULL;
94 rinfo->report_id = ((struct hid_report *) list)->id; 96
97 list = report_enum->report_list.next;
98 report = list_entry(list, struct hid_report, list);
99 rinfo->report_id = report->id;
95 break; 100 break;
96 101
97 case HID_REPORT_ID_NEXT: 102 case HID_REPORT_ID_NEXT:
98 list = (struct list_head *) 103 report = report_enum->report_id_hash[rid];
99 report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK]; 104 if (!report)
100 if (list == NULL)
101 return NULL; 105 return NULL;
102 list = list->next; 106
107 list = report->list.next;
103 if (list == &report_enum->report_list) 108 if (list == &report_enum->report_list)
104 return NULL; 109 return NULL;
105 rinfo->report_id = ((struct hid_report *) list)->id; 110
111 report = list_entry(list, struct hid_report, list);
112 rinfo->report_id = report->id;
106 break; 113 break;
107 114
108 default: 115 default:
@@ -125,12 +132,13 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref)
125 struct hid_field *field; 132 struct hid_field *field;
126 133
127 if (uref->report_type < HID_REPORT_TYPE_MIN || 134 if (uref->report_type < HID_REPORT_TYPE_MIN ||
128 uref->report_type > HID_REPORT_TYPE_MAX) return NULL; 135 uref->report_type > HID_REPORT_TYPE_MAX)
136 return NULL;
129 137
130 report_enum = hid->report_enum + 138 report_enum = hid->report_enum +
131 (uref->report_type - HID_REPORT_TYPE_MIN); 139 (uref->report_type - HID_REPORT_TYPE_MIN);
132 140
133 list_for_each_entry(report, &report_enum->report_list, list) 141 list_for_each_entry(report, &report_enum->report_list, list) {
134 for (i = 0; i < report->maxfield; i++) { 142 for (i = 0; i < report->maxfield; i++) {
135 field = report->field[i]; 143 field = report->field[i];
136 for (j = 0; j < field->maxusage; j++) { 144 for (j = 0; j < field->maxusage; j++) {
@@ -142,6 +150,7 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref)
142 } 150 }
143 } 151 }
144 } 152 }
153 }
145 154
146 return NULL; 155 return NULL;
147} 156}
@@ -150,9 +159,9 @@ static void hiddev_send_event(struct hid_device *hid,
150 struct hiddev_usage_ref *uref) 159 struct hiddev_usage_ref *uref)
151{ 160{
152 struct hiddev *hiddev = hid->hiddev; 161 struct hiddev *hiddev = hid->hiddev;
153 struct hiddev_list *list = hiddev->list; 162 struct hiddev_list *list;
154 163
155 while (list) { 164 list_for_each_entry(list, &hiddev->list, node) {
156 if (uref->field_index != HID_FIELD_INDEX_NONE || 165 if (uref->field_index != HID_FIELD_INDEX_NONE ||
157 (list->flags & HIDDEV_FLAG_REPORT) != 0) { 166 (list->flags & HIDDEV_FLAG_REPORT) != 0) {
158 list->buffer[list->head] = *uref; 167 list->buffer[list->head] = *uref;
@@ -160,8 +169,6 @@ static void hiddev_send_event(struct hid_device *hid,
160 (HIDDEV_BUFFER_SIZE - 1); 169 (HIDDEV_BUFFER_SIZE - 1);
161 kill_fasync(&list->fasync, SIGIO, POLL_IN); 170 kill_fasync(&list->fasync, SIGIO, POLL_IN);
162 } 171 }
163
164 list = list->next;
165 } 172 }
166 173
167 wake_up_interruptible(&hiddev->wait); 174 wake_up_interruptible(&hiddev->wait);
@@ -180,7 +187,7 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
180 uref.report_type = 187 uref.report_type =
181 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : 188 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
182 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : 189 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
183 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); 190 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0));
184 uref.report_id = field->report->id; 191 uref.report_id = field->report->id;
185 uref.field_index = field->index; 192 uref.field_index = field->index;
186 uref.usage_index = (usage - field->usage); 193 uref.usage_index = (usage - field->usage);
@@ -200,7 +207,7 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report)
200 uref.report_type = 207 uref.report_type =
201 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : 208 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
202 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : 209 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
203 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); 210 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0));
204 uref.report_id = report->id; 211 uref.report_id = report->id;
205 uref.field_index = HID_FIELD_INDEX_NONE; 212 uref.field_index = HID_FIELD_INDEX_NONE;
206 213
@@ -213,7 +220,9 @@ static int hiddev_fasync(int fd, struct file *file, int on)
213{ 220{
214 int retval; 221 int retval;
215 struct hiddev_list *list = file->private_data; 222 struct hiddev_list *list = file->private_data;
223
216 retval = fasync_helper(fd, file, on, &list->fasync); 224 retval = fasync_helper(fd, file, on, &list->fasync);
225
217 return retval < 0 ? retval : 0; 226 return retval < 0 ? retval : 0;
218} 227}
219 228
@@ -224,14 +233,9 @@ static int hiddev_fasync(int fd, struct file *file, int on)
224static int hiddev_release(struct inode * inode, struct file * file) 233static int hiddev_release(struct inode * inode, struct file * file)
225{ 234{
226 struct hiddev_list *list = file->private_data; 235 struct hiddev_list *list = file->private_data;
227 struct hiddev_list **listptr;
228 236
229 listptr = &list->hiddev->list;
230 hiddev_fasync(-1, file, 0); 237 hiddev_fasync(-1, file, 0);
231 238 list_del(&list->node);
232 while (*listptr && (*listptr != list))
233 listptr = &((*listptr)->next);
234 *listptr = (*listptr)->next;
235 239
236 if (!--list->hiddev->open) { 240 if (!--list->hiddev->open) {
237 if (list->hiddev->exist) 241 if (list->hiddev->exist)
@@ -248,7 +252,8 @@ static int hiddev_release(struct inode * inode, struct file * file)
248/* 252/*
249 * open file op 253 * open file op
250 */ 254 */
251static int hiddev_open(struct inode * inode, struct file * file) { 255static int hiddev_open(struct inode *inode, struct file *file)
256{
252 struct hiddev_list *list; 257 struct hiddev_list *list;
253 258
254 int i = iminor(inode) - HIDDEV_MINOR_BASE; 259 int i = iminor(inode) - HIDDEV_MINOR_BASE;
@@ -260,9 +265,7 @@ static int hiddev_open(struct inode * inode, struct file * file) {
260 return -ENOMEM; 265 return -ENOMEM;
261 266
262 list->hiddev = hiddev_table[i]; 267 list->hiddev = hiddev_table[i];
263 list->next = hiddev_table[i]->list; 268 list_add_tail(&list->node, &hiddev_table[i]->list);
264 hiddev_table[i]->list = list;
265
266 file->private_data = list; 269 file->private_data = list;
267 270
268 if (!list->hiddev->open++) 271 if (!list->hiddev->open++)
@@ -362,6 +365,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
362static unsigned int hiddev_poll(struct file *file, poll_table *wait) 365static unsigned int hiddev_poll(struct file *file, poll_table *wait)
363{ 366{
364 struct hiddev_list *list = file->private_data; 367 struct hiddev_list *list = file->private_data;
368
365 poll_wait(file, &list->hiddev->wait, wait); 369 poll_wait(file, &list->hiddev->wait, wait);
366 if (list->head != list->tail) 370 if (list->head != list->tail)
367 return POLLIN | POLLRDNORM; 371 return POLLIN | POLLRDNORM;
@@ -382,7 +386,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
382 struct hiddev_collection_info cinfo; 386 struct hiddev_collection_info cinfo;
383 struct hiddev_report_info rinfo; 387 struct hiddev_report_info rinfo;
384 struct hiddev_field_info finfo; 388 struct hiddev_field_info finfo;
385 struct hiddev_usage_ref_multi *uref_multi=NULL; 389 struct hiddev_usage_ref_multi *uref_multi = NULL;
386 struct hiddev_usage_ref *uref; 390 struct hiddev_usage_ref *uref;
387 struct hiddev_devinfo dinfo; 391 struct hiddev_devinfo dinfo;
388 struct hid_report *report; 392 struct hid_report *report;
@@ -764,15 +768,15 @@ int hiddev_connect(struct hid_device *hid)
764 } 768 }
765 769
766 init_waitqueue_head(&hiddev->wait); 770 init_waitqueue_head(&hiddev->wait);
767 771 INIT_LIST_HEAD(&hiddev->list);
768 hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
769
770 hiddev->hid = hid; 772 hiddev->hid = hid;
771 hiddev->exist = 1; 773 hiddev->exist = 1;
772 774
773 hid->minor = hid->intf->minor; 775 hid->minor = hid->intf->minor;
774 hid->hiddev = hiddev; 776 hid->hiddev = hiddev;
775 777
778 hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
779
776 return 0; 780 return 0;
777} 781}
778 782
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index e091d327bd9e..9c46746d5d00 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -12,8 +12,13 @@
12* the single I/O ports of the device. 12* the single I/O ports of the device.
13* 13*
14* Supported vendors: AK Modul-Bus Computer GmbH 14* Supported vendors: AK Modul-Bus Computer GmbH
15* Supported devices: CY7C63001A-PC (to be continued...) 15* (Firmware "Port-Chip")
16* Supported functions: Read/Write Ports (to be continued...) 16*
17* Supported devices: CY7C63001A-PC
18* CY7C63001C-PXC
19* CY7C63001C-SXC
20*
21* Supported functions: Read/Write Ports
17* 22*
18* 23*
19* This program is free software; you can redistribute it and/or 24* This program is free software; you can redistribute it and/or
@@ -203,7 +208,7 @@ static int cypress_probe(struct usb_interface *interface,
203 /* allocate memory for our device state and initialize it */ 208 /* allocate memory for our device state and initialize it */
204 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 209 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
205 if (dev == NULL) { 210 if (dev == NULL) {
206 dev_err(&dev->udev->dev, "Out of memory!\n"); 211 dev_err(&interface->dev, "Out of memory!\n");
207 goto error; 212 goto error;
208 } 213 }
209 214
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 786e1dbe88ec..983e104dd452 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -1242,11 +1242,12 @@ done:
1242static int ctrl_out (struct usbtest_dev *dev, 1242static int ctrl_out (struct usbtest_dev *dev,
1243 unsigned count, unsigned length, unsigned vary) 1243 unsigned count, unsigned length, unsigned vary)
1244{ 1244{
1245 unsigned i, j, len, retval; 1245 unsigned i, j, len;
1246 int retval;
1246 u8 *buf; 1247 u8 *buf;
1247 char *what = "?"; 1248 char *what = "?";
1248 struct usb_device *udev; 1249 struct usb_device *udev;
1249 1250
1250 if (length < 1 || length > 0xffff || vary >= length) 1251 if (length < 1 || length > 0xffff || vary >= length)
1251 return -EINVAL; 1252 return -EINVAL;
1252 1253
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index e5e6e4f3ef87..bd09232ce13c 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -175,6 +175,8 @@ static inline struct sk_buff *pull_skb(rtl8150_t *);
175static void rtl8150_disconnect(struct usb_interface *intf); 175static void rtl8150_disconnect(struct usb_interface *intf);
176static int rtl8150_probe(struct usb_interface *intf, 176static int rtl8150_probe(struct usb_interface *intf,
177 const struct usb_device_id *id); 177 const struct usb_device_id *id);
178static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message);
179static int rtl8150_resume(struct usb_interface *intf);
178 180
179static const char driver_name [] = "rtl8150"; 181static const char driver_name [] = "rtl8150";
180 182
@@ -183,6 +185,8 @@ static struct usb_driver rtl8150_driver = {
183 .probe = rtl8150_probe, 185 .probe = rtl8150_probe,
184 .disconnect = rtl8150_disconnect, 186 .disconnect = rtl8150_disconnect,
185 .id_table = rtl8150_table, 187 .id_table = rtl8150_table,
188 .suspend = rtl8150_suspend,
189 .resume = rtl8150_resume
186}; 190};
187 191
188/* 192/*
@@ -238,9 +242,11 @@ static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size)
238 usb_fill_control_urb(dev->ctrl_urb, dev->udev, 242 usb_fill_control_urb(dev->ctrl_urb, dev->udev,
239 usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, 243 usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr,
240 &dev->rx_creg, size, ctrl_callback, dev); 244 &dev->rx_creg, size, ctrl_callback, dev);
241 if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) 245 if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) {
246 if (ret == -ENODEV)
247 netif_device_detach(dev->netdev);
242 err("control request submission failed: %d", ret); 248 err("control request submission failed: %d", ret);
243 else 249 } else
244 set_bit(RX_REG_SET, &dev->flags); 250 set_bit(RX_REG_SET, &dev->flags);
245 251
246 return ret; 252 return ret;
@@ -416,6 +422,7 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
416 struct sk_buff *skb; 422 struct sk_buff *skb;
417 struct net_device *netdev; 423 struct net_device *netdev;
418 u16 rx_stat; 424 u16 rx_stat;
425 int status;
419 426
420 dev = urb->context; 427 dev = urb->context;
421 if (!dev) 428 if (!dev)
@@ -465,7 +472,10 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
465goon: 472goon:
466 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 473 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
467 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 474 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
468 if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) { 475 status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
476 if (status == -ENODEV)
477 netif_device_detach(dev->netdev);
478 else if (status) {
469 set_bit(RX_URB_FAIL, &dev->flags); 479 set_bit(RX_URB_FAIL, &dev->flags);
470 goto resched; 480 goto resched;
471 } else { 481 } else {
@@ -481,6 +491,7 @@ static void rx_fixup(unsigned long data)
481{ 491{
482 rtl8150_t *dev; 492 rtl8150_t *dev;
483 struct sk_buff *skb; 493 struct sk_buff *skb;
494 int status;
484 495
485 dev = (rtl8150_t *)data; 496 dev = (rtl8150_t *)data;
486 497
@@ -499,10 +510,13 @@ static void rx_fixup(unsigned long data)
499 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 510 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
500 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 511 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
501try_again: 512try_again:
502 if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) { 513 status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
514 if (status == -ENODEV) {
515 netif_device_detach(dev->netdev);
516 } else if (status) {
503 set_bit(RX_URB_FAIL, &dev->flags); 517 set_bit(RX_URB_FAIL, &dev->flags);
504 goto tlsched; 518 goto tlsched;
505 } else { 519 } else {
506 clear_bit(RX_URB_FAIL, &dev->flags); 520 clear_bit(RX_URB_FAIL, &dev->flags);
507 } 521 }
508 522
@@ -574,12 +588,43 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs)
574 588
575resubmit: 589resubmit:
576 status = usb_submit_urb (urb, SLAB_ATOMIC); 590 status = usb_submit_urb (urb, SLAB_ATOMIC);
577 if (status) 591 if (status == -ENODEV)
592 netif_device_detach(dev->netdev);
593 else if (status)
578 err ("can't resubmit intr, %s-%s/input0, status %d", 594 err ("can't resubmit intr, %s-%s/input0, status %d",
579 dev->udev->bus->bus_name, 595 dev->udev->bus->bus_name,
580 dev->udev->devpath, status); 596 dev->udev->devpath, status);
581} 597}
582 598
599static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message)
600{
601 rtl8150_t *dev = usb_get_intfdata(intf);
602
603 netif_device_detach(dev->netdev);
604
605 if (netif_running(dev->netdev)) {
606 usb_kill_urb(dev->rx_urb);
607 usb_kill_urb(dev->intr_urb);
608 }
609 return 0;
610}
611
612static int rtl8150_resume(struct usb_interface *intf)
613{
614 rtl8150_t *dev = usb_get_intfdata(intf);
615
616 netif_device_attach(dev->netdev);
617 if (netif_running(dev->netdev)) {
618 dev->rx_urb->status = 0;
619 dev->rx_urb->actual_length = 0;
620 read_bulk_callback(dev->rx_urb, NULL);
621
622 dev->intr_urb->status = 0;
623 dev->intr_urb->actual_length = 0;
624 intr_callback(dev->intr_urb, NULL);
625 }
626 return 0;
627}
583 628
584/* 629/*
585** 630**
@@ -690,9 +735,14 @@ static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev)
690 usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), 735 usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2),
691 skb->data, count, write_bulk_callback, dev); 736 skb->data, count, write_bulk_callback, dev);
692 if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) { 737 if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) {
693 warn("failed tx_urb %d\n", res); 738 /* Can we get/handle EPIPE here? */
694 dev->stats.tx_errors++; 739 if (res == -ENODEV)
695 netif_start_queue(netdev); 740 netif_device_detach(dev->netdev);
741 else {
742 warn("failed tx_urb %d\n", res);
743 dev->stats.tx_errors++;
744 netif_start_queue(netdev);
745 }
696 } else { 746 } else {
697 dev->stats.tx_packets++; 747 dev->stats.tx_packets++;
698 dev->stats.tx_bytes += skb->len; 748 dev->stats.tx_bytes += skb->len;
@@ -729,16 +779,25 @@ static int rtl8150_open(struct net_device *netdev)
729 779
730 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 780 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
731 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 781 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
732 if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) 782 if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) {
783 if (res == -ENODEV)
784 netif_device_detach(dev->netdev);
733 warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); 785 warn("%s: rx_urb submit failed: %d", __FUNCTION__, res);
786 return res;
787 }
734 usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3), 788 usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3),
735 dev->intr_buff, INTBUFSIZE, intr_callback, 789 dev->intr_buff, INTBUFSIZE, intr_callback,
736 dev, dev->intr_interval); 790 dev, dev->intr_interval);
737 if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) 791 if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) {
792 if (res == -ENODEV)
793 netif_device_detach(dev->netdev);
738 warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); 794 warn("%s: intr_urb submit failed: %d", __FUNCTION__, res);
739 netif_start_queue(netdev); 795 usb_kill_urb(dev->rx_urb);
796 return res;
797 }
740 enable_net_traffic(dev); 798 enable_net_traffic(dev);
741 set_carrier(netdev); 799 set_carrier(netdev);
800 netif_start_queue(netdev);
742 801
743 return res; 802 return res;
744} 803}
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index ac33bd47cfce..f5b9438c94f0 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -62,15 +62,6 @@ config USB_SERIAL_AIRPRIME
62 To compile this driver as a module, choose M here: the 62 To compile this driver as a module, choose M here: the
63 module will be called airprime. 63 module will be called airprime.
64 64
65config USB_SERIAL_ANYDATA
66 tristate "USB AnyData CDMA Wireless Driver"
67 depends on USB_SERIAL
68 help
69 Say Y here if you want to use a AnyData CDMA device.
70
71 To compile this driver as a module, choose M here: the
72 module will be called anydata.
73
74config USB_SERIAL_ARK3116 65config USB_SERIAL_ARK3116
75 tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" 66 tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)"
76 depends on USB_SERIAL && EXPERIMENTAL 67 depends on USB_SERIAL && EXPERIMENTAL
@@ -502,15 +493,18 @@ config USB_SERIAL_XIRCOM
502 module will be called keyspan_pda. 493 module will be called keyspan_pda.
503 494
504config USB_SERIAL_OPTION 495config USB_SERIAL_OPTION
505 tristate "USB driver for GSM modems" 496 tristate "USB driver for GSM and CDMA modems"
506 depends on USB_SERIAL 497 depends on USB_SERIAL
507 help 498 help
508 Say Y here if you have an "Option" GSM PCMCIA card 499 Say Y here if you have a GSM or CDMA modem that's connected to USB.
509 (or an OEM version: branded Huawei, Audiovox, or Novatel). 500
501 This driver also supports several PCMCIA cards which have a
502 built-in OHCI-USB adapter and an internally-connected GSM modem.
503 The USB bus on these cards is not accessible externally.
510 504
511 These cards feature a built-in OHCI-USB adapter and an 505 Supported devices include (some of?) those made by:
512 internally-connected GSM modem. The USB bus is not 506 Option, Huawei, Audiovox, Sierra Wireless, Novatel Wireless, or
513 accessible externally. 507 Anydata.
514 508
515 To compile this driver as a module, choose M here: the 509 To compile this driver as a module, choose M here: the
516 module will be called option. 510 module will be called option.
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 35d4acc7f1d3..8efed2ce1ba3 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -12,7 +12,6 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o
12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) 12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y)
13 13
14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o 14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o
15obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o
16obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o 15obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o
17obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o 16obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o
18obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o 17obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c
deleted file mode 100644
index 01843ef8c11e..000000000000
--- a/drivers/usb/serial/anydata.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * AnyData CDMA Serial USB driver
3 *
4 * Copyright (C) 2005 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/tty.h>
14#include <linux/module.h>
15#include <linux/usb.h>
16#include <linux/usb/serial.h>
17
18static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */
20 { },
21};
22MODULE_DEVICE_TABLE(usb, id_table);
23
24/* if overridden by the user, then use their value for the size of the
25 * read and write urbs */
26static int buffer_size;
27static int debug;
28
29static struct usb_driver anydata_driver = {
30 .name = "anydata",
31 .probe = usb_serial_probe,
32 .disconnect = usb_serial_disconnect,
33 .id_table = id_table,
34 .no_dynamic_id = 1,
35};
36
37static int anydata_open(struct usb_serial_port *port, struct file *filp)
38{
39 char *buffer;
40 int result = 0;
41
42 dbg("%s - port %d", __FUNCTION__, port->number);
43
44 if (buffer_size) {
45 /* override the default buffer sizes */
46 buffer = kmalloc(buffer_size, GFP_KERNEL);
47 if (!buffer) {
48 dev_err(&port->dev, "%s - out of memory.\n",
49 __FUNCTION__);
50 return -ENOMEM;
51 }
52 kfree (port->read_urb->transfer_buffer);
53 port->read_urb->transfer_buffer = buffer;
54 port->read_urb->transfer_buffer_length = buffer_size;
55
56 buffer = kmalloc(buffer_size, GFP_KERNEL);
57 if (!buffer) {
58 dev_err(&port->dev, "%s - out of memory.\n",
59 __FUNCTION__);
60 return -ENOMEM;
61 }
62 kfree (port->write_urb->transfer_buffer);
63 port->write_urb->transfer_buffer = buffer;
64 port->write_urb->transfer_buffer_length = buffer_size;
65 port->bulk_out_size = buffer_size;
66 }
67
68 /* Start reading from the device */
69 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
70 usb_rcvbulkpipe(port->serial->dev,
71 port->bulk_in_endpointAddress),
72 port->read_urb->transfer_buffer,
73 port->read_urb->transfer_buffer_length,
74 usb_serial_generic_read_bulk_callback, port);
75 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
76 if (result)
77 dev_err(&port->dev,
78 "%s - failed submitting read urb, error %d\n",
79 __FUNCTION__, result);
80
81 return result;
82}
83
84static struct usb_serial_driver anydata_device = {
85 .driver = {
86 .owner = THIS_MODULE,
87 .name = "anydata",
88 },
89 .id_table = id_table,
90 .num_interrupt_in = NUM_DONT_CARE,
91 .num_bulk_in = NUM_DONT_CARE,
92 .num_bulk_out = NUM_DONT_CARE,
93 .num_ports = 1,
94 .open = anydata_open,
95};
96
97static int __init anydata_init(void)
98{
99 int retval;
100
101 retval = usb_serial_register(&anydata_device);
102 if (retval)
103 return retval;
104 retval = usb_register(&anydata_driver);
105 if (retval)
106 usb_serial_deregister(&anydata_device);
107 return retval;
108}
109
110static void __exit anydata_exit(void)
111{
112 usb_deregister(&anydata_driver);
113 usb_serial_deregister(&anydata_device);
114}
115
116module_init(anydata_init);
117module_exit(anydata_exit);
118MODULE_LICENSE("GPL");
119
120module_param(debug, bool, S_IRUGO | S_IWUSR);
121MODULE_PARM_DESC(debug, "Debug enabled or not");
122module_param(buffer_size, int, 0);
123MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers");
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b458aedc5fb6..15945e806f03 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -306,6 +306,8 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
306 306
307 307
308static struct usb_device_id id_table_combined [] = { 308static struct usb_device_id id_table_combined [] = {
309 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
310 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
309 { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, 311 { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) },
310 { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, 312 { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) },
311 { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, 313 { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) },
@@ -337,6 +339,7 @@ static struct usb_device_id id_table_combined [] = {
337 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 339 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
338 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 340 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
339 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 341 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
342 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
340 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, 343 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) },
341 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, 344 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) },
342 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, 345 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) },
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 04ef90fcb876..8888cd80a491 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -32,6 +32,12 @@
32#define FTDI_NF_RIC_PID 0x0001 /* Product Id */ 32#define FTDI_NF_RIC_PID 0x0001 /* Product Id */
33 33
34 34
35/* www.canusb.com Lawicel CANUSB device */
36#define FTDI_CANUSB_PID 0xFFA8 /* Product Id */
37
38/* AlphaMicro Components AMC-232USB01 device */
39#define FTDI_AMC232_PID 0xFF00 /* Product Id */
40
35/* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ 41/* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */
36#define FTDI_ACTZWAVE_PID 0xF2D0 42#define FTDI_ACTZWAVE_PID 0xF2D0
37 43
@@ -182,6 +188,10 @@
182/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ 188/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */
183#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ 189#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */
184 190
191/* TNC-X USB-to-packet-radio adapter, versions prior to 3.0 (DLP module) */
192
193#define FTDI_TNC_X_PID 0xEBE0
194
185/* 195/*
186 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). 196 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de).
187 * All of these devices use FTDI's vendor ID (0x0403). 197 * All of these devices use FTDI's vendor ID (0x0403).
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 59c5d999009a..9840bade79f9 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -250,6 +250,9 @@ static struct usb_device_id ipaq_id_table [] = {
250 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ 250 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */
251 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ 251 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
252 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ 252 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */
253 { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */
254 { USB_DEVICE(0x04DD, 0x9121) }, /* SHARP WS004SH USB Modem */
255 { USB_DEVICE(0x04DD, 0x9123) }, /* SHARP WS007SH USB Modem */
253 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ 256 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */
254 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ 257 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */
255 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ 258 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f0530c1d7b7a..c856e6f40e22 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -9,40 +9,14 @@
9 9
10 Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org> 10 Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org>
11 11
12 History: 12 History: see the git log.
13
14 2005-05-19 v0.1 Initial version, based on incomplete docs
15 and analysis of misbehavior with the standard driver
16 2005-05-20 v0.2 Extended the input buffer to avoid losing
17 random 64-byte chunks of data
18 2005-05-21 v0.3 implemented chars_in_buffer()
19 turned on low_latency
20 simplified the code somewhat
21 2005-05-24 v0.4 option_write() sometimes deadlocked under heavy load
22 removed some dead code
23 added sponsor notice
24 coding style clean-up
25 2005-06-20 v0.4.1 add missing braces :-/
26 killed end-of-line whitespace
27 2005-07-15 v0.4.2 rename WLAN product to FUSION, add FUSION2
28 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard
29 2005-09-20 v0.4.4 increased recv buffer size: the card sometimes
30 wants to send >2000 bytes.
31 2006-04-10 v0.5 fixed two array overrun errors :-/
32 2006-04-21 v0.5.1 added support for Sierra Wireless MC8755
33 2006-05-15 v0.6 re-enable multi-port support
34 2006-06-01 v0.6.1 add COBRA
35 2006-06-01 v0.6.2 add backwards-compatibility stuff
36 2006-06-01 v0.6.3 add Novatel Wireless
37 2006-06-01 v0.7 Option => GSM
38 2006-06-01 v0.7.1 add COBRA2
39 13
40 Work sponsored by: Sigos GmbH, Germany <info@sigos.de> 14 Work sponsored by: Sigos GmbH, Germany <info@sigos.de>
41 15
42 This driver exists because the "normal" serial driver doesn't work too well 16 This driver exists because the "normal" serial driver doesn't work too well
43 with GSM modems. Issues: 17 with GSM modems. Issues:
44 - data loss -- one single Receive URB is not nearly enough 18 - data loss -- one single Receive URB is not nearly enough
45 - nonstandard flow (Option devices) and multiplex (Sierra) control 19 - nonstandard flow (Option devices) control
46 - controlling the baud rate doesn't make sense 20 - controlling the baud rate doesn't make sense
47 21
48 This driver is named "option" because the most common device it's 22 This driver is named "option" because the most common device it's
@@ -96,8 +70,8 @@ static int option_send_setup(struct usb_serial_port *port);
96#define OPTION_VENDOR_ID 0x0AF0 70#define OPTION_VENDOR_ID 0x0AF0
97#define HUAWEI_VENDOR_ID 0x12D1 71#define HUAWEI_VENDOR_ID 0x12D1
98#define AUDIOVOX_VENDOR_ID 0x0F3D 72#define AUDIOVOX_VENDOR_ID 0x0F3D
99#define SIERRAWIRELESS_VENDOR_ID 0x1199
100#define NOVATELWIRELESS_VENDOR_ID 0x1410 73#define NOVATELWIRELESS_VENDOR_ID 0x1410
74#define ANYDATA_VENDOR_ID 0x16d5
101 75
102#define OPTION_PRODUCT_OLD 0x5000 76#define OPTION_PRODUCT_OLD 0x5000
103#define OPTION_PRODUCT_FUSION 0x6000 77#define OPTION_PRODUCT_FUSION 0x6000
@@ -106,8 +80,8 @@ static int option_send_setup(struct usb_serial_port *port);
106#define OPTION_PRODUCT_COBRA2 0x6600 80#define OPTION_PRODUCT_COBRA2 0x6600
107#define HUAWEI_PRODUCT_E600 0x1001 81#define HUAWEI_PRODUCT_E600 0x1001
108#define AUDIOVOX_PRODUCT_AIRCARD 0x0112 82#define AUDIOVOX_PRODUCT_AIRCARD 0x0112
109#define SIERRAWIRELESS_PRODUCT_MC8755 0x6802
110#define NOVATELWIRELESS_PRODUCT_U740 0x1400 83#define NOVATELWIRELESS_PRODUCT_U740 0x1400
84#define ANYDATA_PRODUCT_ID 0x6501
111 85
112static struct usb_device_id option_ids[] = { 86static struct usb_device_id option_ids[] = {
113 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, 87 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) },
@@ -117,8 +91,8 @@ static struct usb_device_id option_ids[] = {
117 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, 91 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) },
118 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 92 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
119 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, 93 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) },
120 { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) },
121 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 94 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
95 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
122 { } /* Terminating entry */ 96 { } /* Terminating entry */
123}; 97};
124 98
@@ -131,10 +105,7 @@ static struct usb_device_id option_ids1[] = {
131 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 105 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
132 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, 106 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) },
133 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 107 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
134 { } /* Terminating entry */ 108 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
135};
136static struct usb_device_id option_ids3[] = {
137 { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) },
138 { } /* Terminating entry */ 109 { } /* Terminating entry */
139}; 110};
140 111
@@ -151,37 +122,11 @@ static struct usb_driver option_driver = {
151/* The card has three separate interfaces, which the serial driver 122/* The card has three separate interfaces, which the serial driver
152 * recognizes separately, thus num_port=1. 123 * recognizes separately, thus num_port=1.
153 */ 124 */
154static struct usb_serial_driver option_3port_device = {
155 .driver = {
156 .owner = THIS_MODULE,
157 .name = "option",
158 },
159 .description = "GSM modem (3-port)",
160 .id_table = option_ids3,
161 .num_interrupt_in = NUM_DONT_CARE,
162 .num_bulk_in = NUM_DONT_CARE,
163 .num_bulk_out = NUM_DONT_CARE,
164 .num_ports = 3,
165 .open = option_open,
166 .close = option_close,
167 .write = option_write,
168 .write_room = option_write_room,
169 .chars_in_buffer = option_chars_in_buffer,
170 .throttle = option_rx_throttle,
171 .unthrottle = option_rx_unthrottle,
172 .set_termios = option_set_termios,
173 .break_ctl = option_break_ctl,
174 .tiocmget = option_tiocmget,
175 .tiocmset = option_tiocmset,
176 .attach = option_startup,
177 .shutdown = option_shutdown,
178 .read_int_callback = option_instat_callback,
179};
180 125
181static struct usb_serial_driver option_1port_device = { 126static struct usb_serial_driver option_1port_device = {
182 .driver = { 127 .driver = {
183 .owner = THIS_MODULE, 128 .owner = THIS_MODULE,
184 .name = "option", 129 .name = "option1",
185 }, 130 },
186 .description = "GSM modem (1-port)", 131 .description = "GSM modem (1-port)",
187 .id_table = option_ids1, 132 .id_table = option_ids1,
@@ -245,9 +190,6 @@ static int __init option_init(void)
245 retval = usb_serial_register(&option_1port_device); 190 retval = usb_serial_register(&option_1port_device);
246 if (retval) 191 if (retval)
247 goto failed_1port_device_register; 192 goto failed_1port_device_register;
248 retval = usb_serial_register(&option_3port_device);
249 if (retval)
250 goto failed_3port_device_register;
251 retval = usb_register(&option_driver); 193 retval = usb_register(&option_driver);
252 if (retval) 194 if (retval)
253 goto failed_driver_register; 195 goto failed_driver_register;
@@ -257,8 +199,6 @@ static int __init option_init(void)
257 return 0; 199 return 0;
258 200
259failed_driver_register: 201failed_driver_register:
260 usb_serial_deregister (&option_3port_device);
261failed_3port_device_register:
262 usb_serial_deregister (&option_1port_device); 202 usb_serial_deregister (&option_1port_device);
263failed_1port_device_register: 203failed_1port_device_register:
264 return retval; 204 return retval;
@@ -267,7 +207,6 @@ failed_1port_device_register:
267static void __exit option_exit(void) 207static void __exit option_exit(void)
268{ 208{
269 usb_deregister (&option_driver); 209 usb_deregister (&option_driver);
270 usb_serial_deregister (&option_3port_device);
271 usb_serial_deregister (&option_1port_device); 210 usb_serial_deregister (&option_1port_device);
272} 211}
273 212
@@ -656,7 +595,6 @@ static void option_setup_urbs(struct usb_serial *serial)
656 595
657 dbg("%s", __FUNCTION__); 596 dbg("%s", __FUNCTION__);
658 597
659
660 for (i = 0; i < serial->num_ports; i++) { 598 for (i = 0; i < serial->num_ports; i++) {
661 port = serial->port[i]; 599 port = serial->port[i];
662 portdata = usb_get_serial_port_data(port); 600 portdata = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 259db31b65c1..65e4d046951a 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -79,8 +79,8 @@ static struct usb_device_id id_table [] = {
79 { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, 79 { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) },
80 { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, 80 { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) },
81 { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, 81 { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) },
82 { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) },
83 { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, 82 { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) },
83 { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) },
84 { } /* Terminating entry */ 84 { } /* Terminating entry */
85}; 85};
86 86
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index d9c1e6e0b4b3..55195e76eb6f 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -82,10 +82,10 @@
82#define SPEEDDRAGON_VENDOR_ID 0x0e55 82#define SPEEDDRAGON_VENDOR_ID 0x0e55
83#define SPEEDDRAGON_PRODUCT_ID 0x110b 83#define SPEEDDRAGON_PRODUCT_ID 0x110b
84 84
85/* Ours Technology Inc DKU-5 clone, chipset: Prolific Technology Inc */
86#define OTI_VENDOR_ID 0x0ea0
87#define OTI_PRODUCT_ID 0x6858
88
89/* DATAPILOT Universal-2 Phone Cable */ 85/* DATAPILOT Universal-2 Phone Cable */
90#define DATAPILOT_U2_VENDOR_ID 0x0731 86#define DATAPILOT_U2_VENDOR_ID 0x0731
91#define DATAPILOT_U2_PRODUCT_ID 0x2003 87#define DATAPILOT_U2_PRODUCT_ID 0x2003
88
89/* Belkin "F5U257" Serial Adapter */
90#define BELKIN_VENDOR_ID 0x050d
91#define BELKIN_PRODUCT_ID 0x0257
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index a5ca449f6e64..4a803d69fa36 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -145,6 +145,13 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100,
145 US_SC_DEVICE, US_PR_DEVICE, NULL, 145 US_SC_DEVICE, US_PR_DEVICE, NULL,
146 US_FL_IGNORE_RESIDUE ), 146 US_FL_IGNORE_RESIDUE ),
147 147
148/* Reported by Mario Rettig <mariorettig@web.de> */
149UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
150 "Nokia",
151 "Nokia 3250",
152 US_SC_DEVICE, US_PR_DEVICE, NULL,
153 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
154
148/* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and 155/* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and
149 * Einar Th. Einarsson <einarthered@gmail.com> */ 156 * Einar Th. Einarsson <einarthered@gmail.com> */
150UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, 157UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100,
@@ -627,18 +634,6 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
627 "Digital Camera EX-20 DSC", 634 "Digital Camera EX-20 DSC",
628 US_SC_8070, US_PR_DEVICE, NULL, 0 ), 635 US_SC_8070, US_PR_DEVICE, NULL, 0 ),
629 636
630/* The entry was here before I took over, and had US_SC_RBC. It turns
631 * out that isn't needed. Additionally, Torsten Eriksson
632 * <Torsten.Eriksson@bergianska.se> is able to use his device fine
633 * without this entry at all - but I don't suspect that will be true
634 * for all users (the protocol is likely needed), so is staying at
635 * this time. - Phil Dibowitz <phil@ipom.com>
636 */
637UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200,
638 "LaCie",
639 "USB Hard Disk",
640 US_SC_DEVICE, US_PR_CB, NULL, 0 ),
641
642/* Submitted by Joel Bourquard <numlock@freesurf.ch> 637/* Submitted by Joel Bourquard <numlock@freesurf.ch>
643 * Some versions of this device need the SubClass and Protocol overrides 638 * Some versions of this device need the SubClass and Protocol overrides
644 * while others don't. 639 * while others don't.
@@ -1106,7 +1101,15 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
1106 "Optio S/S4", 1101 "Optio S/S4",
1107 US_SC_DEVICE, US_PR_DEVICE, NULL, 1102 US_SC_DEVICE, US_PR_DEVICE, NULL,
1108 US_FL_FIX_INQUIRY ), 1103 US_FL_FIX_INQUIRY ),
1109 1104
1105/* This is a virtual windows driver CD, which the zd1211rw driver automatically
1106 * converts into a WLAN device. */
1107UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
1108 "ZyXEL",
1109 "G-220F USB-WLAN Install",
1110 US_SC_DEVICE, US_PR_DEVICE, NULL,
1111 US_FL_IGNORE_DEVICE ),
1112
1110#ifdef CONFIG_USB_STORAGE_ISD200 1113#ifdef CONFIG_USB_STORAGE_ISD200
1111UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1114UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1112 "ATI", 1115 "ATI",
@@ -1237,6 +1240,16 @@ UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103,
1237 US_SC_DEVICE, US_PR_DEVICE, NULL, 1240 US_SC_DEVICE, US_PR_DEVICE, NULL,
1238 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), 1241 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64),
1239 1242
1243/* David Kuehling <dvdkhlng@gmx.de>:
1244 * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI
1245 * errors when trying to write.
1246 */
1247UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100,
1248 "C-MEX",
1249 "A-VOX",
1250 US_SC_DEVICE, US_PR_DEVICE, NULL,
1251 US_FL_IGNORE_RESIDUE ),
1252
1240/* Reported by Michael Stattmann <michael@stattmann.com> */ 1253/* Reported by Michael Stattmann <michael@stattmann.com> */
1241UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, 1254UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1242 "Sony Ericsson", 1255 "Sony Ericsson",
@@ -1248,7 +1261,7 @@ UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1248 * Tested on hardware version 1.10. 1261 * Tested on hardware version 1.10.
1249 * Entry is needed only for the initializer function override. 1262 * Entry is needed only for the initializer function override.
1250 */ 1263 */
1251UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x9999, 1264UNUSUAL_DEV( 0x1019, 0x0c55, 0x0110, 0x0110,
1252 "Desknote", 1265 "Desknote",
1253 "UCR-61S2B", 1266 "UCR-61S2B",
1254 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 1267 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 5ee19be52f65..8d7bdcb5924d 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -483,7 +483,7 @@ static struct us_unusual_dev *find_unusual(const struct usb_device_id *id)
483} 483}
484 484
485/* Get the unusual_devs entries and the string descriptors */ 485/* Get the unusual_devs entries and the string descriptors */
486static void get_device_info(struct us_data *us, const struct usb_device_id *id) 486static int get_device_info(struct us_data *us, const struct usb_device_id *id)
487{ 487{
488 struct usb_device *dev = us->pusb_dev; 488 struct usb_device *dev = us->pusb_dev;
489 struct usb_interface_descriptor *idesc = 489 struct usb_interface_descriptor *idesc =
@@ -500,6 +500,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
500 unusual_dev->useTransport; 500 unusual_dev->useTransport;
501 us->flags = USB_US_ORIG_FLAGS(id->driver_info); 501 us->flags = USB_US_ORIG_FLAGS(id->driver_info);
502 502
503 if (us->flags & US_FL_IGNORE_DEVICE) {
504 printk(KERN_INFO USB_STORAGE "device ignored\n");
505 return -ENODEV;
506 }
507
503 /* 508 /*
504 * This flag is only needed when we're in high-speed, so let's 509 * This flag is only needed when we're in high-speed, so let's
505 * disable it if we're in full-speed 510 * disable it if we're in full-speed
@@ -541,6 +546,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
541 msgs[msg], 546 msgs[msg],
542 UTS_RELEASE); 547 UTS_RELEASE);
543 } 548 }
549
550 return 0;
544} 551}
545 552
546/* Get the transport settings */ 553/* Get the transport settings */
@@ -969,7 +976,9 @@ static int storage_probe(struct usb_interface *intf,
969 * of the match from the usb_device_id table, so we can find the 976 * of the match from the usb_device_id table, so we can find the
970 * corresponding entry in the private table. 977 * corresponding entry in the private table.
971 */ 978 */
972 get_device_info(us, id); 979 result = get_device_info(us, id);
980 if (result)
981 goto BadDevice;
973 982
974 /* Get the transport, protocol, and pipe settings */ 983 /* Get the transport, protocol, and pipe settings */
975 result = get_transport(us); 984 result = get_transport(us);