diff options
Diffstat (limited to 'drivers/usb')
90 files changed, 1606 insertions, 1253 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 7fdbc5dad5f..00504319752 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -23,7 +23,8 @@ config USB_ARCH_HAS_OHCI | |||
23 | default y if ARCH_LH7A404 | 23 | default y if ARCH_LH7A404 |
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_AT91RM9200 | 26 | default y if ARCH_EP93XX |
27 | default y if (ARCH_AT91RM9200 || ARCH_AT91SAM9261) | ||
27 | # PPC: | 28 | # PPC: |
28 | default y if STB03xxx | 29 | default y if STB03xxx |
29 | default y if PPC_MPC52xx | 30 | default y if PPC_MPC52xx |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index c7123bf71c5..4710eb02ed6 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -48,7 +48,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ | |||
48 | obj-$(CONFIG_USB_SERIAL) += serial/ | 48 | obj-$(CONFIG_USB_SERIAL) += serial/ |
49 | 49 | ||
50 | obj-$(CONFIG_USB_AUERSWALD) += misc/ | 50 | obj-$(CONFIG_USB_AUERSWALD) += misc/ |
51 | obj-$(CONFIG_USB_CY7C63) += misc/ | 51 | obj-$(CONFIG_USB_CYPRESS_CY7C63)+= misc/ |
52 | obj-$(CONFIG_USB_CYTHERM) += misc/ | 52 | obj-$(CONFIG_USB_CYTHERM) += misc/ |
53 | obj-$(CONFIG_USB_EMI26) += misc/ | 53 | obj-$(CONFIG_USB_EMI26) += misc/ |
54 | obj-$(CONFIG_USB_EMI62) += misc/ | 54 | obj-$(CONFIG_USB_EMI62) += misc/ |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 3670d77e912..ca90326f2f5 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -291,13 +291,13 @@ static void acm_read_bulk(struct urb *urb, struct pt_regs *regs) | |||
291 | struct acm_ru *rcv = urb->context; | 291 | struct acm_ru *rcv = urb->context; |
292 | struct acm *acm = rcv->instance; | 292 | struct acm *acm = rcv->instance; |
293 | int status = urb->status; | 293 | int status = urb->status; |
294 | dbg("Entering acm_read_bulk with status %d\n", urb->status); | 294 | dbg("Entering acm_read_bulk with status %d", urb->status); |
295 | 295 | ||
296 | if (!ACM_READY(acm)) | 296 | if (!ACM_READY(acm)) |
297 | return; | 297 | return; |
298 | 298 | ||
299 | if (status) | 299 | if (status) |
300 | dev_dbg(&acm->data->dev, "bulk rx status %d\n", status); | 300 | dev_dbg(&acm->data->dev, "bulk rx status %d", status); |
301 | 301 | ||
302 | buf = rcv->buffer; | 302 | buf = rcv->buffer; |
303 | buf->size = urb->actual_length; | 303 | buf->size = urb->actual_length; |
@@ -343,7 +343,7 @@ next_buffer: | |||
343 | list_del(&buf->list); | 343 | list_del(&buf->list); |
344 | spin_unlock(&acm->read_lock); | 344 | spin_unlock(&acm->read_lock); |
345 | 345 | ||
346 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d\n", buf, buf->size); | 346 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); |
347 | 347 | ||
348 | tty_buffer_request_room(tty, buf->size); | 348 | tty_buffer_request_room(tty, buf->size); |
349 | if (!acm->throttle) | 349 | if (!acm->throttle) |
@@ -394,7 +394,7 @@ urbs: | |||
394 | rcv->urb->transfer_dma = buf->dma; | 394 | rcv->urb->transfer_dma = buf->dma; |
395 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 395 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
396 | 396 | ||
397 | dbg("acm_rx_tasklet: sending urb 0x%p, rcv 0x%p, buf 0x%p\n", rcv->urb, rcv, buf); | 397 | dbg("acm_rx_tasklet: sending urb 0x%p, rcv 0x%p, buf 0x%p", rcv->urb, rcv, buf); |
398 | 398 | ||
399 | /* This shouldn't kill the driver as unsuccessful URBs are returned to the | 399 | /* This shouldn't kill the driver as unsuccessful URBs are returned to the |
400 | free-urbs-pool and resubmited ASAP */ | 400 | free-urbs-pool and resubmited ASAP */ |
@@ -413,7 +413,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) | |||
413 | { | 413 | { |
414 | struct acm *acm = (struct acm *)urb->context; | 414 | struct acm *acm = (struct acm *)urb->context; |
415 | 415 | ||
416 | dbg("Entering acm_write_bulk with status %d\n", urb->status); | 416 | dbg("Entering acm_write_bulk with status %d", urb->status); |
417 | 417 | ||
418 | acm_write_done(acm); | 418 | acm_write_done(acm); |
419 | acm_write_start(acm); | 419 | acm_write_start(acm); |
@@ -424,7 +424,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) | |||
424 | static void acm_softint(void *private) | 424 | static void acm_softint(void *private) |
425 | { | 425 | { |
426 | struct acm *acm = private; | 426 | struct acm *acm = private; |
427 | dbg("Entering acm_softint.\n"); | 427 | dbg("Entering acm_softint."); |
428 | 428 | ||
429 | if (!ACM_READY(acm)) | 429 | if (!ACM_READY(acm)) |
430 | return; | 430 | return; |
@@ -440,7 +440,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
440 | struct acm *acm; | 440 | struct acm *acm; |
441 | int rv = -EINVAL; | 441 | int rv = -EINVAL; |
442 | int i; | 442 | int i; |
443 | dbg("Entering acm_tty_open.\n"); | 443 | dbg("Entering acm_tty_open."); |
444 | 444 | ||
445 | mutex_lock(&open_mutex); | 445 | mutex_lock(&open_mutex); |
446 | 446 | ||
@@ -541,7 +541,7 @@ static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int c | |||
541 | int wbn; | 541 | int wbn; |
542 | struct acm_wb *wb; | 542 | struct acm_wb *wb; |
543 | 543 | ||
544 | dbg("Entering acm_tty_write to write %d bytes,\n", count); | 544 | dbg("Entering acm_tty_write to write %d bytes,", count); |
545 | 545 | ||
546 | if (!ACM_READY(acm)) | 546 | if (!ACM_READY(acm)) |
547 | return -EINVAL; | 547 | return -EINVAL; |
@@ -793,7 +793,7 @@ static int acm_probe (struct usb_interface *intf, | |||
793 | 793 | ||
794 | if (!buflen) { | 794 | if (!buflen) { |
795 | if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { | 795 | if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { |
796 | dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint\n"); | 796 | dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint"); |
797 | buflen = intf->cur_altsetting->endpoint->extralen; | 797 | buflen = intf->cur_altsetting->endpoint->extralen; |
798 | buffer = intf->cur_altsetting->endpoint->extra; | 798 | buffer = intf->cur_altsetting->endpoint->extra; |
799 | } else { | 799 | } else { |
@@ -842,24 +842,24 @@ next_desc: | |||
842 | 842 | ||
843 | if (!union_header) { | 843 | if (!union_header) { |
844 | if (call_interface_num > 0) { | 844 | if (call_interface_num > 0) { |
845 | dev_dbg(&intf->dev,"No union descriptor, using call management descriptor\n"); | 845 | dev_dbg(&intf->dev,"No union descriptor, using call management descriptor"); |
846 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); | 846 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); |
847 | control_interface = intf; | 847 | control_interface = intf; |
848 | } else { | 848 | } else { |
849 | dev_dbg(&intf->dev,"No union descriptor, giving up\n"); | 849 | dev_dbg(&intf->dev,"No union descriptor, giving up"); |
850 | return -ENODEV; | 850 | return -ENODEV; |
851 | } | 851 | } |
852 | } else { | 852 | } else { |
853 | control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); | 853 | control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); |
854 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); | 854 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); |
855 | if (!control_interface || !data_interface) { | 855 | if (!control_interface || !data_interface) { |
856 | dev_dbg(&intf->dev,"no interfaces\n"); | 856 | dev_dbg(&intf->dev,"no interfaces"); |
857 | return -ENODEV; | 857 | return -ENODEV; |
858 | } | 858 | } |
859 | } | 859 | } |
860 | 860 | ||
861 | if (data_interface_num != call_interface_num) | 861 | if (data_interface_num != call_interface_num) |
862 | dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.\n"); | 862 | dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported."); |
863 | 863 | ||
864 | skip_normal_probe: | 864 | skip_normal_probe: |
865 | 865 | ||
@@ -867,7 +867,7 @@ skip_normal_probe: | |||
867 | if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { | 867 | if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { |
868 | if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { | 868 | if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { |
869 | struct usb_interface *t; | 869 | struct usb_interface *t; |
870 | dev_dbg(&intf->dev,"Your device has switched interfaces.\n"); | 870 | dev_dbg(&intf->dev,"Your device has switched interfaces."); |
871 | 871 | ||
872 | t = control_interface; | 872 | t = control_interface; |
873 | control_interface = data_interface; | 873 | control_interface = data_interface; |
@@ -878,7 +878,7 @@ skip_normal_probe: | |||
878 | } | 878 | } |
879 | 879 | ||
880 | if (usb_interface_claimed(data_interface)) { /* valid in this context */ | 880 | if (usb_interface_claimed(data_interface)) { /* valid in this context */ |
881 | dev_dbg(&intf->dev,"The data interface isn't available\n"); | 881 | dev_dbg(&intf->dev,"The data interface isn't available"); |
882 | return -EBUSY; | 882 | return -EBUSY; |
883 | } | 883 | } |
884 | 884 | ||
@@ -895,7 +895,7 @@ skip_normal_probe: | |||
895 | if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { | 895 | if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { |
896 | /* descriptors are swapped */ | 896 | /* descriptors are swapped */ |
897 | struct usb_endpoint_descriptor *t; | 897 | struct usb_endpoint_descriptor *t; |
898 | dev_dbg(&intf->dev,"The data interface has switched endpoints\n"); | 898 | dev_dbg(&intf->dev,"The data interface has switched endpoints"); |
899 | 899 | ||
900 | t = epread; | 900 | t = epread; |
901 | epread = epwrite; | 901 | epread = epwrite; |
@@ -910,7 +910,7 @@ skip_normal_probe: | |||
910 | } | 910 | } |
911 | 911 | ||
912 | if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { | 912 | if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { |
913 | dev_dbg(&intf->dev, "out of memory (acm kzalloc)\n"); | 913 | dev_dbg(&intf->dev, "out of memory (acm kzalloc)"); |
914 | goto alloc_fail; | 914 | goto alloc_fail; |
915 | } | 915 | } |
916 | 916 | ||
@@ -936,26 +936,26 @@ skip_normal_probe: | |||
936 | 936 | ||
937 | buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); | 937 | buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); |
938 | if (!buf) { | 938 | if (!buf) { |
939 | dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n"); | 939 | dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)"); |
940 | goto alloc_fail2; | 940 | goto alloc_fail2; |
941 | } | 941 | } |
942 | acm->ctrl_buffer = buf; | 942 | acm->ctrl_buffer = buf; |
943 | 943 | ||
944 | if (acm_write_buffers_alloc(acm) < 0) { | 944 | if (acm_write_buffers_alloc(acm) < 0) { |
945 | dev_dbg(&intf->dev, "out of memory (write buffer alloc)\n"); | 945 | dev_dbg(&intf->dev, "out of memory (write buffer alloc)"); |
946 | goto alloc_fail4; | 946 | goto alloc_fail4; |
947 | } | 947 | } |
948 | 948 | ||
949 | acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); | 949 | acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); |
950 | if (!acm->ctrlurb) { | 950 | if (!acm->ctrlurb) { |
951 | dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)\n"); | 951 | dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)"); |
952 | goto alloc_fail5; | 952 | goto alloc_fail5; |
953 | } | 953 | } |
954 | for (i = 0; i < num_rx_buf; i++) { | 954 | for (i = 0; i < num_rx_buf; i++) { |
955 | struct acm_ru *rcv = &(acm->ru[i]); | 955 | struct acm_ru *rcv = &(acm->ru[i]); |
956 | 956 | ||
957 | if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { | 957 | if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { |
958 | dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)\n"); | 958 | dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)"); |
959 | goto alloc_fail7; | 959 | goto alloc_fail7; |
960 | } | 960 | } |
961 | 961 | ||
@@ -966,13 +966,13 @@ skip_normal_probe: | |||
966 | struct acm_rb *buf = &(acm->rb[i]); | 966 | struct acm_rb *buf = &(acm->rb[i]); |
967 | 967 | ||
968 | if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { | 968 | if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { |
969 | dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n"); | 969 | dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)"); |
970 | goto alloc_fail7; | 970 | goto alloc_fail7; |
971 | } | 971 | } |
972 | } | 972 | } |
973 | acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); | 973 | acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); |
974 | if (!acm->writeurb) { | 974 | if (!acm->writeurb) { |
975 | dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n"); | 975 | dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)"); |
976 | goto alloc_fail7; | 976 | goto alloc_fail7; |
977 | } | 977 | } |
978 | 978 | ||
@@ -1086,6 +1086,9 @@ static struct usb_device_id acm_ids[] = { | |||
1086 | { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ | 1086 | { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ |
1087 | .driver_info = SINGLE_RX_URB, /* firmware bug */ | 1087 | .driver_info = SINGLE_RX_URB, /* firmware bug */ |
1088 | }, | 1088 | }, |
1089 | { USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */ | ||
1090 | .driver_info = SINGLE_RX_URB, /* firmware bug */ | ||
1091 | }, | ||
1089 | /* control interfaces with various AT-command sets */ | 1092 | /* control interfaces with various AT-command sets */ |
1090 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 1093 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
1091 | USB_CDC_ACM_PROTO_AT_V25TER) }, | 1094 | USB_CDC_ACM_PROTO_AT_V25TER) }, |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index a08787e253a..6e3b5358a76 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -31,9 +31,6 @@ config USB_DEVICEFS | |||
31 | For the format of the various /proc/bus/usb/ files, please read | 31 | For the format of the various /proc/bus/usb/ files, please read |
32 | <file:Documentation/usb/proc_usb_info.txt>. | 32 | <file:Documentation/usb/proc_usb_info.txt>. |
33 | 33 | ||
34 | Please note that this code is completely unrelated to devfs, the | ||
35 | "/dev file system support". | ||
36 | |||
37 | Most users want to say Y here. | 34 | Most users want to say Y here. |
38 | 35 | ||
39 | config USB_BANDWIDTH | 36 | config USB_BANDWIDTH |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index f7bdd94b3aa..218621b9958 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 abee0f5b6a6..8de4f8c99d6 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/core/hub.c b/drivers/usb/core/hub.c index 875596e98e4..26c8cb5f3e6 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1790,7 +1790,10 @@ static int finish_device_resume(struct usb_device *udev) | |||
1790 | * and device drivers will know about any resume quirks. | 1790 | * and device drivers will know about any resume quirks. |
1791 | */ | 1791 | */ |
1792 | status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); | 1792 | status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); |
1793 | if (status < 2) | 1793 | if (status >= 0) |
1794 | status = (status == 2 ? 0 : -ENODEV); | ||
1795 | |||
1796 | if (status) | ||
1794 | dev_dbg(&udev->dev, | 1797 | dev_dbg(&udev->dev, |
1795 | "gone after usb resume? status %d\n", | 1798 | "gone after usb resume? status %d\n", |
1796 | status); | 1799 | status); |
@@ -1879,7 +1882,12 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) | |||
1879 | dev_dbg(hub->intfdev, | 1882 | dev_dbg(hub->intfdev, |
1880 | "port %d status %04x.%04x after resume, %d\n", | 1883 | "port %d status %04x.%04x after resume, %d\n", |
1881 | port1, portchange, devstatus, status); | 1884 | port1, portchange, devstatus, status); |
1885 | if (status >= 0) | ||
1886 | status = -ENODEV; | ||
1882 | } else { | 1887 | } else { |
1888 | if (portchange & USB_PORT_STAT_C_SUSPEND) | ||
1889 | clear_port_feature(hub->hdev, port1, | ||
1890 | USB_PORT_FEAT_C_SUSPEND); | ||
1883 | /* TRSMRCY = 10 msec */ | 1891 | /* TRSMRCY = 10 msec */ |
1884 | msleep(10); | 1892 | msleep(10); |
1885 | if (udev) | 1893 | if (udev) |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index f48c3dbc367..3182c2224ba 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -695,7 +695,7 @@ static void usbfs_remove_device(struct usb_device *dev) | |||
695 | wake_up_all(&ds->wait); | 695 | wake_up_all(&ds->wait); |
696 | list_del_init(&ds->list); | 696 | list_del_init(&ds->list); |
697 | if (ds->discsignr) { | 697 | if (ds->discsignr) { |
698 | sinfo.si_signo = SIGPIPE; | 698 | sinfo.si_signo = ds->discsignr; |
699 | sinfo.si_errno = EPIPE; | 699 | sinfo.si_errno = EPIPE; |
700 | sinfo.si_code = SI_ASYNCIO; | 700 | sinfo.si_code = SI_ASYNCIO; |
701 | sinfo.si_addr = ds->disccontext; | 701 | sinfo.si_addr = ds->disccontext; |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 363b2ad74ae..1a32d96774b 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 1c459ff037c..cfebca05ead 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 5a4799cedd1..882af42e86c 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 4be47195bd3..7d1c22c3495 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/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index f7c6d758e1b..53d584589c2 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c | |||
@@ -34,12 +34,12 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | /* we must assign addresses for configurable endpoints (like net2280) */ | 36 | /* we must assign addresses for configurable endpoints (like net2280) */ |
37 | static __initdata unsigned epnum; | 37 | static __devinitdata unsigned epnum; |
38 | 38 | ||
39 | // #define MANY_ENDPOINTS | 39 | // #define MANY_ENDPOINTS |
40 | #ifdef MANY_ENDPOINTS | 40 | #ifdef MANY_ENDPOINTS |
41 | /* more than 15 configurable endpoints */ | 41 | /* more than 15 configurable endpoints */ |
42 | static __initdata unsigned in_epnum; | 42 | static __devinitdata unsigned in_epnum; |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
@@ -59,7 +59,7 @@ static __initdata unsigned in_epnum; | |||
59 | * NOTE: each endpoint is unidirectional, as specified by its USB | 59 | * NOTE: each endpoint is unidirectional, as specified by its USB |
60 | * descriptor; and isn't specific to a configuration or altsetting. | 60 | * descriptor; and isn't specific to a configuration or altsetting. |
61 | */ | 61 | */ |
62 | static int __init | 62 | static int __devinit |
63 | ep_matches ( | 63 | ep_matches ( |
64 | struct usb_gadget *gadget, | 64 | struct usb_gadget *gadget, |
65 | struct usb_ep *ep, | 65 | struct usb_ep *ep, |
@@ -73,7 +73,7 @@ ep_matches ( | |||
73 | /* endpoint already claimed? */ | 73 | /* endpoint already claimed? */ |
74 | if (0 != ep->driver_data) | 74 | if (0 != ep->driver_data) |
75 | return 0; | 75 | return 0; |
76 | 76 | ||
77 | /* only support ep0 for portable CONTROL traffic */ | 77 | /* only support ep0 for portable CONTROL traffic */ |
78 | type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | 78 | type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; |
79 | if (USB_ENDPOINT_XFER_CONTROL == type) | 79 | if (USB_ENDPOINT_XFER_CONTROL == type) |
@@ -186,7 +186,7 @@ ep_matches ( | |||
186 | return 1; | 186 | return 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | static struct usb_ep * __init | 189 | static struct usb_ep * __devinit |
190 | find_ep (struct usb_gadget *gadget, const char *name) | 190 | find_ep (struct usb_gadget *gadget, const char *name) |
191 | { | 191 | { |
192 | struct usb_ep *ep; | 192 | struct usb_ep *ep; |
@@ -228,7 +228,7 @@ find_ep (struct usb_gadget *gadget, const char *name) | |||
228 | * | 228 | * |
229 | * On failure, this returns a null endpoint descriptor. | 229 | * On failure, this returns a null endpoint descriptor. |
230 | */ | 230 | */ |
231 | struct usb_ep * __init usb_ep_autoconfig ( | 231 | struct usb_ep * __devinit usb_ep_autoconfig ( |
232 | struct usb_gadget *gadget, | 232 | struct usb_gadget *gadget, |
233 | struct usb_endpoint_descriptor *desc | 233 | struct usb_endpoint_descriptor *desc |
234 | ) | 234 | ) |
@@ -276,7 +276,7 @@ struct usb_ep * __init usb_ep_autoconfig ( | |||
276 | return ep; | 276 | return ep; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* Second, look at endpoints until an unclaimed one looks usable */ | 279 | /* Second, look at endpoints until an unclaimed one looks usable */ |
280 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { | 280 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { |
281 | if (ep_matches (gadget, ep, desc)) | 281 | if (ep_matches (gadget, ep, desc)) |
282 | return ep; | 282 | return ep; |
@@ -295,7 +295,7 @@ struct usb_ep * __init usb_ep_autoconfig ( | |||
295 | * state such as ep->driver_data and the record of assigned endpoints | 295 | * state such as ep->driver_data and the record of assigned endpoints |
296 | * used by usb_ep_autoconfig(). | 296 | * used by usb_ep_autoconfig(). |
297 | */ | 297 | */ |
298 | void __init usb_ep_autoconfig_reset (struct usb_gadget *gadget) | 298 | void __devinit usb_ep_autoconfig_reset (struct usb_gadget *gadget) |
299 | { | 299 | { |
300 | struct usb_ep *ep; | 300 | struct usb_ep *ep; |
301 | 301 | ||
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 8320fcef042..30299c620d9 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -117,6 +117,8 @@ struct eth_dev { | |||
117 | struct usb_ep *in_ep, *out_ep, *status_ep; | 117 | struct usb_ep *in_ep, *out_ep, *status_ep; |
118 | const struct usb_endpoint_descriptor | 118 | const struct usb_endpoint_descriptor |
119 | *in, *out, *status; | 119 | *in, *out, *status; |
120 | |||
121 | spinlock_t req_lock; | ||
120 | struct list_head tx_reqs, rx_reqs; | 122 | struct list_head tx_reqs, rx_reqs; |
121 | 123 | ||
122 | struct net_device *net; | 124 | struct net_device *net; |
@@ -1066,21 +1068,31 @@ static void eth_reset_config (struct eth_dev *dev) | |||
1066 | */ | 1068 | */ |
1067 | if (dev->in) { | 1069 | if (dev->in) { |
1068 | usb_ep_disable (dev->in_ep); | 1070 | usb_ep_disable (dev->in_ep); |
1071 | spin_lock(&dev->req_lock); | ||
1069 | while (likely (!list_empty (&dev->tx_reqs))) { | 1072 | while (likely (!list_empty (&dev->tx_reqs))) { |
1070 | req = container_of (dev->tx_reqs.next, | 1073 | req = container_of (dev->tx_reqs.next, |
1071 | struct usb_request, list); | 1074 | struct usb_request, list); |
1072 | list_del (&req->list); | 1075 | list_del (&req->list); |
1076 | |||
1077 | spin_unlock(&dev->req_lock); | ||
1073 | usb_ep_free_request (dev->in_ep, req); | 1078 | usb_ep_free_request (dev->in_ep, req); |
1079 | spin_lock(&dev->req_lock); | ||
1074 | } | 1080 | } |
1081 | spin_unlock(&dev->req_lock); | ||
1075 | } | 1082 | } |
1076 | if (dev->out) { | 1083 | if (dev->out) { |
1077 | usb_ep_disable (dev->out_ep); | 1084 | usb_ep_disable (dev->out_ep); |
1085 | spin_lock(&dev->req_lock); | ||
1078 | while (likely (!list_empty (&dev->rx_reqs))) { | 1086 | while (likely (!list_empty (&dev->rx_reqs))) { |
1079 | req = container_of (dev->rx_reqs.next, | 1087 | req = container_of (dev->rx_reqs.next, |
1080 | struct usb_request, list); | 1088 | struct usb_request, list); |
1081 | list_del (&req->list); | 1089 | list_del (&req->list); |
1090 | |||
1091 | spin_unlock(&dev->req_lock); | ||
1082 | usb_ep_free_request (dev->out_ep, req); | 1092 | usb_ep_free_request (dev->out_ep, req); |
1093 | spin_lock(&dev->req_lock); | ||
1083 | } | 1094 | } |
1095 | spin_unlock(&dev->req_lock); | ||
1084 | } | 1096 | } |
1085 | 1097 | ||
1086 | if (dev->status) { | 1098 | if (dev->status) { |
@@ -1659,9 +1671,9 @@ enomem: | |||
1659 | if (retval) { | 1671 | if (retval) { |
1660 | DEBUG (dev, "rx submit --> %d\n", retval); | 1672 | DEBUG (dev, "rx submit --> %d\n", retval); |
1661 | dev_kfree_skb_any (skb); | 1673 | dev_kfree_skb_any (skb); |
1662 | spin_lock (&dev->lock); | 1674 | spin_lock(&dev->req_lock); |
1663 | list_add (&req->list, &dev->rx_reqs); | 1675 | list_add (&req->list, &dev->rx_reqs); |
1664 | spin_unlock (&dev->lock); | 1676 | spin_unlock(&dev->req_lock); |
1665 | } | 1677 | } |
1666 | return retval; | 1678 | return retval; |
1667 | } | 1679 | } |
@@ -1730,8 +1742,9 @@ quiesce: | |||
1730 | dev_kfree_skb_any (skb); | 1742 | dev_kfree_skb_any (skb); |
1731 | if (!netif_running (dev->net)) { | 1743 | if (!netif_running (dev->net)) { |
1732 | clean: | 1744 | clean: |
1733 | /* nobody reading rx_reqs, so no dev->lock */ | 1745 | spin_lock(&dev->req_lock); |
1734 | list_add (&req->list, &dev->rx_reqs); | 1746 | list_add (&req->list, &dev->rx_reqs); |
1747 | spin_unlock(&dev->req_lock); | ||
1735 | req = NULL; | 1748 | req = NULL; |
1736 | } | 1749 | } |
1737 | if (req) | 1750 | if (req) |
@@ -1782,15 +1795,18 @@ static int alloc_requests (struct eth_dev *dev, unsigned n, gfp_t gfp_flags) | |||
1782 | { | 1795 | { |
1783 | int status; | 1796 | int status; |
1784 | 1797 | ||
1798 | spin_lock(&dev->req_lock); | ||
1785 | status = prealloc (&dev->tx_reqs, dev->in_ep, n, gfp_flags); | 1799 | status = prealloc (&dev->tx_reqs, dev->in_ep, n, gfp_flags); |
1786 | if (status < 0) | 1800 | if (status < 0) |
1787 | goto fail; | 1801 | goto fail; |
1788 | status = prealloc (&dev->rx_reqs, dev->out_ep, n, gfp_flags); | 1802 | status = prealloc (&dev->rx_reqs, dev->out_ep, n, gfp_flags); |
1789 | if (status < 0) | 1803 | if (status < 0) |
1790 | goto fail; | 1804 | goto fail; |
1791 | return 0; | 1805 | goto done; |
1792 | fail: | 1806 | fail: |
1793 | DEBUG (dev, "can't alloc requests\n"); | 1807 | DEBUG (dev, "can't alloc requests\n"); |
1808 | done: | ||
1809 | spin_unlock(&dev->req_lock); | ||
1794 | return status; | 1810 | return status; |
1795 | } | 1811 | } |
1796 | 1812 | ||
@@ -1800,21 +1816,21 @@ static void rx_fill (struct eth_dev *dev, gfp_t gfp_flags) | |||
1800 | unsigned long flags; | 1816 | unsigned long flags; |
1801 | 1817 | ||
1802 | /* fill unused rxq slots with some skb */ | 1818 | /* fill unused rxq slots with some skb */ |
1803 | spin_lock_irqsave (&dev->lock, flags); | 1819 | spin_lock_irqsave(&dev->req_lock, flags); |
1804 | while (!list_empty (&dev->rx_reqs)) { | 1820 | while (!list_empty (&dev->rx_reqs)) { |
1805 | req = container_of (dev->rx_reqs.next, | 1821 | req = container_of (dev->rx_reqs.next, |
1806 | struct usb_request, list); | 1822 | struct usb_request, list); |
1807 | list_del_init (&req->list); | 1823 | list_del_init (&req->list); |
1808 | spin_unlock_irqrestore (&dev->lock, flags); | 1824 | spin_unlock_irqrestore(&dev->req_lock, flags); |
1809 | 1825 | ||
1810 | if (rx_submit (dev, req, gfp_flags) < 0) { | 1826 | if (rx_submit (dev, req, gfp_flags) < 0) { |
1811 | defer_kevent (dev, WORK_RX_MEMORY); | 1827 | defer_kevent (dev, WORK_RX_MEMORY); |
1812 | return; | 1828 | return; |
1813 | } | 1829 | } |
1814 | 1830 | ||
1815 | spin_lock_irqsave (&dev->lock, flags); | 1831 | spin_lock_irqsave(&dev->req_lock, flags); |
1816 | } | 1832 | } |
1817 | spin_unlock_irqrestore (&dev->lock, flags); | 1833 | spin_unlock_irqrestore(&dev->req_lock, flags); |
1818 | } | 1834 | } |
1819 | 1835 | ||
1820 | static void eth_work (void *_dev) | 1836 | static void eth_work (void *_dev) |
@@ -1848,9 +1864,9 @@ static void tx_complete (struct usb_ep *ep, struct usb_request *req) | |||
1848 | } | 1864 | } |
1849 | dev->stats.tx_packets++; | 1865 | dev->stats.tx_packets++; |
1850 | 1866 | ||
1851 | spin_lock (&dev->lock); | 1867 | spin_lock(&dev->req_lock); |
1852 | list_add (&req->list, &dev->tx_reqs); | 1868 | list_add (&req->list, &dev->tx_reqs); |
1853 | spin_unlock (&dev->lock); | 1869 | spin_unlock(&dev->req_lock); |
1854 | dev_kfree_skb_any (skb); | 1870 | dev_kfree_skb_any (skb); |
1855 | 1871 | ||
1856 | atomic_dec (&dev->tx_qlen); | 1872 | atomic_dec (&dev->tx_qlen); |
@@ -1896,12 +1912,12 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net) | |||
1896 | /* ignores USB_CDC_PACKET_TYPE_DIRECTED */ | 1912 | /* ignores USB_CDC_PACKET_TYPE_DIRECTED */ |
1897 | } | 1913 | } |
1898 | 1914 | ||
1899 | spin_lock_irqsave (&dev->lock, flags); | 1915 | spin_lock_irqsave(&dev->req_lock, flags); |
1900 | req = container_of (dev->tx_reqs.next, struct usb_request, list); | 1916 | req = container_of (dev->tx_reqs.next, struct usb_request, list); |
1901 | list_del (&req->list); | 1917 | list_del (&req->list); |
1902 | if (list_empty (&dev->tx_reqs)) | 1918 | if (list_empty (&dev->tx_reqs)) |
1903 | netif_stop_queue (net); | 1919 | netif_stop_queue (net); |
1904 | spin_unlock_irqrestore (&dev->lock, flags); | 1920 | spin_unlock_irqrestore(&dev->req_lock, flags); |
1905 | 1921 | ||
1906 | /* no buffer copies needed, unless the network stack did it | 1922 | /* no buffer copies needed, unless the network stack did it |
1907 | * or the hardware can't use skb buffers. | 1923 | * or the hardware can't use skb buffers. |
@@ -1955,11 +1971,11 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net) | |||
1955 | drop: | 1971 | drop: |
1956 | dev->stats.tx_dropped++; | 1972 | dev->stats.tx_dropped++; |
1957 | dev_kfree_skb_any (skb); | 1973 | dev_kfree_skb_any (skb); |
1958 | spin_lock_irqsave (&dev->lock, flags); | 1974 | spin_lock_irqsave(&dev->req_lock, flags); |
1959 | if (list_empty (&dev->tx_reqs)) | 1975 | if (list_empty (&dev->tx_reqs)) |
1960 | netif_start_queue (net); | 1976 | netif_start_queue (net); |
1961 | list_add (&req->list, &dev->tx_reqs); | 1977 | list_add (&req->list, &dev->tx_reqs); |
1962 | spin_unlock_irqrestore (&dev->lock, flags); | 1978 | spin_unlock_irqrestore(&dev->req_lock, flags); |
1963 | } | 1979 | } |
1964 | return 0; | 1980 | return 0; |
1965 | } | 1981 | } |
@@ -2131,7 +2147,7 @@ eth_req_free (struct usb_ep *ep, struct usb_request *req) | |||
2131 | } | 2147 | } |
2132 | 2148 | ||
2133 | 2149 | ||
2134 | static void __exit | 2150 | static void /* __init_or_exit */ |
2135 | eth_unbind (struct usb_gadget *gadget) | 2151 | eth_unbind (struct usb_gadget *gadget) |
2136 | { | 2152 | { |
2137 | struct eth_dev *dev = get_gadget_data (gadget); | 2153 | struct eth_dev *dev = get_gadget_data (gadget); |
@@ -2158,7 +2174,7 @@ eth_unbind (struct usb_gadget *gadget) | |||
2158 | set_gadget_data (gadget, NULL); | 2174 | set_gadget_data (gadget, NULL); |
2159 | } | 2175 | } |
2160 | 2176 | ||
2161 | static u8 __init nibble (unsigned char c) | 2177 | static u8 __devinit nibble (unsigned char c) |
2162 | { | 2178 | { |
2163 | if (likely (isdigit (c))) | 2179 | if (likely (isdigit (c))) |
2164 | return c - '0'; | 2180 | return c - '0'; |
@@ -2168,7 +2184,7 @@ static u8 __init nibble (unsigned char c) | |||
2168 | return 0; | 2184 | return 0; |
2169 | } | 2185 | } |
2170 | 2186 | ||
2171 | static int __init get_ether_addr(const char *str, u8 *dev_addr) | 2187 | static int __devinit get_ether_addr(const char *str, u8 *dev_addr) |
2172 | { | 2188 | { |
2173 | if (str) { | 2189 | if (str) { |
2174 | unsigned i; | 2190 | unsigned i; |
@@ -2189,7 +2205,7 @@ static int __init get_ether_addr(const char *str, u8 *dev_addr) | |||
2189 | return 1; | 2205 | return 1; |
2190 | } | 2206 | } |
2191 | 2207 | ||
2192 | static int __init | 2208 | static int __devinit |
2193 | eth_bind (struct usb_gadget *gadget) | 2209 | eth_bind (struct usb_gadget *gadget) |
2194 | { | 2210 | { |
2195 | struct eth_dev *dev; | 2211 | struct eth_dev *dev; |
@@ -2378,6 +2394,7 @@ autoconf_fail: | |||
2378 | return status; | 2394 | return status; |
2379 | dev = netdev_priv(net); | 2395 | dev = netdev_priv(net); |
2380 | spin_lock_init (&dev->lock); | 2396 | spin_lock_init (&dev->lock); |
2397 | spin_lock_init (&dev->req_lock); | ||
2381 | INIT_WORK (&dev->work, eth_work, dev); | 2398 | INIT_WORK (&dev->work, eth_work, dev); |
2382 | INIT_LIST_HEAD (&dev->tx_reqs); | 2399 | INIT_LIST_HEAD (&dev->tx_reqs); |
2383 | INIT_LIST_HEAD (&dev->rx_reqs); | 2400 | INIT_LIST_HEAD (&dev->rx_reqs); |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index b1a9cf06f3e..8d7f1e84cd7 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -3691,7 +3691,7 @@ static void lun_release(struct device *dev) | |||
3691 | kref_put(&fsg->ref, fsg_release); | 3691 | kref_put(&fsg->ref, fsg_release); |
3692 | } | 3692 | } |
3693 | 3693 | ||
3694 | static void __exit fsg_unbind(struct usb_gadget *gadget) | 3694 | static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) |
3695 | { | 3695 | { |
3696 | struct fsg_dev *fsg = get_gadget_data(gadget); | 3696 | struct fsg_dev *fsg = get_gadget_data(gadget); |
3697 | int i; | 3697 | int i; |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 354670d1230..408c3380d60 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -1398,7 +1398,7 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS]; | |||
1398 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ | 1398 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
1399 | 1399 | ||
1400 | 1400 | ||
1401 | int __init rndis_init (void) | 1401 | int __devinit rndis_init (void) |
1402 | { | 1402 | { |
1403 | u8 i; | 1403 | u8 i; |
1404 | 1404 | ||
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h index 2956608be75..4c3c7259f01 100644 --- a/drivers/usb/gadget/rndis.h +++ b/drivers/usb/gadget/rndis.h | |||
@@ -264,7 +264,7 @@ int rndis_signal_disconnect (int configNr); | |||
264 | int rndis_state (int configNr); | 264 | int rndis_state (int configNr); |
265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); | 265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); |
266 | 266 | ||
267 | int __init rndis_init (void); | 267 | int __devinit rndis_init (void); |
268 | void rndis_exit (void); | 268 | void rndis_exit (void); |
269 | 269 | ||
270 | #endif /* _LINUX_RNDIS_H */ | 270 | #endif /* _LINUX_RNDIS_H */ |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 30d7664d449..e762aa19ab0 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -1473,7 +1473,7 @@ autoconf_fail: | |||
1473 | * Called on module unload. Frees the control request and device | 1473 | * Called on module unload. Frees the control request and device |
1474 | * structure. | 1474 | * structure. |
1475 | */ | 1475 | */ |
1476 | static void __exit gs_unbind(struct usb_gadget *gadget) | 1476 | static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget) |
1477 | { | 1477 | { |
1478 | struct gs_dev *dev = get_gadget_data(gadget); | 1478 | struct gs_dev *dev = get_gadget_data(gadget); |
1479 | 1479 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 3a08a7ab4ce..b7018ee487e 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -1121,7 +1121,7 @@ zero_autoresume (unsigned long _dev) | |||
1121 | 1121 | ||
1122 | /*-------------------------------------------------------------------------*/ | 1122 | /*-------------------------------------------------------------------------*/ |
1123 | 1123 | ||
1124 | static void __exit | 1124 | static void /* __init_or_exit */ |
1125 | zero_unbind (struct usb_gadget *gadget) | 1125 | zero_unbind (struct usb_gadget *gadget) |
1126 | { | 1126 | { |
1127 | struct zero_dev *dev = get_gadget_data (gadget); | 1127 | struct zero_dev *dev = get_gadget_data (gadget); |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index d66867aa527..26ed757d22a 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #endif | 41 | #endif |
42 | #define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) | 42 | #define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) |
43 | 43 | ||
44 | #endif /* Au1200 */ | ||
45 | |||
46 | extern int usb_disabled(void); | 44 | extern int usb_disabled(void); |
47 | 45 | ||
48 | /*-------------------------------------------------------------------------*/ | 46 | /*-------------------------------------------------------------------------*/ |
@@ -107,9 +105,9 @@ int usb_ehci_au1xxx_probe(const struct hc_driver *driver, | |||
107 | 105 | ||
108 | /* Au1200 AB USB does not support coherent memory */ | 106 | /* Au1200 AB USB does not support coherent memory */ |
109 | if (!(read_c0_prid() & 0xff)) { | 107 | if (!(read_c0_prid() & 0xff)) { |
110 | pr_info("%s: this is chip revision AB!\n", dev->dev.name); | 108 | pr_info("%s: this is chip revision AB!\n", dev->name); |
111 | pr_info("%s: update your board or re-configure the kernel\n", | 109 | pr_info("%s: update your board or re-configure the kernel\n", |
112 | dev->dev.name); | 110 | dev->name); |
113 | return -ENODEV; | 111 | return -ENODEV; |
114 | } | 112 | } |
115 | #endif | 113 | #endif |
@@ -228,9 +226,8 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
228 | 226 | ||
229 | /*-------------------------------------------------------------------------*/ | 227 | /*-------------------------------------------------------------------------*/ |
230 | 228 | ||
231 | static int ehci_hcd_au1xxx_drv_probe(struct device *dev) | 229 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) |
232 | { | 230 | { |
233 | struct platform_device *pdev = to_platform_device(dev); | ||
234 | struct usb_hcd *hcd = NULL; | 231 | struct usb_hcd *hcd = NULL; |
235 | int ret; | 232 | int ret; |
236 | 233 | ||
@@ -243,10 +240,9 @@ static int ehci_hcd_au1xxx_drv_probe(struct device *dev) | |||
243 | return ret; | 240 | return ret; |
244 | } | 241 | } |
245 | 242 | ||
246 | static int ehci_hcd_au1xxx_drv_remove(struct device *dev) | 243 | static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) |
247 | { | 244 | { |
248 | struct platform_device *pdev = to_platform_device(dev); | 245 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
249 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
250 | 246 | ||
251 | usb_ehci_au1xxx_remove(hcd, pdev); | 247 | usb_ehci_au1xxx_remove(hcd, pdev); |
252 | return 0; | 248 | return 0; |
@@ -269,12 +265,13 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev) | |||
269 | } | 265 | } |
270 | */ | 266 | */ |
271 | MODULE_ALIAS("au1xxx-ehci"); | 267 | MODULE_ALIAS("au1xxx-ehci"); |
272 | /* FIXME use "struct platform_driver" */ | 268 | static struct platform_driver ehci_hcd_au1xxx_driver = { |
273 | static struct device_driver ehci_hcd_au1xxx_driver = { | ||
274 | .name = "au1xxx-ehci", | ||
275 | .bus = &platform_bus_type, | ||
276 | .probe = ehci_hcd_au1xxx_drv_probe, | 269 | .probe = ehci_hcd_au1xxx_drv_probe, |
277 | .remove = ehci_hcd_au1xxx_drv_remove, | 270 | .remove = ehci_hcd_au1xxx_drv_remove, |
278 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ | 271 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ |
279 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ | 272 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ |
273 | .driver = { | ||
274 | .name = "au1xxx-ehci", | ||
275 | .bus = &platform_bus_type | ||
276 | } | ||
280 | }; | 277 | }; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index cee6f538de0..d63177a8eae 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -625,10 +625,11 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) | |||
625 | writel (status | CMD_RUN, &ehci->regs->command); | 625 | writel (status | CMD_RUN, &ehci->regs->command); |
626 | 626 | ||
627 | while (i--) { | 627 | while (i--) { |
628 | status = readl (&ehci->regs->port_status [i]); | 628 | int pstatus = readl (&ehci->regs->port_status [i]); |
629 | if (status & PORT_OWNER) | 629 | |
630 | if (pstatus & PORT_OWNER) | ||
630 | continue; | 631 | continue; |
631 | if (!(status & PORT_RESUME) | 632 | if (!(pstatus & PORT_RESUME) |
632 | || ehci->reset_done [i] != 0) | 633 | || ehci->reset_done [i] != 0) |
633 | continue; | 634 | continue; |
634 | 635 | ||
@@ -891,7 +892,7 @@ MODULE_LICENSE ("GPL"); | |||
891 | #define PCI_DRIVER ehci_pci_driver | 892 | #define PCI_DRIVER ehci_pci_driver |
892 | #endif | 893 | #endif |
893 | 894 | ||
894 | #ifdef CONFIG_PPC_83xx | 895 | #ifdef CONFIG_MPC834x |
895 | #include "ehci-fsl.c" | 896 | #include "ehci-fsl.c" |
896 | #define PLATFORM_DRIVER ehci_fsl_driver | 897 | #define PLATFORM_DRIVER ehci_fsl_driver |
897 | #endif | 898 | #endif |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index cdbafb71000..85cc059705a 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2004 SAN People (Pty) Ltd. | 4 | * Copyright (C) 2004 SAN People (Pty) Ltd. |
5 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> | 5 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> |
6 | * | 6 | * |
7 | * AT91RM9200 Bus Glue | 7 | * AT91 Bus Glue |
8 | * | 8 | * |
9 | * Based on fragments of 2.4 driver by Rick Bronson. | 9 | * Based on fragments of 2.4 driver by Rick Bronson. |
10 | * Based on ohci-omap.c | 10 | * Based on ohci-omap.c |
@@ -19,12 +19,13 @@ | |||
19 | #include <asm/hardware.h> | 19 | #include <asm/hardware.h> |
20 | #include <asm/arch/board.h> | 20 | #include <asm/arch/board.h> |
21 | 21 | ||
22 | #ifndef CONFIG_ARCH_AT91RM9200 | 22 | #ifndef CONFIG_ARCH_AT91 |
23 | #error "CONFIG_ARCH_AT91RM9200 must be defined." | 23 | #error "CONFIG_ARCH_AT91 must be defined." |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | /* interface and function clocks */ | 26 | /* interface and function clocks */ |
27 | static struct clk *iclk, *fclk; | 27 | static struct clk *iclk, *fclk; |
28 | static int clocked; | ||
28 | 29 | ||
29 | extern int usb_disabled(void); | 30 | extern int usb_disabled(void); |
30 | 31 | ||
@@ -35,13 +36,14 @@ static void at91_start_hc(struct platform_device *pdev) | |||
35 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 36 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
36 | struct ohci_regs __iomem *regs = hcd->regs; | 37 | struct ohci_regs __iomem *regs = hcd->regs; |
37 | 38 | ||
38 | dev_dbg(&pdev->dev, "starting AT91RM9200 OHCI USB Controller\n"); | 39 | dev_dbg(&pdev->dev, "start\n"); |
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Start the USB clocks. | 42 | * Start the USB clocks. |
42 | */ | 43 | */ |
43 | clk_enable(iclk); | 44 | clk_enable(iclk); |
44 | clk_enable(fclk); | 45 | clk_enable(fclk); |
46 | clocked = 1; | ||
45 | 47 | ||
46 | /* | 48 | /* |
47 | * The USB host controller must remain in reset. | 49 | * The USB host controller must remain in reset. |
@@ -54,7 +56,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
54 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 56 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
55 | struct ohci_regs __iomem *regs = hcd->regs; | 57 | struct ohci_regs __iomem *regs = hcd->regs; |
56 | 58 | ||
57 | dev_dbg(&pdev->dev, "stopping AT91RM9200 OHCI USB Controller\n"); | 59 | dev_dbg(&pdev->dev, "stop\n"); |
58 | 60 | ||
59 | /* | 61 | /* |
60 | * Put the USB host controller into reset. | 62 | * Put the USB host controller into reset. |
@@ -66,6 +68,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
66 | */ | 68 | */ |
67 | clk_disable(fclk); | 69 | clk_disable(fclk); |
68 | clk_disable(iclk); | 70 | clk_disable(iclk); |
71 | clocked = 0; | ||
69 | } | 72 | } |
70 | 73 | ||
71 | 74 | ||
@@ -78,14 +81,15 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
78 | 81 | ||
79 | 82 | ||
80 | /** | 83 | /** |
81 | * usb_hcd_at91_probe - initialize AT91RM9200-based HCDs | 84 | * usb_hcd_at91_probe - initialize AT91-based HCDs |
82 | * Context: !in_interrupt() | 85 | * Context: !in_interrupt() |
83 | * | 86 | * |
84 | * Allocates basic resources for this USB host controller, and | 87 | * Allocates basic resources for this USB host controller, and |
85 | * then invokes the start() method for the HCD associated with it | 88 | * then invokes the start() method for the HCD associated with it |
86 | * through the hotplug entry's driver_data. | 89 | * through the hotplug entry's driver_data. |
87 | */ | 90 | */ |
88 | int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) | 91 | static int usb_hcd_at91_probe(const struct hc_driver *driver, |
92 | struct platform_device *pdev) | ||
89 | { | 93 | { |
90 | int retval; | 94 | int retval; |
91 | struct usb_hcd *hcd = NULL; | 95 | struct usb_hcd *hcd = NULL; |
@@ -95,12 +99,13 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
95 | return -ENODEV; | 99 | return -ENODEV; |
96 | } | 100 | } |
97 | 101 | ||
98 | if ((pdev->resource[0].flags != IORESOURCE_MEM) || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | 102 | if ((pdev->resource[0].flags != IORESOURCE_MEM) |
103 | || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | ||
99 | pr_debug("hcd probe: invalid resource type\n"); | 104 | pr_debug("hcd probe: invalid resource type\n"); |
100 | return -ENODEV; | 105 | return -ENODEV; |
101 | } | 106 | } |
102 | 107 | ||
103 | hcd = usb_create_hcd(driver, &pdev->dev, "at91rm9200"); | 108 | hcd = usb_create_hcd(driver, &pdev->dev, "at91"); |
104 | if (!hcd) | 109 | if (!hcd) |
105 | return -ENOMEM; | 110 | return -ENOMEM; |
106 | hcd->rsrc_start = pdev->resource[0].start; | 111 | hcd->rsrc_start = pdev->resource[0].start; |
@@ -149,21 +154,23 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
149 | /* may be called with controller, bus, and devices active */ | 154 | /* may be called with controller, bus, and devices active */ |
150 | 155 | ||
151 | /** | 156 | /** |
152 | * usb_hcd_at91_remove - shutdown processing for AT91RM9200-based HCDs | 157 | * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs |
153 | * @dev: USB Host Controller being removed | 158 | * @dev: USB Host Controller being removed |
154 | * Context: !in_interrupt() | 159 | * Context: !in_interrupt() |
155 | * | 160 | * |
156 | * Reverses the effect of usb_hcd_at91_probe(), first invoking | 161 | * Reverses the effect of usb_hcd_at91_probe(), first invoking |
157 | * the HCD's stop() method. It is always called from a thread | 162 | * the HCD's stop() method. It is always called from a thread |
158 | * context, normally "rmmod", "apmd", or something similar. | 163 | * context, "rmmod" or something similar. |
159 | * | 164 | * |
160 | */ | 165 | */ |
161 | static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pdev) | 166 | static int usb_hcd_at91_remove(struct usb_hcd *hcd, |
167 | struct platform_device *pdev) | ||
162 | { | 168 | { |
163 | usb_remove_hcd(hcd); | 169 | usb_remove_hcd(hcd); |
164 | at91_stop_hc(pdev); | 170 | at91_stop_hc(pdev); |
165 | iounmap(hcd->regs); | 171 | iounmap(hcd->regs); |
166 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 172 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
173 | disable_irq_wake(hcd->irq); | ||
167 | 174 | ||
168 | clk_put(fclk); | 175 | clk_put(fclk); |
169 | clk_put(iclk); | 176 | clk_put(iclk); |
@@ -178,19 +185,21 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde | |||
178 | static int __devinit | 185 | static int __devinit |
179 | ohci_at91_start (struct usb_hcd *hcd) | 186 | ohci_at91_start (struct usb_hcd *hcd) |
180 | { | 187 | { |
181 | // struct at91_ohci_data *board = hcd->self.controller->platform_data; | 188 | struct at91_usbh_data *board = hcd->self.controller->platform_data; |
182 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 189 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
190 | struct usb_device *root = hcd->self.root_hub; | ||
183 | int ret; | 191 | int ret; |
184 | 192 | ||
185 | if ((ret = ohci_init(ohci)) < 0) | 193 | if ((ret = ohci_init(ohci)) < 0) |
186 | return ret; | 194 | return ret; |
187 | 195 | ||
196 | root->maxchild = board->ports; | ||
197 | |||
188 | if ((ret = ohci_run(ohci)) < 0) { | 198 | if ((ret = ohci_run(ohci)) < 0) { |
189 | err("can't start %s", hcd->self.bus_name); | 199 | err("can't start %s", hcd->self.bus_name); |
190 | ohci_stop(hcd); | 200 | ohci_stop(hcd); |
191 | return ret; | 201 | return ret; |
192 | } | 202 | } |
193 | // hcd->self.root_hub->maxchild = board->ports; | ||
194 | return 0; | 203 | return 0; |
195 | } | 204 | } |
196 | 205 | ||
@@ -198,7 +207,7 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
198 | 207 | ||
199 | static const struct hc_driver ohci_at91_hc_driver = { | 208 | static const struct hc_driver ohci_at91_hc_driver = { |
200 | .description = hcd_name, | 209 | .description = hcd_name, |
201 | .product_desc = "AT91RM9200 OHCI", | 210 | .product_desc = "AT91 OHCI", |
202 | .hcd_priv_size = sizeof(struct ohci_hcd), | 211 | .hcd_priv_size = sizeof(struct ohci_hcd), |
203 | 212 | ||
204 | /* | 213 | /* |
@@ -240,33 +249,54 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
240 | 249 | ||
241 | /*-------------------------------------------------------------------------*/ | 250 | /*-------------------------------------------------------------------------*/ |
242 | 251 | ||
243 | static int ohci_hcd_at91_drv_probe(struct platform_device *dev) | 252 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
244 | { | 253 | { |
245 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, dev); | 254 | device_init_wakeup(&pdev->dev, 1); |
255 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | ||
246 | } | 256 | } |
247 | 257 | ||
248 | static int ohci_hcd_at91_drv_remove(struct platform_device *dev) | 258 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
249 | { | 259 | { |
250 | return usb_hcd_at91_remove(platform_get_drvdata(dev), dev); | 260 | device_init_wakeup(&pdev->dev, 0); |
261 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); | ||
251 | } | 262 | } |
252 | 263 | ||
253 | #ifdef CONFIG_PM | 264 | #ifdef CONFIG_PM |
254 | 265 | ||
255 | /* REVISIT suspend/resume look "too" simple here */ | ||
256 | |||
257 | static int | 266 | static int |
258 | ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) | 267 | ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) |
259 | { | 268 | { |
260 | clk_disable(fclk); | 269 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
261 | clk_disable(iclk); | 270 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
271 | |||
272 | if (device_may_wakeup(&pdev->dev)) | ||
273 | enable_irq_wake(hcd->irq); | ||
274 | else | ||
275 | disable_irq_wake(hcd->irq); | ||
276 | |||
277 | /* | ||
278 | * The integrated transceivers seem unable to notice disconnect, | ||
279 | * reconnect, or wakeup without the 48 MHz clock active. so for | ||
280 | * correctness, always discard connection state (using reset). | ||
281 | * | ||
282 | * REVISIT: some boards will be able to turn VBUS off... | ||
283 | */ | ||
284 | if (at91_suspend_entering_slow_clock()) { | ||
285 | ohci_usb_reset (ohci); | ||
286 | clk_disable(fclk); | ||
287 | clk_disable(iclk); | ||
288 | clocked = 0; | ||
289 | } | ||
262 | 290 | ||
263 | return 0; | 291 | return 0; |
264 | } | 292 | } |
265 | 293 | ||
266 | static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | 294 | static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) |
267 | { | 295 | { |
268 | clk_enable(iclk); | 296 | if (!clocked) { |
269 | clk_enable(fclk); | 297 | clk_enable(iclk); |
298 | clk_enable(fclk); | ||
299 | } | ||
270 | 300 | ||
271 | return 0; | 301 | return 0; |
272 | } | 302 | } |
@@ -275,7 +305,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | |||
275 | #define ohci_hcd_at91_drv_resume NULL | 305 | #define ohci_hcd_at91_drv_resume NULL |
276 | #endif | 306 | #endif |
277 | 307 | ||
278 | MODULE_ALIAS("at91rm9200-ohci"); | 308 | MODULE_ALIAS("at91_ohci"); |
279 | 309 | ||
280 | static struct platform_driver ohci_hcd_at91_driver = { | 310 | static struct platform_driver ohci_hcd_at91_driver = { |
281 | .probe = ohci_hcd_at91_drv_probe, | 311 | .probe = ohci_hcd_at91_drv_probe, |
@@ -283,7 +313,7 @@ static struct platform_driver ohci_hcd_at91_driver = { | |||
283 | .suspend = ohci_hcd_at91_drv_suspend, | 313 | .suspend = ohci_hcd_at91_drv_suspend, |
284 | .resume = ohci_hcd_at91_drv_resume, | 314 | .resume = ohci_hcd_at91_drv_resume, |
285 | .driver = { | 315 | .driver = { |
286 | .name = "at91rm9200-ohci", | 316 | .name = "at91_ohci", |
287 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
288 | }, | 318 | }, |
289 | }; | 319 | }; |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 689261e4401..f7a975d5db0 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -101,9 +101,11 @@ static void au1xxx_start_ohc(struct platform_device *dev) | |||
101 | 101 | ||
102 | #endif /* Au1200 */ | 102 | #endif /* Au1200 */ |
103 | 103 | ||
104 | #ifndef CONFIG_SOC_AU1200 | ||
104 | /* wait for reset complete (read register twice; see au1500 errata) */ | 105 | /* wait for reset complete (read register twice; see au1500 errata) */ |
105 | while (au_readl(USB_HOST_CONFIG), | 106 | while (au_readl(USB_HOST_CONFIG), |
106 | !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) | 107 | !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) |
108 | #endif | ||
107 | udelay(1000); | 109 | udelay(1000); |
108 | 110 | ||
109 | printk(KERN_DEBUG __FILE__ | 111 | printk(KERN_DEBUG __FILE__ |
@@ -157,9 +159,9 @@ static int usb_ohci_au1xxx_probe(const struct hc_driver *driver, | |||
157 | /* Au1200 AB USB does not support coherent memory */ | 159 | /* Au1200 AB USB does not support coherent memory */ |
158 | if (!(read_c0_prid() & 0xff)) { | 160 | if (!(read_c0_prid() & 0xff)) { |
159 | pr_info("%s: this is chip revision AB !!\n", | 161 | pr_info("%s: this is chip revision AB !!\n", |
160 | dev->dev.name); | 162 | dev->name); |
161 | pr_info("%s: update your board or re-configure the kernel\n", | 163 | pr_info("%s: update your board or re-configure the kernel\n", |
162 | dev->dev.name); | 164 | dev->name); |
163 | return -ENODEV; | 165 | return -ENODEV; |
164 | } | 166 | } |
165 | #endif | 167 | #endif |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c new file mode 100644 index 00000000000..6531c4d2652 --- /dev/null +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -0,0 +1,225 @@ | |||
1 | /* | ||
2 | * OHCI HCD (Host Controller Driver) for USB. | ||
3 | * | ||
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | ||
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | ||
6 | * (C) Copyright 2002 Hewlett-Packard Company | ||
7 | * | ||
8 | * Bus Glue for ep93xx. | ||
9 | * | ||
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | ||
11 | * Based on fragments of previous driver by Russell King et al. | ||
12 | * | ||
13 | * Modified for LH7A404 from ohci-sa1111.c | ||
14 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> | ||
15 | * | ||
16 | * Modified for pxa27x from ohci-lh7a404.c | ||
17 | * by Nick Bane <nick@cecomputing.co.uk> 26-8-2004 | ||
18 | * | ||
19 | * Modified for ep93xx from ohci-pxa27x.c | ||
20 | * by Lennert Buytenhek <buytenh@wantstofly.org> 28-2-2006 | ||
21 | * Based on an earlier driver by Ray Lehtiniemi | ||
22 | * | ||
23 | * This file is licenced under the GPL. | ||
24 | */ | ||
25 | |||
26 | #include <linux/clk.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/signal.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | |||
31 | #include <asm/mach-types.h> | ||
32 | #include <asm/hardware.h> | ||
33 | |||
34 | static struct clk *usb_host_clock; | ||
35 | |||
36 | static void ep93xx_start_hc(struct device *dev) | ||
37 | { | ||
38 | clk_enable(usb_host_clock); | ||
39 | } | ||
40 | |||
41 | static void ep93xx_stop_hc(struct device *dev) | ||
42 | { | ||
43 | clk_disable(usb_host_clock); | ||
44 | } | ||
45 | |||
46 | static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, | ||
47 | struct platform_device *pdev) | ||
48 | { | ||
49 | int retval; | ||
50 | struct usb_hcd *hcd; | ||
51 | |||
52 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | ||
53 | pr_debug("resource[1] is not IORESOURCE_IRQ"); | ||
54 | return -ENOMEM; | ||
55 | } | ||
56 | |||
57 | hcd = usb_create_hcd(driver, &pdev->dev, "ep93xx"); | ||
58 | if (hcd == NULL) | ||
59 | return -ENOMEM; | ||
60 | |||
61 | hcd->rsrc_start = pdev->resource[0].start; | ||
62 | hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; | ||
63 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
64 | usb_put_hcd(hcd); | ||
65 | retval = -EBUSY; | ||
66 | goto err1; | ||
67 | } | ||
68 | |||
69 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
70 | if (hcd->regs == NULL) { | ||
71 | pr_debug("ioremap failed"); | ||
72 | retval = -ENOMEM; | ||
73 | goto err2; | ||
74 | } | ||
75 | |||
76 | usb_host_clock = clk_get(&pdev->dev, "usb_host"); | ||
77 | ep93xx_start_hc(&pdev->dev); | ||
78 | |||
79 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
80 | |||
81 | retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); | ||
82 | if (retval == 0) | ||
83 | return retval; | ||
84 | |||
85 | ep93xx_stop_hc(&pdev->dev); | ||
86 | iounmap(hcd->regs); | ||
87 | err2: | ||
88 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
89 | err1: | ||
90 | usb_put_hcd(hcd); | ||
91 | |||
92 | return retval; | ||
93 | } | ||
94 | |||
95 | static void usb_hcd_ep93xx_remove(struct usb_hcd *hcd, | ||
96 | struct platform_device *pdev) | ||
97 | { | ||
98 | usb_remove_hcd(hcd); | ||
99 | ep93xx_stop_hc(&pdev->dev); | ||
100 | clk_put(usb_host_clock); | ||
101 | iounmap(hcd->regs); | ||
102 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
103 | usb_put_hcd(hcd); | ||
104 | } | ||
105 | |||
106 | static int __devinit ohci_ep93xx_start(struct usb_hcd *hcd) | ||
107 | { | ||
108 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
109 | int ret; | ||
110 | |||
111 | if ((ret = ohci_init(ohci)) < 0) | ||
112 | return ret; | ||
113 | |||
114 | if ((ret = ohci_run(ohci)) < 0) { | ||
115 | err("can't start %s", hcd->self.bus_name); | ||
116 | ohci_stop(hcd); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static struct hc_driver ohci_ep93xx_hc_driver = { | ||
124 | .description = hcd_name, | ||
125 | .product_desc = "EP93xx OHCI", | ||
126 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
127 | .irq = ohci_irq, | ||
128 | .flags = HCD_USB11 | HCD_MEMORY, | ||
129 | .start = ohci_ep93xx_start, | ||
130 | .stop = ohci_stop, | ||
131 | .urb_enqueue = ohci_urb_enqueue, | ||
132 | .urb_dequeue = ohci_urb_dequeue, | ||
133 | .endpoint_disable = ohci_endpoint_disable, | ||
134 | .get_frame_number = ohci_get_frame, | ||
135 | .hub_status_data = ohci_hub_status_data, | ||
136 | .hub_control = ohci_hub_control, | ||
137 | #ifdef CONFIG_PM | ||
138 | .bus_suspend = ohci_bus_suspend, | ||
139 | .bus_resume = ohci_bus_resume, | ||
140 | #endif | ||
141 | .start_port_reset = ohci_start_port_reset, | ||
142 | }; | ||
143 | |||
144 | extern int usb_disabled(void); | ||
145 | |||
146 | static int ohci_hcd_ep93xx_drv_probe(struct platform_device *pdev) | ||
147 | { | ||
148 | int ret; | ||
149 | |||
150 | ret = -ENODEV; | ||
151 | if (!usb_disabled()) | ||
152 | ret = usb_hcd_ep93xx_probe(&ohci_ep93xx_hc_driver, pdev); | ||
153 | |||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | static int ohci_hcd_ep93xx_drv_remove(struct platform_device *pdev) | ||
158 | { | ||
159 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
160 | |||
161 | usb_hcd_ep93xx_remove(hcd, pdev); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | #ifdef CONFIG_PM | ||
167 | static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_t state) | ||
168 | { | ||
169 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
170 | struct ochi_hcd *ohci = hcd_to_ohci(hcd); | ||
171 | |||
172 | if (time_before(jiffies, ohci->next_statechange)) | ||
173 | msleep(5); | ||
174 | ohci->next_statechange = jiffies; | ||
175 | |||
176 | ep93xx_stop_hc(&pdev->dev); | ||
177 | hcd->state = HC_STATE_SUSPENDED; | ||
178 | pdev->dev.power.power_state = PMSG_SUSPEND; | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) | ||
184 | { | ||
185 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
186 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
187 | int status; | ||
188 | |||
189 | if (time_before(jiffies, ohci->next_statechange)) | ||
190 | msleep(5); | ||
191 | ohci->next_statechange = jiffies; | ||
192 | |||
193 | ep93xx_start_hc(&pdev->dev); | ||
194 | pdev->dev.power.power_state = PMSG_ON; | ||
195 | usb_hcd_resume_root_hub(hcd); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | #endif | ||
200 | |||
201 | |||
202 | static struct platform_driver ohci_hcd_ep93xx_driver = { | ||
203 | .probe = ohci_hcd_ep93xx_drv_probe, | ||
204 | .remove = ohci_hcd_ep93xx_drv_remove, | ||
205 | #ifdef CONFIG_PM | ||
206 | .suspend = ohci_hcd_ep93xx_drv_suspend, | ||
207 | .resume = ohci_hcd_ep93xx_drv_resume, | ||
208 | #endif | ||
209 | .driver = { | ||
210 | .name = "ep93xx-ohci", | ||
211 | }, | ||
212 | }; | ||
213 | |||
214 | static int __init ohci_hcd_ep93xx_init(void) | ||
215 | { | ||
216 | return platform_driver_register(&ohci_hcd_ep93xx_driver); | ||
217 | } | ||
218 | |||
219 | static void __exit ohci_hcd_ep93xx_cleanup(void) | ||
220 | { | ||
221 | platform_driver_unregister(&ohci_hcd_ep93xx_driver); | ||
222 | } | ||
223 | |||
224 | module_init(ohci_hcd_ep93xx_init); | ||
225 | module_exit(ohci_hcd_ep93xx_cleanup); | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 8fb842ed5f6..94d8cf4b36c 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -901,6 +901,10 @@ MODULE_LICENSE ("GPL"); | |||
901 | #include "ohci-pxa27x.c" | 901 | #include "ohci-pxa27x.c" |
902 | #endif | 902 | #endif |
903 | 903 | ||
904 | #ifdef CONFIG_ARCH_EP93XX | ||
905 | #include "ohci-ep93xx.c" | ||
906 | #endif | ||
907 | |||
904 | #ifdef CONFIG_SOC_AU1X00 | 908 | #ifdef CONFIG_SOC_AU1X00 |
905 | #include "ohci-au1xxx.c" | 909 | #include "ohci-au1xxx.c" |
906 | #endif | 910 | #endif |
@@ -909,7 +913,7 @@ MODULE_LICENSE ("GPL"); | |||
909 | #include "ohci-ppc-soc.c" | 913 | #include "ohci-ppc-soc.c" |
910 | #endif | 914 | #endif |
911 | 915 | ||
912 | #ifdef CONFIG_ARCH_AT91RM9200 | 916 | #if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261) |
913 | #include "ohci-at91.c" | 917 | #include "ohci-at91.c" |
914 | #endif | 918 | #endif |
915 | 919 | ||
@@ -919,9 +923,11 @@ MODULE_LICENSE ("GPL"); | |||
919 | || defined(CONFIG_ARCH_OMAP) \ | 923 | || defined(CONFIG_ARCH_OMAP) \ |
920 | || defined (CONFIG_ARCH_LH7A404) \ | 924 | || defined (CONFIG_ARCH_LH7A404) \ |
921 | || defined (CONFIG_PXA27x) \ | 925 | || defined (CONFIG_PXA27x) \ |
926 | || defined (CONFIG_ARCH_EP93XX) \ | ||
922 | || defined (CONFIG_SOC_AU1X00) \ | 927 | || defined (CONFIG_SOC_AU1X00) \ |
923 | || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ | 928 | || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ |
924 | || defined (CONFIG_ARCH_AT91RM9200) \ | 929 | || defined (CONFIG_ARCH_AT91RM9200) \ |
930 | || defined (CONFIG_ARCH_AT91SAM9261) \ | ||
925 | ) | 931 | ) |
926 | #error "missing bus glue for ohci-hcd" | 932 | #error "missing bus glue for ohci-hcd" |
927 | #endif | 933 | #endif |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 0bb972b5833..5b0a23fd798 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -581,14 +581,14 @@ static int ohci_hub_control ( | |||
581 | break; | 581 | break; |
582 | case GetHubStatus: | 582 | case GetHubStatus: |
583 | temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE); | 583 | temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE); |
584 | *(__le32 *) buf = cpu_to_le32 (temp); | 584 | put_unaligned(cpu_to_le32 (temp), (__le32 *) buf); |
585 | break; | 585 | break; |
586 | case GetPortStatus: | 586 | case GetPortStatus: |
587 | if (!wIndex || wIndex > ports) | 587 | if (!wIndex || wIndex > ports) |
588 | goto error; | 588 | goto error; |
589 | wIndex--; | 589 | wIndex--; |
590 | temp = roothub_portstatus (ohci, wIndex); | 590 | temp = roothub_portstatus (ohci, wIndex); |
591 | *(__le32 *) buf = cpu_to_le32 (temp); | 591 | put_unaligned(cpu_to_le32 (temp), (__le32 *) buf); |
592 | 592 | ||
593 | #ifndef OHCI_VERBOSE_DEBUG | 593 | #ifndef OHCI_VERBOSE_DEBUG |
594 | if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ | 594 | if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index dff60568b4a..20861650905 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -167,8 +167,6 @@ static int __devinit mmio_resource_enabled(struct pci_dev *pdev, int idx) | |||
167 | static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | 167 | static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) |
168 | { | 168 | { |
169 | void __iomem *base; | 169 | void __iomem *base; |
170 | int wait_time; | ||
171 | u32 control; | ||
172 | 170 | ||
173 | if (!mmio_resource_enabled(pdev, 0)) | 171 | if (!mmio_resource_enabled(pdev, 0)) |
174 | return; | 172 | return; |
@@ -179,9 +177,10 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
179 | 177 | ||
180 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ | 178 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ |
181 | #ifndef __hppa__ | 179 | #ifndef __hppa__ |
182 | control = readl(base + OHCI_CONTROL); | 180 | { |
181 | u32 control = readl(base + OHCI_CONTROL); | ||
183 | if (control & OHCI_CTRL_IR) { | 182 | if (control & OHCI_CTRL_IR) { |
184 | wait_time = 500; /* arbitrary; 5 seconds */ | 183 | int wait_time = 500; /* arbitrary; 5 seconds */ |
185 | writel(OHCI_INTR_OC, base + OHCI_INTRENABLE); | 184 | writel(OHCI_INTR_OC, base + OHCI_INTRENABLE); |
186 | writel(OHCI_OCR, base + OHCI_CMDSTATUS); | 185 | writel(OHCI_OCR, base + OHCI_CMDSTATUS); |
187 | while (wait_time > 0 && | 186 | while (wait_time > 0 && |
@@ -198,6 +197,7 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
198 | /* reset controller, preserving RWC */ | 197 | /* reset controller, preserving RWC */ |
199 | writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL); | 198 | writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL); |
200 | } | 199 | } |
200 | } | ||
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | /* | 203 | /* |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index c9d72ac0a1d..431e8f31f1a 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -372,7 +372,7 @@ static void uhci_fixup_toggles(struct uhci_qh *qh, int skip_first) | |||
372 | * need to change any toggles in this URB */ | 372 | * need to change any toggles in this URB */ |
373 | td = list_entry(urbp->td_list.next, struct uhci_td, list); | 373 | td = list_entry(urbp->td_list.next, struct uhci_td, list); |
374 | if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) { | 374 | if (toggle > 1 || uhci_toggle(td_token(td)) == toggle) { |
375 | td = list_entry(urbp->td_list.next, struct uhci_td, | 375 | td = list_entry(urbp->td_list.prev, struct uhci_td, |
376 | list); | 376 | list); |
377 | toggle = uhci_toggle(td_token(td)) ^ 1; | 377 | toggle = uhci_toggle(td_token(td)) ^ 1; |
378 | 378 | ||
@@ -943,7 +943,9 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) | |||
943 | /* We received a short packet */ | 943 | /* We received a short packet */ |
944 | if (urb->transfer_flags & URB_SHORT_NOT_OK) | 944 | if (urb->transfer_flags & URB_SHORT_NOT_OK) |
945 | ret = -EREMOTEIO; | 945 | ret = -EREMOTEIO; |
946 | else if (ctrlstat & TD_CTRL_SPD) | 946 | |
947 | /* Fixup needed only if this isn't the URB's last TD */ | ||
948 | else if (&td->list != urbp->td_list.prev) | ||
947 | ret = 1; | 949 | ret = 1; |
948 | } | 950 | } |
949 | 951 | ||
@@ -1346,7 +1348,7 @@ static void uhci_scan_qh(struct uhci_hcd *uhci, struct uhci_qh *qh, | |||
1346 | } | 1348 | } |
1347 | 1349 | ||
1348 | uhci_giveback_urb(uhci, qh, urb, regs); | 1350 | uhci_giveback_urb(uhci, qh, urb, regs); |
1349 | if (status < 0) | 1351 | if (status < 0 && qh->type != USB_ENDPOINT_XFER_ISOC) |
1350 | break; | 1352 | break; |
1351 | } | 1353 | } |
1352 | 1354 | ||
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c index 9e3f1390337..044faa07e29 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 05d2d6012eb..3719fcb04b8 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 | |||
114 | static unsigned long channel_mask; | 124 | static unsigned long channel_mask; |
115 | module_param(channel_mask, ulong, 0444); | 125 | module_param(channel_mask, ulong, 0644); |
116 | MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); | 126 | MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); |
117 | 127 | ||
118 | static int debug; | 128 | static int debug; |
119 | module_param(debug, int, 0444); | 129 | module_param(debug, int, 0644); |
120 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); | 130 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); |
121 | 131 | ||
132 | static int repeat_filter = FILTER_TIME; | ||
133 | module_param(repeat_filter, int, 0644); | ||
134 | MODULE_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); | |||
143 | static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; | 157 | static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; |
144 | static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; | 158 | static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; |
145 | 159 | ||
146 | /* Acceleration curve for directional control pad */ | ||
147 | static 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 | |||
159 | struct ati_remote { | 160 | struct 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 | */ | ||
425 | static 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 | */ |
418 | static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | 456 | static 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-core.c b/drivers/usb/input/hid-core.c index e3cd0321c59..bfa267722f1 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1410,17 +1410,54 @@ void hid_init_reports(struct hid_device *hid) | |||
1410 | warn("timeout initializing reports"); | 1410 | warn("timeout initializing reports"); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | #define USB_VENDOR_ID_GTCO 0x078c | ||
1414 | #define USB_DEVICE_ID_GTCO_90 0x0090 | ||
1415 | #define USB_DEVICE_ID_GTCO_100 0x0100 | ||
1416 | #define USB_DEVICE_ID_GTCO_101 0x0101 | ||
1417 | #define USB_DEVICE_ID_GTCO_103 0x0103 | ||
1418 | #define USB_DEVICE_ID_GTCO_104 0x0104 | ||
1419 | #define USB_DEVICE_ID_GTCO_105 0x0105 | ||
1420 | #define USB_DEVICE_ID_GTCO_106 0x0106 | ||
1421 | #define USB_DEVICE_ID_GTCO_107 0x0107 | ||
1422 | #define USB_DEVICE_ID_GTCO_108 0x0108 | ||
1423 | #define USB_DEVICE_ID_GTCO_200 0x0200 | ||
1424 | #define USB_DEVICE_ID_GTCO_201 0x0201 | ||
1425 | #define USB_DEVICE_ID_GTCO_202 0x0202 | ||
1426 | #define USB_DEVICE_ID_GTCO_203 0x0203 | ||
1427 | #define USB_DEVICE_ID_GTCO_204 0x0204 | ||
1428 | #define USB_DEVICE_ID_GTCO_205 0x0205 | ||
1429 | #define USB_DEVICE_ID_GTCO_206 0x0206 | ||
1430 | #define USB_DEVICE_ID_GTCO_207 0x0207 | ||
1431 | #define USB_DEVICE_ID_GTCO_300 0x0300 | ||
1432 | #define USB_DEVICE_ID_GTCO_301 0x0301 | ||
1433 | #define USB_DEVICE_ID_GTCO_302 0x0302 | ||
1434 | #define USB_DEVICE_ID_GTCO_303 0x0303 | ||
1435 | #define USB_DEVICE_ID_GTCO_304 0x0304 | ||
1436 | #define USB_DEVICE_ID_GTCO_305 0x0305 | ||
1437 | #define USB_DEVICE_ID_GTCO_306 0x0306 | ||
1438 | #define USB_DEVICE_ID_GTCO_307 0x0307 | ||
1439 | #define USB_DEVICE_ID_GTCO_308 0x0308 | ||
1440 | #define USB_DEVICE_ID_GTCO_309 0x0309 | ||
1441 | #define USB_DEVICE_ID_GTCO_400 0x0400 | ||
1442 | #define USB_DEVICE_ID_GTCO_401 0x0401 | ||
1443 | #define USB_DEVICE_ID_GTCO_402 0x0402 | ||
1444 | #define USB_DEVICE_ID_GTCO_403 0x0403 | ||
1445 | #define USB_DEVICE_ID_GTCO_404 0x0404 | ||
1446 | #define USB_DEVICE_ID_GTCO_405 0x0405 | ||
1447 | #define USB_DEVICE_ID_GTCO_500 0x0500 | ||
1448 | #define USB_DEVICE_ID_GTCO_501 0x0501 | ||
1449 | #define USB_DEVICE_ID_GTCO_502 0x0502 | ||
1450 | #define USB_DEVICE_ID_GTCO_503 0x0503 | ||
1451 | #define USB_DEVICE_ID_GTCO_504 0x0504 | ||
1452 | #define USB_DEVICE_ID_GTCO_1000 0x1000 | ||
1453 | #define USB_DEVICE_ID_GTCO_1001 0x1001 | ||
1454 | #define USB_DEVICE_ID_GTCO_1002 0x1002 | ||
1455 | #define USB_DEVICE_ID_GTCO_1003 0x1003 | ||
1456 | #define USB_DEVICE_ID_GTCO_1004 0x1004 | ||
1457 | #define USB_DEVICE_ID_GTCO_1005 0x1005 | ||
1458 | #define USB_DEVICE_ID_GTCO_1006 0x1006 | ||
1459 | |||
1413 | #define USB_VENDOR_ID_WACOM 0x056a | 1460 | #define USB_VENDOR_ID_WACOM 0x056a |
1414 | #define USB_DEVICE_ID_WACOM_PENPARTNER 0x0000 | ||
1415 | #define USB_DEVICE_ID_WACOM_GRAPHIRE 0x0010 | ||
1416 | #define USB_DEVICE_ID_WACOM_INTUOS 0x0020 | ||
1417 | #define USB_DEVICE_ID_WACOM_PL 0x0030 | ||
1418 | #define USB_DEVICE_ID_WACOM_INTUOS2 0x0040 | ||
1419 | #define USB_DEVICE_ID_WACOM_VOLITO 0x0060 | ||
1420 | #define USB_DEVICE_ID_WACOM_PTU 0x0003 | ||
1421 | #define USB_DEVICE_ID_WACOM_INTUOS3 0x00B0 | ||
1422 | #define USB_DEVICE_ID_WACOM_CINTIQ 0x003F | ||
1423 | #define USB_DEVICE_ID_WACOM_DTF 0x00C0 | ||
1424 | 1461 | ||
1425 | #define USB_VENDOR_ID_ACECAD 0x0460 | 1462 | #define USB_VENDOR_ID_ACECAD 0x0460 |
1426 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 | 1463 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 |
@@ -1506,6 +1543,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1506 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 | 1543 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 |
1507 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 | 1544 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 |
1508 | 1545 | ||
1546 | #define USB_VENDOR_ID_WISEGROUP_LTD 0x6677 | ||
1547 | #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 | ||
1548 | |||
1509 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 | 1549 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 |
1510 | #define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500 | 1550 | #define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500 |
1511 | #define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501 | 1551 | #define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501 |
@@ -1584,6 +1624,51 @@ static const struct hid_blacklist { | |||
1584 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, | 1624 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, |
1585 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, | 1625 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, |
1586 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, | 1626 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, |
1627 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE }, | ||
1628 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100, HID_QUIRK_IGNORE }, | ||
1629 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101, HID_QUIRK_IGNORE }, | ||
1630 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103, HID_QUIRK_IGNORE }, | ||
1631 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104, HID_QUIRK_IGNORE }, | ||
1632 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105, HID_QUIRK_IGNORE }, | ||
1633 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106, HID_QUIRK_IGNORE }, | ||
1634 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107, HID_QUIRK_IGNORE }, | ||
1635 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108, HID_QUIRK_IGNORE }, | ||
1636 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200, HID_QUIRK_IGNORE }, | ||
1637 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201, HID_QUIRK_IGNORE }, | ||
1638 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202, HID_QUIRK_IGNORE }, | ||
1639 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203, HID_QUIRK_IGNORE }, | ||
1640 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204, HID_QUIRK_IGNORE }, | ||
1641 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205, HID_QUIRK_IGNORE }, | ||
1642 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206, HID_QUIRK_IGNORE }, | ||
1643 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207, HID_QUIRK_IGNORE }, | ||
1644 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300, HID_QUIRK_IGNORE }, | ||
1645 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301, HID_QUIRK_IGNORE }, | ||
1646 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302, HID_QUIRK_IGNORE }, | ||
1647 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303, HID_QUIRK_IGNORE }, | ||
1648 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304, HID_QUIRK_IGNORE }, | ||
1649 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305, HID_QUIRK_IGNORE }, | ||
1650 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306, HID_QUIRK_IGNORE }, | ||
1651 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307, HID_QUIRK_IGNORE }, | ||
1652 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308, HID_QUIRK_IGNORE }, | ||
1653 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309, HID_QUIRK_IGNORE }, | ||
1654 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400, HID_QUIRK_IGNORE }, | ||
1655 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401, HID_QUIRK_IGNORE }, | ||
1656 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402, HID_QUIRK_IGNORE }, | ||
1657 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403, HID_QUIRK_IGNORE }, | ||
1658 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404, HID_QUIRK_IGNORE }, | ||
1659 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405, HID_QUIRK_IGNORE }, | ||
1660 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500, HID_QUIRK_IGNORE }, | ||
1661 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501, HID_QUIRK_IGNORE }, | ||
1662 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502, HID_QUIRK_IGNORE }, | ||
1663 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503, HID_QUIRK_IGNORE }, | ||
1664 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504, HID_QUIRK_IGNORE }, | ||
1665 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000, HID_QUIRK_IGNORE }, | ||
1666 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001, HID_QUIRK_IGNORE }, | ||
1667 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002, HID_QUIRK_IGNORE }, | ||
1668 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003, HID_QUIRK_IGNORE }, | ||
1669 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE }, | ||
1670 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE }, | ||
1671 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE }, | ||
1587 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, | 1672 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, |
1588 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, | 1673 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, |
1589 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE }, | 1674 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE }, |
@@ -1613,49 +1698,6 @@ static const struct hid_blacklist { | |||
1613 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, | 1698 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, |
1614 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, | 1699 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, |
1615 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE }, | 1700 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE }, |
1616 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PENPARTNER, HID_QUIRK_IGNORE }, | ||
1617 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE, HID_QUIRK_IGNORE }, | ||
1618 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 1, HID_QUIRK_IGNORE }, | ||
1619 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 2, HID_QUIRK_IGNORE }, | ||
1620 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 3, HID_QUIRK_IGNORE }, | ||
1621 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 4, HID_QUIRK_IGNORE }, | ||
1622 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS, HID_QUIRK_IGNORE }, | ||
1623 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 1, HID_QUIRK_IGNORE }, | ||
1624 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 2, HID_QUIRK_IGNORE }, | ||
1625 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 3, HID_QUIRK_IGNORE }, | ||
1626 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 4, HID_QUIRK_IGNORE }, | ||
1627 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL, HID_QUIRK_IGNORE }, | ||
1628 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 1, HID_QUIRK_IGNORE }, | ||
1629 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 2, HID_QUIRK_IGNORE }, | ||
1630 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 3, HID_QUIRK_IGNORE }, | ||
1631 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 4, HID_QUIRK_IGNORE }, | ||
1632 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 5, HID_QUIRK_IGNORE }, | ||
1633 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 7, HID_QUIRK_IGNORE }, | ||
1634 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 8, HID_QUIRK_IGNORE }, | ||
1635 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 9, HID_QUIRK_IGNORE }, | ||
1636 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 1, HID_QUIRK_IGNORE }, | ||
1637 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 2, HID_QUIRK_IGNORE }, | ||
1638 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 3, HID_QUIRK_IGNORE }, | ||
1639 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 4, HID_QUIRK_IGNORE }, | ||
1640 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 5, HID_QUIRK_IGNORE }, | ||
1641 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 7, HID_QUIRK_IGNORE }, | ||
1642 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO, HID_QUIRK_IGNORE }, | ||
1643 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 1, HID_QUIRK_IGNORE }, | ||
1644 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 2, HID_QUIRK_IGNORE }, | ||
1645 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 3, HID_QUIRK_IGNORE }, | ||
1646 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 4, HID_QUIRK_IGNORE }, | ||
1647 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 5, HID_QUIRK_IGNORE }, | ||
1648 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 6, HID_QUIRK_IGNORE }, | ||
1649 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PTU, HID_QUIRK_IGNORE }, | ||
1650 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, | ||
1651 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, | ||
1652 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, | ||
1653 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 3, HID_QUIRK_IGNORE }, | ||
1654 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 4, HID_QUIRK_IGNORE }, | ||
1655 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE }, | ||
1656 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, | ||
1657 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE }, | ||
1658 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF + 3, HID_QUIRK_IGNORE }, | ||
1659 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | 1701 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, |
1660 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | 1702 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, |
1661 | { USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K, HID_QUIRK_IGNORE }, | 1703 | { USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K, HID_QUIRK_IGNORE }, |
@@ -1669,6 +1711,7 @@ static const struct hid_blacklist { | |||
1669 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | 1711 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, |
1670 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 1712 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
1671 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 1713 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
1714 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | ||
1672 | 1715 | ||
1673 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, | 1716 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, |
1674 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, | 1717 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, |
@@ -1773,6 +1816,10 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1773 | char *rdesc; | 1816 | char *rdesc; |
1774 | int n, len, insize = 0; | 1817 | int n, len, insize = 0; |
1775 | 1818 | ||
1819 | /* Ignore all Wacom devices */ | ||
1820 | if (dev->descriptor.idVendor == USB_VENDOR_ID_WACOM) | ||
1821 | return NULL; | ||
1822 | |||
1776 | for (n = 0; hid_blacklist[n].idVendor; n++) | 1823 | for (n = 0; hid_blacklist[n].idVendor; n++) |
1777 | if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) && | 1824 | if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) && |
1778 | (hid_blacklist[n].idProduct == le16_to_cpu(dev->descriptor.idProduct))) | 1825 | (hid_blacklist[n].idProduct == le16_to_cpu(dev->descriptor.idProduct))) |
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c index 3b175aa482c..a338bf4c2d7 100644 --- a/drivers/usb/input/usbtouchscreen.c +++ b/drivers/usb/input/usbtouchscreen.c | |||
@@ -286,7 +286,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
286 | static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | 286 | static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) |
287 | { | 287 | { |
288 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); | 288 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); |
289 | *x = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); | 289 | *y = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); |
290 | *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); | 290 | *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); |
291 | *touch = ~pkt[7] & 0x20; | 291 | *touch = ~pkt[7] & 0x20; |
292 | 292 | ||
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c index 575a4e672e9..7b45fd3de91 100644 --- a/drivers/usb/input/yealink.c +++ b/drivers/usb/input/yealink.c | |||
@@ -810,12 +810,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err) | |||
810 | if (yld == NULL) | 810 | if (yld == NULL) |
811 | return err; | 811 | return err; |
812 | 812 | ||
813 | if (yld->urb_irq) { | 813 | usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */ |
814 | usb_kill_urb(yld->urb_irq); | 814 | usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */ |
815 | usb_free_urb(yld->urb_irq); | 815 | |
816 | } | ||
817 | if (yld->urb_ctl) | ||
818 | usb_free_urb(yld->urb_ctl); | ||
819 | if (yld->idev) { | 816 | if (yld->idev) { |
820 | if (err) | 817 | if (err) |
821 | input_free_device(yld->idev); | 818 | input_free_device(yld->idev); |
@@ -831,6 +828,9 @@ static int usb_cleanup(struct yealink_dev *yld, int err) | |||
831 | if (yld->irq_data) | 828 | if (yld->irq_data) |
832 | usb_buffer_free(yld->udev, USB_PKT_LEN, | 829 | usb_buffer_free(yld->udev, USB_PKT_LEN, |
833 | yld->irq_data, yld->irq_dma); | 830 | yld->irq_data, yld->irq_dma); |
831 | |||
832 | usb_free_urb(yld->urb_irq); /* parameter validation in core/urb */ | ||
833 | usb_free_urb(yld->urb_ctl); /* parameter validation in core/urb */ | ||
834 | kfree(yld); | 834 | kfree(yld); |
835 | return err; | 835 | return err; |
836 | } | 836 | } |
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index daa486dde8c..88928a4be80 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig | |||
@@ -88,19 +88,19 @@ config USB_LED | |||
88 | To compile this driver as a module, choose M here: the | 88 | To compile this driver as a module, choose M here: the |
89 | module will be called usbled. | 89 | module will be called usbled. |
90 | 90 | ||
91 | config USB_CY7C63 | 91 | config USB_CYPRESS_CY7C63 |
92 | tristate "Cypress CY7C63xxx USB driver support" | 92 | tristate "Cypress CY7C63xxx USB driver support" |
93 | depends on USB | 93 | depends on USB |
94 | help | 94 | help |
95 | Say Y here if you want to connect a Cypress CY7C63xxx | 95 | Say Y here if you want to connect a Cypress CY7C63xxx |
96 | micro controller to your computer's USB port. This driver | 96 | micro controller to your computer's USB port. Currently this |
97 | supports the pre-programmed devices (incl. firmware) by | 97 | driver supports the pre-programmed devices (incl. firmware) |
98 | AK Modul-Bus Computer GmbH. | 98 | by AK Modul-Bus Computer GmbH. |
99 | 99 | ||
100 | Please see: http://www.ak-modul-bus.de/stat/mikrocontroller.html | 100 | Please see: http://www.ak-modul-bus.de/stat/mikrocontroller.html |
101 | 101 | ||
102 | To compile this driver as a module, choose M here: the | 102 | To compile this driver as a module, choose M here: the |
103 | module will be called cy7c63. | 103 | module will be called cypress_cy7c63. |
104 | 104 | ||
105 | config USB_CYTHERM | 105 | config USB_CYTHERM |
106 | tristate "Cypress USB thermometer driver support" | 106 | tristate "Cypress USB thermometer driver support" |
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index f25a9722729..2927260c581 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-$(CONFIG_USB_AUERSWALD) += auerswald.o | 6 | obj-$(CONFIG_USB_AUERSWALD) += auerswald.o |
7 | obj-$(CONFIG_USB_CY7C63) += cy7c63.o | 7 | obj-$(CONFIG_USB_CYPRESS_CY7C63)+= cypress_cy7c63.o |
8 | obj-$(CONFIG_USB_CYTHERM) += cytherm.o | 8 | obj-$(CONFIG_USB_CYTHERM) += cytherm.o |
9 | obj-$(CONFIG_USB_EMI26) += emi26.o | 9 | obj-$(CONFIG_USB_EMI26) += emi26.o |
10 | obj-$(CONFIG_USB_EMI62) += emi62.o | 10 | obj-$(CONFIG_USB_EMI62) += emi62.o |
diff --git a/drivers/usb/misc/cy7c63.c b/drivers/usb/misc/cy7c63.c deleted file mode 100644 index 8a1c10b89b7..00000000000 --- a/drivers/usb/misc/cy7c63.c +++ /dev/null | |||
@@ -1,244 +0,0 @@ | |||
1 | /* | ||
2 | * cy7c63.c | ||
3 | * | ||
4 | * Copyright (c) 2006 Oliver Bock (bock@fh-wolfenbuettel.de) | ||
5 | * | ||
6 | * This driver is based on the Cypress Thermometer USB Driver by | ||
7 | * Marcus Maul and the 2.0 version of Greg Kroah-Hartman's | ||
8 | * USB Skeleton driver. | ||
9 | * | ||
10 | * Is is a generic driver for the Cypress CY7C63000 family. | ||
11 | * For the time being it enables you to toggle the single I/O ports | ||
12 | * of the device. | ||
13 | * | ||
14 | * Supported vendors: AK Modul-Bus Computer GmbH | ||
15 | * Supported devices: CY7C63001A-PC (to be continued...) | ||
16 | * Supported functions: Read/Write Ports (to be continued...) | ||
17 | * | ||
18 | * Chipsets families: CY7C63000, CY7C63001, CY7C63100, CY7C63101 | ||
19 | * | ||
20 | * | ||
21 | * This program is free software; you can redistribute it and/or | ||
22 | * modify it under the terms of the GNU General Public License as | ||
23 | * published by the Free Software Foundation, version 2. | ||
24 | */ | ||
25 | |||
26 | #include <linux/init.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/usb.h> | ||
30 | |||
31 | #define DRIVER_AUTHOR "Oliver Bock (bock@fh-wolfenbuettel.de)" | ||
32 | #define DRIVER_DESC "Cypress CY7C63xxx USB driver" | ||
33 | |||
34 | #define CY7C63_VENDOR_ID 0xa2c | ||
35 | #define CY7C63_PRODUCT_ID 0x8 | ||
36 | |||
37 | #define CY7C63_READ_PORT 0x4 | ||
38 | #define CY7C63_WRITE_PORT 0x5 | ||
39 | #define CY7C63_READ_RAM 0x2 | ||
40 | #define CY7C63_WRITE_RAM 0x3 | ||
41 | #define CY7C63_READ_ROM 0x1 | ||
42 | |||
43 | #define CY7C63_READ_PORT_ID0 0 | ||
44 | #define CY7C63_WRITE_PORT_ID0 0 | ||
45 | #define CY7C63_READ_PORT_ID1 0x2 | ||
46 | #define CY7C63_WRITE_PORT_ID1 1 | ||
47 | |||
48 | #define CY7C63_MAX_REQSIZE 8 | ||
49 | |||
50 | |||
51 | /* table of devices that work with this driver */ | ||
52 | static struct usb_device_id cy7c63_table [] = { | ||
53 | { USB_DEVICE(CY7C63_VENDOR_ID, CY7C63_PRODUCT_ID) }, | ||
54 | { } | ||
55 | }; | ||
56 | MODULE_DEVICE_TABLE(usb, cy7c63_table); | ||
57 | |||
58 | /* structure to hold all of our device specific stuff */ | ||
59 | struct cy7c63 { | ||
60 | struct usb_device * udev; | ||
61 | char port0; | ||
62 | char port1; | ||
63 | }; | ||
64 | |||
65 | /* used to send usb control messages to device */ | ||
66 | int vendor_command(struct cy7c63 *dev, unsigned char request, | ||
67 | unsigned char address, unsigned char data) { | ||
68 | |||
69 | int retval = 0; | ||
70 | unsigned int pipe; | ||
71 | unsigned char *iobuf; | ||
72 | |||
73 | /* allocate some memory for the i/o buffer*/ | ||
74 | iobuf = kzalloc(CY7C63_MAX_REQSIZE, GFP_KERNEL); | ||
75 | if (!iobuf) { | ||
76 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
77 | retval = -ENOMEM; | ||
78 | goto error; | ||
79 | } | ||
80 | |||
81 | dev_dbg(&dev->udev->dev, "Sending usb_control_msg (data: %d)\n", data); | ||
82 | |||
83 | /* prepare usb control message and send it upstream */ | ||
84 | pipe = usb_rcvctrlpipe(dev->udev, 0); | ||
85 | retval = usb_control_msg(dev->udev, pipe, request, | ||
86 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, | ||
87 | address, data, iobuf, CY7C63_MAX_REQSIZE, | ||
88 | USB_CTRL_GET_TIMEOUT); | ||
89 | |||
90 | /* store returned data (more READs to be added!) */ | ||
91 | switch (request) { | ||
92 | case CY7C63_READ_PORT: | ||
93 | if (address == CY7C63_READ_PORT_ID0) { | ||
94 | dev->port0 = iobuf[1]; | ||
95 | dev_dbg(&dev->udev->dev, | ||
96 | "READ_PORT0 returned: %d\n",dev->port0); | ||
97 | } | ||
98 | else if (address == CY7C63_READ_PORT_ID1) { | ||
99 | dev->port1 = iobuf[1]; | ||
100 | dev_dbg(&dev->udev->dev, | ||
101 | "READ_PORT1 returned: %d\n",dev->port1); | ||
102 | } | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | kfree(iobuf); | ||
107 | error: | ||
108 | return retval; | ||
109 | } | ||
110 | |||
111 | #define get_set_port(num,read_id,write_id) \ | ||
112 | static ssize_t set_port##num(struct device *dev, struct device_attribute *attr, \ | ||
113 | const char *buf, size_t count) { \ | ||
114 | \ | ||
115 | int value; \ | ||
116 | int result = 0; \ | ||
117 | \ | ||
118 | struct usb_interface *intf = to_usb_interface(dev); \ | ||
119 | struct cy7c63 *cyp = usb_get_intfdata(intf); \ | ||
120 | \ | ||
121 | dev_dbg(&cyp->udev->dev, "WRITE_PORT%d called\n", num); \ | ||
122 | \ | ||
123 | /* validate input data */ \ | ||
124 | if (sscanf(buf, "%d", &value) < 1) { \ | ||
125 | result = -EINVAL; \ | ||
126 | goto error; \ | ||
127 | } \ | ||
128 | if (value>255 || value<0) { \ | ||
129 | result = -EINVAL; \ | ||
130 | goto error; \ | ||
131 | } \ | ||
132 | \ | ||
133 | result = vendor_command(cyp, CY7C63_WRITE_PORT, write_id, \ | ||
134 | (unsigned char)value); \ | ||
135 | \ | ||
136 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n",result); \ | ||
137 | error: \ | ||
138 | return result < 0 ? result : count; \ | ||
139 | } \ | ||
140 | \ | ||
141 | static ssize_t get_port##num(struct device *dev, \ | ||
142 | struct device_attribute *attr, char *buf) { \ | ||
143 | \ | ||
144 | int result = 0; \ | ||
145 | \ | ||
146 | struct usb_interface *intf = to_usb_interface(dev); \ | ||
147 | struct cy7c63 *cyp = usb_get_intfdata(intf); \ | ||
148 | \ | ||
149 | dev_dbg(&cyp->udev->dev, "READ_PORT%d called\n", num); \ | ||
150 | \ | ||
151 | result = vendor_command(cyp, CY7C63_READ_PORT, read_id, 0); \ | ||
152 | \ | ||
153 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result); \ | ||
154 | \ | ||
155 | return sprintf(buf, "%d", cyp->port##num); \ | ||
156 | } \ | ||
157 | static DEVICE_ATTR(port##num, S_IWUGO | S_IRUGO, get_port##num, set_port##num); | ||
158 | |||
159 | get_set_port(0, CY7C63_READ_PORT_ID0, CY7C63_WRITE_PORT_ID0); | ||
160 | get_set_port(1, CY7C63_READ_PORT_ID1, CY7C63_WRITE_PORT_ID1); | ||
161 | |||
162 | static int cy7c63_probe(struct usb_interface *interface, | ||
163 | const struct usb_device_id *id) { | ||
164 | |||
165 | struct cy7c63 *dev = NULL; | ||
166 | int retval = -ENOMEM; | ||
167 | |||
168 | /* allocate memory for our device state and initialize it */ | ||
169 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
170 | if (dev == NULL) { | ||
171 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
172 | goto error; | ||
173 | } | ||
174 | |||
175 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); | ||
176 | |||
177 | /* save our data pointer in this interface device */ | ||
178 | usb_set_intfdata(interface, dev); | ||
179 | |||
180 | /* create device attribute files */ | ||
181 | device_create_file(&interface->dev, &dev_attr_port0); | ||
182 | device_create_file(&interface->dev, &dev_attr_port1); | ||
183 | |||
184 | /* let the user know what node this device is now attached to */ | ||
185 | dev_info(&interface->dev, | ||
186 | "Cypress CY7C63xxx device now attached\n"); | ||
187 | |||
188 | retval = 0; | ||
189 | error: | ||
190 | return retval; | ||
191 | } | ||
192 | |||
193 | static void cy7c63_disconnect(struct usb_interface *interface) { | ||
194 | |||
195 | struct cy7c63 *dev; | ||
196 | |||
197 | dev = usb_get_intfdata(interface); | ||
198 | usb_set_intfdata(interface, NULL); | ||
199 | |||
200 | /* remove device attribute files */ | ||
201 | device_remove_file(&interface->dev, &dev_attr_port0); | ||
202 | device_remove_file(&interface->dev, &dev_attr_port1); | ||
203 | |||
204 | usb_put_dev(dev->udev); | ||
205 | |||
206 | dev_info(&interface->dev, | ||
207 | "Cypress CY7C63xxx device now disconnected\n"); | ||
208 | |||
209 | kfree(dev); | ||
210 | } | ||
211 | |||
212 | static struct usb_driver cy7c63_driver = { | ||
213 | .name = "cy7c63", | ||
214 | .probe = cy7c63_probe, | ||
215 | .disconnect = cy7c63_disconnect, | ||
216 | .id_table = cy7c63_table, | ||
217 | }; | ||
218 | |||
219 | static int __init cy7c63_init(void) { | ||
220 | |||
221 | int result; | ||
222 | |||
223 | /* register this driver with the USB subsystem */ | ||
224 | result = usb_register(&cy7c63_driver); | ||
225 | if (result) { | ||
226 | err("Function usb_register failed! Error number: %d\n", result); | ||
227 | } | ||
228 | |||
229 | return result; | ||
230 | } | ||
231 | |||
232 | static void __exit cy7c63_exit(void) { | ||
233 | |||
234 | /* deregister this driver with the USB subsystem */ | ||
235 | usb_deregister(&cy7c63_driver); | ||
236 | } | ||
237 | |||
238 | module_init(cy7c63_init); | ||
239 | module_exit(cy7c63_exit); | ||
240 | |||
241 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
242 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
243 | |||
244 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c new file mode 100644 index 00000000000..9c46746d5d0 --- /dev/null +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
@@ -0,0 +1,284 @@ | |||
1 | /* | ||
2 | * cypress_cy7c63.c | ||
3 | * | ||
4 | * Copyright (c) 2006 Oliver Bock (o.bock@fh-wolfenbuettel.de) | ||
5 | * | ||
6 | * This driver is based on the Cypress USB Driver by Marcus Maul | ||
7 | * (cyport) and the 2.0 version of Greg Kroah-Hartman's | ||
8 | * USB Skeleton driver. | ||
9 | * | ||
10 | * This is a generic driver for the Cypress CY7C63xxx family. | ||
11 | * For the time being it enables you to read from and write to | ||
12 | * the single I/O ports of the device. | ||
13 | * | ||
14 | * Supported vendors: AK Modul-Bus Computer GmbH | ||
15 | * (Firmware "Port-Chip") | ||
16 | * | ||
17 | * Supported devices: CY7C63001A-PC | ||
18 | * CY7C63001C-PXC | ||
19 | * CY7C63001C-SXC | ||
20 | * | ||
21 | * Supported functions: Read/Write Ports | ||
22 | * | ||
23 | * | ||
24 | * This program is free software; you can redistribute it and/or | ||
25 | * modify it under the terms of the GNU General Public License as | ||
26 | * published by the Free Software Foundation, version 2. | ||
27 | */ | ||
28 | |||
29 | #include <linux/init.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/usb.h> | ||
33 | |||
34 | #define DRIVER_AUTHOR "Oliver Bock (o.bock@fh-wolfenbuettel.de)" | ||
35 | #define DRIVER_DESC "Cypress CY7C63xxx USB driver" | ||
36 | |||
37 | #define CYPRESS_VENDOR_ID 0xa2c | ||
38 | #define CYPRESS_PRODUCT_ID 0x8 | ||
39 | |||
40 | #define CYPRESS_READ_PORT 0x4 | ||
41 | #define CYPRESS_WRITE_PORT 0x5 | ||
42 | |||
43 | #define CYPRESS_READ_RAM 0x2 | ||
44 | #define CYPRESS_WRITE_RAM 0x3 | ||
45 | #define CYPRESS_READ_ROM 0x1 | ||
46 | |||
47 | #define CYPRESS_READ_PORT_ID0 0 | ||
48 | #define CYPRESS_WRITE_PORT_ID0 0 | ||
49 | #define CYPRESS_READ_PORT_ID1 0x2 | ||
50 | #define CYPRESS_WRITE_PORT_ID1 1 | ||
51 | |||
52 | #define CYPRESS_MAX_REQSIZE 8 | ||
53 | |||
54 | |||
55 | /* table of devices that work with this driver */ | ||
56 | static struct usb_device_id cypress_table [] = { | ||
57 | { USB_DEVICE(CYPRESS_VENDOR_ID, CYPRESS_PRODUCT_ID) }, | ||
58 | { } | ||
59 | }; | ||
60 | MODULE_DEVICE_TABLE(usb, cypress_table); | ||
61 | |||
62 | /* structure to hold all of our device specific stuff */ | ||
63 | struct cypress { | ||
64 | struct usb_device * udev; | ||
65 | unsigned char port[2]; | ||
66 | }; | ||
67 | |||
68 | /* used to send usb control messages to device */ | ||
69 | static int vendor_command(struct cypress *dev, unsigned char request, | ||
70 | unsigned char address, unsigned char data) | ||
71 | { | ||
72 | int retval = 0; | ||
73 | unsigned int pipe; | ||
74 | unsigned char *iobuf; | ||
75 | |||
76 | /* allocate some memory for the i/o buffer*/ | ||
77 | iobuf = kzalloc(CYPRESS_MAX_REQSIZE, GFP_KERNEL); | ||
78 | if (!iobuf) { | ||
79 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
80 | retval = -ENOMEM; | ||
81 | goto error; | ||
82 | } | ||
83 | |||
84 | dev_dbg(&dev->udev->dev, "Sending usb_control_msg (data: %d)\n", data); | ||
85 | |||
86 | /* prepare usb control message and send it upstream */ | ||
87 | pipe = usb_rcvctrlpipe(dev->udev, 0); | ||
88 | retval = usb_control_msg(dev->udev, pipe, request, | ||
89 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, | ||
90 | address, data, iobuf, CYPRESS_MAX_REQSIZE, | ||
91 | USB_CTRL_GET_TIMEOUT); | ||
92 | |||
93 | /* store returned data (more READs to be added) */ | ||
94 | switch (request) { | ||
95 | case CYPRESS_READ_PORT: | ||
96 | if (address == CYPRESS_READ_PORT_ID0) { | ||
97 | dev->port[0] = iobuf[1]; | ||
98 | dev_dbg(&dev->udev->dev, | ||
99 | "READ_PORT0 returned: %d\n", | ||
100 | dev->port[0]); | ||
101 | } | ||
102 | else if (address == CYPRESS_READ_PORT_ID1) { | ||
103 | dev->port[1] = iobuf[1]; | ||
104 | dev_dbg(&dev->udev->dev, | ||
105 | "READ_PORT1 returned: %d\n", | ||
106 | dev->port[1]); | ||
107 | } | ||
108 | break; | ||
109 | } | ||
110 | |||
111 | kfree(iobuf); | ||
112 | error: | ||
113 | return retval; | ||
114 | } | ||
115 | |||
116 | /* write port value */ | ||
117 | static ssize_t write_port(struct device *dev, struct device_attribute *attr, | ||
118 | const char *buf, size_t count, | ||
119 | int port_num, int write_id) | ||
120 | { | ||
121 | int value = -1; | ||
122 | int result = 0; | ||
123 | |||
124 | struct usb_interface *intf = to_usb_interface(dev); | ||
125 | struct cypress *cyp = usb_get_intfdata(intf); | ||
126 | |||
127 | dev_dbg(&cyp->udev->dev, "WRITE_PORT%d called\n", port_num); | ||
128 | |||
129 | /* validate input data */ | ||
130 | if (sscanf(buf, "%d", &value) < 1) { | ||
131 | result = -EINVAL; | ||
132 | goto error; | ||
133 | } | ||
134 | if (value < 0 || value > 255) { | ||
135 | result = -EINVAL; | ||
136 | goto error; | ||
137 | } | ||
138 | |||
139 | result = vendor_command(cyp, CYPRESS_WRITE_PORT, write_id, | ||
140 | (unsigned char)value); | ||
141 | |||
142 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result); | ||
143 | error: | ||
144 | return result < 0 ? result : count; | ||
145 | } | ||
146 | |||
147 | /* attribute callback handler (write) */ | ||
148 | static ssize_t set_port0_handler(struct device *dev, | ||
149 | struct device_attribute *attr, | ||
150 | const char *buf, size_t count) | ||
151 | { | ||
152 | return write_port(dev, attr, buf, count, 0, CYPRESS_WRITE_PORT_ID0); | ||
153 | } | ||
154 | |||
155 | /* attribute callback handler (write) */ | ||
156 | static ssize_t set_port1_handler(struct device *dev, | ||
157 | struct device_attribute *attr, | ||
158 | const char *buf, size_t count) | ||
159 | { | ||
160 | return write_port(dev, attr, buf, count, 1, CYPRESS_WRITE_PORT_ID1); | ||
161 | } | ||
162 | |||
163 | /* read port value */ | ||
164 | static ssize_t read_port(struct device *dev, struct device_attribute *attr, | ||
165 | char *buf, int port_num, int read_id) | ||
166 | { | ||
167 | int result = 0; | ||
168 | |||
169 | struct usb_interface *intf = to_usb_interface(dev); | ||
170 | struct cypress *cyp = usb_get_intfdata(intf); | ||
171 | |||
172 | dev_dbg(&cyp->udev->dev, "READ_PORT%d called\n", port_num); | ||
173 | |||
174 | result = vendor_command(cyp, CYPRESS_READ_PORT, read_id, 0); | ||
175 | |||
176 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result); | ||
177 | |||
178 | return sprintf(buf, "%d", cyp->port[port_num]); | ||
179 | } | ||
180 | |||
181 | /* attribute callback handler (read) */ | ||
182 | static ssize_t get_port0_handler(struct device *dev, | ||
183 | struct device_attribute *attr, char *buf) | ||
184 | { | ||
185 | return read_port(dev, attr, buf, 0, CYPRESS_READ_PORT_ID0); | ||
186 | } | ||
187 | |||
188 | /* attribute callback handler (read) */ | ||
189 | static ssize_t get_port1_handler(struct device *dev, | ||
190 | struct device_attribute *attr, char *buf) | ||
191 | { | ||
192 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); | ||
193 | } | ||
194 | |||
195 | static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, | ||
196 | get_port0_handler, set_port0_handler); | ||
197 | |||
198 | static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, | ||
199 | get_port1_handler, set_port1_handler); | ||
200 | |||
201 | |||
202 | static int cypress_probe(struct usb_interface *interface, | ||
203 | const struct usb_device_id *id) | ||
204 | { | ||
205 | struct cypress *dev = NULL; | ||
206 | int retval = -ENOMEM; | ||
207 | |||
208 | /* allocate memory for our device state and initialize it */ | ||
209 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
210 | if (dev == NULL) { | ||
211 | dev_err(&interface->dev, "Out of memory!\n"); | ||
212 | goto error; | ||
213 | } | ||
214 | |||
215 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); | ||
216 | |||
217 | /* save our data pointer in this interface device */ | ||
218 | usb_set_intfdata(interface, dev); | ||
219 | |||
220 | /* create device attribute files */ | ||
221 | device_create_file(&interface->dev, &dev_attr_port0); | ||
222 | device_create_file(&interface->dev, &dev_attr_port1); | ||
223 | |||
224 | /* let the user know that the device is now attached */ | ||
225 | dev_info(&interface->dev, | ||
226 | "Cypress CY7C63xxx device now attached\n"); | ||
227 | |||
228 | retval = 0; | ||
229 | error: | ||
230 | return retval; | ||
231 | } | ||
232 | |||
233 | static void cypress_disconnect(struct usb_interface *interface) | ||
234 | { | ||
235 | struct cypress *dev; | ||
236 | |||
237 | dev = usb_get_intfdata(interface); | ||
238 | usb_set_intfdata(interface, NULL); | ||
239 | |||
240 | /* remove device attribute files */ | ||
241 | device_remove_file(&interface->dev, &dev_attr_port0); | ||
242 | device_remove_file(&interface->dev, &dev_attr_port1); | ||
243 | |||
244 | usb_put_dev(dev->udev); | ||
245 | |||
246 | dev_info(&interface->dev, | ||
247 | "Cypress CY7C63xxx device now disconnected\n"); | ||
248 | |||
249 | kfree(dev); | ||
250 | } | ||
251 | |||
252 | static struct usb_driver cypress_driver = { | ||
253 | .name = "cypress_cy7c63", | ||
254 | .probe = cypress_probe, | ||
255 | .disconnect = cypress_disconnect, | ||
256 | .id_table = cypress_table, | ||
257 | }; | ||
258 | |||
259 | static int __init cypress_init(void) | ||
260 | { | ||
261 | int result; | ||
262 | |||
263 | /* register this driver with the USB subsystem */ | ||
264 | result = usb_register(&cypress_driver); | ||
265 | if (result) { | ||
266 | err("Function usb_register failed! Error number: %d\n", result); | ||
267 | } | ||
268 | |||
269 | return result; | ||
270 | } | ||
271 | |||
272 | static void __exit cypress_exit(void) | ||
273 | { | ||
274 | /* deregister this driver with the USB subsystem */ | ||
275 | usb_deregister(&cypress_driver); | ||
276 | } | ||
277 | |||
278 | module_init(cypress_init); | ||
279 | module_exit(cypress_exit); | ||
280 | |||
281 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
282 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
283 | |||
284 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 738bd7c7451..e16582f3733 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -3435,6 +3435,8 @@ static void sisusb_disconnect(struct usb_interface *intf) | |||
3435 | 3435 | ||
3436 | static struct usb_device_id sisusb_table [] = { | 3436 | static struct usb_device_id sisusb_table [] = { |
3437 | { USB_DEVICE(0x0711, 0x0900) }, | 3437 | { USB_DEVICE(0x0711, 0x0900) }, |
3438 | { USB_DEVICE(0x0711, 0x0901) }, | ||
3439 | { USB_DEVICE(0x0711, 0x0902) }, | ||
3438 | { USB_DEVICE(0x182d, 0x021c) }, | 3440 | { USB_DEVICE(0x182d, 0x021c) }, |
3439 | { USB_DEVICE(0x182d, 0x0269) }, | 3441 | { USB_DEVICE(0x182d, 0x0269) }, |
3440 | { } | 3442 | { } |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index c82c402285a..e095772dd8e 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -200,10 +200,8 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz | |||
200 | 200 | ||
201 | /* create a urb, and a buffer for it, and copy the data to the urb */ | 201 | /* create a urb, and a buffer for it, and copy the data to the urb */ |
202 | urb = usb_alloc_urb(0, GFP_KERNEL); | 202 | urb = usb_alloc_urb(0, GFP_KERNEL); |
203 | if (!urb) { | 203 | if (!urb) |
204 | retval = -ENOMEM; | 204 | return -ENOMEM; |
205 | goto error; | ||
206 | } | ||
207 | 205 | ||
208 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); | 206 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); |
209 | if (!buf) { | 207 | if (!buf) { |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 786e1dbe88e..983e104dd45 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -1242,11 +1242,12 @@ done: | |||
1242 | static int ctrl_out (struct usbtest_dev *dev, | 1242 | static 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/mon/mon_text.c b/drivers/usb/mon/mon_text.c index e02c1a30c4c..f961a770cee 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -64,7 +64,6 @@ struct mon_reader_text { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | static void mon_text_ctor(void *, kmem_cache_t *, unsigned long); | 66 | static void mon_text_ctor(void *, kmem_cache_t *, unsigned long); |
67 | static void mon_text_dtor(void *, kmem_cache_t *, unsigned long); | ||
68 | 67 | ||
69 | /* | 68 | /* |
70 | * mon_text_submit | 69 | * mon_text_submit |
@@ -268,7 +267,7 @@ static int mon_text_open(struct inode *inode, struct file *file) | |||
268 | (long)rp); | 267 | (long)rp); |
269 | rp->e_slab = kmem_cache_create(rp->slab_name, | 268 | rp->e_slab = kmem_cache_create(rp->slab_name, |
270 | sizeof(struct mon_event_text), sizeof(long), 0, | 269 | sizeof(struct mon_event_text), sizeof(long), 0, |
271 | mon_text_ctor, mon_text_dtor); | 270 | mon_text_ctor, NULL); |
272 | if (rp->e_slab == NULL) { | 271 | if (rp->e_slab == NULL) { |
273 | rc = -ENOMEM; | 272 | rc = -ENOMEM; |
274 | goto err_slab; | 273 | goto err_slab; |
@@ -459,7 +458,3 @@ static void mon_text_ctor(void *mem, kmem_cache_t *slab, unsigned long sflags) | |||
459 | memset(mem, 0xe5, sizeof(struct mon_event_text)); | 458 | memset(mem, 0xe5, sizeof(struct mon_event_text)); |
460 | } | 459 | } |
461 | 460 | ||
462 | static void mon_text_dtor(void *mem, kmem_cache_t *slab, unsigned long sflags) | ||
463 | { | ||
464 | ; | ||
465 | } | ||
diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h index a54752ce149..006438069b6 100644 --- a/drivers/usb/net/pegasus.h +++ b/drivers/usb/net/pegasus.h | |||
@@ -131,6 +131,7 @@ struct usb_eth_dev { | |||
131 | #define VENDOR_COREGA 0x07aa | 131 | #define VENDOR_COREGA 0x07aa |
132 | #define VENDOR_DLINK 0x2001 | 132 | #define VENDOR_DLINK 0x2001 |
133 | #define VENDOR_ELCON 0x0db7 | 133 | #define VENDOR_ELCON 0x0db7 |
134 | #define VENDOR_ELECOM 0x056e | ||
134 | #define VENDOR_ELSA 0x05cc | 135 | #define VENDOR_ELSA 0x05cc |
135 | #define VENDOR_GIGABYTE 0x1044 | 136 | #define VENDOR_GIGABYTE 0x1044 |
136 | #define VENDOR_HAWKING 0x0e66 | 137 | #define VENDOR_HAWKING 0x0e66 |
@@ -233,6 +234,8 @@ PEGASUS_DEV( "D-Link DSB-650", VENDOR_DLINK, 0xabc1, | |||
233 | DEFAULT_GPIO_RESET ) | 234 | DEFAULT_GPIO_RESET ) |
234 | PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002, | 235 | PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002, |
235 | DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) | 236 | DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) |
237 | PEGASUS_DEV( "ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM, 0x4010, | ||
238 | DEFAULT_GPIO_RESET | PEGASUS_II ) | ||
236 | PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304, | 239 | PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304, |
237 | DEFAULT_GPIO_RESET ) | 240 | DEFAULT_GPIO_RESET ) |
238 | PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000, | 241 | PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000, |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 718f8e2b552..a72685b9606 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -128,11 +128,13 @@ | |||
128 | #define VENDOR_ID_MELCO 0x0411 | 128 | #define VENDOR_ID_MELCO 0x0411 |
129 | #define VENDOR_ID_MICRONET 0x3980 | 129 | #define VENDOR_ID_MICRONET 0x3980 |
130 | #define VENDOR_ID_LONGSHINE 0x07b8 | 130 | #define VENDOR_ID_LONGSHINE 0x07b8 |
131 | #define VENDOR_ID_ZYXEL 0x0586 | ||
131 | 132 | ||
132 | #define PRODUCT_ID_RTL8150 0x8150 | 133 | #define PRODUCT_ID_RTL8150 0x8150 |
133 | #define PRODUCT_ID_LUAKTX 0x0012 | 134 | #define PRODUCT_ID_LUAKTX 0x0012 |
134 | #define PRODUCT_ID_LCS8138TX 0x401a | 135 | #define PRODUCT_ID_LCS8138TX 0x401a |
135 | #define PRODUCT_ID_SP128AR 0x0003 | 136 | #define PRODUCT_ID_SP128AR 0x0003 |
137 | #define PRODUCT_ID_PRESTIGE 0x401a | ||
136 | 138 | ||
137 | #undef EEPROM_WRITE | 139 | #undef EEPROM_WRITE |
138 | 140 | ||
@@ -142,6 +144,7 @@ static struct usb_device_id rtl8150_table[] = { | |||
142 | {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)}, | 144 | {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)}, |
143 | {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)}, | 145 | {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)}, |
144 | {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)}, | 146 | {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)}, |
147 | {USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)}, | ||
145 | {} | 148 | {} |
146 | }; | 149 | }; |
147 | 150 | ||
@@ -172,6 +175,8 @@ static inline struct sk_buff *pull_skb(rtl8150_t *); | |||
172 | static void rtl8150_disconnect(struct usb_interface *intf); | 175 | static void rtl8150_disconnect(struct usb_interface *intf); |
173 | static int rtl8150_probe(struct usb_interface *intf, | 176 | static int rtl8150_probe(struct usb_interface *intf, |
174 | 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); | ||
175 | 180 | ||
176 | static const char driver_name [] = "rtl8150"; | 181 | static const char driver_name [] = "rtl8150"; |
177 | 182 | ||
@@ -180,6 +185,8 @@ static struct usb_driver rtl8150_driver = { | |||
180 | .probe = rtl8150_probe, | 185 | .probe = rtl8150_probe, |
181 | .disconnect = rtl8150_disconnect, | 186 | .disconnect = rtl8150_disconnect, |
182 | .id_table = rtl8150_table, | 187 | .id_table = rtl8150_table, |
188 | .suspend = rtl8150_suspend, | ||
189 | .resume = rtl8150_resume | ||
183 | }; | 190 | }; |
184 | 191 | ||
185 | /* | 192 | /* |
@@ -235,9 +242,11 @@ static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size) | |||
235 | usb_fill_control_urb(dev->ctrl_urb, dev->udev, | 242 | usb_fill_control_urb(dev->ctrl_urb, dev->udev, |
236 | usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, | 243 | usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, |
237 | &dev->rx_creg, size, ctrl_callback, dev); | 244 | &dev->rx_creg, size, ctrl_callback, dev); |
238 | 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); | ||
239 | err("control request submission failed: %d", ret); | 248 | err("control request submission failed: %d", ret); |
240 | else | 249 | } else |
241 | set_bit(RX_REG_SET, &dev->flags); | 250 | set_bit(RX_REG_SET, &dev->flags); |
242 | 251 | ||
243 | return ret; | 252 | return ret; |
@@ -413,6 +422,7 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
413 | struct sk_buff *skb; | 422 | struct sk_buff *skb; |
414 | struct net_device *netdev; | 423 | struct net_device *netdev; |
415 | u16 rx_stat; | 424 | u16 rx_stat; |
425 | int status; | ||
416 | 426 | ||
417 | dev = urb->context; | 427 | dev = urb->context; |
418 | if (!dev) | 428 | if (!dev) |
@@ -462,7 +472,10 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
462 | goon: | 472 | goon: |
463 | 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), |
464 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 474 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
465 | 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) { | ||
466 | set_bit(RX_URB_FAIL, &dev->flags); | 479 | set_bit(RX_URB_FAIL, &dev->flags); |
467 | goto resched; | 480 | goto resched; |
468 | } else { | 481 | } else { |
@@ -478,6 +491,7 @@ static void rx_fixup(unsigned long data) | |||
478 | { | 491 | { |
479 | rtl8150_t *dev; | 492 | rtl8150_t *dev; |
480 | struct sk_buff *skb; | 493 | struct sk_buff *skb; |
494 | int status; | ||
481 | 495 | ||
482 | dev = (rtl8150_t *)data; | 496 | dev = (rtl8150_t *)data; |
483 | 497 | ||
@@ -496,10 +510,13 @@ static void rx_fixup(unsigned long data) | |||
496 | 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), |
497 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 511 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
498 | try_again: | 512 | try_again: |
499 | 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) { | ||
500 | set_bit(RX_URB_FAIL, &dev->flags); | 517 | set_bit(RX_URB_FAIL, &dev->flags); |
501 | goto tlsched; | 518 | goto tlsched; |
502 | } else { | 519 | } else { |
503 | clear_bit(RX_URB_FAIL, &dev->flags); | 520 | clear_bit(RX_URB_FAIL, &dev->flags); |
504 | } | 521 | } |
505 | 522 | ||
@@ -571,12 +588,43 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs) | |||
571 | 588 | ||
572 | resubmit: | 589 | resubmit: |
573 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 590 | status = usb_submit_urb (urb, SLAB_ATOMIC); |
574 | if (status) | 591 | if (status == -ENODEV) |
592 | netif_device_detach(dev->netdev); | ||
593 | else if (status) | ||
575 | err ("can't resubmit intr, %s-%s/input0, status %d", | 594 | err ("can't resubmit intr, %s-%s/input0, status %d", |
576 | dev->udev->bus->bus_name, | 595 | dev->udev->bus->bus_name, |
577 | dev->udev->devpath, status); | 596 | dev->udev->devpath, status); |
578 | } | 597 | } |
579 | 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 | } | ||
580 | 628 | ||
581 | /* | 629 | /* |
582 | ** | 630 | ** |
@@ -687,9 +735,14 @@ static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
687 | 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), |
688 | skb->data, count, write_bulk_callback, dev); | 736 | skb->data, count, write_bulk_callback, dev); |
689 | if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) { | 737 | if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) { |
690 | warn("failed tx_urb %d\n", res); | 738 | /* Can we get/handle EPIPE here? */ |
691 | dev->stats.tx_errors++; | 739 | if (res == -ENODEV) |
692 | 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 | } | ||
693 | } else { | 746 | } else { |
694 | dev->stats.tx_packets++; | 747 | dev->stats.tx_packets++; |
695 | dev->stats.tx_bytes += skb->len; | 748 | dev->stats.tx_bytes += skb->len; |
@@ -726,16 +779,25 @@ static int rtl8150_open(struct net_device *netdev) | |||
726 | 779 | ||
727 | 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), |
728 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 781 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
729 | 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); | ||
730 | warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); | 785 | warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); |
786 | return res; | ||
787 | } | ||
731 | 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), |
732 | dev->intr_buff, INTBUFSIZE, intr_callback, | 789 | dev->intr_buff, INTBUFSIZE, intr_callback, |
733 | dev, dev->intr_interval); | 790 | dev, dev->intr_interval); |
734 | 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); | ||
735 | warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); | 794 | warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); |
736 | netif_start_queue(netdev); | 795 | usb_kill_urb(dev->rx_urb); |
796 | return res; | ||
797 | } | ||
737 | enable_net_traffic(dev); | 798 | enable_net_traffic(dev); |
738 | set_carrier(netdev); | 799 | set_carrier(netdev); |
800 | netif_start_queue(netdev); | ||
739 | 801 | ||
740 | return res; | 802 | return res; |
741 | } | 803 | } |
@@ -910,6 +972,7 @@ static void rtl8150_disconnect(struct usb_interface *intf) | |||
910 | if (dev) { | 972 | if (dev) { |
911 | set_bit(RTL8150_UNPLUG, &dev->flags); | 973 | set_bit(RTL8150_UNPLUG, &dev->flags); |
912 | tasklet_disable(&dev->tl); | 974 | tasklet_disable(&dev->tl); |
975 | tasklet_kill(&dev->tl); | ||
913 | unregister_netdev(dev->netdev); | 976 | unregister_netdev(dev->netdev); |
914 | unlink_all_urbs(dev); | 977 | unlink_all_urbs(dev); |
915 | free_all_urbs(dev); | 978 | free_all_urbs(dev); |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 8bd44fda5ea..f5b9438c94f 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 |
@@ -456,6 +447,17 @@ config USB_SERIAL_SAFE_PADDED | |||
456 | bool "USB Secure Encapsulated Driver - Padded" | 447 | bool "USB Secure Encapsulated Driver - Padded" |
457 | depends on USB_SERIAL_SAFE | 448 | depends on USB_SERIAL_SAFE |
458 | 449 | ||
450 | config USB_SERIAL_SIERRAWIRELESS | ||
451 | tristate "USB Sierra Wireless Driver" | ||
452 | depends on USB_SERIAL | ||
453 | help | ||
454 | Say M here if you want to use a Sierra Wireless device (if | ||
455 | using an PC 5220 or AC580 please use the Airprime driver | ||
456 | instead). | ||
457 | |||
458 | To compile this driver as a module, choose M here: the | ||
459 | module will be called sierra. | ||
460 | |||
459 | config USB_SERIAL_TI | 461 | config USB_SERIAL_TI |
460 | tristate "USB TI 3410/5052 Serial Driver" | 462 | tristate "USB TI 3410/5052 Serial Driver" |
461 | depends on USB_SERIAL | 463 | depends on USB_SERIAL |
@@ -491,15 +493,18 @@ config USB_SERIAL_XIRCOM | |||
491 | module will be called keyspan_pda. | 493 | module will be called keyspan_pda. |
492 | 494 | ||
493 | config USB_SERIAL_OPTION | 495 | config USB_SERIAL_OPTION |
494 | tristate "USB driver for GSM modems" | 496 | tristate "USB driver for GSM and CDMA modems" |
495 | depends on USB_SERIAL | 497 | depends on USB_SERIAL |
496 | help | 498 | help |
497 | 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. |
498 | (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. | ||
499 | 504 | ||
500 | These cards feature a built-in OHCI-USB adapter and an | 505 | Supported devices include (some of?) those made by: |
501 | internally-connected GSM modem. The USB bus is not | 506 | Option, Huawei, Audiovox, Sierra Wireless, Novatel Wireless, or |
502 | accessible externally. | 507 | Anydata. |
503 | 508 | ||
504 | To compile this driver as a module, choose M here: the | 509 | To compile this driver as a module, choose M here: the |
505 | module will be called option. | 510 | module will be called option. |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 5a0960fc9d3..8efed2ce1ba 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 |
@@ -39,6 +38,7 @@ obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o | |||
39 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o | 38 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o |
40 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o | 39 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o |
41 | obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o | 40 | obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o |
41 | obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o | ||
42 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o | 42 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o |
43 | obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o | 43 | obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o |
44 | obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o | 44 | obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 94b9ba0ff87..62082532a8b 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ | 19 | { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ |
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c deleted file mode 100644 index 343f6f22822..00000000000 --- 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 "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_write_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/ark3116.c b/drivers/usb/serial/ark3116.c index 8dec796222a..970d9ef0a7a 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/tty.h> | 21 | #include <linux/tty.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/usb.h> | 23 | #include <linux/usb.h> |
24 | #include "usb-serial.h" | 24 | #include <linux/usb/serial.h> |
25 | 25 | ||
26 | 26 | ||
27 | static int debug; | 27 | static int debug; |
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 3faa7aa0111..70ece9e01ce 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -74,7 +74,7 @@ | |||
74 | #include <linux/spinlock.h> | 74 | #include <linux/spinlock.h> |
75 | #include <asm/uaccess.h> | 75 | #include <asm/uaccess.h> |
76 | #include <linux/usb.h> | 76 | #include <linux/usb.h> |
77 | #include "usb-serial.h" | 77 | #include <linux/usb/serial.h> |
78 | #include "belkin_sa.h" | 78 | #include "belkin_sa.h" |
79 | 79 | ||
80 | static int debug; | 80 | static int debug; |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index f2d993b70c1..6542f220468 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static int usb_serial_device_match (struct device *dev, struct device_driver *drv) | 18 | static int usb_serial_device_match (struct device *dev, struct device_driver *drv) |
19 | { | 19 | { |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 3d456b32c31..3a9073dbfe6 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -17,11 +17,10 @@ | |||
17 | #include <linux/tty.h> | 17 | #include <linux/tty.h> |
18 | #include <linux/console.h> | 18 | #include <linux/console.h> |
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include <linux/usb/serial.h> | ||
20 | 21 | ||
21 | static int debug; | 22 | static int debug; |
22 | 23 | ||
23 | #include "usb-serial.h" | ||
24 | |||
25 | struct usbcons_info { | 24 | struct usbcons_info { |
26 | int magic; | 25 | int magic; |
27 | int break_flag; | 26 | int break_flag; |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index df0a4f98b4a..486c7411b9a 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
29 | #include "usb-serial.h" | 29 | #include <linux/usb/serial.h> |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Version Information | 32 | * Version Information |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 49b51ab0d4c..6286aba86fa 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | #include <linux/usb.h> | 41 | #include <linux/usb.h> |
42 | #include "usb-serial.h" | 42 | #include <linux/usb/serial.h> |
43 | 43 | ||
44 | #define CYBERJACK_LOCAL_BUF_SIZE 32 | 44 | #define CYBERJACK_LOCAL_BUF_SIZE 32 |
45 | 45 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 4ff2dfb299b..ee70fddcab6 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -59,11 +59,11 @@ | |||
59 | #include <linux/moduleparam.h> | 59 | #include <linux/moduleparam.h> |
60 | #include <linux/spinlock.h> | 60 | #include <linux/spinlock.h> |
61 | #include <linux/usb.h> | 61 | #include <linux/usb.h> |
62 | #include <linux/usb/serial.h> | ||
62 | #include <linux/serial.h> | 63 | #include <linux/serial.h> |
63 | #include <linux/delay.h> | 64 | #include <linux/delay.h> |
64 | #include <asm/uaccess.h> | 65 | #include <asm/uaccess.h> |
65 | 66 | ||
66 | #include "usb-serial.h" | ||
67 | #include "cypress_m8.h" | 67 | #include "cypress_m8.h" |
68 | 68 | ||
69 | 69 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 6953d3ef573..9b225183fc7 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -246,7 +246,7 @@ | |||
246 | #include <asm/uaccess.h> | 246 | #include <asm/uaccess.h> |
247 | #include <linux/usb.h> | 247 | #include <linux/usb.h> |
248 | #include <linux/wait.h> | 248 | #include <linux/wait.h> |
249 | #include "usb-serial.h" | 249 | #include <linux/usb/serial.h> |
250 | 250 | ||
251 | /* Defines */ | 251 | /* Defines */ |
252 | 252 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 1e2b31eeb49..daafe405d86 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <linux/spinlock.h> | 62 | #include <linux/spinlock.h> |
63 | #include <asm/uaccess.h> | 63 | #include <asm/uaccess.h> |
64 | #include <linux/usb.h> | 64 | #include <linux/usb.h> |
65 | #include "usb-serial.h" | 65 | #include <linux/usb/serial.h> |
66 | 66 | ||
67 | static int debug; | 67 | static int debug; |
68 | 68 | ||
diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c index debc3b0f966..5169c2d154a 100644 --- a/drivers/usb/serial/ezusb.c +++ b/drivers/usb/serial/ezusb.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/tty.h> | 15 | #include <linux/tty.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include "usb-serial.h" | 18 | #include <linux/usb/serial.h> |
19 | 19 | ||
20 | /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ | 20 | /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ |
21 | #define CPUCS_REG 0x7F92 | 21 | #define CPUCS_REG 0x7F92 |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8a74b19f128..c6115aa1b44 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -257,7 +257,7 @@ | |||
257 | #include <asm/uaccess.h> | 257 | #include <asm/uaccess.h> |
258 | #include <linux/usb.h> | 258 | #include <linux/usb.h> |
259 | #include <linux/serial.h> | 259 | #include <linux/serial.h> |
260 | #include "usb-serial.h" | 260 | #include <linux/usb/serial.h> |
261 | #include "ftdi_sio.h" | 261 | #include "ftdi_sio.h" |
262 | 262 | ||
263 | /* | 263 | /* |
@@ -306,6 +306,8 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
306 | 306 | ||
307 | 307 | ||
308 | static struct usb_device_id id_table_combined [] = { | 308 | static 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) }, |
@@ -313,6 +315,7 @@ static struct usb_device_id id_table_combined [] = { | |||
313 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, | 315 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, |
314 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, | 316 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, |
315 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, | 317 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, |
318 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, | ||
316 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, | 319 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, |
317 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | 320 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, |
318 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | 321 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, |
@@ -336,6 +339,7 @@ static struct usb_device_id id_table_combined [] = { | |||
336 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 339 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
337 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 340 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
338 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 341 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
342 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | ||
339 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, | 343 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, |
340 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, | 344 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, |
341 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, | 345 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, |
@@ -500,6 +504,9 @@ static struct usb_device_id id_table_combined [] = { | |||
500 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | 504 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, |
501 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 505 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
502 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 506 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
507 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | ||
508 | { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, | ||
509 | { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, | ||
503 | { }, /* Optional parameter entry */ | 510 | { }, /* Optional parameter entry */ |
504 | { } /* Terminating entry */ | 511 | { } /* Terminating entry */ |
505 | }; | 512 | }; |
@@ -548,11 +555,17 @@ struct ftdi_private { | |||
548 | spinlock_t rx_lock; /* spinlock for receive state */ | 555 | spinlock_t rx_lock; /* spinlock for receive state */ |
549 | struct work_struct rx_work; | 556 | struct work_struct rx_work; |
550 | int rx_processed; | 557 | int rx_processed; |
558 | unsigned long rx_bytes; | ||
551 | 559 | ||
552 | __u16 interface; /* FT2232C port interface (0 for FT232/245) */ | 560 | __u16 interface; /* FT2232C port interface (0 for FT232/245) */ |
553 | 561 | ||
554 | int force_baud; /* if non-zero, force the baud rate to this value */ | 562 | int force_baud; /* if non-zero, force the baud rate to this value */ |
555 | int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ | 563 | int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ |
564 | |||
565 | spinlock_t tx_lock; /* spinlock for transmit state */ | ||
566 | unsigned long tx_bytes; | ||
567 | unsigned long tx_outstanding_bytes; | ||
568 | unsigned long tx_outstanding_urbs; | ||
556 | }; | 569 | }; |
557 | 570 | ||
558 | /* Used for TIOCMIWAIT */ | 571 | /* Used for TIOCMIWAIT */ |
@@ -626,6 +639,9 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
626 | #define HIGH 1 | 639 | #define HIGH 1 |
627 | #define LOW 0 | 640 | #define LOW 0 |
628 | 641 | ||
642 | /* number of outstanding urbs to prevent userspace DoS from happening */ | ||
643 | #define URB_UPPER_LIMIT 42 | ||
644 | |||
629 | /* | 645 | /* |
630 | * *************************************************************************** | 646 | * *************************************************************************** |
631 | * Utlity functions | 647 | * Utlity functions |
@@ -1156,6 +1172,7 @@ static int ftdi_sio_attach (struct usb_serial *serial) | |||
1156 | } | 1172 | } |
1157 | 1173 | ||
1158 | spin_lock_init(&priv->rx_lock); | 1174 | spin_lock_init(&priv->rx_lock); |
1175 | spin_lock_init(&priv->tx_lock); | ||
1159 | init_waitqueue_head(&priv->delta_msr_wait); | 1176 | init_waitqueue_head(&priv->delta_msr_wait); |
1160 | /* This will push the characters through immediately rather | 1177 | /* This will push the characters through immediately rather |
1161 | than queue a task to deliver them */ | 1178 | than queue a task to deliver them */ |
@@ -1270,6 +1287,13 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1270 | 1287 | ||
1271 | dbg("%s", __FUNCTION__); | 1288 | dbg("%s", __FUNCTION__); |
1272 | 1289 | ||
1290 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1291 | priv->tx_bytes = 0; | ||
1292 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1293 | spin_lock_irqsave(&priv->rx_lock, flags); | ||
1294 | priv->rx_bytes = 0; | ||
1295 | spin_unlock_irqrestore(&priv->rx_lock, flags); | ||
1296 | |||
1273 | if (port->tty) | 1297 | if (port->tty) |
1274 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 1298 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1275 | 1299 | ||
@@ -1372,6 +1396,7 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1372 | int data_offset ; /* will be 1 for the SIO and 0 otherwise */ | 1396 | int data_offset ; /* will be 1 for the SIO and 0 otherwise */ |
1373 | int status; | 1397 | int status; |
1374 | int transfer_size; | 1398 | int transfer_size; |
1399 | unsigned long flags; | ||
1375 | 1400 | ||
1376 | dbg("%s port %d, %d bytes", __FUNCTION__, port->number, count); | 1401 | dbg("%s port %d, %d bytes", __FUNCTION__, port->number, count); |
1377 | 1402 | ||
@@ -1379,6 +1404,13 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1379 | dbg("write request of 0 bytes"); | 1404 | dbg("write request of 0 bytes"); |
1380 | return 0; | 1405 | return 0; |
1381 | } | 1406 | } |
1407 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1408 | if (priv->tx_outstanding_urbs > URB_UPPER_LIMIT) { | ||
1409 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1410 | dbg("%s - write limit hit\n", __FUNCTION__); | ||
1411 | return 0; | ||
1412 | } | ||
1413 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1382 | 1414 | ||
1383 | data_offset = priv->write_offset; | 1415 | data_offset = priv->write_offset; |
1384 | dbg("data_offset set to %d",data_offset); | 1416 | dbg("data_offset set to %d",data_offset); |
@@ -1445,6 +1477,12 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1445 | err("%s - failed submitting write urb, error %d", __FUNCTION__, status); | 1477 | err("%s - failed submitting write urb, error %d", __FUNCTION__, status); |
1446 | count = status; | 1478 | count = status; |
1447 | kfree (buffer); | 1479 | kfree (buffer); |
1480 | } else { | ||
1481 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1482 | ++priv->tx_outstanding_urbs; | ||
1483 | priv->tx_outstanding_bytes += count; | ||
1484 | priv->tx_bytes += count; | ||
1485 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1448 | } | 1486 | } |
1449 | 1487 | ||
1450 | /* we are done with this urb, so let the host driver | 1488 | /* we are done with this urb, so let the host driver |
@@ -1460,7 +1498,11 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1460 | 1498 | ||
1461 | static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | 1499 | static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) |
1462 | { | 1500 | { |
1501 | unsigned long flags; | ||
1463 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1502 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
1503 | struct ftdi_private *priv; | ||
1504 | int data_offset; /* will be 1 for the SIO and 0 otherwise */ | ||
1505 | unsigned long countback; | ||
1464 | 1506 | ||
1465 | /* free up the transfer buffer, as usb_free_urb() does not do this */ | 1507 | /* free up the transfer buffer, as usb_free_urb() does not do this */ |
1466 | kfree (urb->transfer_buffer); | 1508 | kfree (urb->transfer_buffer); |
@@ -1472,34 +1514,67 @@ static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1472 | return; | 1514 | return; |
1473 | } | 1515 | } |
1474 | 1516 | ||
1517 | priv = usb_get_serial_port_data(port); | ||
1518 | if (!priv) { | ||
1519 | dbg("%s - bad port private data pointer - exiting", __FUNCTION__); | ||
1520 | return; | ||
1521 | } | ||
1522 | /* account for transferred data */ | ||
1523 | countback = urb->actual_length; | ||
1524 | data_offset = priv->write_offset; | ||
1525 | if (data_offset > 0) { | ||
1526 | /* Subtract the control bytes */ | ||
1527 | countback -= (data_offset * ((countback + (PKTSZ - 1)) / PKTSZ)); | ||
1528 | } | ||
1529 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1530 | --priv->tx_outstanding_urbs; | ||
1531 | priv->tx_outstanding_bytes -= countback; | ||
1532 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1533 | |||
1475 | usb_serial_port_softint(port); | 1534 | usb_serial_port_softint(port); |
1476 | } /* ftdi_write_bulk_callback */ | 1535 | } /* ftdi_write_bulk_callback */ |
1477 | 1536 | ||
1478 | 1537 | ||
1479 | static int ftdi_write_room( struct usb_serial_port *port ) | 1538 | static int ftdi_write_room( struct usb_serial_port *port ) |
1480 | { | 1539 | { |
1540 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
1541 | int room; | ||
1542 | unsigned long flags; | ||
1543 | |||
1481 | dbg("%s - port %d", __FUNCTION__, port->number); | 1544 | dbg("%s - port %d", __FUNCTION__, port->number); |
1482 | 1545 | ||
1483 | /* | 1546 | spin_lock_irqsave(&priv->tx_lock, flags); |
1484 | * We really can take anything the user throws at us | 1547 | if (priv->tx_outstanding_urbs < URB_UPPER_LIMIT) { |
1485 | * but let's pick a nice big number to tell the tty | 1548 | /* |
1486 | * layer that we have lots of free space | 1549 | * We really can take anything the user throws at us |
1487 | */ | 1550 | * but let's pick a nice big number to tell the tty |
1488 | return 2048; | 1551 | * layer that we have lots of free space |
1552 | */ | ||
1553 | room = 2048; | ||
1554 | } else { | ||
1555 | room = 0; | ||
1556 | } | ||
1557 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1558 | return room; | ||
1489 | } /* ftdi_write_room */ | 1559 | } /* ftdi_write_room */ |
1490 | 1560 | ||
1491 | 1561 | ||
1492 | static int ftdi_chars_in_buffer (struct usb_serial_port *port) | 1562 | static int ftdi_chars_in_buffer (struct usb_serial_port *port) |
1493 | { /* ftdi_chars_in_buffer */ | 1563 | { /* ftdi_chars_in_buffer */ |
1564 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
1565 | int buffered; | ||
1566 | unsigned long flags; | ||
1567 | |||
1494 | dbg("%s - port %d", __FUNCTION__, port->number); | 1568 | dbg("%s - port %d", __FUNCTION__, port->number); |
1495 | 1569 | ||
1496 | /* | 1570 | spin_lock_irqsave(&priv->tx_lock, flags); |
1497 | * We can't really account for how much data we | 1571 | buffered = (int)priv->tx_outstanding_bytes; |
1498 | * have sent out, but hasn't made it through to the | 1572 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
1499 | * device, so just tell the tty layer that everything | 1573 | if (buffered < 0) { |
1500 | * is flushed. | 1574 | err("%s outstanding tx bytes is negative!", __FUNCTION__); |
1501 | */ | 1575 | buffered = 0; |
1502 | return 0; | 1576 | } |
1577 | return buffered; | ||
1503 | } /* ftdi_chars_in_buffer */ | 1578 | } /* ftdi_chars_in_buffer */ |
1504 | 1579 | ||
1505 | 1580 | ||
@@ -1509,6 +1584,8 @@ static void ftdi_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1509 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1584 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
1510 | struct tty_struct *tty; | 1585 | struct tty_struct *tty; |
1511 | struct ftdi_private *priv; | 1586 | struct ftdi_private *priv; |
1587 | unsigned long countread; | ||
1588 | unsigned long flags; | ||
1512 | 1589 | ||
1513 | if (urb->number_of_packets > 0) { | 1590 | if (urb->number_of_packets > 0) { |
1514 | err("%s transfer_buffer_length %d actual_length %d number of packets %d",__FUNCTION__, | 1591 | err("%s transfer_buffer_length %d actual_length %d number of packets %d",__FUNCTION__, |
@@ -1543,6 +1620,13 @@ static void ftdi_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1543 | return; | 1620 | return; |
1544 | } | 1621 | } |
1545 | 1622 | ||
1623 | /* count data bytes, but not status bytes */ | ||
1624 | countread = urb->actual_length; | ||
1625 | countread -= 2 * ((countread + (PKTSZ - 1)) / PKTSZ); | ||
1626 | spin_lock_irqsave(&priv->rx_lock, flags); | ||
1627 | priv->rx_bytes += countread; | ||
1628 | spin_unlock_irqrestore(&priv->rx_lock, flags); | ||
1629 | |||
1546 | ftdi_process_read(port); | 1630 | ftdi_process_read(port); |
1547 | 1631 | ||
1548 | } /* ftdi_read_bulk_callback */ | 1632 | } /* ftdi_read_bulk_callback */ |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 6ab2ac845bd..77299996f7e 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -32,10 +32,19 @@ | |||
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 | ||
38 | 44 | ||
45 | /* www.starting-point-systems.com µChameleon device */ | ||
46 | #define FTDI_MICRO_CHAMELEON_PID 0xCAA0 /* Product Id */ | ||
47 | |||
39 | /* www.irtrans.de device */ | 48 | /* www.irtrans.de device */ |
40 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ | 49 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ |
41 | 50 | ||
@@ -179,6 +188,10 @@ | |||
179 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ | 188 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ |
180 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ | 189 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ |
181 | 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 | |||
182 | /* | 195 | /* |
183 | * 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). |
184 | * All of these devices use FTDI's vendor ID (0x0403). | 197 | * All of these devices use FTDI's vendor ID (0x0403). |
@@ -442,6 +455,23 @@ | |||
442 | */ | 455 | */ |
443 | #define FTDI_YEI_SERVOCENTER31_PID 0xE050 /* YEI ServoCenter3.1 USB */ | 456 | #define FTDI_YEI_SERVOCENTER31_PID 0xE050 /* YEI ServoCenter3.1 USB */ |
444 | 457 | ||
458 | /* | ||
459 | * ThorLabs USB motor drivers | ||
460 | */ | ||
461 | #define FTDI_THORLABS_PID 0xfaf0 /* ThorLabs USB motor drivers */ | ||
462 | |||
463 | /* | ||
464 | * Testo products (http://www.testo.com/) | ||
465 | * Submitted by Colin Leroy | ||
466 | */ | ||
467 | #define TESTO_VID 0x128D | ||
468 | #define TESTO_USB_INTERFACE_PID 0x0001 | ||
469 | |||
470 | /* | ||
471 | * Gamma Scout (http://gamma-scout.com/). Submitted by rsc@runtux.com. | ||
472 | */ | ||
473 | #define FTDI_GAMMA_SCOUT_PID 0xD678 /* Gamma Scout online */ | ||
474 | |||
445 | /* Commands */ | 475 | /* Commands */ |
446 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 476 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
447 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 477 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c index 803721b97e2..77b977206a8 100644 --- a/drivers/usb/serial/funsoft.c +++ b/drivers/usb/serial/funsoft.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0x1404, 0xcddc) }, | 19 | { USB_DEVICE(0x1404, 0xcddc) }, |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1f5d1620baa..727852634be 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
38 | #include <linux/usb/serial.h> | ||
38 | 39 | ||
39 | /* the mode to be set when the port ist opened */ | 40 | /* the mode to be set when the port ist opened */ |
40 | static int initial_mode = 1; | 41 | static int initial_mode = 1; |
@@ -42,8 +43,6 @@ static int initial_mode = 1; | |||
42 | /* debug flag */ | 43 | /* debug flag */ |
43 | static int debug = 0; | 44 | static int debug = 0; |
44 | 45 | ||
45 | #include "usb-serial.h" | ||
46 | |||
47 | #define GARMIN_VENDOR_ID 0x091E | 46 | #define GARMIN_VENDOR_ID 0x091E |
48 | 47 | ||
49 | /* | 48 | /* |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 945b8bb38c9..17271355639 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include <linux/usb/serial.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include "usb-serial.h" | ||
22 | 22 | ||
23 | static int debug; | 23 | static int debug; |
24 | 24 | ||
@@ -285,6 +285,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg | |||
285 | if (result) | 285 | if (result) |
286 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); | 286 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); |
287 | } | 287 | } |
288 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); | ||
288 | 289 | ||
289 | void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | 290 | void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs) |
290 | { | 291 | { |
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index 7e06358b031..ebcac701b06 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/tty.h> | 17 | #include <linux/tty.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include "usb-serial.h" | 20 | #include <linux/usb/serial.h> |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Version Information | 23 | * Version Information |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index bd2c05dac2a..c49976c3ad5 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/wait.h> | 44 | #include <linux/wait.h> |
45 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
46 | #include <linux/usb.h> | 46 | #include <linux/usb.h> |
47 | #include "usb-serial.h" | 47 | #include <linux/usb/serial.h> |
48 | #include "io_edgeport.h" | 48 | #include "io_edgeport.h" |
49 | #include "io_ionsp.h" /* info for the iosp messages */ | 49 | #include "io_ionsp.h" /* info for the iosp messages */ |
50 | #include "io_16654.h" /* 16654 UART defines */ | 50 | #include "io_16654.h" /* 16654 UART defines */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 723a12ae87b..17c5b1d2311 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -39,8 +39,8 @@ | |||
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | #include <asm/semaphore.h> | 40 | #include <asm/semaphore.h> |
41 | #include <linux/usb.h> | 41 | #include <linux/usb.h> |
42 | #include <linux/usb/serial.h> | ||
42 | 43 | ||
43 | #include "usb-serial.h" | ||
44 | #include "io_16654.h" | 44 | #include "io_16654.h" |
45 | #include "io_usbvend.h" | 45 | #include "io_usbvend.h" |
46 | #include "io_ti.h" | 46 | #include "io_ti.h" |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index dbcfe172a5c..9840bade79f 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <linux/spinlock.h> | 55 | #include <linux/spinlock.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | #include "usb-serial.h" | 58 | #include <linux/usb/serial.h> |
59 | #include "ipaq.h" | 59 | #include "ipaq.h" |
60 | 60 | ||
61 | #define KP_RETRIES 100 | 61 | #define KP_RETRIES 100 |
@@ -70,6 +70,8 @@ | |||
70 | 70 | ||
71 | static __u16 product, vendor; | 71 | static __u16 product, vendor; |
72 | static int debug; | 72 | static int debug; |
73 | static int connect_retries = KP_RETRIES; | ||
74 | static int initial_wait; | ||
73 | 75 | ||
74 | /* Function prototypes for an ipaq */ | 76 | /* Function prototypes for an ipaq */ |
75 | static int ipaq_open (struct usb_serial_port *port, struct file *filp); | 77 | static int ipaq_open (struct usb_serial_port *port, struct file *filp); |
@@ -248,6 +250,9 @@ static struct usb_device_id ipaq_id_table [] = { | |||
248 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ | 250 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ |
249 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ |
250 | { 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 */ | ||
251 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ | 256 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ |
252 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ | 257 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ |
253 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ | 258 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ |
@@ -582,7 +587,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
582 | struct ipaq_private *priv; | 587 | struct ipaq_private *priv; |
583 | struct ipaq_packet *pkt; | 588 | struct ipaq_packet *pkt; |
584 | int i, result = 0; | 589 | int i, result = 0; |
585 | int retries = KP_RETRIES; | 590 | int retries = connect_retries; |
586 | 591 | ||
587 | dbg("%s - port %d", __FUNCTION__, port->number); | 592 | dbg("%s - port %d", __FUNCTION__, port->number); |
588 | 593 | ||
@@ -646,16 +651,12 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
646 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; | 651 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; |
647 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; | 652 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; |
648 | 653 | ||
654 | msleep(1000*initial_wait); | ||
649 | /* Start reading from the device */ | 655 | /* Start reading from the device */ |
650 | usb_fill_bulk_urb(port->read_urb, serial->dev, | 656 | usb_fill_bulk_urb(port->read_urb, serial->dev, |
651 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), | 657 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), |
652 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, | 658 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, |
653 | ipaq_read_bulk_callback, port); | 659 | ipaq_read_bulk_callback, port); |
654 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
655 | if (result) { | ||
656 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
657 | goto error; | ||
658 | } | ||
659 | 660 | ||
660 | /* | 661 | /* |
661 | * Send out control message observed in win98 sniffs. Not sure what | 662 | * Send out control message observed in win98 sniffs. Not sure what |
@@ -670,8 +671,14 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
670 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, | 671 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, |
671 | 0x1, 0, NULL, 0, 100); | 672 | 0x1, 0, NULL, 0, 100); |
672 | if (result == 0) { | 673 | if (result == 0) { |
674 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
675 | if (result) { | ||
676 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
677 | goto error; | ||
678 | } | ||
673 | return 0; | 679 | return 0; |
674 | } | 680 | } |
681 | msleep(1000); | ||
675 | } | 682 | } |
676 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); | 683 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); |
677 | goto error; | 684 | goto error; |
@@ -854,6 +861,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
854 | 861 | ||
855 | if (urb->status) { | 862 | if (urb->status) { |
856 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 863 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
864 | return; | ||
857 | } | 865 | } |
858 | 866 | ||
859 | spin_lock_irqsave(&write_list_lock, flags); | 867 | spin_lock_irqsave(&write_list_lock, flags); |
@@ -966,3 +974,9 @@ MODULE_PARM_DESC(vendor, "User specified USB idVendor"); | |||
966 | 974 | ||
967 | module_param(product, ushort, 0); | 975 | module_param(product, ushort, 0); |
968 | MODULE_PARM_DESC(product, "User specified USB idProduct"); | 976 | MODULE_PARM_DESC(product, "User specified USB idProduct"); |
977 | |||
978 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); | ||
979 | MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (one second each)"); | ||
980 | |||
981 | module_param(initial_wait, int, S_IRUGO|S_IWUSR); | ||
982 | MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)"); | ||
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index a4a0bfeaab0..87306cb6f9f 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/usb/serial.h> | ||
49 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
50 | #include "usb-serial.h" | ||
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Version Information | 53 | * Version Information |
@@ -373,6 +373,8 @@ static void ipw_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
373 | 373 | ||
374 | dbg("%s", __FUNCTION__); | 374 | dbg("%s", __FUNCTION__); |
375 | 375 | ||
376 | port->write_urb_busy = 0; | ||
377 | |||
376 | if (urb->status) | 378 | if (urb->status) |
377 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 379 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
378 | 380 | ||
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 2cf1fed3de4..1738b0b6a37 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #include <linux/spinlock.h> | 57 | #include <linux/spinlock.h> |
58 | #include <asm/uaccess.h> | 58 | #include <asm/uaccess.h> |
59 | #include <linux/usb.h> | 59 | #include <linux/usb.h> |
60 | #include "usb-serial.h" | 60 | #include <linux/usb/serial.h> |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * Version Information | 63 | * Version Information |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index d7c58f1bc96..015ad6cc1bb 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -107,7 +107,7 @@ | |||
107 | #include <linux/spinlock.h> | 107 | #include <linux/spinlock.h> |
108 | #include <asm/uaccess.h> | 108 | #include <asm/uaccess.h> |
109 | #include <linux/usb.h> | 109 | #include <linux/usb.h> |
110 | #include "usb-serial.h" | 110 | #include <linux/usb/serial.h> |
111 | #include "keyspan.h" | 111 | #include "keyspan.h" |
112 | 112 | ||
113 | static int debug; | 113 | static int debug; |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 03ab3c0f3cc..49b8dc039d1 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -78,6 +78,7 @@ | |||
78 | #include <linux/workqueue.h> | 78 | #include <linux/workqueue.h> |
79 | #include <asm/uaccess.h> | 79 | #include <asm/uaccess.h> |
80 | #include <linux/usb.h> | 80 | #include <linux/usb.h> |
81 | #include <linux/usb/serial.h> | ||
81 | 82 | ||
82 | static int debug; | 83 | static int debug; |
83 | 84 | ||
@@ -107,8 +108,6 @@ struct ezusb_hex_record { | |||
107 | #include "xircom_pgs_fw.h" | 108 | #include "xircom_pgs_fw.h" |
108 | #endif | 109 | #endif |
109 | 110 | ||
110 | #include "usb-serial.h" | ||
111 | |||
112 | /* | 111 | /* |
113 | * Version Information | 112 | * Version Information |
114 | */ | 113 | */ |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index b45ff3e7ab4..2a2f3e2da05 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <linux/module.h> | 55 | #include <linux/module.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | #include "usb-serial.h" | 58 | #include <linux/usb/serial.h> |
59 | #include "kl5kusb105.h" | 59 | #include "kl5kusb105.h" |
60 | 60 | ||
61 | static int debug; | 61 | static int debug; |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 45773337477..d50dce03495 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include <linux/spinlock.h> | 46 | #include <linux/spinlock.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/usb/serial.h> | ||
49 | #include <linux/ioctl.h> | 50 | #include <linux/ioctl.h> |
50 | #include "usb-serial.h" | ||
51 | #include "kobil_sct.h" | 51 | #include "kobil_sct.h" |
52 | 52 | ||
53 | static int debug; | 53 | static int debug; |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index ca05d3275f3..f4d4305c2c0 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -75,7 +75,7 @@ | |||
75 | #include <linux/spinlock.h> | 75 | #include <linux/spinlock.h> |
76 | #include <asm/uaccess.h> | 76 | #include <asm/uaccess.h> |
77 | #include <linux/usb.h> | 77 | #include <linux/usb.h> |
78 | #include "usb-serial.h" | 78 | #include <linux/usb/serial.h> |
79 | #include "mct_u232.h" | 79 | #include "mct_u232.h" |
80 | 80 | ||
81 | /* | 81 | /* |
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c index 7f544081032..ac3f8b5d2c4 100644 --- a/drivers/usb/serial/navman.c +++ b/drivers/usb/serial/navman.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/tty_flip.h> | 14 | #include <linux/tty_flip.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/usb.h> | 16 | #include <linux/usb.h> |
17 | #include "usb-serial.h" | 17 | #include <linux/usb/serial.h> |
18 | 18 | ||
19 | static int debug; | 19 | static int debug; |
20 | 20 | ||
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index cfb711a21a4..e49f40913c2 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/spinlock.h> | 46 | #include <linux/spinlock.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include "usb-serial.h" | 49 | #include <linux/usb/serial.h> |
50 | 50 | ||
51 | static int debug; | 51 | static int debug; |
52 | 52 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 78ad4b3126a..c856e6f40e2 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -9,39 +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 | 13 | ||
39 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> | 14 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> |
40 | 15 | ||
41 | 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 |
42 | with GSM modems. Issues: | 17 | with GSM modems. Issues: |
43 | - data loss -- one single Receive URB is not nearly enough | 18 | - data loss -- one single Receive URB is not nearly enough |
44 | - nonstandard flow (Option devices) and multiplex (Sierra) control | 19 | - nonstandard flow (Option devices) control |
45 | - controlling the baud rate doesn't make sense | 20 | - controlling the baud rate doesn't make sense |
46 | 21 | ||
47 | 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 |
@@ -53,7 +28,7 @@ | |||
53 | device features. | 28 | device features. |
54 | */ | 29 | */ |
55 | 30 | ||
56 | #define DRIVER_VERSION "v0.7.0" | 31 | #define DRIVER_VERSION "v0.7.1" |
57 | #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" | 32 | #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" |
58 | #define DRIVER_DESC "USB Driver for GSM modems" | 33 | #define DRIVER_DESC "USB Driver for GSM modems" |
59 | 34 | ||
@@ -64,7 +39,7 @@ | |||
64 | #include <linux/tty_flip.h> | 39 | #include <linux/tty_flip.h> |
65 | #include <linux/module.h> | 40 | #include <linux/module.h> |
66 | #include <linux/usb.h> | 41 | #include <linux/usb.h> |
67 | #include "usb-serial.h" | 42 | #include <linux/usb/serial.h> |
68 | 43 | ||
69 | /* Function prototypes */ | 44 | /* Function prototypes */ |
70 | static int option_open(struct usb_serial_port *port, struct file *filp); | 45 | static int option_open(struct usb_serial_port *port, struct file *filp); |
@@ -95,27 +70,29 @@ static int option_send_setup(struct usb_serial_port *port); | |||
95 | #define OPTION_VENDOR_ID 0x0AF0 | 70 | #define OPTION_VENDOR_ID 0x0AF0 |
96 | #define HUAWEI_VENDOR_ID 0x12D1 | 71 | #define HUAWEI_VENDOR_ID 0x12D1 |
97 | #define AUDIOVOX_VENDOR_ID 0x0F3D | 72 | #define AUDIOVOX_VENDOR_ID 0x0F3D |
98 | #define SIERRAWIRELESS_VENDOR_ID 0x1199 | ||
99 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 | 73 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 |
74 | #define ANYDATA_VENDOR_ID 0x16d5 | ||
100 | 75 | ||
101 | #define OPTION_PRODUCT_OLD 0x5000 | 76 | #define OPTION_PRODUCT_OLD 0x5000 |
102 | #define OPTION_PRODUCT_FUSION 0x6000 | 77 | #define OPTION_PRODUCT_FUSION 0x6000 |
103 | #define OPTION_PRODUCT_FUSION2 0x6300 | 78 | #define OPTION_PRODUCT_FUSION2 0x6300 |
104 | #define OPTION_PRODUCT_COBRA 0x6500 | 79 | #define OPTION_PRODUCT_COBRA 0x6500 |
80 | #define OPTION_PRODUCT_COBRA2 0x6600 | ||
105 | #define HUAWEI_PRODUCT_E600 0x1001 | 81 | #define HUAWEI_PRODUCT_E600 0x1001 |
106 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 | 82 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 |
107 | #define SIERRAWIRELESS_PRODUCT_MC8755 0x6802 | ||
108 | #define NOVATELWIRELESS_PRODUCT_U740 0x1400 | 83 | #define NOVATELWIRELESS_PRODUCT_U740 0x1400 |
84 | #define ANYDATA_PRODUCT_ID 0x6501 | ||
109 | 85 | ||
110 | static struct usb_device_id option_ids[] = { | 86 | static struct usb_device_id option_ids[] = { |
111 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, | 87 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, |
112 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, | 88 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, |
113 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, | 89 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, |
114 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, | 90 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, |
91 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, | ||
115 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 92 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
116 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, | 93 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
117 | { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) }, | ||
118 | { 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) }, | ||
119 | { } /* Terminating entry */ | 96 | { } /* Terminating entry */ |
120 | }; | 97 | }; |
121 | 98 | ||
@@ -124,13 +101,11 @@ static struct usb_device_id option_ids1[] = { | |||
124 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, | 101 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, |
125 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, | 102 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, |
126 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, | 103 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, |
104 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, | ||
127 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 105 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
128 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, | 106 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
129 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, | 107 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, |
130 | { } /* Terminating entry */ | 108 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, |
131 | }; | ||
132 | static struct usb_device_id option_ids3[] = { | ||
133 | { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) }, | ||
134 | { } /* Terminating entry */ | 109 | { } /* Terminating entry */ |
135 | }; | 110 | }; |
136 | 111 | ||
@@ -147,37 +122,11 @@ static struct usb_driver option_driver = { | |||
147 | /* The card has three separate interfaces, which the serial driver | 122 | /* The card has three separate interfaces, which the serial driver |
148 | * recognizes separately, thus num_port=1. | 123 | * recognizes separately, thus num_port=1. |
149 | */ | 124 | */ |
150 | static struct usb_serial_driver option_3port_device = { | ||
151 | .driver = { | ||
152 | .owner = THIS_MODULE, | ||
153 | .name = "option", | ||
154 | }, | ||
155 | .description = "GSM modem (3-port)", | ||
156 | .id_table = option_ids3, | ||
157 | .num_interrupt_in = NUM_DONT_CARE, | ||
158 | .num_bulk_in = NUM_DONT_CARE, | ||
159 | .num_bulk_out = NUM_DONT_CARE, | ||
160 | .num_ports = 3, | ||
161 | .open = option_open, | ||
162 | .close = option_close, | ||
163 | .write = option_write, | ||
164 | .write_room = option_write_room, | ||
165 | .chars_in_buffer = option_chars_in_buffer, | ||
166 | .throttle = option_rx_throttle, | ||
167 | .unthrottle = option_rx_unthrottle, | ||
168 | .set_termios = option_set_termios, | ||
169 | .break_ctl = option_break_ctl, | ||
170 | .tiocmget = option_tiocmget, | ||
171 | .tiocmset = option_tiocmset, | ||
172 | .attach = option_startup, | ||
173 | .shutdown = option_shutdown, | ||
174 | .read_int_callback = option_instat_callback, | ||
175 | }; | ||
176 | 125 | ||
177 | static struct usb_serial_driver option_1port_device = { | 126 | static struct usb_serial_driver option_1port_device = { |
178 | .driver = { | 127 | .driver = { |
179 | .owner = THIS_MODULE, | 128 | .owner = THIS_MODULE, |
180 | .name = "option", | 129 | .name = "option1", |
181 | }, | 130 | }, |
182 | .description = "GSM modem (1-port)", | 131 | .description = "GSM modem (1-port)", |
183 | .id_table = option_ids1, | 132 | .id_table = option_ids1, |
@@ -241,9 +190,6 @@ static int __init option_init(void) | |||
241 | retval = usb_serial_register(&option_1port_device); | 190 | retval = usb_serial_register(&option_1port_device); |
242 | if (retval) | 191 | if (retval) |
243 | goto failed_1port_device_register; | 192 | goto failed_1port_device_register; |
244 | retval = usb_serial_register(&option_3port_device); | ||
245 | if (retval) | ||
246 | goto failed_3port_device_register; | ||
247 | retval = usb_register(&option_driver); | 193 | retval = usb_register(&option_driver); |
248 | if (retval) | 194 | if (retval) |
249 | goto failed_driver_register; | 195 | goto failed_driver_register; |
@@ -253,8 +199,6 @@ static int __init option_init(void) | |||
253 | return 0; | 199 | return 0; |
254 | 200 | ||
255 | failed_driver_register: | 201 | failed_driver_register: |
256 | usb_serial_deregister (&option_3port_device); | ||
257 | failed_3port_device_register: | ||
258 | usb_serial_deregister (&option_1port_device); | 202 | usb_serial_deregister (&option_1port_device); |
259 | failed_1port_device_register: | 203 | failed_1port_device_register: |
260 | return retval; | 204 | return retval; |
@@ -263,7 +207,6 @@ failed_1port_device_register: | |||
263 | static void __exit option_exit(void) | 207 | static void __exit option_exit(void) |
264 | { | 208 | { |
265 | usb_deregister (&option_driver); | 209 | usb_deregister (&option_driver); |
266 | usb_serial_deregister (&option_3port_device); | ||
267 | usb_serial_deregister (&option_1port_device); | 210 | usb_serial_deregister (&option_1port_device); |
268 | } | 211 | } |
269 | 212 | ||
@@ -652,7 +595,6 @@ static void option_setup_urbs(struct usb_serial *serial) | |||
652 | 595 | ||
653 | dbg("%s", __FUNCTION__); | 596 | dbg("%s", __FUNCTION__); |
654 | 597 | ||
655 | |||
656 | for (i = 0; i < serial->num_ports; i++) { | 598 | for (i = 0; i < serial->num_ports; i++) { |
657 | port = serial->port[i]; | 599 | port = serial->port[i]; |
658 | 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 de93a2b909e..65e4d046951 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | #include "usb-serial.h" | 30 | #include <linux/usb/serial.h> |
31 | #include "pl2303.h" | 31 | #include "pl2303.h" |
32 | 32 | ||
33 | /* | 33 | /* |
@@ -52,6 +52,7 @@ struct pl2303_buf { | |||
52 | static struct usb_device_id id_table [] = { | 52 | static struct usb_device_id id_table [] = { |
53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, | 53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, |
54 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, | 54 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, |
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, | ||
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
57 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 58 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
@@ -78,7 +79,8 @@ static struct usb_device_id id_table [] = { | |||
78 | { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, | 79 | { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, |
79 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, | 80 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, |
80 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, | 81 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, |
81 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, | 82 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, |
83 | { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) }, | ||
82 | { } /* Terminating entry */ | 84 | { } /* Terminating entry */ |
83 | }; | 85 | }; |
84 | 86 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 7f29e81d3e3..55195e76eb6 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define PL2303_VENDOR_ID 0x067b | 10 | #define PL2303_VENDOR_ID 0x067b |
11 | #define PL2303_PRODUCT_ID 0x2303 | 11 | #define PL2303_PRODUCT_ID 0x2303 |
12 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb | 12 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb |
13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 | ||
13 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
14 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 | 15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 |
15 | 16 | ||
@@ -81,6 +82,10 @@ | |||
81 | #define SPEEDDRAGON_VENDOR_ID 0x0e55 | 82 | #define SPEEDDRAGON_VENDOR_ID 0x0e55 |
82 | #define SPEEDDRAGON_PRODUCT_ID 0x110b | 83 | #define SPEEDDRAGON_PRODUCT_ID 0x110b |
83 | 84 | ||
84 | /* Ours Technology Inc DKU-5 clone, chipset: Prolific Technology Inc */ | 85 | /* DATAPILOT Universal-2 Phone Cable */ |
85 | #define OTI_VENDOR_ID 0x0ea0 | 86 | #define DATAPILOT_U2_VENDOR_ID 0x0731 |
86 | #define OTI_PRODUCT_ID 0x6858 | 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/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 897d8447252..789771ecdb1 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c | |||
@@ -71,7 +71,7 @@ | |||
71 | #include <linux/spinlock.h> | 71 | #include <linux/spinlock.h> |
72 | #include <asm/uaccess.h> | 72 | #include <asm/uaccess.h> |
73 | #include <linux/usb.h> | 73 | #include <linux/usb.h> |
74 | #include "usb-serial.h" | 74 | #include <linux/usb/serial.h> |
75 | 75 | ||
76 | 76 | ||
77 | #ifndef CONFIG_USB_SAFE_PADDED | 77 | #ifndef CONFIG_USB_SAFE_PADDED |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c new file mode 100644 index 00000000000..d29638daa98 --- /dev/null +++ b/drivers/usb/serial/sierra.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Sierra Wireless CDMA Wireless Serial USB driver | ||
3 | * | ||
4 | * Current Copy modified by: Kevin Lloyd <linux@sierrawireless.com> | ||
5 | * Original Copyright (C) 2005-2006 Greg Kroah-Hartman <gregkh@suse.de> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version | ||
9 | * 2 as published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/tty.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/usb.h> | ||
17 | #include <linux/usb/serial.h> | ||
18 | |||
19 | static struct usb_device_id id_table [] = { | ||
20 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ | ||
21 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | ||
22 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ | ||
23 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ | ||
24 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ | ||
25 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | ||
26 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */ | ||
27 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | ||
28 | /* Following devices are supported in the airprime.c driver */ | ||
29 | /* { USB_DEVICE(0x1199, 0x0112) }, */ /* Sierra Wireless AirCard 580 */ | ||
30 | /* { USB_DEVICE(0x0F3D, 0x0112) }, */ /* AirPrime/Sierra PC 5220 */ | ||
31 | { } | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE(usb, id_table); | ||
34 | |||
35 | static struct usb_driver sierra_driver = { | ||
36 | .name = "sierra_wireless", | ||
37 | .probe = usb_serial_probe, | ||
38 | .disconnect = usb_serial_disconnect, | ||
39 | .id_table = id_table, | ||
40 | }; | ||
41 | |||
42 | static struct usb_serial_driver sierra_device = { | ||
43 | .driver = { | ||
44 | .owner = THIS_MODULE, | ||
45 | .name = "Sierra_Wireless", | ||
46 | }, | ||
47 | .id_table = id_table, | ||
48 | .num_interrupt_in = NUM_DONT_CARE, | ||
49 | .num_bulk_in = NUM_DONT_CARE, | ||
50 | .num_bulk_out = NUM_DONT_CARE, | ||
51 | .num_ports = 3, | ||
52 | }; | ||
53 | |||
54 | static int __init sierra_init(void) | ||
55 | { | ||
56 | int retval; | ||
57 | |||
58 | retval = usb_serial_register(&sierra_device); | ||
59 | if (retval) | ||
60 | return retval; | ||
61 | retval = usb_register(&sierra_driver); | ||
62 | if (retval) | ||
63 | usb_serial_deregister(&sierra_device); | ||
64 | return retval; | ||
65 | } | ||
66 | |||
67 | static void __exit sierra_exit(void) | ||
68 | { | ||
69 | usb_deregister(&sierra_driver); | ||
70 | usb_serial_deregister(&sierra_device); | ||
71 | } | ||
72 | |||
73 | module_init(sierra_init); | ||
74 | module_exit(sierra_exit); | ||
75 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index a9afff31a92..ac9b8ee52d4 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -83,8 +83,8 @@ | |||
83 | #include <asm/uaccess.h> | 83 | #include <asm/uaccess.h> |
84 | #include <asm/semaphore.h> | 84 | #include <asm/semaphore.h> |
85 | #include <linux/usb.h> | 85 | #include <linux/usb.h> |
86 | #include <linux/usb/serial.h> | ||
86 | 87 | ||
87 | #include "usb-serial.h" | ||
88 | #include "ti_usb_3410_5052.h" | 88 | #include "ti_usb_3410_5052.h" |
89 | #include "ti_fw_3410.h" /* firmware image for 3410 */ | 89 | #include "ti_fw_3410.h" /* firmware image for 3410 */ |
90 | #include "ti_fw_5052.h" /* firmware image for 5052 */ | 90 | #include "ti_fw_5052.h" /* firmware image for 5052 */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index b59a0536ea5..e06a41bd0f3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
34 | #include "usb-serial.h" | 34 | #include <linux/usb/serial.h> |
35 | #include "pl2303.h" | 35 | #include "pl2303.h" |
36 | 36 | ||
37 | /* | 37 | /* |
@@ -40,6 +40,8 @@ | |||
40 | #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/" | 40 | #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/" |
41 | #define DRIVER_DESC "USB Serial Driver core" | 41 | #define DRIVER_DESC "USB Serial Driver core" |
42 | 42 | ||
43 | static void port_free(struct usb_serial_port *port); | ||
44 | |||
43 | /* Driver structure we register with the USB core */ | 45 | /* Driver structure we register with the USB core */ |
44 | static struct usb_driver usb_serial_driver = { | 46 | static struct usb_driver usb_serial_driver = { |
45 | .name = "usbserial", | 47 | .name = "usbserial", |
@@ -146,23 +148,10 @@ static void destroy_serial(struct kref *kref) | |||
146 | port = serial->port[i]; | 148 | port = serial->port[i]; |
147 | if (!port) | 149 | if (!port) |
148 | continue; | 150 | continue; |
149 | usb_kill_urb(port->read_urb); | 151 | port_free(port); |
150 | usb_free_urb(port->read_urb); | ||
151 | usb_kill_urb(port->write_urb); | ||
152 | usb_free_urb(port->write_urb); | ||
153 | usb_kill_urb(port->interrupt_in_urb); | ||
154 | usb_free_urb(port->interrupt_in_urb); | ||
155 | usb_kill_urb(port->interrupt_out_urb); | ||
156 | usb_free_urb(port->interrupt_out_urb); | ||
157 | kfree(port->bulk_in_buffer); | ||
158 | kfree(port->bulk_out_buffer); | ||
159 | kfree(port->interrupt_in_buffer); | ||
160 | kfree(port->interrupt_out_buffer); | ||
161 | } | 152 | } |
162 | } | 153 | } |
163 | 154 | ||
164 | flush_scheduled_work(); /* port->work */ | ||
165 | |||
166 | usb_put_dev(serial->dev); | 155 | usb_put_dev(serial->dev); |
167 | 156 | ||
168 | /* free up any memory that we allocated */ | 157 | /* free up any memory that we allocated */ |
@@ -475,8 +464,10 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int | |||
475 | length += sprintf (page+length, " path:%s", tmp); | 464 | length += sprintf (page+length, " path:%s", tmp); |
476 | 465 | ||
477 | length += sprintf (page+length, "\n"); | 466 | length += sprintf (page+length, "\n"); |
478 | if ((length + begin) > (off + count)) | 467 | if ((length + begin) > (off + count)) { |
468 | usb_serial_put(serial); | ||
479 | goto done; | 469 | goto done; |
470 | } | ||
480 | if ((length + begin) < off) { | 471 | if ((length + begin) < off) { |
481 | begin += length; | 472 | begin += length; |
482 | length = 0; | 473 | length = 0; |
@@ -564,6 +555,11 @@ static void port_release(struct device *dev) | |||
564 | struct usb_serial_port *port = to_usb_serial_port(dev); | 555 | struct usb_serial_port *port = to_usb_serial_port(dev); |
565 | 556 | ||
566 | dbg ("%s - %s", __FUNCTION__, dev->bus_id); | 557 | dbg ("%s - %s", __FUNCTION__, dev->bus_id); |
558 | port_free(port); | ||
559 | } | ||
560 | |||
561 | static void port_free(struct usb_serial_port *port) | ||
562 | { | ||
567 | usb_kill_urb(port->read_urb); | 563 | usb_kill_urb(port->read_urb); |
568 | usb_free_urb(port->read_urb); | 564 | usb_free_urb(port->read_urb); |
569 | usb_kill_urb(port->write_urb); | 565 | usb_kill_urb(port->write_urb); |
@@ -576,6 +572,7 @@ static void port_release(struct device *dev) | |||
576 | kfree(port->bulk_out_buffer); | 572 | kfree(port->bulk_out_buffer); |
577 | kfree(port->interrupt_in_buffer); | 573 | kfree(port->interrupt_in_buffer); |
578 | kfree(port->interrupt_out_buffer); | 574 | kfree(port->interrupt_out_buffer); |
575 | flush_scheduled_work(); /* port->work */ | ||
579 | kfree(port); | 576 | kfree(port); |
580 | } | 577 | } |
581 | 578 | ||
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h deleted file mode 100644 index 0f2802a6019..00000000000 --- a/drivers/usb/serial/usb-serial.h +++ /dev/null | |||
@@ -1,300 +0,0 @@ | |||
1 | /* | ||
2 | * USB Serial Converter driver | ||
3 | * | ||
4 | * Copyright (C) 1999 - 2005 | ||
5 | * Greg Kroah-Hartman (greg@kroah.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | |||
14 | #ifndef __LINUX_USB_SERIAL_H | ||
15 | #define __LINUX_USB_SERIAL_H | ||
16 | |||
17 | #include <linux/kref.h> | ||
18 | #include <linux/mutex.h> | ||
19 | |||
20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | ||
21 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | ||
22 | |||
23 | #define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ | ||
24 | |||
25 | /* parity check flag */ | ||
26 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | ||
27 | |||
28 | /** | ||
29 | * usb_serial_port: structure for the specific ports of a device. | ||
30 | * @serial: pointer back to the struct usb_serial owner of this port. | ||
31 | * @tty: pointer to the corresponding tty for this port. | ||
32 | * @lock: spinlock to grab when updating portions of this structure. | ||
33 | * @mutex: mutex used to synchronize serial_open() and serial_close() | ||
34 | * access for this port. | ||
35 | * @number: the number of the port (the minor number). | ||
36 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | ||
37 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | ||
38 | * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe | ||
39 | * for this port. | ||
40 | * @interrupt_out_buffer: pointer to the interrupt out buffer for this port. | ||
41 | * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. | ||
42 | * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. | ||
43 | * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe | ||
44 | * for this port. | ||
45 | * @bulk_in_buffer: pointer to the bulk in buffer for this port. | ||
46 | * @read_urb: pointer to the bulk in struct urb for this port. | ||
47 | * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this | ||
48 | * port. | ||
49 | * @bulk_out_buffer: pointer to the bulk out buffer for this port. | ||
50 | * @bulk_out_size: the size of the bulk_out_buffer, in bytes. | ||
51 | * @write_urb: pointer to the bulk out struct urb for this port. | ||
52 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this | ||
53 | * port. | ||
54 | * @write_wait: a wait_queue_head_t used by the port. | ||
55 | * @work: work queue entry for the line discipline waking up. | ||
56 | * @open_count: number of times this port has been opened. | ||
57 | * | ||
58 | * This structure is used by the usb-serial core and drivers for the specific | ||
59 | * ports of a device. | ||
60 | */ | ||
61 | struct usb_serial_port { | ||
62 | struct usb_serial * serial; | ||
63 | struct tty_struct * tty; | ||
64 | spinlock_t lock; | ||
65 | struct mutex mutex; | ||
66 | unsigned char number; | ||
67 | |||
68 | unsigned char * interrupt_in_buffer; | ||
69 | struct urb * interrupt_in_urb; | ||
70 | __u8 interrupt_in_endpointAddress; | ||
71 | |||
72 | unsigned char * interrupt_out_buffer; | ||
73 | int interrupt_out_size; | ||
74 | struct urb * interrupt_out_urb; | ||
75 | __u8 interrupt_out_endpointAddress; | ||
76 | |||
77 | unsigned char * bulk_in_buffer; | ||
78 | int bulk_in_size; | ||
79 | struct urb * read_urb; | ||
80 | __u8 bulk_in_endpointAddress; | ||
81 | |||
82 | unsigned char * bulk_out_buffer; | ||
83 | int bulk_out_size; | ||
84 | struct urb * write_urb; | ||
85 | int write_urb_busy; | ||
86 | __u8 bulk_out_endpointAddress; | ||
87 | |||
88 | wait_queue_head_t write_wait; | ||
89 | struct work_struct work; | ||
90 | int open_count; | ||
91 | struct device dev; | ||
92 | }; | ||
93 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | ||
94 | |||
95 | /* get and set the port private data pointer helper functions */ | ||
96 | static inline void *usb_get_serial_port_data (struct usb_serial_port *port) | ||
97 | { | ||
98 | return dev_get_drvdata(&port->dev); | ||
99 | } | ||
100 | |||
101 | static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) | ||
102 | { | ||
103 | dev_set_drvdata(&port->dev, data); | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * usb_serial - structure used by the usb-serial core for a device | ||
108 | * @dev: pointer to the struct usb_device for this device | ||
109 | * @type: pointer to the struct usb_serial_driver for this device | ||
110 | * @interface: pointer to the struct usb_interface for this device | ||
111 | * @minor: the starting minor number for this device | ||
112 | * @num_ports: the number of ports this device has | ||
113 | * @num_interrupt_in: number of interrupt in endpoints we have | ||
114 | * @num_interrupt_out: number of interrupt out endpoints we have | ||
115 | * @num_bulk_in: number of bulk in endpoints we have | ||
116 | * @num_bulk_out: number of bulk out endpoints we have | ||
117 | * @port: array of struct usb_serial_port structures for the different ports. | ||
118 | * @private: place to put any driver specific information that is needed. The | ||
119 | * usb-serial driver is required to manage this data, the usb-serial core | ||
120 | * will not touch this. Use usb_get_serial_data() and | ||
121 | * usb_set_serial_data() to access this. | ||
122 | */ | ||
123 | struct usb_serial { | ||
124 | struct usb_device * dev; | ||
125 | struct usb_serial_driver * type; | ||
126 | struct usb_interface * interface; | ||
127 | unsigned char minor; | ||
128 | unsigned char num_ports; | ||
129 | unsigned char num_port_pointers; | ||
130 | char num_interrupt_in; | ||
131 | char num_interrupt_out; | ||
132 | char num_bulk_in; | ||
133 | char num_bulk_out; | ||
134 | struct usb_serial_port * port[MAX_NUM_PORTS]; | ||
135 | struct kref kref; | ||
136 | void * private; | ||
137 | }; | ||
138 | #define to_usb_serial(d) container_of(d, struct usb_serial, kref) | ||
139 | |||
140 | #define NUM_DONT_CARE (-1) | ||
141 | |||
142 | /* get and set the serial private data pointer helper functions */ | ||
143 | static inline void *usb_get_serial_data (struct usb_serial *serial) | ||
144 | { | ||
145 | return serial->private; | ||
146 | } | ||
147 | |||
148 | static inline void usb_set_serial_data (struct usb_serial *serial, void *data) | ||
149 | { | ||
150 | serial->private = data; | ||
151 | } | ||
152 | |||
153 | /** | ||
154 | * usb_serial_driver - describes a usb serial driver | ||
155 | * @description: pointer to a string that describes this driver. This string used | ||
156 | * in the syslog messages when a device is inserted or removed. | ||
157 | * @id_table: pointer to a list of usb_device_id structures that define all | ||
158 | * of the devices this structure can support. | ||
159 | * @num_interrupt_in: the number of interrupt in endpoints this device will | ||
160 | * have. | ||
161 | * @num_interrupt_out: the number of interrupt out endpoints this device will | ||
162 | * have. | ||
163 | * @num_bulk_in: the number of bulk in endpoints this device will have. | ||
164 | * @num_bulk_out: the number of bulk out endpoints this device will have. | ||
165 | * @num_ports: the number of different ports this device will have. | ||
166 | * @calc_num_ports: pointer to a function to determine how many ports this | ||
167 | * device has dynamically. It will be called after the probe() | ||
168 | * callback is called, but before attach() | ||
169 | * @probe: pointer to the driver's probe function. | ||
170 | * This will be called when the device is inserted into the system, | ||
171 | * but before the device has been fully initialized by the usb_serial | ||
172 | * subsystem. Use this function to download any firmware to the device, | ||
173 | * or any other early initialization that might be needed. | ||
174 | * Return 0 to continue on with the initialization sequence. Anything | ||
175 | * else will abort it. | ||
176 | * @attach: pointer to the driver's attach function. | ||
177 | * This will be called when the struct usb_serial structure is fully set | ||
178 | * set up. Do any local initialization of the device, or any private | ||
179 | * memory structure allocation at this point in time. | ||
180 | * @shutdown: pointer to the driver's shutdown function. This will be | ||
181 | * called when the device is removed from the system. | ||
182 | * | ||
183 | * This structure is defines a USB Serial driver. It provides all of | ||
184 | * the information that the USB serial core code needs. If the function | ||
185 | * pointers are defined, then the USB serial core code will call them when | ||
186 | * the corresponding tty port functions are called. If they are not | ||
187 | * called, the generic serial function will be used instead. | ||
188 | * | ||
189 | * The driver.owner field should be set to the module owner of this driver. | ||
190 | * The driver.name field should be set to the name of this driver (remember | ||
191 | * it will show up in sysfs, so it needs to be short and to the point. | ||
192 | * Useing the module name is a good idea.) | ||
193 | */ | ||
194 | struct usb_serial_driver { | ||
195 | const char *description; | ||
196 | const struct usb_device_id *id_table; | ||
197 | char num_interrupt_in; | ||
198 | char num_interrupt_out; | ||
199 | char num_bulk_in; | ||
200 | char num_bulk_out; | ||
201 | char num_ports; | ||
202 | |||
203 | struct list_head driver_list; | ||
204 | struct device_driver driver; | ||
205 | |||
206 | int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); | ||
207 | int (*attach) (struct usb_serial *serial); | ||
208 | int (*calc_num_ports) (struct usb_serial *serial); | ||
209 | |||
210 | void (*shutdown) (struct usb_serial *serial); | ||
211 | |||
212 | int (*port_probe) (struct usb_serial_port *port); | ||
213 | int (*port_remove) (struct usb_serial_port *port); | ||
214 | |||
215 | /* serial function calls */ | ||
216 | int (*open) (struct usb_serial_port *port, struct file * filp); | ||
217 | void (*close) (struct usb_serial_port *port, struct file * filp); | ||
218 | int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); | ||
219 | int (*write_room) (struct usb_serial_port *port); | ||
220 | int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); | ||
221 | void (*set_termios) (struct usb_serial_port *port, struct termios * old); | ||
222 | void (*break_ctl) (struct usb_serial_port *port, int break_state); | ||
223 | int (*chars_in_buffer) (struct usb_serial_port *port); | ||
224 | void (*throttle) (struct usb_serial_port *port); | ||
225 | void (*unthrottle) (struct usb_serial_port *port); | ||
226 | int (*tiocmget) (struct usb_serial_port *port, struct file *file); | ||
227 | int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); | ||
228 | |||
229 | void (*read_int_callback)(struct urb *urb, struct pt_regs *regs); | ||
230 | void (*write_int_callback)(struct urb *urb, struct pt_regs *regs); | ||
231 | void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs); | ||
232 | void (*write_bulk_callback)(struct urb *urb, struct pt_regs *regs); | ||
233 | }; | ||
234 | #define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) | ||
235 | |||
236 | extern int usb_serial_register(struct usb_serial_driver *driver); | ||
237 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | ||
238 | extern void usb_serial_port_softint(struct usb_serial_port *port); | ||
239 | |||
240 | extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); | ||
241 | extern void usb_serial_disconnect(struct usb_interface *iface); | ||
242 | |||
243 | extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); | ||
244 | extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); | ||
245 | |||
246 | /* USB Serial console functions */ | ||
247 | #ifdef CONFIG_USB_SERIAL_CONSOLE | ||
248 | extern void usb_serial_console_init (int debug, int minor); | ||
249 | extern void usb_serial_console_exit (void); | ||
250 | extern void usb_serial_console_disconnect(struct usb_serial *serial); | ||
251 | #else | ||
252 | static inline void usb_serial_console_init (int debug, int minor) { } | ||
253 | static inline void usb_serial_console_exit (void) { } | ||
254 | static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} | ||
255 | #endif | ||
256 | |||
257 | /* Functions needed by other parts of the usbserial core */ | ||
258 | extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); | ||
259 | extern void usb_serial_put(struct usb_serial *serial); | ||
260 | extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); | ||
261 | extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); | ||
262 | extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); | ||
263 | extern int usb_serial_generic_write_room (struct usb_serial_port *port); | ||
264 | extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); | ||
265 | extern void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *regs); | ||
266 | extern void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs); | ||
267 | extern void usb_serial_generic_shutdown (struct usb_serial *serial); | ||
268 | extern int usb_serial_generic_register (int debug); | ||
269 | extern void usb_serial_generic_deregister (void); | ||
270 | |||
271 | extern int usb_serial_bus_register (struct usb_serial_driver *device); | ||
272 | extern void usb_serial_bus_deregister (struct usb_serial_driver *device); | ||
273 | |||
274 | extern struct usb_serial_driver usb_serial_generic_device; | ||
275 | extern struct bus_type usb_serial_bus_type; | ||
276 | extern struct tty_driver *usb_serial_tty_driver; | ||
277 | |||
278 | static inline void usb_serial_debug_data(int debug, | ||
279 | struct device *dev, | ||
280 | const char *function, int size, | ||
281 | const unsigned char *data) | ||
282 | { | ||
283 | int i; | ||
284 | |||
285 | if (debug) { | ||
286 | dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); | ||
287 | for (i = 0; i < size; ++i) | ||
288 | printk ("%.2x ", data[i]); | ||
289 | printk ("\n"); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | /* Use our own dbg macro */ | ||
294 | #undef dbg | ||
295 | #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) | ||
296 | |||
297 | |||
298 | |||
299 | #endif /* ifdef __LINUX_USB_SERIAL_H */ | ||
300 | |||
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 95a2936e902..88949f7884c 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
28 | #include "usb-serial.h" | 28 | #include <linux/usb/serial.h> |
29 | #include "visor.h" | 29 | #include "visor.h" |
30 | 30 | ||
31 | /* | 31 | /* |
@@ -302,7 +302,6 @@ static int visor_open (struct usb_serial_port *port, struct file *filp) | |||
302 | spin_lock_irqsave(&priv->lock, flags); | 302 | spin_lock_irqsave(&priv->lock, flags); |
303 | priv->bytes_in = 0; | 303 | priv->bytes_in = 0; |
304 | priv->bytes_out = 0; | 304 | priv->bytes_out = 0; |
305 | priv->outstanding_urbs = 0; | ||
306 | priv->throttled = 0; | 305 | priv->throttled = 0; |
307 | spin_unlock_irqrestore(&priv->lock, flags); | 306 | spin_unlock_irqrestore(&priv->lock, flags); |
308 | 307 | ||
@@ -435,13 +434,25 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf, | |||
435 | 434 | ||
436 | static int visor_write_room (struct usb_serial_port *port) | 435 | static int visor_write_room (struct usb_serial_port *port) |
437 | { | 436 | { |
437 | struct visor_private *priv = usb_get_serial_port_data(port); | ||
438 | unsigned long flags; | ||
439 | |||
438 | dbg("%s - port %d", __FUNCTION__, port->number); | 440 | dbg("%s - port %d", __FUNCTION__, port->number); |
439 | 441 | ||
440 | /* | 442 | /* |
441 | * We really can take anything the user throws at us | 443 | * We really can take anything the user throws at us |
442 | * but let's pick a nice big number to tell the tty | 444 | * but let's pick a nice big number to tell the tty |
443 | * layer that we have lots of free space | 445 | * layer that we have lots of free space, unless we don't. |
444 | */ | 446 | */ |
447 | |||
448 | spin_lock_irqsave(&priv->lock, flags); | ||
449 | if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) { | ||
450 | spin_unlock_irqrestore(&priv->lock, flags); | ||
451 | dbg("%s - write limit hit\n", __FUNCTION__); | ||
452 | return 0; | ||
453 | } | ||
454 | spin_unlock_irqrestore(&priv->lock, flags); | ||
455 | |||
445 | return 2048; | 456 | return 2048; |
446 | } | 457 | } |
447 | 458 | ||
@@ -758,15 +769,22 @@ static int visor_calc_num_ports (struct usb_serial *serial) | |||
758 | 769 | ||
759 | static int generic_startup(struct usb_serial *serial) | 770 | static int generic_startup(struct usb_serial *serial) |
760 | { | 771 | { |
772 | struct usb_serial_port **ports = serial->port; | ||
761 | struct visor_private *priv; | 773 | struct visor_private *priv; |
762 | int i; | 774 | int i; |
763 | 775 | ||
764 | for (i = 0; i < serial->num_ports; ++i) { | 776 | for (i = 0; i < serial->num_ports; ++i) { |
765 | priv = kzalloc (sizeof(*priv), GFP_KERNEL); | 777 | priv = kzalloc (sizeof(*priv), GFP_KERNEL); |
766 | if (!priv) | 778 | if (!priv) { |
779 | while (i-- != 0) { | ||
780 | priv = usb_get_serial_port_data(ports[i]); | ||
781 | usb_set_serial_port_data(ports[i], NULL); | ||
782 | kfree(priv); | ||
783 | } | ||
767 | return -ENOMEM; | 784 | return -ENOMEM; |
785 | } | ||
768 | spin_lock_init(&priv->lock); | 786 | spin_lock_init(&priv->lock); |
769 | usb_set_serial_port_data(serial->port[i], priv); | 787 | usb_set_serial_port_data(ports[i], priv); |
770 | } | 788 | } |
771 | return 0; | 789 | return 0; |
772 | } | 790 | } |
@@ -876,7 +894,18 @@ static int clie_5_attach (struct usb_serial *serial) | |||
876 | 894 | ||
877 | static void visor_shutdown (struct usb_serial *serial) | 895 | static void visor_shutdown (struct usb_serial *serial) |
878 | { | 896 | { |
897 | struct visor_private *priv; | ||
898 | int i; | ||
899 | |||
879 | dbg("%s", __FUNCTION__); | 900 | dbg("%s", __FUNCTION__); |
901 | |||
902 | for (i = 0; i < serial->num_ports; i++) { | ||
903 | priv = usb_get_serial_port_data(serial->port[i]); | ||
904 | if (priv) { | ||
905 | usb_set_serial_port_data(serial->port[i], NULL); | ||
906 | kfree(priv); | ||
907 | } | ||
908 | } | ||
880 | } | 909 | } |
881 | 910 | ||
882 | static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) | 911 | static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 540438c3f38..6e6c7934be3 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -79,7 +79,7 @@ | |||
79 | #include <linux/usb.h> | 79 | #include <linux/usb.h> |
80 | #include <linux/serial_reg.h> | 80 | #include <linux/serial_reg.h> |
81 | #include <linux/serial.h> | 81 | #include <linux/serial.h> |
82 | #include "usb-serial.h" | 82 | #include <linux/usb/serial.h> |
83 | #include "whiteheat_fw.h" /* firmware for the ConnectTech WhiteHEAT device */ | 83 | #include "whiteheat_fw.h" /* firmware for the ConnectTech WhiteHEAT device */ |
84 | #include "whiteheat.h" /* WhiteHEAT specific commands */ | 84 | #include "whiteheat.h" /* WhiteHEAT specific commands */ |
85 | 85 | ||
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 5715291ba54..a4b7df9ff8c 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -112,13 +112,11 @@ static int slave_configure(struct scsi_device *sdev) | |||
112 | if (sdev->scsi_level < SCSI_2) | 112 | if (sdev->scsi_level < SCSI_2) |
113 | sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; | 113 | sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; |
114 | 114 | ||
115 | /* According to the technical support people at Genesys Logic, | 115 | /* Many devices have trouble transfering more than 32KB at a time, |
116 | * devices using their chips have problems transferring more than | 116 | * while others have trouble with more than 64K. At this time we |
117 | * 32 KB at a time. In practice people have found that 64 KB | 117 | * are limiting both to 32K (64 sectores). |
118 | * works okay and that's what Windows does. But we'll be | 118 | */ |
119 | * conservative; people can always use the sysfs interface to | 119 | if ((us->flags & US_FL_MAX_SECTORS_64) && |
120 | * increase max_sectors. */ | ||
121 | if (le16_to_cpu(us->pusb_dev->descriptor.idVendor) == USB_VENDOR_ID_GENESYS && | ||
122 | sdev->request_queue->max_sectors > 64) | 120 | sdev->request_queue->max_sectors > 64) |
123 | blk_queue_max_sectors(sdev->request_queue, 64); | 121 | blk_queue_max_sectors(sdev->request_queue, 64); |
124 | 122 | ||
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index eb7188b3565..d6acc92a4ae 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -180,7 +180,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
180 | if (timeleft <= 0) { | 180 | if (timeleft <= 0) { |
181 | US_DEBUGP("%s -- cancelling URB\n", | 181 | US_DEBUGP("%s -- cancelling URB\n", |
182 | timeleft == 0 ? "Timeout" : "Signal"); | 182 | timeleft == 0 ? "Timeout" : "Signal"); |
183 | usb_unlink_urb(us->current_urb); | 183 | usb_kill_urb(us->current_urb); |
184 | } | 184 | } |
185 | 185 | ||
186 | /* return the URB status */ | 186 | /* return the URB status */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index c7e84e653df..b130e170b4a 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -112,6 +112,19 @@ UNUSUAL_DEV( 0x0411, 0x001c, 0x0113, 0x0113, | |||
112 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 112 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
113 | US_FL_FIX_INQUIRY ), | 113 | US_FL_FIX_INQUIRY ), |
114 | 114 | ||
115 | /* Submitted by Ernestas Vaiciukevicius <ernisv@gmail.com> */ | ||
116 | UNUSUAL_DEV( 0x0419, 0x0100, 0x0100, 0x0100, | ||
117 | "Samsung Info. Systems America, Inc.", | ||
118 | "MP3 Player", | ||
119 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
120 | US_FL_IGNORE_RESIDUE ), | ||
121 | |||
122 | /* Reported by Orgad Shaneh <orgads@gmail.com> */ | ||
123 | UNUSUAL_DEV( 0x0419, 0xaace, 0x0100, 0x0100, | ||
124 | "Samsung", "MP3 Player", | ||
125 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
126 | US_FL_IGNORE_RESIDUE ), | ||
127 | |||
115 | /* Reported by Christian Leber <christian@leber.de> */ | 128 | /* Reported by Christian Leber <christian@leber.de> */ |
116 | UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100, | 129 | UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100, |
117 | "TrekStor", | 130 | "TrekStor", |
@@ -132,6 +145,21 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100, | |||
132 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 145 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
133 | US_FL_IGNORE_RESIDUE ), | 146 | US_FL_IGNORE_RESIDUE ), |
134 | 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 | |||
155 | /* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and | ||
156 | * Einar Th. Einarsson <einarthered@gmail.com> */ | ||
157 | UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, | ||
158 | "Nokia", | ||
159 | "N91", | ||
160 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
161 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | ||
162 | |||
135 | /* Reported by Jiri Slaby <jirislaby@gmail.com> and | 163 | /* Reported by Jiri Slaby <jirislaby@gmail.com> and |
136 | * Rene C. Castberg <Rene@Castberg.org> */ | 164 | * Rene C. Castberg <Rene@Castberg.org> */ |
137 | UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, | 165 | UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, |
@@ -140,6 +168,13 @@ UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, | |||
140 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 168 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
141 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | 169 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), |
142 | 170 | ||
171 | /* Reported by Matthew Bloch <matthew@bytemark.co.uk> */ | ||
172 | UNUSUAL_DEV( 0x0421, 0x044e, 0x0100, 0x0100, | ||
173 | "Nokia", | ||
174 | "E61", | ||
175 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
176 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | ||
177 | |||
143 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ | 178 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ |
144 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, | 179 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, |
145 | "SMSC", | 180 | "SMSC", |
@@ -206,16 +241,6 @@ UNUSUAL_DEV( 0x0482, 0x0103, 0x0100, 0x0100, | |||
206 | "Finecam S5", | 241 | "Finecam S5", |
207 | US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), | 242 | US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), |
208 | 243 | ||
209 | /* Patch for Kyocera Finecam L3 | ||
210 | * Submitted by Michael Krauth <michael.krauth@web.de> | ||
211 | * and Alessandro Fracchetti <al.fracchetti@tin.it> | ||
212 | */ | ||
213 | UNUSUAL_DEV( 0x0482, 0x0105, 0x0100, 0x0100, | ||
214 | "Kyocera", | ||
215 | "Finecam L3", | ||
216 | US_SC_SCSI, US_PR_BULK, NULL, | ||
217 | US_FL_FIX_INQUIRY), | ||
218 | |||
219 | /* Reported by Paul Stewart <stewart@wetlogic.net> | 244 | /* Reported by Paul Stewart <stewart@wetlogic.net> |
220 | * This entry is needed because the device reports Sub=ff */ | 245 | * This entry is needed because the device reports Sub=ff */ |
221 | UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, | 246 | UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, |
@@ -473,10 +498,11 @@ UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0450, | |||
473 | US_SC_SCSI, US_PR_DEVICE, NULL, | 498 | US_SC_SCSI, US_PR_DEVICE, NULL, |
474 | US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), | 499 | US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), |
475 | 500 | ||
476 | /* This entry is needed because the device reports Sub=ff */ | 501 | /* Submitted by Lars Jacob <jacob.lars@googlemail.com> |
477 | UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0600, | 502 | * This entry is needed because the device reports Sub=ff */ |
503 | UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0610, | ||
478 | "Sony", | 504 | "Sony", |
479 | "DSC-T1/T5", | 505 | "DSC-T1/T5/H5", |
480 | US_SC_8070, US_PR_DEVICE, NULL, | 506 | US_SC_8070, US_PR_DEVICE, NULL, |
481 | US_FL_SINGLE_LUN ), | 507 | US_FL_SINGLE_LUN ), |
482 | 508 | ||
@@ -563,6 +589,13 @@ UNUSUAL_DEV( 0x054c, 0x0099, 0x0000, 0x9999, | |||
563 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 589 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
564 | US_FL_FIX_INQUIRY ), | 590 | US_FL_FIX_INQUIRY ), |
565 | 591 | ||
592 | /* floppy reports multiple luns */ | ||
593 | UNUSUAL_DEV( 0x055d, 0x2020, 0x0000, 0x0210, | ||
594 | "SAMSUNG", | ||
595 | "SFD-321U [FW 0C]", | ||
596 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
597 | US_FL_SINGLE_LUN ), | ||
598 | |||
566 | 599 | ||
567 | UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299, | 600 | UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299, |
568 | "Y-E Data", | 601 | "Y-E Data", |
@@ -598,18 +631,6 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, | |||
598 | "Digital Camera EX-20 DSC", | 631 | "Digital Camera EX-20 DSC", |
599 | US_SC_8070, US_PR_DEVICE, NULL, 0 ), | 632 | US_SC_8070, US_PR_DEVICE, NULL, 0 ), |
600 | 633 | ||
601 | /* The entry was here before I took over, and had US_SC_RBC. It turns | ||
602 | * out that isn't needed. Additionally, Torsten Eriksson | ||
603 | * <Torsten.Eriksson@bergianska.se> is able to use his device fine | ||
604 | * without this entry at all - but I don't suspect that will be true | ||
605 | * for all users (the protocol is likely needed), so is staying at | ||
606 | * this time. - Phil Dibowitz <phil@ipom.com> | ||
607 | */ | ||
608 | UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200, | ||
609 | "LaCie", | ||
610 | "USB Hard Disk", | ||
611 | US_SC_DEVICE, US_PR_CB, NULL, 0 ), | ||
612 | |||
613 | /* Submitted by Joel Bourquard <numlock@freesurf.ch> | 634 | /* Submitted by Joel Bourquard <numlock@freesurf.ch> |
614 | * Some versions of this device need the SubClass and Protocol overrides | 635 | * Some versions of this device need the SubClass and Protocol overrides |
615 | * while others don't. | 636 | * while others don't. |
@@ -708,18 +729,22 @@ UNUSUAL_DEV( 0x05dc, 0xb002, 0x0000, 0x0113, | |||
708 | * They were originally reported by Alexander Oltu | 729 | * They were originally reported by Alexander Oltu |
709 | * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com> | 730 | * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com> |
710 | * respectively. | 731 | * respectively. |
732 | * | ||
733 | * US_FL_GO_SLOW and US_FL_MAX_SECTORS_64 added by Phil Dibowitz | ||
734 | * <phil@ipom.com> as these flags were made and hard-coded | ||
735 | * special-cases were pulled from scsiglue.c. | ||
711 | */ | 736 | */ |
712 | UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, | 737 | UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, |
713 | "Genesys Logic", | 738 | "Genesys Logic", |
714 | "USB to IDE Optical", | 739 | "USB to IDE Optical", |
715 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 740 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
716 | US_FL_GO_SLOW ), | 741 | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), |
717 | 742 | ||
718 | UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, | 743 | UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, |
719 | "Genesys Logic", | 744 | "Genesys Logic", |
720 | "USB to IDE Disk", | 745 | "USB to IDE Disk", |
721 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 746 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
722 | US_FL_GO_SLOW ), | 747 | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), |
723 | 748 | ||
724 | /* Reported by Hanno Boeck <hanno@gmx.de> | 749 | /* Reported by Hanno Boeck <hanno@gmx.de> |
725 | * Taken from the Lycoris Kernel */ | 750 | * Taken from the Lycoris Kernel */ |
@@ -1073,7 +1098,15 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff, | |||
1073 | "Optio S/S4", | 1098 | "Optio S/S4", |
1074 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1099 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1075 | US_FL_FIX_INQUIRY ), | 1100 | US_FL_FIX_INQUIRY ), |
1076 | 1101 | ||
1102 | /* This is a virtual windows driver CD, which the zd1211rw driver automatically | ||
1103 | * converts into a WLAN device. */ | ||
1104 | UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, | ||
1105 | "ZyXEL", | ||
1106 | "G-220F USB-WLAN Install", | ||
1107 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1108 | US_FL_IGNORE_DEVICE ), | ||
1109 | |||
1077 | #ifdef CONFIG_USB_STORAGE_ISD200 | 1110 | #ifdef CONFIG_USB_STORAGE_ISD200 |
1078 | UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, | 1111 | UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, |
1079 | "ATI", | 1112 | "ATI", |
@@ -1196,6 +1229,24 @@ UNUSUAL_DEV( 0x0ea0, 0x6828, 0x0110, 0x0110, | |||
1196 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1229 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1197 | US_FL_IGNORE_RESIDUE ), | 1230 | US_FL_IGNORE_RESIDUE ), |
1198 | 1231 | ||
1232 | /* Reported by Benjamin Schiller <sbenni@gmx.de> | ||
1233 | * It is also sold by Easylite as DJ 20 */ | ||
1234 | UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103, | ||
1235 | "Typhoon", | ||
1236 | "My DJ 1820", | ||
1237 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1238 | US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), | ||
1239 | |||
1240 | /* David Kuehling <dvdkhlng@gmx.de>: | ||
1241 | * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI | ||
1242 | * errors when trying to write. | ||
1243 | */ | ||
1244 | UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, | ||
1245 | "C-MEX", | ||
1246 | "A-VOX", | ||
1247 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1248 | US_FL_IGNORE_RESIDUE ), | ||
1249 | |||
1199 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1250 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
1200 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1251 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
1201 | "Sony Ericsson", | 1252 | "Sony Ericsson", |
@@ -1203,11 +1254,18 @@ UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | |||
1203 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1254 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1204 | US_FL_NO_WP_DETECT ), | 1255 | US_FL_NO_WP_DETECT ), |
1205 | 1256 | ||
1257 | /* Reported by Emmanuel Vasilakis <evas@forthnet.gr> */ | ||
1258 | UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000, | ||
1259 | "Sony Ericsson", | ||
1260 | "M600i", | ||
1261 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1262 | US_FL_FIX_CAPACITY ), | ||
1263 | |||
1206 | /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> | 1264 | /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> |
1207 | * Tested on hardware version 1.10. | 1265 | * Tested on hardware version 1.10. |
1208 | * Entry is needed only for the initializer function override. | 1266 | * Entry is needed only for the initializer function override. |
1209 | */ | 1267 | */ |
1210 | UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x9999, | 1268 | UNUSUAL_DEV( 0x1019, 0x0c55, 0x0110, 0x0110, |
1211 | "Desknote", | 1269 | "Desknote", |
1212 | "UCR-61S2B", | 1270 | "UCR-61S2B", |
1213 | US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, | 1271 | US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, |
@@ -1227,6 +1285,15 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, | |||
1227 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1285 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1228 | US_FL_IGNORE_RESIDUE ), | 1286 | US_FL_IGNORE_RESIDUE ), |
1229 | 1287 | ||
1288 | /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> | ||
1289 | * and Renato Perini <rperini@email.it> | ||
1290 | */ | ||
1291 | UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, | ||
1292 | "Motorola", | ||
1293 | "RAZR V3x", | ||
1294 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1295 | US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), | ||
1296 | |||
1230 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ | 1297 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ |
1231 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | 1298 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, |
1232 | "MPIO", | 1299 | "MPIO", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 1185acac4b2..8d7bdcb5924 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
56 | #include <linux/kthread.h> | 56 | #include <linux/kthread.h> |
57 | #include <linux/mutex.h> | 57 | #include <linux/mutex.h> |
58 | #include <linux/utsrelease.h> | ||
58 | 59 | ||
59 | #include <scsi/scsi.h> | 60 | #include <scsi/scsi.h> |
60 | #include <scsi/scsi_cmnd.h> | 61 | #include <scsi/scsi_cmnd.h> |
@@ -373,8 +374,12 @@ static int usb_stor_control_thread(void * __us) | |||
373 | /* lock access to the state */ | 374 | /* lock access to the state */ |
374 | scsi_lock(host); | 375 | scsi_lock(host); |
375 | 376 | ||
377 | /* did the command already complete because of a disconnect? */ | ||
378 | if (!us->srb) | ||
379 | ; /* nothing to do */ | ||
380 | |||
376 | /* indicate that the command is done */ | 381 | /* indicate that the command is done */ |
377 | if (us->srb->result != DID_ABORT << 16) { | 382 | else if (us->srb->result != DID_ABORT << 16) { |
378 | US_DEBUGP("scsi cmd done, result=0x%x\n", | 383 | US_DEBUGP("scsi cmd done, result=0x%x\n", |
379 | us->srb->result); | 384 | us->srb->result); |
380 | us->srb->scsi_done(us->srb); | 385 | us->srb->scsi_done(us->srb); |
@@ -478,7 +483,7 @@ static struct us_unusual_dev *find_unusual(const struct usb_device_id *id) | |||
478 | } | 483 | } |
479 | 484 | ||
480 | /* Get the unusual_devs entries and the string descriptors */ | 485 | /* Get the unusual_devs entries and the string descriptors */ |
481 | 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) |
482 | { | 487 | { |
483 | struct usb_device *dev = us->pusb_dev; | 488 | struct usb_device *dev = us->pusb_dev; |
484 | struct usb_interface_descriptor *idesc = | 489 | struct usb_interface_descriptor *idesc = |
@@ -495,6 +500,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
495 | unusual_dev->useTransport; | 500 | unusual_dev->useTransport; |
496 | us->flags = USB_US_ORIG_FLAGS(id->driver_info); | 501 | us->flags = USB_US_ORIG_FLAGS(id->driver_info); |
497 | 502 | ||
503 | if (us->flags & US_FL_IGNORE_DEVICE) { | ||
504 | printk(KERN_INFO USB_STORAGE "device ignored\n"); | ||
505 | return -ENODEV; | ||
506 | } | ||
507 | |||
498 | /* | 508 | /* |
499 | * 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 |
500 | * disable it if we're in full-speed | 510 | * disable it if we're in full-speed |
@@ -524,7 +534,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
524 | if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) | 534 | if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) |
525 | printk(KERN_NOTICE USB_STORAGE "This device " | 535 | printk(KERN_NOTICE USB_STORAGE "This device " |
526 | "(%04x,%04x,%04x S %02x P %02x)" | 536 | "(%04x,%04x,%04x S %02x P %02x)" |
527 | " has %s in unusual_devs.h\n" | 537 | " has %s in unusual_devs.h (kernel" |
538 | " %s)\n" | ||
528 | " Please send a copy of this message to " | 539 | " Please send a copy of this message to " |
529 | "<linux-usb-devel@lists.sourceforge.net>\n", | 540 | "<linux-usb-devel@lists.sourceforge.net>\n", |
530 | le16_to_cpu(ddesc->idVendor), | 541 | le16_to_cpu(ddesc->idVendor), |
@@ -532,8 +543,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
532 | le16_to_cpu(ddesc->bcdDevice), | 543 | le16_to_cpu(ddesc->bcdDevice), |
533 | idesc->bInterfaceSubClass, | 544 | idesc->bInterfaceSubClass, |
534 | idesc->bInterfaceProtocol, | 545 | idesc->bInterfaceProtocol, |
535 | msgs[msg]); | 546 | msgs[msg], |
547 | UTS_RELEASE); | ||
536 | } | 548 | } |
549 | |||
550 | return 0; | ||
537 | } | 551 | } |
538 | 552 | ||
539 | /* Get the transport settings */ | 553 | /* Get the transport settings */ |
@@ -836,32 +850,34 @@ static void dissociate_dev(struct us_data *us) | |||
836 | * the host */ | 850 | * the host */ |
837 | static void quiesce_and_remove_host(struct us_data *us) | 851 | static void quiesce_and_remove_host(struct us_data *us) |
838 | { | 852 | { |
853 | struct Scsi_Host *host = us_to_host(us); | ||
854 | |||
839 | /* Prevent new USB transfers, stop the current command, and | 855 | /* Prevent new USB transfers, stop the current command, and |
840 | * interrupt a SCSI-scan or device-reset delay */ | 856 | * interrupt a SCSI-scan or device-reset delay */ |
857 | scsi_lock(host); | ||
841 | set_bit(US_FLIDX_DISCONNECTING, &us->flags); | 858 | set_bit(US_FLIDX_DISCONNECTING, &us->flags); |
859 | scsi_unlock(host); | ||
842 | usb_stor_stop_transport(us); | 860 | usb_stor_stop_transport(us); |
843 | wake_up(&us->delay_wait); | 861 | wake_up(&us->delay_wait); |
844 | 862 | ||
845 | /* It doesn't matter if the SCSI-scanning thread is still running. | 863 | /* It doesn't matter if the SCSI-scanning thread is still running. |
846 | * The thread will exit when it sees the DISCONNECTING flag. */ | 864 | * The thread will exit when it sees the DISCONNECTING flag. */ |
847 | 865 | ||
848 | /* Wait for the current command to finish, then remove the host */ | ||
849 | mutex_lock(&us->dev_mutex); | ||
850 | mutex_unlock(&us->dev_mutex); | ||
851 | |||
852 | /* queuecommand won't accept any new commands and the control | 866 | /* queuecommand won't accept any new commands and the control |
853 | * thread won't execute a previously-queued command. If there | 867 | * thread won't execute a previously-queued command. If there |
854 | * is such a command pending, complete it with an error. */ | 868 | * is such a command pending, complete it with an error. */ |
869 | mutex_lock(&us->dev_mutex); | ||
855 | if (us->srb) { | 870 | if (us->srb) { |
856 | us->srb->result = DID_NO_CONNECT << 16; | 871 | us->srb->result = DID_NO_CONNECT << 16; |
857 | scsi_lock(us_to_host(us)); | 872 | scsi_lock(host); |
858 | us->srb->scsi_done(us->srb); | 873 | us->srb->scsi_done(us->srb); |
859 | us->srb = NULL; | 874 | us->srb = NULL; |
860 | scsi_unlock(us_to_host(us)); | 875 | scsi_unlock(host); |
861 | } | 876 | } |
877 | mutex_unlock(&us->dev_mutex); | ||
862 | 878 | ||
863 | /* Now we own no commands so it's safe to remove the SCSI host */ | 879 | /* Now we own no commands so it's safe to remove the SCSI host */ |
864 | scsi_remove_host(us_to_host(us)); | 880 | scsi_remove_host(host); |
865 | } | 881 | } |
866 | 882 | ||
867 | /* Second stage of disconnect processing: deallocate all resources */ | 883 | /* Second stage of disconnect processing: deallocate all resources */ |
@@ -960,7 +976,9 @@ static int storage_probe(struct usb_interface *intf, | |||
960 | * 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 |
961 | * corresponding entry in the private table. | 977 | * corresponding entry in the private table. |
962 | */ | 978 | */ |
963 | get_device_info(us, id); | 979 | result = get_device_info(us, id); |
980 | if (result) | ||
981 | goto BadDevice; | ||
964 | 982 | ||
965 | /* Get the transport, protocol, and pipe settings */ | 983 | /* Get the transport, protocol, and pipe settings */ |
966 | result = get_transport(us); | 984 | result = get_transport(us); |
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 5284abe1b5e..21f3ddbc908 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h | |||
@@ -176,8 +176,4 @@ extern void fill_inquiry_response(struct us_data *us, | |||
176 | #define scsi_unlock(host) spin_unlock_irq(host->host_lock) | 176 | #define scsi_unlock(host) spin_unlock_irq(host->host_lock) |
177 | #define scsi_lock(host) spin_lock_irq(host->host_lock) | 177 | #define scsi_lock(host) spin_lock_irq(host->host_lock) |
178 | 178 | ||
179 | |||
180 | /* Vendor ID list for devices that require special handling */ | ||
181 | #define USB_VENDOR_ID_GENESYS 0x05e3 /* Genesys Logic */ | ||
182 | |||
183 | #endif | 179 | #endif |