diff options
29 files changed, 343 insertions, 364 deletions
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt index f86550fe38ee..22c5331260ca 100644 --- a/Documentation/usb/proc_usb_info.txt +++ b/Documentation/usb/proc_usb_info.txt | |||
@@ -59,7 +59,7 @@ bind to an interface (or perhaps several) using an ioctl call. You | |||
59 | would issue more ioctls to the device to communicate to it using | 59 | would issue more ioctls to the device to communicate to it using |
60 | control, bulk, or other kinds of USB transfers. The IOCTLs are | 60 | control, bulk, or other kinds of USB transfers. The IOCTLs are |
61 | listed in the <linux/usbdevice_fs.h> file, and at this writing the | 61 | listed in the <linux/usbdevice_fs.h> file, and at this writing the |
62 | source code (linux/drivers/usb/devio.c) is the primary reference | 62 | source code (linux/drivers/usb/core/devio.c) is the primary reference |
63 | for how to access devices through those files. | 63 | for how to access devices through those files. |
64 | 64 | ||
65 | Note that since by default these BBB/DDD files are writable only by | 65 | Note that since by default these BBB/DDD files are writable only by |
diff --git a/Documentation/usb/usb-help.txt b/Documentation/usb/usb-help.txt index b7c324973695..a7408593829f 100644 --- a/Documentation/usb/usb-help.txt +++ b/Documentation/usb/usb-help.txt | |||
@@ -5,8 +5,7 @@ For USB help other than the readme files that are located in | |||
5 | Documentation/usb/*, see the following: | 5 | Documentation/usb/*, see the following: |
6 | 6 | ||
7 | Linux-USB project: http://www.linux-usb.org | 7 | Linux-USB project: http://www.linux-usb.org |
8 | mirrors at http://www.suse.cz/development/linux-usb/ | 8 | mirrors at http://usb.in.tum.de/linux-usb/ |
9 | and http://usb.in.tum.de/linux-usb/ | ||
10 | and http://it.linux-usb.org | 9 | and http://it.linux-usb.org |
11 | Linux USB Guide: http://linux-usb.sourceforge.net | 10 | Linux USB Guide: http://linux-usb.sourceforge.net |
12 | Linux-USB device overview (working devices and drivers): | 11 | Linux-USB device overview (working devices and drivers): |
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 | ||
518 | static struct usb_device *usbdev_lookup_minor(int minor) | 518 | static 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 | ||
1590 | static void usbdev_remove(struct usb_device *dev) | 1590 | static 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 | ||
1595 | static int usbdev_notify(struct notifier_block *self, unsigned long action, | 1595 | static 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 | } |
205 | exit: | 206 | exit: |
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 | ||
208 | config USB_GADGET_DUMMY_HCD | 208 | config 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 | ||
74 | static const char driver_name [] = "at91_udc"; | 78 | static const char driver_name [] = "at91_udc"; |
75 | static const char ep0name[] = "ep0"; | 79 | static 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 */ |
324 | static int read_fifo (struct at91_ep *ep, struct at91_request *req) | 334 | static 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 | ||
475 | static int at91_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | 485 | static 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 | ||
585 | static struct usb_request *at91_ep_alloc_request (struct usb_ep *_ep, unsigned int gfp_flags) | 596 | static struct usb_request * |
597 | at91_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 | ||
1466 | static void nop_release(struct device *dev) | ||
1467 | { | ||
1468 | /* nothing to free */ | ||
1469 | } | ||
1470 | |||
1455 | static struct at91_udc controller = { | 1471 | static 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 | ||
1532 | static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r) | 1555 | static 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) | |||
1678 | fail1: | 1720 | fail1: |
1679 | device_unregister(&udc->gadget.dev); | 1721 | device_unregister(&udc->gadget.dev); |
1680 | fail0: | 1722 | fail0: |
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 | ||
1686 | static int __devexit at91udc_remove(struct platform_device *dev) | 1728 | static 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 |
1711 | static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg) | 1754 | static 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 | ||
1733 | static int at91udc_resume(struct platform_device *dev) | 1781 | static 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 | } |
1768 | module_exit(udc_exit_module); | 1816 | module_exit(udc_exit_module); |
1769 | 1817 | ||
1770 | MODULE_DESCRIPTION("AT91RM9200 udc driver"); | 1818 | MODULE_DESCRIPTION("AT91 udc driver"); |
1771 | MODULE_AUTHOR("Thomas Rathbone, David Brownell"); | 1819 | MODULE_AUTHOR("Thomas Rathbone, David Brownell"); |
1772 | MODULE_LICENSE("GPL"); | 1820 | MODULE_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 | ||
146 | static inline struct at91_udc *to_udc(struct usb_gadget *g) | 147 | static 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 */ |
27 | static struct clk *iclk, *fclk; | 27 | static struct clk *iclk, *fclk; |
28 | static int clocked; | ||
28 | 29 | ||
29 | extern int usb_disabled(void); | 30 | extern int usb_disabled(void); |
30 | 31 | ||
@@ -35,13 +36,14 @@ static void at91_start_hc(struct platform_device *pdev) | |||
35 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 36 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
36 | struct ohci_regs __iomem *regs = hcd->regs; | 37 | struct ohci_regs __iomem *regs = hcd->regs; |
37 | 38 | ||
38 | dev_dbg(&pdev->dev, "starting AT91RM9200 OHCI USB Controller\n"); | 39 | dev_dbg(&pdev->dev, "start\n"); |
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Start the USB clocks. | 42 | * Start the USB clocks. |
42 | */ | 43 | */ |
43 | clk_enable(iclk); | 44 | clk_enable(iclk); |
44 | clk_enable(fclk); | 45 | clk_enable(fclk); |
46 | clocked = 1; | ||
45 | 47 | ||
46 | /* | 48 | /* |
47 | * The USB host controller must remain in reset. | 49 | * The USB host controller must remain in reset. |
@@ -54,7 +56,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
54 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 56 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
55 | struct ohci_regs __iomem *regs = hcd->regs; | 57 | struct ohci_regs __iomem *regs = hcd->regs; |
56 | 58 | ||
57 | dev_dbg(&pdev->dev, "stopping AT91RM9200 OHCI USB Controller\n"); | 59 | dev_dbg(&pdev->dev, "stop\n"); |
58 | 60 | ||
59 | /* | 61 | /* |
60 | * Put the USB host controller into reset. | 62 | * Put the USB host controller into reset. |
@@ -66,6 +68,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
66 | */ | 68 | */ |
67 | clk_disable(fclk); | 69 | clk_disable(fclk); |
68 | clk_disable(iclk); | 70 | clk_disable(iclk); |
71 | clocked = 0; | ||
69 | } | 72 | } |
70 | 73 | ||
71 | 74 | ||
@@ -78,14 +81,15 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
78 | 81 | ||
79 | 82 | ||
80 | /** | 83 | /** |
81 | * usb_hcd_at91_probe - initialize AT91RM9200-based HCDs | 84 | * usb_hcd_at91_probe - initialize AT91-based HCDs |
82 | * Context: !in_interrupt() | 85 | * Context: !in_interrupt() |
83 | * | 86 | * |
84 | * Allocates basic resources for this USB host controller, and | 87 | * Allocates basic resources for this USB host controller, and |
85 | * then invokes the start() method for the HCD associated with it | 88 | * then invokes the start() method for the HCD associated with it |
86 | * through the hotplug entry's driver_data. | 89 | * through the hotplug entry's driver_data. |
87 | */ | 90 | */ |
88 | int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) | 91 | static int usb_hcd_at91_probe(const struct hc_driver *driver, |
92 | struct platform_device *pdev) | ||
89 | { | 93 | { |
90 | int retval; | 94 | int retval; |
91 | struct usb_hcd *hcd = NULL; | 95 | struct usb_hcd *hcd = NULL; |
@@ -95,12 +99,13 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
95 | return -ENODEV; | 99 | return -ENODEV; |
96 | } | 100 | } |
97 | 101 | ||
98 | if ((pdev->resource[0].flags != IORESOURCE_MEM) || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | 102 | if ((pdev->resource[0].flags != IORESOURCE_MEM) |
103 | || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | ||
99 | pr_debug("hcd probe: invalid resource type\n"); | 104 | pr_debug("hcd probe: invalid resource type\n"); |
100 | return -ENODEV; | 105 | return -ENODEV; |
101 | } | 106 | } |
102 | 107 | ||
103 | hcd = usb_create_hcd(driver, &pdev->dev, "at91rm9200"); | 108 | hcd = usb_create_hcd(driver, &pdev->dev, "at91"); |
104 | if (!hcd) | 109 | if (!hcd) |
105 | return -ENOMEM; | 110 | return -ENOMEM; |
106 | hcd->rsrc_start = pdev->resource[0].start; | 111 | hcd->rsrc_start = pdev->resource[0].start; |
@@ -149,21 +154,23 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
149 | /* may be called with controller, bus, and devices active */ | 154 | /* may be called with controller, bus, and devices active */ |
150 | 155 | ||
151 | /** | 156 | /** |
152 | * usb_hcd_at91_remove - shutdown processing for AT91RM9200-based HCDs | 157 | * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs |
153 | * @dev: USB Host Controller being removed | 158 | * @dev: USB Host Controller being removed |
154 | * Context: !in_interrupt() | 159 | * Context: !in_interrupt() |
155 | * | 160 | * |
156 | * Reverses the effect of usb_hcd_at91_probe(), first invoking | 161 | * Reverses the effect of usb_hcd_at91_probe(), first invoking |
157 | * the HCD's stop() method. It is always called from a thread | 162 | * the HCD's stop() method. It is always called from a thread |
158 | * context, normally "rmmod", "apmd", or something similar. | 163 | * context, "rmmod" or something similar. |
159 | * | 164 | * |
160 | */ | 165 | */ |
161 | static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pdev) | 166 | static int usb_hcd_at91_remove(struct usb_hcd *hcd, |
167 | struct platform_device *pdev) | ||
162 | { | 168 | { |
163 | usb_remove_hcd(hcd); | 169 | usb_remove_hcd(hcd); |
164 | at91_stop_hc(pdev); | 170 | at91_stop_hc(pdev); |
165 | iounmap(hcd->regs); | 171 | iounmap(hcd->regs); |
166 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 172 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
173 | disable_irq_wake(hcd->irq); | ||
167 | 174 | ||
168 | clk_put(fclk); | 175 | clk_put(fclk); |
169 | clk_put(iclk); | 176 | clk_put(iclk); |
@@ -178,19 +185,21 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde | |||
178 | static int __devinit | 185 | static int __devinit |
179 | ohci_at91_start (struct usb_hcd *hcd) | 186 | ohci_at91_start (struct usb_hcd *hcd) |
180 | { | 187 | { |
181 | // struct at91_ohci_data *board = hcd->self.controller->platform_data; | 188 | struct at91_usbh_data *board = hcd->self.controller->platform_data; |
182 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 189 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
190 | struct usb_device *root = hcd->self.root_hub; | ||
183 | int ret; | 191 | int ret; |
184 | 192 | ||
185 | if ((ret = ohci_init(ohci)) < 0) | 193 | if ((ret = ohci_init(ohci)) < 0) |
186 | return ret; | 194 | return ret; |
187 | 195 | ||
196 | root->maxchild = board->ports; | ||
197 | |||
188 | if ((ret = ohci_run(ohci)) < 0) { | 198 | if ((ret = ohci_run(ohci)) < 0) { |
189 | err("can't start %s", hcd->self.bus_name); | 199 | err("can't start %s", hcd->self.bus_name); |
190 | ohci_stop(hcd); | 200 | ohci_stop(hcd); |
191 | return ret; | 201 | return ret; |
192 | } | 202 | } |
193 | // hcd->self.root_hub->maxchild = board->ports; | ||
194 | return 0; | 203 | return 0; |
195 | } | 204 | } |
196 | 205 | ||
@@ -198,7 +207,7 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
198 | 207 | ||
199 | static const struct hc_driver ohci_at91_hc_driver = { | 208 | static const struct hc_driver ohci_at91_hc_driver = { |
200 | .description = hcd_name, | 209 | .description = hcd_name, |
201 | .product_desc = "AT91RM9200 OHCI", | 210 | .product_desc = "AT91 OHCI", |
202 | .hcd_priv_size = sizeof(struct ohci_hcd), | 211 | .hcd_priv_size = sizeof(struct ohci_hcd), |
203 | 212 | ||
204 | /* | 213 | /* |
@@ -240,33 +249,54 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
240 | 249 | ||
241 | /*-------------------------------------------------------------------------*/ | 250 | /*-------------------------------------------------------------------------*/ |
242 | 251 | ||
243 | static int ohci_hcd_at91_drv_probe(struct platform_device *dev) | 252 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
244 | { | 253 | { |
245 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, dev); | 254 | device_init_wakeup(&pdev->dev, 1); |
255 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | ||
246 | } | 256 | } |
247 | 257 | ||
248 | static int ohci_hcd_at91_drv_remove(struct platform_device *dev) | 258 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
249 | { | 259 | { |
250 | return usb_hcd_at91_remove(platform_get_drvdata(dev), dev); | 260 | device_init_wakeup(&pdev->dev, 0); |
261 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); | ||
251 | } | 262 | } |
252 | 263 | ||
253 | #ifdef CONFIG_PM | 264 | #ifdef CONFIG_PM |
254 | 265 | ||
255 | /* REVISIT suspend/resume look "too" simple here */ | ||
256 | |||
257 | static int | 266 | static int |
258 | ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) | 267 | ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) |
259 | { | 268 | { |
260 | clk_disable(fclk); | 269 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
261 | clk_disable(iclk); | 270 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
271 | |||
272 | if (device_may_wakeup(&pdev->dev)) | ||
273 | enable_irq_wake(hcd->irq); | ||
274 | else | ||
275 | disable_irq_wake(hcd->irq); | ||
276 | |||
277 | /* | ||
278 | * The integrated transceivers seem unable to notice disconnect, | ||
279 | * reconnect, or wakeup without the 48 MHz clock active. so for | ||
280 | * correctness, always discard connection state (using reset). | ||
281 | * | ||
282 | * REVISIT: some boards will be able to turn VBUS off... | ||
283 | */ | ||
284 | if (at91_suspend_entering_slow_clock()) { | ||
285 | ohci_usb_reset (ohci); | ||
286 | clk_disable(fclk); | ||
287 | clk_disable(iclk); | ||
288 | clocked = 0; | ||
289 | } | ||
262 | 290 | ||
263 | return 0; | 291 | return 0; |
264 | } | 292 | } |
265 | 293 | ||
266 | static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | 294 | static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) |
267 | { | 295 | { |
268 | clk_enable(iclk); | 296 | if (!clocked) { |
269 | clk_enable(fclk); | 297 | clk_enable(iclk); |
298 | clk_enable(fclk); | ||
299 | } | ||
270 | 300 | ||
271 | return 0; | 301 | return 0; |
272 | } | 302 | } |
@@ -275,7 +305,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | |||
275 | #define ohci_hcd_at91_drv_resume NULL | 305 | #define ohci_hcd_at91_drv_resume NULL |
276 | #endif | 306 | #endif |
277 | 307 | ||
278 | MODULE_ALIAS("at91rm9200-ohci"); | 308 | MODULE_ALIAS("at91_ohci"); |
279 | 309 | ||
280 | static struct platform_driver ohci_hcd_at91_driver = { | 310 | static struct platform_driver ohci_hcd_at91_driver = { |
281 | .probe = ohci_hcd_at91_drv_probe, | 311 | .probe = ohci_hcd_at91_drv_probe, |
@@ -283,7 +313,7 @@ static struct platform_driver ohci_hcd_at91_driver = { | |||
283 | .suspend = ohci_hcd_at91_drv_suspend, | 313 | .suspend = ohci_hcd_at91_drv_suspend, |
284 | .resume = ohci_hcd_at91_drv_resume, | 314 | .resume = ohci_hcd_at91_drv_resume, |
285 | .driver = { | 315 | .driver = { |
286 | .name = "at91rm9200-ohci", | 316 | .name = "at91_ohci", |
287 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
288 | }, | 318 | }, |
289 | }; | 319 | }; |
diff --git a/drivers/usb/host/ohci-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/ati_remote.c b/drivers/usb/input/ati_remote.c index 05d2d6012eb2..df198cf76f52 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -152,9 +152,8 @@ static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; | |||
152 | * events. The hardware generates 5 events for the first keypress | 152 | * events. The hardware generates 5 events for the first keypress |
153 | * and we have to take this into account for an accurate repeat | 153 | * and we have to take this into account for an accurate repeat |
154 | * behaviour. | 154 | * behaviour. |
155 | * (HZ / 20) == 50 ms and works well for me. | ||
156 | */ | 155 | */ |
157 | #define FILTER_TIME (HZ / 20) | 156 | #define FILTER_TIME 60 /* msec */ |
158 | 157 | ||
159 | struct ati_remote { | 158 | struct ati_remote { |
160 | struct input_dev *idev; | 159 | struct input_dev *idev; |
@@ -467,7 +466,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | |||
467 | /* Filter duplicate events which happen "too close" together. */ | 466 | /* Filter duplicate events which happen "too close" together. */ |
468 | if ((ati_remote->old_data[0] == data[1]) && | 467 | if ((ati_remote->old_data[0] == data[1]) && |
469 | (ati_remote->old_data[1] == data[2]) && | 468 | (ati_remote->old_data[1] == data[2]) && |
470 | time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) { | 469 | time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) { |
471 | ati_remote->repeat_count++; | 470 | ati_remote->repeat_count++; |
472 | } else { | 471 | } else { |
473 | ati_remote->repeat_count = 0; | 472 | ati_remote->repeat_count = 0; |
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index e091d327bd9e..a4062a6adbb8 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 |
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 *); | |||
175 | static void rtl8150_disconnect(struct usb_interface *intf); | 175 | static void rtl8150_disconnect(struct usb_interface *intf); |
176 | static int rtl8150_probe(struct usb_interface *intf, | 176 | static int rtl8150_probe(struct usb_interface *intf, |
177 | const struct usb_device_id *id); | 177 | const struct usb_device_id *id); |
178 | static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message); | ||
179 | static int rtl8150_resume(struct usb_interface *intf); | ||
178 | 180 | ||
179 | static const char driver_name [] = "rtl8150"; | 181 | static 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) | |||
465 | goon: | 472 | goon: |
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); |
501 | try_again: | 512 | try_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 | ||
575 | resubmit: | 589 | resubmit: |
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 | ||
599 | static 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 | |||
612 | static 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 | ||
65 | config 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 | |||
74 | config USB_SERIAL_ARK3116 | 65 | config 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 | ||
504 | config USB_SERIAL_OPTION | 495 | config 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 | |||
12 | usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) | 12 | usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) |
13 | 13 | ||
14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o | 14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o |
15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o | ||
16 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o | 15 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o |
17 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o | 16 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o |
18 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o | 17 | obj-$(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 | |||
18 | static struct usb_device_id id_table [] = { | ||
19 | { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */ | ||
20 | { }, | ||
21 | }; | ||
22 | MODULE_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 */ | ||
26 | static int buffer_size; | ||
27 | static int debug; | ||
28 | |||
29 | static 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 | |||
37 | static 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 | |||
84 | static 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 | |||
97 | static 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 | |||
110 | static void __exit anydata_exit(void) | ||
111 | { | ||
112 | usb_deregister(&anydata_driver); | ||
113 | usb_serial_deregister(&anydata_device); | ||
114 | } | ||
115 | |||
116 | module_init(anydata_init); | ||
117 | module_exit(anydata_exit); | ||
118 | MODULE_LICENSE("GPL"); | ||
119 | |||
120 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
121 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
122 | module_param(buffer_size, int, 0); | ||
123 | MODULE_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..a20da8528a5f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -337,6 +337,7 @@ static struct usb_device_id id_table_combined [] = { | |||
337 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 337 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
338 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 338 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
339 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 339 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
340 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | ||
340 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, | 341 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, |
341 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, | 342 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, |
342 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, | 343 | { 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..9f7343a45424 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -182,6 +182,10 @@ | |||
182 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ | 182 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ |
183 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ | 183 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ |
184 | 184 | ||
185 | /* TNC-X USB-to-packet-radio adapter, versions prior to 3.0 (DLP module) */ | ||
186 | |||
187 | #define FTDI_TNC_X_PID 0xEBE0 | ||
188 | |||
185 | /* | 189 | /* |
186 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). | 190 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). |
187 | * All of these devices use FTDI's vendor ID (0x0403). | 191 | * 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..7e1bd5d6dfa0 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -250,6 +250,7 @@ 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 */ | ||
253 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ | 254 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ |
254 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ | 255 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ |
255 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ | 256 | { 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 | ||
112 | static struct usb_device_id option_ids[] = { | 86 | static 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 | }; | ||
136 | static 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 | */ |
154 | static 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 | ||
181 | static struct usb_serial_driver option_1port_device = { | 126 | static 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 | ||
259 | failed_driver_register: | 201 | failed_driver_register: |
260 | usb_serial_deregister (&option_3port_device); | ||
261 | failed_3port_device_register: | ||
262 | usb_serial_deregister (&option_1port_device); | 202 | usb_serial_deregister (&option_1port_device); |
263 | failed_1port_device_register: | 203 | failed_1port_device_register: |
264 | return retval; | 204 | return retval; |
@@ -267,7 +207,6 @@ failed_1port_device_register: | |||
267 | static void __exit option_exit(void) | 207 | static 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..efbbc0adb89a 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -81,6 +81,7 @@ static struct usb_device_id id_table [] = { | |||
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) }, | 82 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, |
83 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, | 83 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, |
84 | { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) }, | ||
84 | { } /* Terminating entry */ | 85 | { } /* Terminating entry */ |
85 | }; | 86 | }; |
86 | 87 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index d9c1e6e0b4b3..a692ac66ca6c 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -89,3 +89,7 @@ | |||
89 | /* DATAPILOT Universal-2 Phone Cable */ | 89 | /* DATAPILOT Universal-2 Phone Cable */ |
90 | #define DATAPILOT_U2_VENDOR_ID 0x0731 | 90 | #define DATAPILOT_U2_VENDOR_ID 0x0731 |
91 | #define DATAPILOT_U2_PRODUCT_ID 0x2003 | 91 | #define DATAPILOT_U2_PRODUCT_ID 0x2003 |
92 | |||
93 | /* Belkin "F5U257" Serial Adapter */ | ||
94 | #define BELKIN_VENDOR_ID 0x050d | ||
95 | #define BELKIN_PRODUCT_ID 0x0257 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index a5ca449f6e64..2793f9a912b4 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> */ | ||
149 | UNUSUAL_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> */ |
150 | UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, | 157 | UNUSUAL_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 | */ | ||
637 | UNUSUAL_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. */ | ||
1107 | UNUSUAL_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 |
1111 | UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, | 1114 | UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, |
1112 | "ATI", | 1115 | "ATI", |
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 */ |
486 | static void get_device_info(struct us_data *us, const struct usb_device_id *id) | 486 | static 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); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index c944e8f06a4a..d2bd0c8e0154 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -103,8 +103,7 @@ enum usb_interface_condition { | |||
103 | * @condition: binding state of the interface: not bound, binding | 103 | * @condition: binding state of the interface: not bound, binding |
104 | * (in probe()), bound to a driver, or unbinding (in disconnect()) | 104 | * (in probe()), bound to a driver, or unbinding (in disconnect()) |
105 | * @dev: driver model's view of this device | 105 | * @dev: driver model's view of this device |
106 | * @usb_dev: if an interface is bound to the USB major, this will point | 106 | * @class_dev: driver model's class view of this device. |
107 | * to the sysfs representation for that device. | ||
108 | * | 107 | * |
109 | * USB device drivers attach to interfaces on a physical device. Each | 108 | * USB device drivers attach to interfaces on a physical device. Each |
110 | * interface encapsulates a single high level function, such as feeding | 109 | * interface encapsulates a single high level function, such as feeding |
@@ -144,7 +143,7 @@ struct usb_interface { | |||
144 | * bound to */ | 143 | * bound to */ |
145 | enum usb_interface_condition condition; /* state of binding */ | 144 | enum usb_interface_condition condition; /* state of binding */ |
146 | struct device dev; /* interface specific device info */ | 145 | struct device dev; /* interface specific device info */ |
147 | struct device *usb_dev; /* pointer to the usb class's device, if any */ | 146 | struct class_device *class_dev; |
148 | }; | 147 | }; |
149 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | 148 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
150 | #define interface_to_usbdev(intf) \ | 149 | #define interface_to_usbdev(intf) \ |
@@ -361,7 +360,7 @@ struct usb_device { | |||
361 | char *serial; /* iSerialNumber string, if present */ | 360 | char *serial; /* iSerialNumber string, if present */ |
362 | 361 | ||
363 | struct list_head filelist; | 362 | struct list_head filelist; |
364 | struct device *usbfs_dev; | 363 | struct class_device *class_dev; |
365 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ | 364 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ |
366 | 365 | ||
367 | /* | 366 | /* |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index f38f43f20fae..e7fc5fed5b98 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
@@ -44,7 +44,9 @@ | |||
44 | US_FLAG(NO_WP_DETECT, 0x00000200) \ | 44 | US_FLAG(NO_WP_DETECT, 0x00000200) \ |
45 | /* Don't check for write-protect */ \ | 45 | /* Don't check for write-protect */ \ |
46 | US_FLAG(MAX_SECTORS_64, 0x00000400) \ | 46 | US_FLAG(MAX_SECTORS_64, 0x00000400) \ |
47 | /* Sets max_sectors to 64 */ | 47 | /* Sets max_sectors to 64 */ \ |
48 | US_FLAG(IGNORE_DEVICE, 0x00000800) \ | ||
49 | /* Don't claim device */ | ||
48 | 50 | ||
49 | #define US_FLAG(name, value) US_FL_##name = value , | 51 | #define US_FLAG(name, value) US_FL_##name = value , |
50 | enum { US_DO_ALL_FLAGS }; | 52 | enum { US_DO_ALL_FLAGS }; |