aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJames Bottomley <jejb@titanic.(none)>2005-05-20 16:27:44 -0400
committerJames Bottomley <jejb@titanic.(none)>2005-05-20 16:27:44 -0400
commitad34ea2cc3845ef4dcd7d12fb0fa8484734bd672 (patch)
treead434400f5ecaa33b433c8f830e40792d8d6c05c /drivers/usb
parent90356ac3194bf91a441a5f9c3067af386ef62462 (diff)
parent88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff)
merge by hand - fix up rejections in Documentation/DocBook/Makefile
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/message.c4
-rw-r--r--drivers/usb/core/urb.c6
-rw-r--r--drivers/usb/core/usb.c6
-rw-r--r--drivers/usb/gadget/ether.c2
-rw-r--r--drivers/usb/gadget/inode.c2
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c2
-rw-r--r--drivers/usb/gadget/serial.c2
-rw-r--r--drivers/usb/host/ehci-hcd.c65
-rw-r--r--drivers/usb/host/ehci-hub.c2
-rw-r--r--drivers/usb/host/ehci.h19
-rw-r--r--drivers/usb/host/hc_crisv10.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c4
-rw-r--r--drivers/usb/image/mdc800.c2
-rw-r--r--drivers/usb/image/microtek.c2
-rw-r--r--drivers/usb/input/aiptek.c2
-rw-r--r--drivers/usb/input/ati_remote.c2
-rw-r--r--drivers/usb/input/mtouchusb.c2
-rw-r--r--drivers/usb/input/usbkbd.c3
-rw-r--r--drivers/usb/media/ov511.c2
-rw-r--r--drivers/usb/media/pwc/pwc-ctrl.c80
-rw-r--r--drivers/usb/media/pwc/pwc-if.c12
-rw-r--r--drivers/usb/media/pwc/pwc-ioctl.h2
-rw-r--r--drivers/usb/media/pwc/pwc.h6
-rw-r--r--drivers/usb/media/sn9c102_core.c4
-rw-r--r--drivers/usb/media/sn9c102_sensor.h2
-rw-r--r--drivers/usb/misc/legousbtower.c2
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c3
-rw-r--r--drivers/usb/net/pegasus.c4
-rw-r--r--drivers/usb/net/usbnet.c432
-rw-r--r--drivers/usb/net/zd1201.c28
-rw-r--r--drivers/usb/serial/Kconfig18
-rw-r--r--drivers/usb/serial/Makefile2
-rw-r--r--drivers/usb/serial/airprime.c63
-rw-r--r--drivers/usb/serial/cypress_m8.c187
-rw-r--r--drivers/usb/serial/ftdi_sio.c46
-rw-r--r--drivers/usb/serial/ftdi_sio.h36
-rw-r--r--drivers/usb/serial/hp4x.c85
-rw-r--r--drivers/usb/serial/io_usbvend.h2
-rw-r--r--drivers/usb/serial/keyspan_usa90msg.h2
-rw-r--r--drivers/usb/storage/debug.c1
-rw-r--r--drivers/usb/storage/shuttle_usbat.c2
-rw-r--r--drivers/usb/storage/unusual_devs.h39
42 files changed, 781 insertions, 408 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index e12c5be1e0a3..f50aaf25c98e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -431,7 +431,7 @@ nomem:
431 * (2) error, where io->status is a negative errno value. The number 431 * (2) error, where io->status is a negative errno value. The number
432 * of io->bytes transferred before the error is usually less 432 * of io->bytes transferred before the error is usually less
433 * than requested, and can be nonzero. 433 * than requested, and can be nonzero.
434 * (3) cancelation, a type of error with status -ECONNRESET that 434 * (3) cancellation, a type of error with status -ECONNRESET that
435 * is initiated by usb_sg_cancel(). 435 * is initiated by usb_sg_cancel().
436 * 436 *
437 * When this function returns, all memory allocated through usb_sg_init() or 437 * When this function returns, all memory allocated through usb_sg_init() or
@@ -1282,7 +1282,7 @@ static void release_interface(struct device *dev)
1282 * bus rwsem; usb device driver probe() methods cannot use this routine. 1282 * bus rwsem; usb device driver probe() methods cannot use this routine.
1283 * 1283 *
1284 * Returns zero on success, or else the status code returned by the 1284 * Returns zero on success, or else the status code returned by the
1285 * underlying call that failed. On succesful completion, each interface 1285 * underlying call that failed. On successful completion, each interface
1286 * in the original device configuration has been destroyed, and each one 1286 * in the original device configuration has been destroyed, and each one
1287 * in the new configuration has been probed by all relevant usb device 1287 * in the new configuration has been probed by all relevant usb device
1288 * drivers currently known to the kernel. 1288 * drivers currently known to the kernel.
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 16972159a57a..0faf18d511de 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -121,7 +121,7 @@ struct urb * usb_get_urb(struct urb *urb)
121 * describing that request to the USB subsystem. Request completion will 121 * describing that request to the USB subsystem. Request completion will
122 * be indicated later, asynchronously, by calling the completion handler. 122 * be indicated later, asynchronously, by calling the completion handler.
123 * The three types of completion are success, error, and unlink 123 * The three types of completion are success, error, and unlink
124 * (a software-induced fault, also called "request cancelation"). 124 * (a software-induced fault, also called "request cancellation").
125 * 125 *
126 * URBs may be submitted in interrupt context. 126 * URBs may be submitted in interrupt context.
127 * 127 *
@@ -170,7 +170,7 @@ struct urb * usb_get_urb(struct urb *urb)
170 * As of Linux 2.6, all USB endpoint transfer queues support depths greater 170 * As of Linux 2.6, all USB endpoint transfer queues support depths greater
171 * than one. This was previously a HCD-specific behavior, except for ISO 171 * than one. This was previously a HCD-specific behavior, except for ISO
172 * transfers. Non-isochronous endpoint queues are inactive during cleanup 172 * transfers. Non-isochronous endpoint queues are inactive during cleanup
173 * after faults (transfer errors or cancelation). 173 * after faults (transfer errors or cancellation).
174 * 174 *
175 * Reserved Bandwidth Transfers: 175 * Reserved Bandwidth Transfers:
176 * 176 *
@@ -395,7 +395,7 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
395 * 395 *
396 * This routine cancels an in-progress request. URBs complete only 396 * This routine cancels an in-progress request. URBs complete only
397 * once per submission, and may be canceled only once per submission. 397 * once per submission, and may be canceled only once per submission.
398 * Successful cancelation means the requests's completion handler will 398 * Successful cancellation means the requests's completion handler will
399 * be called with a status code indicating that the request has been 399 * be called with a status code indicating that the request has been
400 * canceled (rather than any other code) and will quickly be removed 400 * canceled (rather than any other code) and will quickly be removed
401 * from host controller data structures. 401 * from host controller data structures.
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c231b4bef314..25cf7e9eccfa 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -611,11 +611,10 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
611 611
612 if (add_hotplug_env_var(envp, num_envp, &i, 612 if (add_hotplug_env_var(envp, num_envp, &i,
613 buffer, buffer_size, &length, 613 buffer, buffer_size, &length,
614 "MODALIAS=usb:v%04Xp%04Xdl%04Xdh%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", 614 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
615 le16_to_cpu(usb_dev->descriptor.idVendor), 615 le16_to_cpu(usb_dev->descriptor.idVendor),
616 le16_to_cpu(usb_dev->descriptor.idProduct), 616 le16_to_cpu(usb_dev->descriptor.idProduct),
617 le16_to_cpu(usb_dev->descriptor.bcdDevice), 617 le16_to_cpu(usb_dev->descriptor.bcdDevice),
618 le16_to_cpu(usb_dev->descriptor.bcdDevice),
619 usb_dev->descriptor.bDeviceClass, 618 usb_dev->descriptor.bDeviceClass,
620 usb_dev->descriptor.bDeviceSubClass, 619 usb_dev->descriptor.bDeviceSubClass,
621 usb_dev->descriptor.bDeviceProtocol, 620 usb_dev->descriptor.bDeviceProtocol,
@@ -626,11 +625,10 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
626 } else { 625 } else {
627 if (add_hotplug_env_var(envp, num_envp, &i, 626 if (add_hotplug_env_var(envp, num_envp, &i,
628 buffer, buffer_size, &length, 627 buffer, buffer_size, &length,
629 "MODALIAS=usb:v%04Xp%04Xdl%04Xdh%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*", 628 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*",
630 le16_to_cpu(usb_dev->descriptor.idVendor), 629 le16_to_cpu(usb_dev->descriptor.idVendor),
631 le16_to_cpu(usb_dev->descriptor.idProduct), 630 le16_to_cpu(usb_dev->descriptor.idProduct),
632 le16_to_cpu(usb_dev->descriptor.bcdDevice), 631 le16_to_cpu(usb_dev->descriptor.bcdDevice),
633 le16_to_cpu(usb_dev->descriptor.bcdDevice),
634 usb_dev->descriptor.bDeviceClass, 632 usb_dev->descriptor.bDeviceClass,
635 usb_dev->descriptor.bDeviceSubClass, 633 usb_dev->descriptor.bDeviceSubClass,
636 usb_dev->descriptor.bDeviceProtocol)) 634 usb_dev->descriptor.bDeviceProtocol))
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 3993156c2e82..3f783cbdc7c3 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -569,7 +569,7 @@ static const struct usb_cdc_ether_desc ether_desc = {
569 569
570/* include the status endpoint if we can, even where it's optional. 570/* include the status endpoint if we can, even where it's optional.
571 * use wMaxPacketSize big enough to fit CDC_NOTIFY_SPEED_CHANGE in one 571 * use wMaxPacketSize big enough to fit CDC_NOTIFY_SPEED_CHANGE in one
572 * packet, to simplify cancelation; and a big transfer interval, to 572 * packet, to simplify cancellation; and a big transfer interval, to
573 * waste less bandwidth. 573 * waste less bandwidth.
574 * 574 *
575 * some drivers (like Linux 2.4 cdc-ether!) "need" it to exist even 575 * some drivers (like Linux 2.4 cdc-ether!) "need" it to exist even
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 2cff67ccce45..1e5e6ddef787 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -275,7 +275,7 @@ static const char *CHIP;
275 * 275 *
276 * After opening, configure non-control endpoints. Then use normal 276 * After opening, configure non-control endpoints. Then use normal
277 * stream read() and write() requests; and maybe ioctl() to get more 277 * stream read() and write() requests; and maybe ioctl() to get more
278 * precise FIFO status when recovering from cancelation. 278 * precise FIFO status when recovering from cancellation.
279 */ 279 */
280 280
281static void epio_complete (struct usb_ep *ep, struct usb_request *req) 281static void epio_complete (struct usb_ep *ep, struct usb_request *req)
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 0def9f70e889..df75ab65a5ec 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -705,7 +705,7 @@ void nuke(struct lh7a40x_ep *ep, int status)
705 done(ep, req, status); 705 done(ep, req, status);
706 } 706 }
707 707
708 /* Disable IRQ if EP is enabled (has decriptor) */ 708 /* Disable IRQ if EP is enabled (has descriptor) */
709 if (ep->desc) 709 if (ep->desc)
710 pio_irq_disable(ep_index(ep)); 710 pio_irq_disable(ep_index(ep));
711} 711}
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index f1762ed6db63..4d591c764e38 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -240,7 +240,7 @@ struct gs_dev {
240 struct usb_ep *dev_notify_ep; /* address of notify endpoint */ 240 struct usb_ep *dev_notify_ep; /* address of notify endpoint */
241 struct usb_ep *dev_in_ep; /* address of in endpoint */ 241 struct usb_ep *dev_in_ep; /* address of in endpoint */
242 struct usb_ep *dev_out_ep; /* address of out endpoint */ 242 struct usb_ep *dev_out_ep; /* address of out endpoint */
243 struct usb_endpoint_descriptor /* desciptor of notify ep */ 243 struct usb_endpoint_descriptor /* descriptor of notify ep */
244 *dev_notify_ep_desc; 244 *dev_notify_ep_desc;
245 struct usb_endpoint_descriptor /* descriptor of in endpoint */ 245 struct usb_endpoint_descriptor /* descriptor of in endpoint */
246 *dev_in_ep_desc; 246 *dev_in_ep_desc;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 84d2b93aca37..bc69bd7acebe 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -346,6 +346,22 @@ ehci_reboot (struct notifier_block *self, unsigned long code, void *null)
346 return 0; 346 return 0;
347} 347}
348 348
349static void ehci_port_power (struct ehci_hcd *ehci, int is_on)
350{
351 unsigned port;
352
353 if (!HCS_PPC (ehci->hcs_params))
354 return;
355
356 ehci_dbg (ehci, "...power%s ports...\n", is_on ? "up" : "down");
357 for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; )
358 (void) ehci_hub_control(ehci_to_hcd(ehci),
359 is_on ? SetPortFeature : ClearPortFeature,
360 USB_PORT_FEAT_POWER,
361 port--, NULL, 0);
362 msleep(20);
363}
364
349 365
350/* called by khubd or root hub init threads */ 366/* called by khubd or root hub init threads */
351 367
@@ -362,8 +378,10 @@ static int ehci_hc_reset (struct usb_hcd *hcd)
362 dbg_hcs_params (ehci, "reset"); 378 dbg_hcs_params (ehci, "reset");
363 dbg_hcc_params (ehci, "reset"); 379 dbg_hcc_params (ehci, "reset");
364 380
381 /* cache this readonly data; minimize chip reads */
382 ehci->hcs_params = readl (&ehci->caps->hcs_params);
383
365#ifdef CONFIG_PCI 384#ifdef CONFIG_PCI
366 /* EHCI 0.96 and later may have "extended capabilities" */
367 if (hcd->self.controller->bus == &pci_bus_type) { 385 if (hcd->self.controller->bus == &pci_bus_type) {
368 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 386 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
369 387
@@ -383,9 +401,30 @@ static int ehci_hc_reset (struct usb_hcd *hcd)
383 break; 401 break;
384 } 402 }
385 403
404 /* optional debug port, normally in the first BAR */
405 temp = pci_find_capability (pdev, 0x0a);
406 if (temp) {
407 pci_read_config_dword(pdev, temp, &temp);
408 temp >>= 16;
409 if ((temp & (3 << 13)) == (1 << 13)) {
410 temp &= 0x1fff;
411 ehci->debug = hcd->regs + temp;
412 temp = readl (&ehci->debug->control);
413 ehci_info (ehci, "debug port %d%s\n",
414 HCS_DEBUG_PORT(ehci->hcs_params),
415 (temp & DBGP_ENABLED)
416 ? " IN USE"
417 : "");
418 if (!(temp & DBGP_ENABLED))
419 ehci->debug = NULL;
420 }
421 }
422
386 temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); 423 temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params));
387 } else 424 } else
388 temp = 0; 425 temp = 0;
426
427 /* EHCI 0.96 and later may have "extended capabilities" */
389 while (temp && count--) { 428 while (temp && count--) {
390 u32 cap; 429 u32 cap;
391 430
@@ -414,8 +453,7 @@ static int ehci_hc_reset (struct usb_hcd *hcd)
414 ehci_reset (ehci); 453 ehci_reset (ehci);
415#endif 454#endif
416 455
417 /* cache this readonly data; minimize PCI reads */ 456 ehci_port_power (ehci, 0);
418 ehci->hcs_params = readl (&ehci->caps->hcs_params);
419 457
420 /* at least the Genesys GL880S needs fixup here */ 458 /* at least the Genesys GL880S needs fixup here */
421 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); 459 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
@@ -657,16 +695,11 @@ done2:
657static void ehci_stop (struct usb_hcd *hcd) 695static void ehci_stop (struct usb_hcd *hcd)
658{ 696{
659 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 697 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
660 u8 rh_ports, port;
661 698
662 ehci_dbg (ehci, "stop\n"); 699 ehci_dbg (ehci, "stop\n");
663 700
664 /* Turn off port power on all root hub ports. */ 701 /* Turn off port power on all root hub ports. */
665 rh_ports = HCS_N_PORTS (ehci->hcs_params); 702 ehci_port_power (ehci, 0);
666 for (port = 1; port <= rh_ports; port++)
667 (void) ehci_hub_control(hcd,
668 ClearPortFeature, USB_PORT_FEAT_POWER,
669 port, NULL, 0);
670 703
671 /* no more interrupts ... */ 704 /* no more interrupts ... */
672 del_timer_sync (&ehci->watchdog); 705 del_timer_sync (&ehci->watchdog);
@@ -748,7 +781,6 @@ static int ehci_resume (struct usb_hcd *hcd)
748 unsigned port; 781 unsigned port;
749 struct usb_device *root = hcd->self.root_hub; 782 struct usb_device *root = hcd->self.root_hub;
750 int retval = -EINVAL; 783 int retval = -EINVAL;
751 int powerup = 0;
752 784
753 // maybe restore (PCI) FLADJ 785 // maybe restore (PCI) FLADJ
754 786
@@ -766,8 +798,6 @@ static int ehci_resume (struct usb_hcd *hcd)
766 up (&hcd->self.root_hub->serialize); 798 up (&hcd->self.root_hub->serialize);
767 break; 799 break;
768 } 800 }
769 if ((status & PORT_POWER) == 0)
770 powerup = 1;
771 if (!root->children [port]) 801 if (!root->children [port])
772 continue; 802 continue;
773 dbg_port (ehci, __FUNCTION__, port + 1, status); 803 dbg_port (ehci, __FUNCTION__, port + 1, status);
@@ -794,16 +824,9 @@ static int ehci_resume (struct usb_hcd *hcd)
794 retval = ehci_start (hcd); 824 retval = ehci_start (hcd);
795 825
796 /* here we "know" root ports should always stay powered; 826 /* here we "know" root ports should always stay powered;
797 * but some controllers may lost all power. 827 * but some controllers may lose all power.
798 */ 828 */
799 if (powerup) { 829 ehci_port_power (ehci, 1);
800 ehci_dbg (ehci, "...powerup ports...\n");
801 for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; )
802 (void) ehci_hub_control(hcd,
803 SetPortFeature, USB_PORT_FEAT_POWER,
804 port--, NULL, 0);
805 msleep(20);
806 }
807 } 830 }
808 831
809 return retval; 832 return retval;
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 2373537fabed..02fefab3501e 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -281,6 +281,8 @@ ehci_hub_descriptor (
281 temp = 0x0008; /* per-port overcurrent reporting */ 281 temp = 0x0008; /* per-port overcurrent reporting */
282 if (HCS_PPC (ehci->hcs_params)) 282 if (HCS_PPC (ehci->hcs_params))
283 temp |= 0x0001; /* per-port power control */ 283 temp |= 0x0001; /* per-port power control */
284 else
285 temp |= 0x0002; /* no power switching */
284#if 0 286#if 0
285// re-enable when we support USB_PORT_FEAT_INDICATOR below. 287// re-enable when we support USB_PORT_FEAT_INDICATOR below.
286 if (HCS_INDICATOR (ehci->hcs_params)) 288 if (HCS_INDICATOR (ehci->hcs_params))
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index e763a8399a75..4df498231752 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -47,6 +47,12 @@ struct ehci_stats {
47#define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */ 47#define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */
48 48
49struct ehci_hcd { /* one per controller */ 49struct ehci_hcd { /* one per controller */
50 /* glue to PCI and HCD framework */
51 struct ehci_caps __iomem *caps;
52 struct ehci_regs __iomem *regs;
53 struct ehci_dbg_port __iomem *debug;
54
55 __u32 hcs_params; /* cached register copy */
50 spinlock_t lock; 56 spinlock_t lock;
51 57
52 /* async schedule support */ 58 /* async schedule support */
@@ -84,11 +90,6 @@ struct ehci_hcd { /* one per controller */
84 90
85 unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */ 91 unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */
86 92
87 /* glue to PCI and HCD framework */
88 struct ehci_caps __iomem *caps;
89 struct ehci_regs __iomem *regs;
90 __u32 hcs_params; /* cached register copy */
91
92 /* irq statistics */ 93 /* irq statistics */
93#ifdef EHCI_STATS 94#ifdef EHCI_STATS
94 struct ehci_stats stats; 95 struct ehci_stats stats;
@@ -165,7 +166,7 @@ struct ehci_caps {
165 /* these fields are specified as 8 and 16 bit registers, 166 /* these fields are specified as 8 and 16 bit registers,
166 * but some hosts can't perform 8 or 16 bit PCI accesses. 167 * but some hosts can't perform 8 or 16 bit PCI accesses.
167 */ 168 */
168 u32 hc_capbase; 169 u32 hc_capbase;
169#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */ 170#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */
170#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */ 171#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */
171 u32 hcs_params; /* HCSPARAMS - offset 0x4 */ 172 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
@@ -273,7 +274,7 @@ struct ehci_dbg_port {
273#define DBGP_ENABLED (1<<28) 274#define DBGP_ENABLED (1<<28)
274#define DBGP_DONE (1<<16) 275#define DBGP_DONE (1<<16)
275#define DBGP_INUSE (1<<10) 276#define DBGP_INUSE (1<<10)
276#define DBGP_ERRCODE(x) (((x)>>7)&0x0f) 277#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
277# define DBGP_ERR_BAD 1 278# define DBGP_ERR_BAD 1
278# define DBGP_ERR_SIGNAL 2 279# define DBGP_ERR_SIGNAL 2
279#define DBGP_ERROR (1<<6) 280#define DBGP_ERROR (1<<6)
@@ -282,11 +283,11 @@ struct ehci_dbg_port {
282#define DBGP_LEN(x) (((x)>>0)&0x0f) 283#define DBGP_LEN(x) (((x)>>0)&0x0f)
283 u32 pids; 284 u32 pids;
284#define DBGP_PID_GET(x) (((x)>>16)&0xff) 285#define DBGP_PID_GET(x) (((x)>>16)&0xff)
285#define DBGP_PID_SET(data,tok) (((data)<<8)|(tok)); 286#define DBGP_PID_SET(data,tok) (((data)<<8)|(tok))
286 u32 data03; 287 u32 data03;
287 u32 data47; 288 u32 data47;
288 u32 address; 289 u32 address;
289#define DBGP_EPADDR(dev,ep) (((dev)<<8)|(ep)); 290#define DBGP_EPADDR(dev,ep) (((dev)<<8)|(ep))
290} __attribute__ ((packed)); 291} __attribute__ ((packed));
291 292
292/*-------------------------------------------------------------------------*/ 293/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c
index 376f8a034f65..d9883d774d3a 100644
--- a/drivers/usb/host/hc_crisv10.c
+++ b/drivers/usb/host/hc_crisv10.c
@@ -4329,7 +4329,7 @@ static int __init etrax_usb_hc_init(void)
4329 bus->bus_name="ETRAX 100LX"; 4329 bus->bus_name="ETRAX 100LX";
4330 bus->hcpriv = hc; 4330 bus->hcpriv = hc;
4331 4331
4332 /* Initalize RH to the default address. 4332 /* Initialize RH to the default address.
4333 And make sure that we have no status change indication */ 4333 And make sure that we have no status change indication */
4334 hc->rh.numports = 2; /* The RH has two ports */ 4334 hc->rh.numports = 2; /* The RH has two ports */
4335 hc->rh.devnum = 1; 4335 hc->rh.devnum = 1;
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index d309e292198e..a374b7692073 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -134,7 +134,7 @@ static void port_power(struct sl811 *sl811, int is_on)
134 134
135/* This is a PIO-only HCD. Queueing appends URBs to the endpoint's queue, 135/* This is a PIO-only HCD. Queueing appends URBs to the endpoint's queue,
136 * and may start I/O. Endpoint queues are scanned during completion irq 136 * and may start I/O. Endpoint queues are scanned during completion irq
137 * handlers (one per packet: ACK, NAK, faults, etc) and urb cancelation. 137 * handlers (one per packet: ACK, NAK, faults, etc) and urb cancellation.
138 * 138 *
139 * Using an external DMA engine to copy a packet at a time could work, 139 * Using an external DMA engine to copy a packet at a time could work,
140 * though setup/teardown costs may be too big to make it worthwhile. 140 * though setup/teardown costs may be too big to make it worthwhile.
@@ -738,7 +738,7 @@ retry:
738 } 738 }
739#endif 739#endif
740 740
741 /* port status seems wierd until after reset, so 741 /* port status seems weird until after reset, so
742 * force the reset and make khubd clean up later. 742 * force the reset and make khubd clean up later.
743 */ 743 */
744 sl811->port1 |= (1 << USB_PORT_FEAT_C_CONNECTION) 744 sl811->port1 |= (1 << USB_PORT_FEAT_C_CONNECTION)
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index 5791723e6083..a330a4b50e16 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -23,7 +23,7 @@
23 * 23 *
24 * 24 *
25 * The driver brings the USB functions of the MDC800 to Linux. 25 * The driver brings the USB functions of the MDC800 to Linux.
26 * To use the Camera you must support the USB Protocoll of the camera 26 * To use the Camera you must support the USB Protocol of the camera
27 * to the Kernel Node. 27 * to the Kernel Node.
28 * The Driver uses a misc device Node. Create it with : 28 * The Driver uses a misc device Node. Create it with :
29 * mknod /dev/mustek c 180 32 29 * mknod /dev/mustek c 180 32
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index cab89a970c7f..7d21a4f5c425 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -335,7 +335,7 @@ static int mts_scsi_abort (Scsi_Cmnd *srb)
335 335
336 mts_urb_abort(desc); 336 mts_urb_abort(desc);
337 337
338 return FAILURE; 338 return FAILED;
339} 339}
340 340
341static int mts_scsi_host_reset (Scsi_Cmnd *srb) 341static int mts_scsi_host_reset (Scsi_Cmnd *srb)
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 2d76be62f4e0..94ce2a9ad50f 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -386,7 +386,7 @@ static int aiptek_convert_from_2s_complement(unsigned char c)
386 * convention above.) I therefore have taken over REL_MISC and ABS_MISC 386 * convention above.) I therefore have taken over REL_MISC and ABS_MISC
387 * (for relative and absolute reports, respectively) for communicating 387 * (for relative and absolute reports, respectively) for communicating
388 * Proximity. Why two events? I thought it interesting to know if the 388 * Proximity. Why two events? I thought it interesting to know if the
389 * Proximity event occured while the tablet was in absolute or relative 389 * Proximity event occurred while the tablet was in absolute or relative
390 * mode. 390 * mode.
391 * 391 *
392 * Other tablets use the notion of a certain minimum stylus pressure 392 * Other tablets use the notion of a certain minimum stylus pressure
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 355add5c29f5..860df26323b1 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -619,7 +619,7 @@ static void ati_remote_delete(struct ati_remote *ati_remote)
619 619
620 if (ati_remote->outbuf) 620 if (ati_remote->outbuf)
621 usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, 621 usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
622 ati_remote->inbuf, ati_remote->outbuf_dma); 622 ati_remote->outbuf, ati_remote->outbuf_dma);
623 623
624 if (ati_remote->irq_urb) 624 if (ati_remote->irq_urb)
625 usb_free_urb(ati_remote->irq_urb); 625 usb_free_urb(ati_remote->irq_urb);
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
index 6b45a66d58c1..ab1a2a30ce7c 100644
--- a/drivers/usb/input/mtouchusb.c
+++ b/drivers/usb/input/mtouchusb.c
@@ -32,7 +32,7 @@
32 * Changed reset from standard USB dev reset to vendor reset 32 * Changed reset from standard USB dev reset to vendor reset
33 * Changed data sent to host from compensated to raw coordinates 33 * Changed data sent to host from compensated to raw coordinates
34 * Eliminated vendor/product module params 34 * Eliminated vendor/product module params
35 * Performed multiple successfull tests with an EXII-5010UC 35 * Performed multiple successful tests with an EXII-5010UC
36 * 36 *
37 * 1.5 02/27/2005 ddstreet@ieee.org 37 * 1.5 02/27/2005 ddstreet@ieee.org
38 * Added module parameter to select raw or hw-calibrated coordinate reporting 38 * Added module parameter to select raw or hw-calibrated coordinate reporting
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
index 01514b0551b8..7038fb9d1ced 100644
--- a/drivers/usb/input/usbkbd.c
+++ b/drivers/usb/input/usbkbd.c
@@ -133,7 +133,8 @@ resubmit:
133 kbd->usbdev->devpath, i); 133 kbd->usbdev->devpath, i);
134} 134}
135 135
136int usb_kbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 136static int usb_kbd_event(struct input_dev *dev, unsigned int type,
137 unsigned int code, int value)
137{ 138{
138 struct usb_kbd *kbd = dev->private; 139 struct usb_kbd *kbd = dev->private;
139 140
diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c
index d6051822416e..036c485d1d1e 100644
--- a/drivers/usb/media/ov511.c
+++ b/drivers/usb/media/ov511.c
@@ -5041,7 +5041,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
5041 { OV511_I2C_BUS, 0x2a, 0x04 }, /* Disable framerate adjust */ 5041 { OV511_I2C_BUS, 0x2a, 0x04 }, /* Disable framerate adjust */
5042// { OV511_I2C_BUS, 0x2b, 0xac }, /* Framerate; Set 2a[7] first */ 5042// { OV511_I2C_BUS, 0x2b, 0xac }, /* Framerate; Set 2a[7] first */
5043 { OV511_I2C_BUS, 0x2d, 0x99 }, 5043 { OV511_I2C_BUS, 0x2d, 0x99 },
5044 { OV511_I2C_BUS, 0x33, 0xa0 }, /* Color Procesing Parameter */ 5044 { OV511_I2C_BUS, 0x33, 0xa0 }, /* Color Processing Parameter */
5045 { OV511_I2C_BUS, 0x34, 0xd2 }, /* Max A/D range */ 5045 { OV511_I2C_BUS, 0x34, 0xd2 }, /* Max A/D range */
5046 { OV511_I2C_BUS, 0x38, 0x8b }, 5046 { OV511_I2C_BUS, 0x38, 0x8b },
5047 { OV511_I2C_BUS, 0x39, 0x40 }, 5047 { OV511_I2C_BUS, 0x39, 0x40 },
diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/usb/media/pwc/pwc-ctrl.c
index 26aa914bc541..42ec468d52d6 100644
--- a/drivers/usb/media/pwc/pwc-ctrl.c
+++ b/drivers/usb/media/pwc/pwc-ctrl.c
@@ -418,6 +418,44 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr
418 418
419 419
420 420
421static void pwc_set_image_buffer_size(struct pwc_device *pdev)
422{
423 int i, factor = 0, filler = 0;
424
425 /* for PALETTE_YUV420P */
426 switch(pdev->vpalette)
427 {
428 case VIDEO_PALETTE_YUV420P:
429 factor = 6;
430 filler = 128;
431 break;
432 case VIDEO_PALETTE_RAW:
433 factor = 6; /* can be uncompressed YUV420P */
434 filler = 0;
435 break;
436 }
437
438 /* Set sizes in bytes */
439 pdev->image.size = pdev->image.x * pdev->image.y * factor / 4;
440 pdev->view.size = pdev->view.x * pdev->view.y * factor / 4;
441
442 /* Align offset, or you'll get some very weird results in
443 YUV420 mode... x must be multiple of 4 (to get the Y's in
444 place), and y even (or you'll mixup U & V). This is less of a
445 problem for YUV420P.
446 */
447 pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC;
448 pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE;
449
450 /* Fill buffers with gray or black */
451 for (i = 0; i < MAX_IMAGES; i++) {
452 if (pdev->image_ptr[i] != NULL)
453 memset(pdev->image_ptr[i], filler, pdev->view.size);
454 }
455}
456
457
458
421/** 459/**
422 @pdev: device structure 460 @pdev: device structure
423 @width: viewport width 461 @width: viewport width
@@ -475,44 +513,6 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame
475} 513}
476 514
477 515
478void pwc_set_image_buffer_size(struct pwc_device *pdev)
479{
480 int i, factor = 0, filler = 0;
481
482 /* for PALETTE_YUV420P */
483 switch(pdev->vpalette)
484 {
485 case VIDEO_PALETTE_YUV420P:
486 factor = 6;
487 filler = 128;
488 break;
489 case VIDEO_PALETTE_RAW:
490 factor = 6; /* can be uncompressed YUV420P */
491 filler = 0;
492 break;
493 }
494
495 /* Set sizes in bytes */
496 pdev->image.size = pdev->image.x * pdev->image.y * factor / 4;
497 pdev->view.size = pdev->view.x * pdev->view.y * factor / 4;
498
499 /* Align offset, or you'll get some very weird results in
500 YUV420 mode... x must be multiple of 4 (to get the Y's in
501 place), and y even (or you'll mixup U & V). This is less of a
502 problem for YUV420P.
503 */
504 pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC;
505 pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE;
506
507 /* Fill buffers with gray or black */
508 for (i = 0; i < MAX_IMAGES; i++) {
509 if (pdev->image_ptr[i] != NULL)
510 memset(pdev->image_ptr[i], filler, pdev->view.size);
511 }
512}
513
514
515
516/* BRIGHTNESS */ 516/* BRIGHTNESS */
517 517
518int pwc_get_brightness(struct pwc_device *pdev) 518int pwc_get_brightness(struct pwc_device *pdev)
@@ -949,7 +949,7 @@ int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value)
949 return SendControlMsg(SET_STATUS_CTL, LED_FORMATTER, 2); 949 return SendControlMsg(SET_STATUS_CTL, LED_FORMATTER, 2);
950} 950}
951 951
952int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) 952static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value)
953{ 953{
954 unsigned char buf[2]; 954 unsigned char buf[2];
955 int ret; 955 int ret;
@@ -1100,7 +1100,7 @@ static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)
1100 unsigned char buf[4]; 1100 unsigned char buf[4];
1101 1101
1102 /* set new relative angle; angles are expressed in degrees * 100, 1102 /* set new relative angle; angles are expressed in degrees * 100,
1103 but cam as .5 degree resolution, hence devide by 200. Also 1103 but cam as .5 degree resolution, hence divide by 200. Also
1104 the angle must be multiplied by 64 before it's send to 1104 the angle must be multiplied by 64 before it's send to
1105 the cam (??) 1105 the cam (??)
1106 */ 1106 */
diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/usb/media/pwc/pwc-if.c
index 100a5a4f03a3..cca47f480a8b 100644
--- a/drivers/usb/media/pwc/pwc-if.c
+++ b/drivers/usb/media/pwc/pwc-if.c
@@ -129,7 +129,7 @@ static int default_mbufs = 2; /* Default number of mmap() buffers */
129 int pwc_trace = TRACE_MODULE | TRACE_FLOW | TRACE_PWCX; 129 int pwc_trace = TRACE_MODULE | TRACE_FLOW | TRACE_PWCX;
130static int power_save = 0; 130static int power_save = 0;
131static int led_on = 100, led_off = 0; /* defaults to LED that is on while in use */ 131static int led_on = 100, led_off = 0; /* defaults to LED that is on while in use */
132 int pwc_preferred_compression = 2; /* 0..3 = uncompressed..high */ 132static int pwc_preferred_compression = 2; /* 0..3 = uncompressed..high */
133static struct { 133static struct {
134 int type; 134 int type;
135 char serial_number[30]; 135 char serial_number[30];
@@ -272,7 +272,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
272 return -ENXIO; 272 return -ENXIO;
273 } 273 }
274#endif 274#endif
275 /* Allocate Isochronuous pipe buffers */ 275 /* Allocate Isochronous pipe buffers */
276 for (i = 0; i < MAX_ISO_BUFS; i++) { 276 for (i = 0; i < MAX_ISO_BUFS; i++) {
277 if (pdev->sbuf[i].data == NULL) { 277 if (pdev->sbuf[i].data == NULL) {
278 kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL); 278 kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL);
@@ -322,7 +322,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
322 case 730: 322 case 730:
323 case 740: 323 case 740:
324 case 750: 324 case 750:
325 Trace(TRACE_MEMORY,"private_data(%Zd)\n",sizeof(struct pwc_dec23_private)); 325 Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private));
326 kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ 326 kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */
327 break; 327 break;
328 case 645: 328 case 645:
@@ -850,7 +850,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
850 850
851 if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { 851 if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) {
852 Err("Failed to find packet size for video endpoint in current alternate setting.\n"); 852 Err("Failed to find packet size for video endpoint in current alternate setting.\n");
853 return -ENFILE; /* Odd error, that should be noticable */ 853 return -ENFILE; /* Odd error, that should be noticeable */
854 } 854 }
855 855
856 /* Set alternate interface */ 856 /* Set alternate interface */
@@ -1179,7 +1179,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf,
1179 DECLARE_WAITQUEUE(wait, current); 1179 DECLARE_WAITQUEUE(wait, current);
1180 int bytes_to_read; 1180 int bytes_to_read;
1181 1181
1182 Trace(TRACE_READ, "video_read(0x%p, %p, %Zd) called.\n", vdev, buf, count); 1182 Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count);
1183 if (vdev == NULL) 1183 if (vdev == NULL)
1184 return -EFAULT; 1184 return -EFAULT;
1185 pdev = vdev->priv; 1185 pdev = vdev->priv;
@@ -2128,7 +2128,7 @@ static int __init usb_pwc_init(void)
2128 if (leds[1] >= 0) 2128 if (leds[1] >= 0)
2129 led_off = leds[1]; 2129 led_off = leds[1];
2130 2130
2131 /* Big device node whoopla. Basicly, it allows you to assign a 2131 /* Big device node whoopla. Basically, it allows you to assign a
2132 device node (/dev/videoX) to a camera, based on its type 2132 device node (/dev/videoX) to a camera, based on its type
2133 & serial number. The format is [type[.serialnumber]:]node. 2133 & serial number. The format is [type[.serialnumber]:]node.
2134 2134
diff --git a/drivers/usb/media/pwc/pwc-ioctl.h b/drivers/usb/media/pwc/pwc-ioctl.h
index 65805eaa9a1c..5f9cb08bc02e 100644
--- a/drivers/usb/media/pwc/pwc-ioctl.h
+++ b/drivers/usb/media/pwc/pwc-ioctl.h
@@ -75,7 +75,7 @@
75#define PWC_FPS_SNAPSHOT 0x00400000 75#define PWC_FPS_SNAPSHOT 0x00400000
76 76
77 77
78/* structure for transfering x & y coordinates */ 78/* structure for transferring x & y coordinates */
79struct pwc_coord 79struct pwc_coord
80{ 80{
81 int x, y; /* guess what */ 81 int x, y; /* guess what */
diff --git a/drivers/usb/media/pwc/pwc.h b/drivers/usb/media/pwc/pwc.h
index 53b516d29cf5..267869dab185 100644
--- a/drivers/usb/media/pwc/pwc.h
+++ b/drivers/usb/media/pwc/pwc.h
@@ -226,9 +226,8 @@ struct pwc_device
226extern "C" { 226extern "C" {
227#endif 227#endif
228 228
229/* Global variables */ 229/* Global variable */
230extern int pwc_trace; 230extern int pwc_trace;
231extern int pwc_preferred_compression;
232 231
233/** functions in pwc-if.c */ 232/** functions in pwc-if.c */
234int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compression, int new_snapshot); 233int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compression, int new_snapshot);
@@ -243,8 +242,6 @@ void pwc_construct(struct pwc_device *pdev);
243/** Functions in pwc-ctrl.c */ 242/** Functions in pwc-ctrl.c */
244/* Request a certain video mode. Returns < 0 if not possible */ 243/* Request a certain video mode. Returns < 0 if not possible */
245extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot); 244extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot);
246/* Calculate the number of bytes per image (not frame) */
247extern void pwc_set_image_buffer_size(struct pwc_device *pdev);
248 245
249/* Various controls; should be obvious. Value 0..65535, or < 0 on error */ 246/* Various controls; should be obvious. Value 0..65535, or < 0 on error */
250extern int pwc_get_brightness(struct pwc_device *pdev); 247extern int pwc_get_brightness(struct pwc_device *pdev);
@@ -256,7 +253,6 @@ extern int pwc_set_gamma(struct pwc_device *pdev, int value);
256extern int pwc_get_saturation(struct pwc_device *pdev); 253extern int pwc_get_saturation(struct pwc_device *pdev);
257extern int pwc_set_saturation(struct pwc_device *pdev, int value); 254extern int pwc_set_saturation(struct pwc_device *pdev, int value);
258extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value); 255extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value);
259extern int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value);
260extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor); 256extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor);
261 257
262/* Power down or up the camera; not supported by all models */ 258/* Power down or up the camera; not supported by all models */
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c
index 898401cf7dcc..31d57400d5be 100644
--- a/drivers/usb/media/sn9c102_core.c
+++ b/drivers/usb/media/sn9c102_core.c
@@ -429,7 +429,7 @@ sn9c102_i2c_try_read(struct sn9c102_device* cam,
429} 429}
430 430
431 431
432int 432static int
433sn9c102_i2c_try_write(struct sn9c102_device* cam, 433sn9c102_i2c_try_write(struct sn9c102_device* cam,
434 struct sn9c102_sensor* sensor, u8 address, u8 value) 434 struct sn9c102_sensor* sensor, u8 address, u8 value)
435{ 435{
@@ -785,7 +785,7 @@ static int sn9c102_stop_transfer(struct sn9c102_device* cam)
785} 785}
786 786
787 787
788int sn9c102_stream_interrupt(struct sn9c102_device* cam) 788static int sn9c102_stream_interrupt(struct sn9c102_device* cam)
789{ 789{
790 int err = 0; 790 int err = 0;
791 791
diff --git a/drivers/usb/media/sn9c102_sensor.h b/drivers/usb/media/sn9c102_sensor.h
index 16f7483559f0..6a7adebcb4bf 100644
--- a/drivers/usb/media/sn9c102_sensor.h
+++ b/drivers/usb/media/sn9c102_sensor.h
@@ -145,8 +145,6 @@ static const struct usb_device_id sn9c102_id_table[] = { \
145*/ 145*/
146 146
147/* The "try" I2C I/O versions are used when probing the sensor */ 147/* The "try" I2C I/O versions are used when probing the sensor */
148extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*,
149 u8 address, u8 value);
150extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, 148extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*,
151 u8 address); 149 u8 address);
152 150
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index dd4580cb57e0..7d06105763d4 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -859,7 +859,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
859 info ("udev is NULL."); 859 info ("udev is NULL.");
860 } 860 }
861 861
862 /* allocate memory for our device state and intialize it */ 862 /* allocate memory for our device state and initialize it */
863 863
864 dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL); 864 dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL);
865 865
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 57b82d53a940..2fd12264fd53 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -983,7 +983,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
983 msgcount++; 983 msgcount++;
984 if (msgcount < 500) 984 if (msgcount < 500)
985 printk(KERN_ERR 985 printk(KERN_ERR
986 "sisusbvga[%d]: Wrote %Zd of " 986 "sisusbvga[%d]: Wrote %zd of "
987 "%d bytes, error %d\n", 987 "%d bytes, error %d\n",
988 sisusb->minor, *bytes_written, 988 sisusb->minor, *bytes_written,
989 length, ret); 989 length, ret);
@@ -3105,6 +3105,7 @@ static void sisusb_disconnect(struct usb_interface *intf)
3105static struct usb_device_id sisusb_table [] = { 3105static struct usb_device_id sisusb_table [] = {
3106 { USB_DEVICE(0x0711, 0x0900) }, 3106 { USB_DEVICE(0x0711, 0x0900) },
3107 { USB_DEVICE(0x182d, 0x021c) }, 3107 { USB_DEVICE(0x182d, 0x021c) },
3108 { USB_DEVICE(0x182d, 0x0269) },
3108 { } 3109 { }
3109}; 3110};
3110 3111
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index a02be795d63e..d976790312aa 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -1388,11 +1388,11 @@ static int pegasus_resume (struct usb_interface *intf)
1388 if (netif_running(pegasus->net)) { 1388 if (netif_running(pegasus->net)) {
1389 pegasus->rx_urb->status = 0; 1389 pegasus->rx_urb->status = 0;
1390 pegasus->rx_urb->actual_length = 0; 1390 pegasus->rx_urb->actual_length = 0;
1391 read_bulk_callback(pegasus->rx_urb, 0); 1391 read_bulk_callback(pegasus->rx_urb, NULL);
1392 1392
1393 pegasus->intr_urb->status = 0; 1393 pegasus->intr_urb->status = 0;
1394 pegasus->intr_urb->actual_length = 0; 1394 pegasus->intr_urb->actual_length = 0;
1395 intr_callback(pegasus->intr_urb, 0); 1395 intr_callback(pegasus->intr_urb, NULL);
1396 1396
1397 queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, 1397 queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
1398 CARRIER_CHECK_DELAY); 1398 CARRIER_CHECK_DELAY);
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index bbaef047d532..f6bc6b3b333c 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * USB Networking Links 2 * USB Networking Links
3 * Copyright (C) 2000-2003 by David Brownell <dbrownell@users.sourceforge.net> 3 * Copyright (C) 2000-2005 by David Brownell <dbrownell@users.sourceforge.net>
4 * Copyright (C) 2002 Pavel Machek <pavel@ucw.cz> 4 * Copyright (C) 2002 Pavel Machek <pavel@ucw.cz>
5 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> 5 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
6 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net> 6 * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
@@ -210,6 +210,7 @@ struct usbnet {
210# define EVENT_RX_HALT 1 210# define EVENT_RX_HALT 1
211# define EVENT_RX_MEMORY 2 211# define EVENT_RX_MEMORY 2
212# define EVENT_STS_SPLIT 3 212# define EVENT_STS_SPLIT 3
213# define EVENT_LINK_RESET 4
213}; 214};
214 215
215// device-specific info used by the driver 216// device-specific info used by the driver
@@ -243,6 +244,9 @@ struct driver_info {
243 /* for status polling */ 244 /* for status polling */
244 void (*status)(struct usbnet *, struct urb *); 245 void (*status)(struct usbnet *, struct urb *);
245 246
247 /* link reset handling, called from defer_kevent */
248 int (*link_reset)(struct usbnet *);
249
246 /* fixup rx packet (strip framing) */ 250 /* fixup rx packet (strip framing) */
247 int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb); 251 int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb);
248 252
@@ -304,6 +308,7 @@ static void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
304static u32 usbnet_get_link (struct net_device *); 308static u32 usbnet_get_link (struct net_device *);
305static u32 usbnet_get_msglevel (struct net_device *); 309static u32 usbnet_get_msglevel (struct net_device *);
306static void usbnet_set_msglevel (struct net_device *, u32); 310static void usbnet_set_msglevel (struct net_device *, u32);
311static void defer_kevent (struct usbnet *, int);
307 312
308/* mostly for PDA style devices, which are always connected if present */ 313/* mostly for PDA style devices, which are always connected if present */
309static int always_connected (struct usbnet *dev) 314static int always_connected (struct usbnet *dev)
@@ -426,7 +431,7 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb)
426 dev->stats.rx_bytes += skb->len; 431 dev->stats.rx_bytes += skb->len;
427 432
428 if (netif_msg_rx_status (dev)) 433 if (netif_msg_rx_status (dev))
429 devdbg (dev, "< rx, len %zd, type 0x%x", 434 devdbg (dev, "< rx, len %zu, type 0x%x",
430 skb->len + sizeof (struct ethhdr), skb->protocol); 435 skb->len + sizeof (struct ethhdr), skb->protocol);
431 memset (skb->cb, 0, sizeof (struct skb_data)); 436 memset (skb->cb, 0, sizeof (struct skb_data));
432 status = netif_rx (skb); 437 status = netif_rx (skb);
@@ -501,6 +506,7 @@ static const struct driver_info an2720_info = {
501#define AX_CMD_WRITE_MULTI_FILTER 0x16 506#define AX_CMD_WRITE_MULTI_FILTER 0x16
502#define AX_CMD_READ_NODE_ID 0x17 507#define AX_CMD_READ_NODE_ID 0x17
503#define AX_CMD_READ_PHY_ID 0x19 508#define AX_CMD_READ_PHY_ID 0x19
509#define AX_CMD_READ_MEDIUM_STATUS 0x1a
504#define AX_CMD_WRITE_MEDIUM_MODE 0x1b 510#define AX_CMD_WRITE_MEDIUM_MODE 0x1b
505#define AX_CMD_READ_MONITOR_MODE 0x1c 511#define AX_CMD_READ_MONITOR_MODE 0x1c
506#define AX_CMD_WRITE_MONITOR_MODE 0x1d 512#define AX_CMD_WRITE_MONITOR_MODE 0x1d
@@ -515,11 +521,14 @@ static const struct driver_info an2720_info = {
515#define AX_MONITOR_MAGIC 0x04 521#define AX_MONITOR_MAGIC 0x04
516#define AX_MONITOR_HSFS 0x10 522#define AX_MONITOR_HSFS 0x10
517 523
524/* AX88172 Medium Status Register values */
525#define AX_MEDIUM_FULL_DUPLEX 0x02
526#define AX_MEDIUM_TX_ABORT_ALLOW 0x04
527#define AX_MEDIUM_FLOW_CONTROL_EN 0x10
528
518#define AX_MCAST_FILTER_SIZE 8 529#define AX_MCAST_FILTER_SIZE 8
519#define AX_MAX_MCAST 64 530#define AX_MAX_MCAST 64
520 531
521#define AX_INTERRUPT_BUFSIZE 8
522
523#define AX_EEPROM_LEN 0x40 532#define AX_EEPROM_LEN 0x40
524 533
525#define AX_SWRESET_CLEAR 0x00 534#define AX_SWRESET_CLEAR 0x00
@@ -535,15 +544,33 @@ static const struct driver_info an2720_info = {
535#define AX88772_IPG1_DEFAULT 0x0c 544#define AX88772_IPG1_DEFAULT 0x0c
536#define AX88772_IPG2_DEFAULT 0x12 545#define AX88772_IPG2_DEFAULT 0x12
537 546
547#define AX88772_MEDIUM_FULL_DUPLEX 0x0002
548#define AX88772_MEDIUM_RESERVED 0x0004
549#define AX88772_MEDIUM_RX_FC_ENABLE 0x0010
550#define AX88772_MEDIUM_TX_FC_ENABLE 0x0020
551#define AX88772_MEDIUM_PAUSE_FORMAT 0x0080
552#define AX88772_MEDIUM_RX_ENABLE 0x0100
553#define AX88772_MEDIUM_100MB 0x0200
554#define AX88772_MEDIUM_DEFAULT \
555 (AX88772_MEDIUM_FULL_DUPLEX | AX88772_MEDIUM_RX_FC_ENABLE | \
556 AX88772_MEDIUM_TX_FC_ENABLE | AX88772_MEDIUM_100MB | \
557 AX88772_MEDIUM_RESERVED | AX88772_MEDIUM_RX_ENABLE )
558
538#define AX_EEPROM_MAGIC 0xdeadbeef 559#define AX_EEPROM_MAGIC 0xdeadbeef
539 560
540/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ 561/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
541struct ax8817x_data { 562struct ax8817x_data {
542 u8 multi_filter[AX_MCAST_FILTER_SIZE]; 563 u8 multi_filter[AX_MCAST_FILTER_SIZE];
543 struct urb *int_urb;
544 u8 *int_buf;
545}; 564};
546 565
566struct ax88172_int_data {
567 u16 res1;
568 u8 link;
569 u16 res2;
570 u8 status;
571 u16 res3;
572} __attribute__ ((packed));
573
547static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 574static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
548 u16 size, void *data) 575 u16 size, void *data)
549{ 576{
@@ -586,25 +613,23 @@ static void ax8817x_async_cmd_callback(struct urb *urb, struct pt_regs *regs)
586 usb_free_urb(urb); 613 usb_free_urb(urb);
587} 614}
588 615
589static void ax8817x_interrupt_complete(struct urb *urb, struct pt_regs *regs) 616static void ax8817x_status(struct usbnet *dev, struct urb *urb)
590{ 617{
591 struct usbnet *dev = (struct usbnet *)urb->context; 618 struct ax88172_int_data *event;
592 struct ax8817x_data *data = (struct ax8817x_data *)&dev->data;
593 int link; 619 int link;
594 620
595 if (urb->status < 0) { 621 if (urb->actual_length < 8)
596 devdbg(dev,"ax8817x_interrupt_complete() failed with %d", 622 return;
597 urb->status); 623
598 } else { 624 event = urb->transfer_buffer;
599 link = data->int_buf[2] & 0x01; 625 link = event->link & 0x01;
600 if (netif_carrier_ok(dev->net) != link) { 626 if (netif_carrier_ok(dev->net) != link) {
601 if (link) 627 if (link) {
602 netif_carrier_on(dev->net); 628 netif_carrier_on(dev->net);
603 else 629 defer_kevent (dev, EVENT_LINK_RESET );
604 netif_carrier_off(dev->net); 630 } else
605 devdbg(dev, "ax8817x - Link Status is: %d", link); 631 netif_carrier_off(dev->net);
606 } 632 devdbg(dev, "ax8817x - Link Status is: %d", link);
607 usb_submit_urb(data->int_urb, GFP_ATOMIC);
608 } 633 }
609} 634}
610 635
@@ -711,6 +736,20 @@ static void ax8817x_mdio_write(struct net_device *netdev, int phy_id, int loc, i
711 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); 736 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf);
712} 737}
713 738
739static int ax88172_link_reset(struct usbnet *dev)
740{
741 u16 lpa;
742 u8 mode;
743
744 mode = AX_MEDIUM_TX_ABORT_ALLOW | AX_MEDIUM_FLOW_CONTROL_EN;
745 lpa = ax8817x_mdio_read(dev->net, dev->mii.phy_id, MII_LPA);
746 if (lpa & LPA_DUPLEX)
747 mode |= AX_MEDIUM_FULL_DUPLEX;
748 ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL);
749
750 return 0;
751}
752
714static void ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) 753static void ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
715{ 754{
716 struct usbnet *dev = netdev_priv(net); 755 struct usbnet *dev = netdev_priv(net);
@@ -824,35 +863,13 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
824 void *buf; 863 void *buf;
825 int i; 864 int i;
826 unsigned long gpio_bits = dev->driver_info->data; 865 unsigned long gpio_bits = dev->driver_info->data;
827 struct ax8817x_data *data = (struct ax8817x_data *)dev->data;
828 866
829 get_endpoints(dev,intf); 867 get_endpoints(dev,intf);
830 868
831 if ((data->int_urb = usb_alloc_urb (0, GFP_KERNEL)) == NULL) {
832 dbg ("%s: cannot allocate interrupt URB",
833 dev->net->name);
834 ret = -ENOMEM;
835 goto out1;
836 }
837
838 if ((data->int_buf = kmalloc(AX_INTERRUPT_BUFSIZE, GFP_KERNEL)) == NULL) {
839 dbg ("%s: cannot allocate memory for interrupt buffer",
840 dev->net->name);
841 ret = -ENOMEM;
842 goto out1;
843 }
844 memset(data->int_buf, 0, AX_INTERRUPT_BUFSIZE);
845
846 usb_fill_int_urb (data->int_urb, dev->udev,
847 usb_rcvintpipe (dev->udev, 1),
848 data->int_buf, AX_INTERRUPT_BUFSIZE,
849 ax8817x_interrupt_complete, dev,
850 dev->udev->speed == USB_SPEED_HIGH ? 8 : 100);
851
852 buf = kmalloc(ETH_ALEN, GFP_KERNEL); 869 buf = kmalloc(ETH_ALEN, GFP_KERNEL);
853 if(!buf) { 870 if(!buf) {
854 ret = -ENOMEM; 871 ret = -ENOMEM;
855 goto out2; 872 goto out1;
856 } 873 }
857 874
858 /* Toggle the GPIOs in a manufacturer/model specific way */ 875 /* Toggle the GPIOs in a manufacturer/model specific way */
@@ -860,32 +877,32 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
860 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, 877 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS,
861 (gpio_bits >> (i * 8)) & 0xff, 0, 0, 878 (gpio_bits >> (i * 8)) & 0xff, 0, 0,
862 buf)) < 0) 879 buf)) < 0)
863 goto out3; 880 goto out2;
864 msleep(5); 881 msleep(5);
865 } 882 }
866 883
867 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x80, 0, 0, buf)) < 0) { 884 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x80, 0, 0, buf)) < 0) {
868 dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret); 885 dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret);
869 goto out3; 886 goto out2;
870 } 887 }
871 888
872 /* Get the MAC address */ 889 /* Get the MAC address */
873 memset(buf, 0, ETH_ALEN); 890 memset(buf, 0, ETH_ALEN);
874 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, 6, buf)) < 0) { 891 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, 6, buf)) < 0) {
875 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 892 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
876 goto out3; 893 goto out2;
877 } 894 }
878 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 895 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
879 896
880 /* Get the PHY id */ 897 /* Get the PHY id */
881 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) { 898 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) {
882 dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret); 899 dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret);
883 goto out3; 900 goto out2;
884 } else if (ret < 2) { 901 } else if (ret < 2) {
885 /* this should always return 2 bytes */ 902 /* this should always return 2 bytes */
886 dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", ret); 903 dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", ret);
887 ret = -EIO; 904 ret = -EIO;
888 goto out3; 905 goto out2;
889 } 906 }
890 907
891 /* Initialize MII structure */ 908 /* Initialize MII structure */
@@ -899,36 +916,18 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
899 dev->net->set_multicast_list = ax8817x_set_multicast; 916 dev->net->set_multicast_list = ax8817x_set_multicast;
900 dev->net->ethtool_ops = &ax8817x_ethtool_ops; 917 dev->net->ethtool_ops = &ax8817x_ethtool_ops;
901 918
902 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, 919 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
903 cpu_to_le16(BMCR_RESET));
904 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, 920 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
905 cpu_to_le16(ADVERTISE_ALL | ADVERTISE_CSMA | 0x0400)); 921 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
906 mii_nway_restart(&dev->mii); 922 mii_nway_restart(&dev->mii);
907 923
908 if((ret = usb_submit_urb(data->int_urb, GFP_KERNEL)) < 0) {
909 dbg("Failed to submit interrupt URB: %02x", ret);
910 goto out2;
911 }
912
913 return 0; 924 return 0;
914out3:
915 kfree(buf);
916out2: 925out2:
917 kfree(data->int_buf); 926 kfree(buf);
918out1: 927out1:
919 usb_free_urb(data->int_urb);
920 return ret; 928 return ret;
921} 929}
922 930
923static void ax8817x_unbind(struct usbnet *dev, struct usb_interface *intf)
924{
925 struct ax8817x_data *data = (struct ax8817x_data *)dev->data;
926
927 usb_kill_urb(data->int_urb);
928 usb_free_urb(data->int_urb);
929 kfree(data->int_buf);
930}
931
932static struct ethtool_ops ax88772_ethtool_ops = { 931static struct ethtool_ops ax88772_ethtool_ops = {
933 .get_drvinfo = ax8817x_get_drvinfo, 932 .get_drvinfo = ax8817x_get_drvinfo,
934 .get_link = ethtool_op_get_link, 933 .get_link = ethtool_op_get_link,
@@ -946,64 +945,44 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
946{ 945{
947 int ret; 946 int ret;
948 void *buf; 947 void *buf;
949 struct ax8817x_data *data = (struct ax8817x_data *)dev->data;
950 948
951 get_endpoints(dev,intf); 949 get_endpoints(dev,intf);
952 950
953 if ((data->int_urb = usb_alloc_urb (0, GFP_KERNEL)) == 0) {
954 dbg ("Cannot allocate interrupt URB");
955 ret = -ENOMEM;
956 goto out1;
957 }
958
959 if ((data->int_buf = kmalloc(AX_INTERRUPT_BUFSIZE, GFP_KERNEL)) == NULL) {
960 dbg ("Cannot allocate memory for interrupt buffer");
961 ret = -ENOMEM;
962 goto out1;
963 }
964 memset(data->int_buf, 0, AX_INTERRUPT_BUFSIZE);
965
966 usb_fill_int_urb (data->int_urb, dev->udev,
967 usb_rcvintpipe (dev->udev, 1),
968 data->int_buf, AX_INTERRUPT_BUFSIZE,
969 ax8817x_interrupt_complete, dev,
970 dev->udev->speed == USB_SPEED_HIGH ? 8 : 100);
971
972 buf = kmalloc(6, GFP_KERNEL); 951 buf = kmalloc(6, GFP_KERNEL);
973 if(!buf) { 952 if(!buf) {
974 dbg ("Cannot allocate memory for buffer"); 953 dbg ("Cannot allocate memory for buffer");
975 ret = -ENOMEM; 954 ret = -ENOMEM;
976 goto out2; 955 goto out1;
977 } 956 }
978 957
979 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, 958 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS,
980 0x00B0, 0, 0, buf)) < 0) 959 0x00B0, 0, 0, buf)) < 0)
981 goto out3; 960 goto out2;
982 961
983 msleep(5); 962 msleep(5);
984 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0x0001, 0, 0, buf)) < 0) { 963 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0x0001, 0, 0, buf)) < 0) {
985 dbg("Select PHY #1 failed: %d", ret); 964 dbg("Select PHY #1 failed: %d", ret);
986 goto out3; 965 goto out2;
987 } 966 }
988 967
989 if ((ret = 968 if ((ret =
990 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPPD, 0, 0, buf)) < 0) { 969 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPPD, 0, 0, buf)) < 0) {
991 dbg("Failed to power down internal PHY: %d", ret); 970 dbg("Failed to power down internal PHY: %d", ret);
992 goto out3; 971 goto out2;
993 } 972 }
994 973
995 msleep(150); 974 msleep(150);
996 if ((ret = 975 if ((ret =
997 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, 0, 0, buf)) < 0) { 976 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, 0, 0, buf)) < 0) {
998 dbg("Failed to perform software reset: %d", ret); 977 dbg("Failed to perform software reset: %d", ret);
999 goto out3; 978 goto out2;
1000 } 979 }
1001 980
1002 msleep(150); 981 msleep(150);
1003 if ((ret = 982 if ((ret =
1004 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | AX_SWRESET_PRL, 0, 0, buf)) < 0) { 983 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | AX_SWRESET_PRL, 0, 0, buf)) < 0) {
1005 dbg("Failed to set Internal/External PHY reset control: %d", ret); 984 dbg("Failed to set Internal/External PHY reset control: %d", ret);
1006 goto out3; 985 goto out2;
1007 } 986 }
1008 987
1009 msleep(150); 988 msleep(150);
@@ -1011,27 +990,27 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1011 ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0000, 0, 0, 990 ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0000, 0, 0,
1012 buf)) < 0) { 991 buf)) < 0) {
1013 dbg("Failed to reset RX_CTL: %d", ret); 992 dbg("Failed to reset RX_CTL: %d", ret);
1014 goto out3; 993 goto out2;
1015 } 994 }
1016 995
1017 /* Get the MAC address */ 996 /* Get the MAC address */
1018 memset(buf, 0, ETH_ALEN); 997 memset(buf, 0, ETH_ALEN);
1019 if ((ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf)) < 0) { 998 if ((ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf)) < 0) {
1020 dbg("Failed to read MAC address: %d", ret); 999 dbg("Failed to read MAC address: %d", ret);
1021 goto out3; 1000 goto out2;
1022 } 1001 }
1023 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 1002 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
1024 1003
1025 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, buf)) < 0) { 1004 if ((ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, buf)) < 0) {
1026 dbg("Enabling software MII failed: %d", ret); 1005 dbg("Enabling software MII failed: %d", ret);
1027 goto out3; 1006 goto out2;
1028 } 1007 }
1029 1008
1030 if (((ret = 1009 if (((ret =
1031 ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, 0x0010, 2, 2, buf)) < 0) 1010 ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, 0x0010, 2, 2, buf)) < 0)
1032 || (*((u16 *)buf) != 0x003b)) { 1011 || (*((u16 *)buf) != 0x003b)) {
1033 dbg("Read PHY register 2 must be 0x3b00: %d", ret); 1012 dbg("Read PHY register 2 must be 0x3b00: %d", ret);
1034 goto out3; 1013 goto out2;
1035 } 1014 }
1036 1015
1037 /* Initialize MII structure */ 1016 /* Initialize MII structure */
@@ -1044,26 +1023,26 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1044 /* Get the PHY id */ 1023 /* Get the PHY id */
1045 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) { 1024 if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) {
1046 dbg("Error reading PHY ID: %02x", ret); 1025 dbg("Error reading PHY ID: %02x", ret);
1047 goto out3; 1026 goto out2;
1048 } else if (ret < 2) { 1027 } else if (ret < 2) {
1049 /* this should always return 2 bytes */ 1028 /* this should always return 2 bytes */
1050 dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", 1029 dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x",
1051 ret); 1030 ret);
1052 ret = -EIO; 1031 ret = -EIO;
1053 goto out3; 1032 goto out2;
1054 } 1033 }
1055 dev->mii.phy_id = *((u8 *)buf + 1); 1034 dev->mii.phy_id = *((u8 *)buf + 1);
1056 1035
1057 if ((ret = 1036 if ((ret =
1058 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_PRL, 0, 0, buf)) < 0) { 1037 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_PRL, 0, 0, buf)) < 0) {
1059 dbg("Set external PHY reset pin level: %d", ret); 1038 dbg("Set external PHY reset pin level: %d", ret);
1060 goto out3; 1039 goto out2;
1061 } 1040 }
1062 msleep(150); 1041 msleep(150);
1063 if ((ret = 1042 if ((ret =
1064 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | AX_SWRESET_PRL, 0, 0, buf)) < 0) { 1043 ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | AX_SWRESET_PRL, 0, 0, buf)) < 0) {
1065 dbg("Set Internal/External PHY reset control: %d", ret); 1044 dbg("Set Internal/External PHY reset control: %d", ret);
1066 goto out3; 1045 goto out2;
1067 } 1046 }
1068 msleep(150); 1047 msleep(150);
1069 1048
@@ -1071,25 +1050,24 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1071 dev->net->set_multicast_list = ax8817x_set_multicast; 1050 dev->net->set_multicast_list = ax8817x_set_multicast;
1072 dev->net->ethtool_ops = &ax88772_ethtool_ops; 1051 dev->net->ethtool_ops = &ax88772_ethtool_ops;
1073 1052
1074 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, 1053 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
1075 cpu_to_le16(BMCR_RESET));
1076 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, 1054 ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
1077 cpu_to_le16(ADVERTISE_ALL | ADVERTISE_CSMA)); 1055 ADVERTISE_ALL | ADVERTISE_CSMA);
1078 mii_nway_restart(&dev->mii); 1056 mii_nway_restart(&dev->mii);
1079 1057
1080 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, 0x0336, 0, 0, buf)) < 0) { 1058 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, AX88772_MEDIUM_DEFAULT, 0, 0, buf)) < 0) {
1081 dbg("Write medium mode register: %d", ret); 1059 dbg("Write medium mode register: %d", ret);
1082 goto out3; 1060 goto out2;
1083 } 1061 }
1084 1062
1085 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,AX88772_IPG2_DEFAULT, 0, buf)) < 0) { 1063 if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,AX88772_IPG2_DEFAULT, 0, buf)) < 0) {
1086 dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 1064 dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
1087 goto out3; 1065 goto out2;
1088 } 1066 }
1089 if ((ret = 1067 if ((ret =
1090 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf)) < 0) { 1068 ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf)) < 0) {
1091 dbg("Failed to set hardware MII: %02x", ret); 1069 dbg("Failed to set hardware MII: %02x", ret);
1092 goto out3; 1070 goto out2;
1093 } 1071 }
1094 1072
1095 /* Set RX_CTL to default values with 2k buffer, and enable cactus */ 1073 /* Set RX_CTL to default values with 2k buffer, and enable cactus */
@@ -1097,25 +1075,16 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1097 ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0088, 0, 0, 1075 ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0088, 0, 0,
1098 buf)) < 0) { 1076 buf)) < 0) {
1099 dbg("Reset RX_CTL failed: %d", ret); 1077 dbg("Reset RX_CTL failed: %d", ret);
1100 goto out3; 1078 goto out2;
1101 }
1102
1103 if((ret = usb_submit_urb(data->int_urb, GFP_KERNEL)) < 0) {
1104 dbg("Failed to submit interrupt URB: %02x", ret);
1105 goto out3;
1106 } 1079 }
1107 1080
1108 kfree(buf); 1081 kfree(buf);
1109 1082
1110 return 0; 1083 return 0;
1111 1084
1112out3:
1113 kfree(buf);
1114out2: 1085out2:
1115 kfree(data->int_buf); 1086 kfree(buf);
1116out1: 1087out1:
1117 usb_free_urb(data->int_urb);
1118
1119 return ret; 1088 return ret;
1120} 1089}
1121 1090
@@ -1213,10 +1182,29 @@ static struct sk_buff *ax88772_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
1213 return skb; 1182 return skb;
1214} 1183}
1215 1184
1185static int ax88772_link_reset(struct usbnet *dev)
1186{
1187 u16 lpa;
1188 u16 mode;
1189
1190 mode = AX88772_MEDIUM_DEFAULT;
1191 lpa = ax8817x_mdio_read(dev->net, dev->mii.phy_id, MII_LPA);
1192
1193 if ((lpa & LPA_DUPLEX) == 0)
1194 mode &= ~AX88772_MEDIUM_FULL_DUPLEX;
1195 if ((lpa & LPA_100) == 0)
1196 mode &= ~AX88772_MEDIUM_100MB;
1197 ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL);
1198
1199 return 0;
1200}
1201
1216static const struct driver_info ax8817x_info = { 1202static const struct driver_info ax8817x_info = {
1217 .description = "ASIX AX8817x USB 2.0 Ethernet", 1203 .description = "ASIX AX8817x USB 2.0 Ethernet",
1218 .bind = ax8817x_bind, 1204 .bind = ax8817x_bind,
1219 .unbind = ax8817x_unbind, 1205 .status = ax8817x_status,
1206 .link_reset = ax88172_link_reset,
1207 .reset = ax88172_link_reset,
1220 .flags = FLAG_ETHER, 1208 .flags = FLAG_ETHER,
1221 .data = 0x00130103, 1209 .data = 0x00130103,
1222}; 1210};
@@ -1224,7 +1212,9 @@ static const struct driver_info ax8817x_info = {
1224static const struct driver_info dlink_dub_e100_info = { 1212static const struct driver_info dlink_dub_e100_info = {
1225 .description = "DLink DUB-E100 USB Ethernet", 1213 .description = "DLink DUB-E100 USB Ethernet",
1226 .bind = ax8817x_bind, 1214 .bind = ax8817x_bind,
1227 .unbind = ax8817x_unbind, 1215 .status = ax8817x_status,
1216 .link_reset = ax88172_link_reset,
1217 .reset = ax88172_link_reset,
1228 .flags = FLAG_ETHER, 1218 .flags = FLAG_ETHER,
1229 .data = 0x009f9d9f, 1219 .data = 0x009f9d9f,
1230}; 1220};
@@ -1232,7 +1222,9 @@ static const struct driver_info dlink_dub_e100_info = {
1232static const struct driver_info netgear_fa120_info = { 1222static const struct driver_info netgear_fa120_info = {
1233 .description = "Netgear FA-120 USB Ethernet", 1223 .description = "Netgear FA-120 USB Ethernet",
1234 .bind = ax8817x_bind, 1224 .bind = ax8817x_bind,
1235 .unbind = ax8817x_unbind, 1225 .status = ax8817x_status,
1226 .link_reset = ax88172_link_reset,
1227 .reset = ax88172_link_reset,
1236 .flags = FLAG_ETHER, 1228 .flags = FLAG_ETHER,
1237 .data = 0x00130103, 1229 .data = 0x00130103,
1238}; 1230};
@@ -1240,7 +1232,9 @@ static const struct driver_info netgear_fa120_info = {
1240static const struct driver_info hawking_uf200_info = { 1232static const struct driver_info hawking_uf200_info = {
1241 .description = "Hawking UF200 USB Ethernet", 1233 .description = "Hawking UF200 USB Ethernet",
1242 .bind = ax8817x_bind, 1234 .bind = ax8817x_bind,
1243 .unbind = ax8817x_unbind, 1235 .status = ax8817x_status,
1236 .link_reset = ax88172_link_reset,
1237 .reset = ax88172_link_reset,
1244 .flags = FLAG_ETHER, 1238 .flags = FLAG_ETHER,
1245 .data = 0x001f1d1f, 1239 .data = 0x001f1d1f,
1246}; 1240};
@@ -1248,7 +1242,9 @@ static const struct driver_info hawking_uf200_info = {
1248static const struct driver_info ax88772_info = { 1242static const struct driver_info ax88772_info = {
1249 .description = "ASIX AX88772 USB 2.0 Ethernet", 1243 .description = "ASIX AX88772 USB 2.0 Ethernet",
1250 .bind = ax88772_bind, 1244 .bind = ax88772_bind,
1251 .unbind = ax8817x_unbind, 1245 .status = ax8817x_status,
1246 .link_reset = ax88772_link_reset,
1247 .reset = ax88772_link_reset,
1252 .flags = FLAG_ETHER | FLAG_FRAMING_AX, 1248 .flags = FLAG_ETHER | FLAG_FRAMING_AX,
1253 .rx_fixup = ax88772_rx_fixup, 1249 .rx_fixup = ax88772_rx_fixup,
1254 .tx_fixup = ax88772_tx_fixup, 1250 .tx_fixup = ax88772_tx_fixup,
@@ -2661,7 +2657,7 @@ static const struct driver_info blob_info = {
2661 * All known Zaurii lie about their standards conformance. Most lie by 2657 * All known Zaurii lie about their standards conformance. Most lie by
2662 * saying they support CDC Ethernet. Some lie and say they support CDC 2658 * saying they support CDC Ethernet. Some lie and say they support CDC
2663 * MDLM (as if for access to cell phone modems). Someone, please beat 2659 * MDLM (as if for access to cell phone modems). Someone, please beat
2664 * on Sharp for a while with a cluestick. 2660 * on Sharp (and other such vendors) for a while with a cluestick.
2665 * 2661 *
2666 *-------------------------------------------------------------------------*/ 2662 *-------------------------------------------------------------------------*/
2667 2663
@@ -2714,13 +2710,6 @@ static const struct driver_info zaurus_pxa_info = {
2714}; 2710};
2715#define ZAURUS_PXA_INFO ((unsigned long)&zaurus_pxa_info) 2711#define ZAURUS_PXA_INFO ((unsigned long)&zaurus_pxa_info)
2716 2712
2717static const struct driver_info zaurus_pxa_mdlm_info = {
2718 .description = "Sharp Zaurus, PXA-255 based",
2719 .flags = FLAG_FRAMING_Z,
2720 .check_connect = always_connected,
2721 .tx_fixup = zaurus_tx_fixup,
2722};
2723
2724static const struct driver_info olympus_mxl_info = { 2713static const struct driver_info olympus_mxl_info = {
2725 .description = "Olympus R1000", 2714 .description = "Olympus R1000",
2726 .flags = FLAG_FRAMING_Z, 2715 .flags = FLAG_FRAMING_Z,
@@ -2731,6 +2720,133 @@ static const struct driver_info olympus_mxl_info = {
2731}; 2720};
2732#define OLYMPUS_MXL_INFO ((unsigned long)&olympus_mxl_info) 2721#define OLYMPUS_MXL_INFO ((unsigned long)&olympus_mxl_info)
2733 2722
2723
2724/* Some more recent products using Lineo/Belcarra code will wrongly claim
2725 * CDC MDLM conformance. They aren't conformant: data endpoints live
2726 * in the control interface, there's no data interface, and it's not used
2727 * to talk to a cell phone radio. But at least we can detect these two
2728 * pseudo-classes, rather than growing this product list with entries for
2729 * each new nonconformant product (sigh).
2730 */
2731static const u8 safe_guid[16] = {
2732 0x5d, 0x34, 0xcf, 0x66, 0x11, 0x18, 0x11, 0xd6,
2733 0xa2, 0x1a, 0x00, 0x01, 0x02, 0xca, 0x9a, 0x7f,
2734};
2735static const u8 blan_guid[16] = {
2736 0x74, 0xf0, 0x3d, 0xbd, 0x1e, 0xc1, 0x44, 0x70,
2737 0xa3, 0x67, 0x71, 0x34, 0xc9, 0xf5, 0x54, 0x37,
2738};
2739
2740static int blan_mdlm_bind (struct usbnet *dev, struct usb_interface *intf)
2741{
2742 u8 *buf = intf->cur_altsetting->extra;
2743 int len = intf->cur_altsetting->extralen;
2744 struct usb_cdc_mdlm_desc *desc = NULL;
2745 struct usb_cdc_mdlm_detail_desc *detail = NULL;
2746
2747 while (len > 3) {
2748 if (buf [1] != USB_DT_CS_INTERFACE)
2749 goto next_desc;
2750
2751 /* use bDescriptorSubType, and just verify that we get a
2752 * "BLAN" (or "SAFE") descriptor.
2753 */
2754 switch (buf [2]) {
2755 case USB_CDC_MDLM_TYPE:
2756 if (desc) {
2757 dev_dbg (&intf->dev, "extra MDLM\n");
2758 goto bad_desc;
2759 }
2760 desc = (void *) buf;
2761 if (desc->bLength != sizeof *desc) {
2762 dev_dbg (&intf->dev, "MDLM len %u\n",
2763 desc->bLength);
2764 goto bad_desc;
2765 }
2766 /* expect bcdVersion 1.0, ignore */
2767 if (memcmp(&desc->bGUID, blan_guid, 16)
2768 || memcmp(&desc->bGUID, blan_guid, 16) ) {
2769 /* hey, this one might _really_ be MDLM! */
2770 dev_dbg (&intf->dev, "MDLM guid\n");
2771 goto bad_desc;
2772 }
2773 break;
2774 case USB_CDC_MDLM_DETAIL_TYPE:
2775 if (detail) {
2776 dev_dbg (&intf->dev, "extra MDLM detail\n");
2777 goto bad_desc;
2778 }
2779 detail = (void *) buf;
2780 switch (detail->bGuidDescriptorType) {
2781 case 0: /* "SAFE" */
2782 if (detail->bLength != (sizeof *detail + 2))
2783 goto bad_detail;
2784 break;
2785 case 1: /* "BLAN" */
2786 if (detail->bLength != (sizeof *detail + 3))
2787 goto bad_detail;
2788 break;
2789 default:
2790 goto bad_detail;
2791 }
2792
2793 /* assuming we either noticed BLAN already, or will
2794 * find it soon, there are some data bytes here:
2795 * - bmNetworkCapabilities (unused)
2796 * - bmDataCapabilities (bits, see below)
2797 * - bPad (ignored, for PADAFTER -- BLAN-only)
2798 * bits are:
2799 * - 0x01 -- Zaurus framing (add CRC)
2800 * - 0x02 -- PADBEFORE
2801 * - 0x04 -- PADAFTER
2802 * - 0x08 -- "fermat" packet mangling (for hw bugs)
2803 */
2804 if (detail->bDetailData[1] != 0x01) {
2805 /* bmDataCapabilites == 0 would be fine too,
2806 * but framing is minidriver-coupled for now.
2807 */
2808bad_detail:
2809 dev_dbg (&intf->dev,
2810 "bad MDLM detail, %d %d %d\n",
2811 detail->bLength,
2812 detail->bDetailData[0],
2813 detail->bDetailData[2]);
2814 goto bad_desc;
2815 }
2816 break;
2817 }
2818next_desc:
2819 len -= buf [0]; /* bLength */
2820 buf += buf [0];
2821 }
2822
2823 if (!desc || !detail) {
2824 dev_dbg (&intf->dev, "missing cdc mdlm %s%sdescriptor\n",
2825 desc ? "" : "func ",
2826 detail ? "" : "detail ");
2827 goto bad_desc;
2828 }
2829
2830 /* There's probably a CDC Ethernet descriptor there, but we can't
2831 * rely on the Ethernet address it provides since not all vendors
2832 * bother to make it unique. Likewise there's no point in tracking
2833 * of the CDC event notifications.
2834 */
2835 return get_endpoints (dev, intf);
2836
2837bad_desc:
2838 dev_info (&dev->udev->dev, "unsupported MDLM descriptors\n");
2839 return -ENODEV;
2840}
2841
2842static const struct driver_info bogus_mdlm_info = {
2843 .description = "pseudo-MDLM (BLAN) device",
2844 .flags = FLAG_FRAMING_Z,
2845 .check_connect = always_connected,
2846 .tx_fixup = zaurus_tx_fixup,
2847 .bind = blan_mdlm_bind,
2848};
2849
2734#else 2850#else
2735 2851
2736/* blacklist all those devices */ 2852/* blacklist all those devices */
@@ -3307,6 +3423,19 @@ kevent (void *data)
3307 } 3423 }
3308 } 3424 }
3309 3425
3426 if (test_bit (EVENT_LINK_RESET, &dev->flags)) {
3427 struct driver_info *info = dev->driver_info;
3428 int retval = 0;
3429
3430 clear_bit (EVENT_LINK_RESET, &dev->flags);
3431 if(info->link_reset && (retval = info->link_reset(dev)) < 0) {
3432 devinfo(dev, "link reset failed (%d) usbnet usb-%s-%s, %s",
3433 retval,
3434 dev->udev->bus->bus_name, dev->udev->devpath,
3435 info->description);
3436 }
3437 }
3438
3310 if (dev->flags) 3439 if (dev->flags)
3311 devdbg (dev, "kevent done, flags = 0x%lx", 3440 devdbg (dev, "kevent done, flags = 0x%lx",
3312 dev->flags); 3441 dev->flags);
@@ -3942,6 +4071,9 @@ static const struct usb_device_id products [] = {
3942 USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader 4071 USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader
3943 .driver_info = (unsigned long) &blob_info, 4072 .driver_info = (unsigned long) &blob_info,
3944}, { 4073}, {
4074 USB_DEVICE (0x22b8, 0x600c), // USBNET Motorola E680
4075 .driver_info = (unsigned long) &linuxdev_info,
4076}, {
3945 // Linux Ethernet/RNDIS gadget on pxa210/25x/26x 4077 // Linux Ethernet/RNDIS gadget on pxa210/25x/26x
3946 // e.g. Gumstix, current OpenZaurus, ... 4078 // e.g. Gumstix, current OpenZaurus, ...
3947 USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203), 4079 USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
@@ -4020,30 +4152,14 @@ static const struct usb_device_id products [] = {
4020}, 4152},
4021 4153
4022#ifdef CONFIG_USB_ZAURUS 4154#ifdef CONFIG_USB_ZAURUS
4023 /* at least some (reports vary) PXA units have very different 4155 /* At least some (reports vary) PXA units have very different lies
4024 * lies about their standards support: they claim to be cell 4156 * about their standards support: they claim to be cell phones with
4025 * phones giving direct radio access (which they aren't). 4157 * direct access to their radios. (They don't conform to CDC MDLM.)
4026 */ 4158 */
4027{ 4159{
4028 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 4160 USB_INTERFACE_INFO (USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
4029 | USB_DEVICE_ID_MATCH_DEVICE, 4161 USB_CDC_PROTO_NONE),
4030 .idVendor = 0x04DD, 4162 .driver_info = (unsigned long) &bogus_mdlm_info,
4031 /* Sharp ROM v1.32 */
4032 .idProduct = 0x8006, /* SL-5600 */
4033 .bInterfaceClass = USB_CLASS_COMM,
4034 .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM,
4035 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
4036 .driver_info = (unsigned long) &zaurus_pxa_mdlm_info,
4037}, {
4038 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
4039 | USB_DEVICE_ID_MATCH_DEVICE,
4040 .idVendor = 0x04DD,
4041 /* reported with some C860 units */
4042 .idProduct = 0x9031, /* C-860 */
4043 .bInterfaceClass = USB_CLASS_COMM,
4044 .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM,
4045 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
4046 .driver_info = (unsigned long) &zaurus_pxa_mdlm_info,
4047}, 4163},
4048#endif 4164#endif
4049 4165
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
index c81cd0a619bf..341ae5f732dd 100644
--- a/drivers/usb/net/zd1201.c
+++ b/drivers/usb/net/zd1201.c
@@ -45,7 +45,7 @@ MODULE_PARM_DESC(ap, "If non-zero Access Point firmware will be loaded");
45MODULE_DEVICE_TABLE(usb, zd1201_table); 45MODULE_DEVICE_TABLE(usb, zd1201_table);
46 46
47 47
48int zd1201_fw_upload(struct usb_device *dev, int apfw) 48static int zd1201_fw_upload(struct usb_device *dev, int apfw)
49{ 49{
50 const struct firmware *fw_entry; 50 const struct firmware *fw_entry;
51 char* data; 51 char* data;
@@ -111,7 +111,7 @@ exit:
111 return err; 111 return err;
112} 112}
113 113
114void zd1201_usbfree(struct urb *urb, struct pt_regs *regs) 114static void zd1201_usbfree(struct urb *urb, struct pt_regs *regs)
115{ 115{
116 struct zd1201 *zd = urb->context; 116 struct zd1201 *zd = urb->context;
117 117
@@ -142,7 +142,8 @@ void zd1201_usbfree(struct urb *urb, struct pt_regs *regs)
142 142
143 total: 4 + 2 + 2 + 2 + 2 + 4 = 16 143 total: 4 + 2 + 2 + 2 + 2 + 4 = 16
144*/ 144*/
145int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0, int parm1, int parm2) 145static int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0,
146 int parm1, int parm2)
146{ 147{
147 unsigned char *command; 148 unsigned char *command;
148 int ret; 149 int ret;
@@ -175,15 +176,15 @@ int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0, int parm1, int parm2)
175} 176}
176 177
177/* Callback after sending out a packet */ 178/* Callback after sending out a packet */
178void zd1201_usbtx(struct urb *urb, struct pt_regs *regs) 179static void zd1201_usbtx(struct urb *urb, struct pt_regs *regs)
179{ 180{
180 struct zd1201 *zd = urb->context; 181 struct zd1201 *zd = urb->context;
181 netif_wake_queue(zd->dev); 182 netif_wake_queue(zd->dev);
182 return; 183 return;
183} 184}
184 185
185/* Incomming data */ 186/* Incoming data */
186void zd1201_usbrx(struct urb *urb, struct pt_regs *regs) 187static void zd1201_usbrx(struct urb *urb, struct pt_regs *regs)
187{ 188{
188 struct zd1201 *zd = urb->context; 189 struct zd1201 *zd = urb->context;
189 int free = 0; 190 int free = 0;
@@ -613,7 +614,7 @@ static inline int zd1201_setconfig16(struct zd1201 *zd, int rid, short val)
613 return (zd1201_setconfig(zd, rid, &zdval, sizeof(__le16), 1)); 614 return (zd1201_setconfig(zd, rid, &zdval, sizeof(__le16), 1));
614} 615}
615 616
616int zd1201_drvr_start(struct zd1201 *zd) 617static int zd1201_drvr_start(struct zd1201 *zd)
617{ 618{
618 int err, i; 619 int err, i;
619 short max; 620 short max;
@@ -771,7 +772,7 @@ static int zd1201_net_stop(struct net_device *dev)
771/* 772/*
772 RFC 1042 encapsulates Ethernet frames in 802.11 frames 773 RFC 1042 encapsulates Ethernet frames in 802.11 frames
773 by prefixing them with 0xaa, 0xaa, 0x03) followed by a SNAP OID of 0 774 by prefixing them with 0xaa, 0xaa, 0x03) followed by a SNAP OID of 0
774 (0x00, 0x00, 0x00). Zd requires an additionnal padding, copy 775 (0x00, 0x00, 0x00). Zd requires an additional padding, copy
775 of ethernet addresses, length of the standard RFC 1042 packet 776 of ethernet addresses, length of the standard RFC 1042 packet
776 and a command byte (which is nul for tx). 777 and a command byte (which is nul for tx).
777 778
@@ -1097,7 +1098,7 @@ static int zd1201_get_range(struct net_device *dev,
1097 1098
1098/* Little bit of magic here: we only get the quality if we poll 1099/* Little bit of magic here: we only get the quality if we poll
1099 * for it, and we never get an actual request to trigger such 1100 * for it, and we never get an actual request to trigger such
1100 * a poll. Therefore we 'asume' that the user will soon ask for 1101 * a poll. Therefore we 'assume' that the user will soon ask for
1101 * the stats after asking the bssid. 1102 * the stats after asking the bssid.
1102 */ 1103 */
1103static int zd1201_get_wap(struct net_device *dev, 1104static int zd1201_get_wap(struct net_device *dev,
@@ -1107,7 +1108,7 @@ static int zd1201_get_wap(struct net_device *dev,
1107 unsigned char buffer[6]; 1108 unsigned char buffer[6];
1108 1109
1109 if (!zd1201_getconfig(zd, ZD1201_RID_COMMSQUALITY, buffer, 6)) { 1110 if (!zd1201_getconfig(zd, ZD1201_RID_COMMSQUALITY, buffer, 6)) {
1110 /* Unfortunatly the quality and noise reported is useless. 1111 /* Unfortunately the quality and noise reported is useless.
1111 they seem to be accumulators that increase until you 1112 they seem to be accumulators that increase until you
1112 read them, unless we poll on a fixed interval we can't 1113 read them, unless we poll on a fixed interval we can't
1113 use them 1114 use them
@@ -1739,7 +1740,8 @@ static const struct iw_handler_def zd1201_iw_handlers = {
1739 .private_args = (struct iw_priv_args *) zd1201_private_args, 1740 .private_args = (struct iw_priv_args *) zd1201_private_args,
1740}; 1741};
1741 1742
1742int zd1201_probe(struct usb_interface *interface, const struct usb_device_id *id) 1743static int zd1201_probe(struct usb_interface *interface,
1744 const struct usb_device_id *id)
1743{ 1745{
1744 struct zd1201 *zd; 1746 struct zd1201 *zd;
1745 struct usb_device *usb; 1747 struct usb_device *usb;
@@ -1851,7 +1853,7 @@ err_zd:
1851 return err; 1853 return err;
1852} 1854}
1853 1855
1854void zd1201_disconnect(struct usb_interface *interface) 1856static void zd1201_disconnect(struct usb_interface *interface)
1855{ 1857{
1856 struct zd1201 *zd=(struct zd1201 *)usb_get_intfdata(interface); 1858 struct zd1201 *zd=(struct zd1201 *)usb_get_intfdata(interface);
1857 struct hlist_node *node, *node2; 1859 struct hlist_node *node, *node2;
@@ -1882,7 +1884,7 @@ void zd1201_disconnect(struct usb_interface *interface)
1882 kfree(zd); 1884 kfree(zd);
1883} 1885}
1884 1886
1885struct usb_driver zd1201_usb = { 1887static struct usb_driver zd1201_usb = {
1886 .owner = THIS_MODULE, 1888 .owner = THIS_MODULE,
1887 .name = "zd1201", 1889 .name = "zd1201",
1888 .probe = zd1201_probe, 1890 .probe = zd1201_probe,
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index b869076d9c7c..bc798edf0358 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -53,6 +53,15 @@ config USB_SERIAL_GENERIC
53 support" be compiled as a module for this driver to be used 53 support" be compiled as a module for this driver to be used
54 properly. 54 properly.
55 55
56config USB_SERIAL_AIRPRIME
57 tristate "USB AirPrime CDMA Wireless Driver"
58 depends on USB_SERIAL
59 help
60 Say Y here if you want to use a AirPrime CDMA Wireless PC card.
61
62 To compile this driver as a module, choose M here: the
63 module will be called airprime.
64
56config USB_SERIAL_BELKIN 65config USB_SERIAL_BELKIN
57 tristate "USB Belkin and Peracom Single Port Serial Driver" 66 tristate "USB Belkin and Peracom Single Port Serial Driver"
58 depends on USB_SERIAL 67 depends on USB_SERIAL
@@ -395,6 +404,15 @@ config USB_SERIAL_PL2303
395 To compile this driver as a module, choose M here: the 404 To compile this driver as a module, choose M here: the
396 module will be called pl2303. 405 module will be called pl2303.
397 406
407config USB_SERIAL_HP4X
408 tristate "USB HP4x Calculators support"
409 depends on USB_SERIAL
410 help
411 Say Y here if you want to use an Hewlett-Packard 4x Calculator.
412
413 To compile this driver as a module, choose M here: the
414 module will be called hp4x.
415
398config USB_SERIAL_SAFE 416config USB_SERIAL_SAFE
399 tristate "USB Safe Serial (Encapsulated) Driver (EXPERIMENTAL)" 417 tristate "USB Safe Serial (Encapsulated) Driver (EXPERIMENTAL)"
400 depends on USB_SERIAL && EXPERIMENTAL 418 depends on USB_SERIAL && EXPERIMENTAL
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 351b81855b18..d56ff6d86cce 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -11,6 +11,7 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o
11 11
12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) 12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y)
13 13
14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o
14obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o 15obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o
15obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o 16obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o
16obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o 17obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o
@@ -21,6 +22,7 @@ obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o
21obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o 22obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o
22obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o 23obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o
23obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o 24obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o
25obj-$(CONFIG_USB_SERIAL_HP4X) += hp4x.o
24obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o 26obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o
25obj-$(CONFIG_USB_SERIAL_IPW) += ipw.o 27obj-$(CONFIG_USB_SERIAL_IPW) += ipw.o
26obj-$(CONFIG_USB_SERIAL_IR) += ir-usb.o 28obj-$(CONFIG_USB_SERIAL_IR) += ir-usb.o
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
new file mode 100644
index 000000000000..a4ce0008d69b
--- /dev/null
+++ b/drivers/usb/serial/airprime.c
@@ -0,0 +1,63 @@
1/*
2 * AirPrime CDMA Wireless 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
18static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0xf3d, 0x0112) },
20 { },
21};
22MODULE_DEVICE_TABLE(usb, id_table);
23
24static struct usb_driver airprime_driver = {
25 .owner = THIS_MODULE,
26 .name = "airprime",
27 .probe = usb_serial_probe,
28 .disconnect = usb_serial_disconnect,
29 .id_table = id_table,
30};
31
32static struct usb_serial_device_type airprime_device = {
33 .owner = THIS_MODULE,
34 .name = "airprime",
35 .id_table = id_table,
36 .num_interrupt_in = NUM_DONT_CARE,
37 .num_bulk_in = NUM_DONT_CARE,
38 .num_bulk_out = NUM_DONT_CARE,
39 .num_ports = 1,
40};
41
42static int __init airprime_init(void)
43{
44 int retval;
45
46 retval = usb_serial_register(&airprime_device);
47 if (retval)
48 return retval;
49 retval = usb_register(&airprime_driver);
50 if (retval)
51 usb_serial_deregister(&airprime_device);
52 return retval;
53}
54
55static void __exit airprime_exit(void)
56{
57 usb_deregister(&airprime_driver);
58 usb_serial_deregister(&airprime_device);
59}
60
61module_init(airprime_init);
62module_exit(airprime_exit);
63MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index d165f42d560d..f34a9bb6a219 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -16,6 +16,14 @@
16 * See http://geocities.com/i0xox0i for information on this driver and the 16 * See http://geocities.com/i0xox0i for information on this driver and the
17 * earthmate usb device. 17 * earthmate usb device.
18 * 18 *
19 * Lonnie Mendez <dignome@gmail.com>
20 * 4-29-2005
21 * Fixed problem where setting or retreiving the serial config would fail with
22 * EPIPE. Removed CRTS toggling so the driver behaves more like other usbserial
23 * adapters. Issued new interval of 1ms instead of the default 10ms. As a
24 * result, transfer speed has been substantially increased. From avg. 850bps to
25 * avg. 3300bps. initial termios has also been modified. Cleaned up code and
26 * formatting issues so it is more readable. Replaced the C++ style comments.
19 * 27 *
20 * Lonnie Mendez <dignome@gmail.com> 28 * Lonnie Mendez <dignome@gmail.com>
21 * 12-15-2004 29 * 12-15-2004
@@ -32,12 +40,6 @@
32 * 10-2003 40 * 10-2003
33 * Driver first released. 41 * Driver first released.
34 * 42 *
35 *
36 * Long Term TODO:
37 * Improve transfer speeds - both read/write are somewhat slow
38 * at this point.
39 * Improve debugging. Show modem line status with debug output and
40 * implement filtering for certain data as a module parameter.
41 */ 43 */
42 44
43/* Thanks to Neil Whelchel for writing the first cypress m8 implementation for linux. */ 45/* Thanks to Neil Whelchel for writing the first cypress m8 implementation for linux. */
@@ -72,11 +74,12 @@
72 static int debug; 74 static int debug;
73#endif 75#endif
74static int stats; 76static int stats;
77static int interval;
75 78
76/* 79/*
77 * Version Information 80 * Version Information
78 */ 81 */
79#define DRIVER_VERSION "v1.08" 82#define DRIVER_VERSION "v1.09"
80#define DRIVER_AUTHOR "Lonnie Mendez <dignome@gmail.com>, Neil Whelchel <koyama@firstlight.net>" 83#define DRIVER_AUTHOR "Lonnie Mendez <dignome@gmail.com>, Neil Whelchel <koyama@firstlight.net>"
81#define DRIVER_DESC "Cypress USB to Serial Driver" 84#define DRIVER_DESC "Cypress USB to Serial Driver"
82 85
@@ -130,7 +133,6 @@ struct cypress_private {
130 char prev_status, diff_status; /* used for TIOCMIWAIT */ 133 char prev_status, diff_status; /* used for TIOCMIWAIT */
131 /* we pass a pointer to this as the arguement sent to cypress_set_termios old_termios */ 134 /* we pass a pointer to this as the arguement sent to cypress_set_termios old_termios */
132 struct termios tmp_termios; /* stores the old termios settings */ 135 struct termios tmp_termios; /* stores the old termios settings */
133 char calledfromopen; /* used when issuing lines on open - fixes rts drop bug */
134}; 136};
135 137
136/* write buffer structure */ 138/* write buffer structure */
@@ -168,10 +170,8 @@ static void cypress_buf_free(struct cypress_buf *cb);
168static void cypress_buf_clear(struct cypress_buf *cb); 170static void cypress_buf_clear(struct cypress_buf *cb);
169static unsigned int cypress_buf_data_avail(struct cypress_buf *cb); 171static unsigned int cypress_buf_data_avail(struct cypress_buf *cb);
170static unsigned int cypress_buf_space_avail(struct cypress_buf *cb); 172static unsigned int cypress_buf_space_avail(struct cypress_buf *cb);
171static unsigned int cypress_buf_put(struct cypress_buf *cb, const char *buf, 173static unsigned int cypress_buf_put(struct cypress_buf *cb, const char *buf, unsigned int count);
172 unsigned int count); 174static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, unsigned int count);
173static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf,
174 unsigned int count);
175 175
176 176
177static struct usb_serial_device_type cypress_earthmate_device = { 177static struct usb_serial_device_type cypress_earthmate_device = {
@@ -234,14 +234,13 @@ static struct usb_serial_device_type cypress_hidcom_device = {
234 *****************************************************************************/ 234 *****************************************************************************/
235 235
236 236
237/* This function can either set or retreive the current serial line settings */ 237/* This function can either set or retrieve the current serial line settings */
238static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_mask, int data_bits, int stop_bits, 238static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_mask, int data_bits, int stop_bits,
239 int parity_enable, int parity_type, int reset, int cypress_request_type) 239 int parity_enable, int parity_type, int reset, int cypress_request_type)
240{ 240{
241 int i, n_baud_rate = 0, retval = 0; 241 int new_baudrate = 0, retval = 0, tries = 0;
242 struct cypress_private *priv; 242 struct cypress_private *priv;
243 __u8 feature_buffer[5]; 243 __u8 feature_buffer[8];
244 __u8 config;
245 unsigned long flags; 244 unsigned long flags;
246 245
247 dbg("%s", __FUNCTION__); 246 dbg("%s", __FUNCTION__);
@@ -256,7 +255,8 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m
256 * of 57600bps (I have no idea whether DeLorme chose to use the general purpose 255 * of 57600bps (I have no idea whether DeLorme chose to use the general purpose
257 * firmware or not), if you need to modify this speed setting for your own 256 * firmware or not), if you need to modify this speed setting for your own
258 * project please add your own chiptype and modify the code likewise. The 257 * project please add your own chiptype and modify the code likewise. The
259 * Cypress HID->COM device will work successfully up to 115200bps. 258 * Cypress HID->COM device will work successfully up to 115200bps (but the
259 * actual throughput is around 3kBps).
260 */ 260 */
261 if (baud_mask != priv->cbr_mask) { 261 if (baud_mask != priv->cbr_mask) {
262 dbg("%s - baud rate is changing", __FUNCTION__); 262 dbg("%s - baud rate is changing", __FUNCTION__);
@@ -265,109 +265,114 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m
265 * but are not used with NMEA and SiRF protocols */ 265 * but are not used with NMEA and SiRF protocols */
266 266
267 if ( (baud_mask == B300) || (baud_mask == B600) ) { 267 if ( (baud_mask == B300) || (baud_mask == B600) ) {
268 err("%s - failed setting baud rate, unsupported speed (default to 4800)", 268 err("%s - failed setting baud rate, unsupported speed",
269 __FUNCTION__); 269 __FUNCTION__);
270 n_baud_rate = 4800; 270 new_baudrate = priv->baud_rate;
271 } else if ( (n_baud_rate = mask_to_rate(baud_mask)) == -1) { 271 } else if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) {
272 err("%s - failed setting baud rate, unsupported speed (default to 4800)", 272 err("%s - failed setting baud rate, unsupported speed",
273 __FUNCTION__); 273 __FUNCTION__);
274 n_baud_rate = 4800; 274 new_baudrate = priv->baud_rate;
275 } 275 }
276 } else if (priv->chiptype == CT_CYPHIDCOM) { 276 } else if (priv->chiptype == CT_CYPHIDCOM) {
277 if ( (n_baud_rate = mask_to_rate(baud_mask)) == -1) { 277 if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) {
278 err("%s - failed setting baud rate, unsupported speed (default to 4800)", 278 err("%s - failed setting baud rate, unsupported speed",
279 __FUNCTION__); 279 __FUNCTION__);
280 n_baud_rate = 4800; 280 new_baudrate = priv->baud_rate;
281 } 281 }
282 } else if (priv->chiptype == CT_GENERIC) { 282 } else if (priv->chiptype == CT_GENERIC) {
283 if ( (n_baud_rate = mask_to_rate(baud_mask)) == -1) { 283 if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) {
284 err("%s - failed setting baud rate, unsupported speed (default to 4800)", 284 err("%s - failed setting baud rate, unsupported speed",
285 __FUNCTION__); 285 __FUNCTION__);
286 n_baud_rate = 4800; 286 new_baudrate = priv->baud_rate;
287 } 287 }
288 } else { 288 } else {
289 info("%s - please define your chiptype, using 4800bps default", __FUNCTION__); 289 info("%s - please define your chiptype", __FUNCTION__);
290 n_baud_rate = 4800; 290 new_baudrate = priv->baud_rate;
291 } 291 }
292 } else { /* baud rate not changing, keep the old */ 292 } else { /* baud rate not changing, keep the old */
293 n_baud_rate = priv->baud_rate; 293 new_baudrate = priv->baud_rate;
294 } 294 }
295 dbg("%s - baud rate is being sent as %d", __FUNCTION__, n_baud_rate); 295 dbg("%s - baud rate is being sent as %d", __FUNCTION__, new_baudrate);
296
297 296
298 /* 297 memset(feature_buffer, 0, 8);
299 * This algorithm accredited to Jiang Jay Zhang... thanks for all the help! 298 /* fill the feature_buffer with new configuration */
300 */ 299 *((u_int32_t *)feature_buffer) = new_baudrate;
301 for (i = 0; i < 4; ++i) {
302 feature_buffer[i] = ( n_baud_rate >> (i*8) & 0xFF );
303 }
304 300
305 config = 0; // reset config byte 301 feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */
306 config |= data_bits; // assign data bits in 2 bit space ( max 3 )
307 /* 1 bit gap */ 302 /* 1 bit gap */
308 config |= (stop_bits << 3); // assign stop bits in 1 bit space 303 feature_buffer[4] |= (stop_bits << 3); /* assign stop bits in 1 bit space */
309 config |= (parity_enable << 4); // assign parity flag in 1 bit space 304 feature_buffer[4] |= (parity_enable << 4); /* assign parity flag in 1 bit space */
310 config |= (parity_type << 5); // assign parity type in 1 bit space 305 feature_buffer[4] |= (parity_type << 5); /* assign parity type in 1 bit space */
311 /* 1 bit gap */ 306 /* 1 bit gap */
312 config |= (reset << 7); // assign reset at end of byte, 1 bit space 307 feature_buffer[4] |= (reset << 7); /* assign reset at end of byte, 1 bit space */
313
314 feature_buffer[4] = config;
315 308
316 dbg("%s - device is being sent this feature report:", __FUNCTION__); 309 dbg("%s - device is being sent this feature report:", __FUNCTION__);
317 dbg("%s - %02X - %02X - %02X - %02X - %02X", __FUNCTION__, feature_buffer[0], feature_buffer[1], 310 dbg("%s - %02X - %02X - %02X - %02X - %02X", __FUNCTION__, feature_buffer[0], feature_buffer[1],
318 feature_buffer[2], feature_buffer[3], feature_buffer[4]); 311 feature_buffer[2], feature_buffer[3], feature_buffer[4]);
319 312
313 do {
320 retval = usb_control_msg (port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), 314 retval = usb_control_msg (port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0),
321 HID_REQ_SET_REPORT, USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS, 315 HID_REQ_SET_REPORT, USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS,
322 0x0300, 0, feature_buffer, 5, 500); 316 0x0300, 0, feature_buffer, 8, 500);
317
318 if (tries++ >= 3)
319 break;
323 320
324 if (retval != 5) 321 if (retval == EPIPE)
322 usb_clear_halt(port->serial->dev, 0x00);
323 } while (retval != 8 && retval != ENODEV);
324
325 if (retval != 8)
325 err("%s - failed sending serial line settings - %d", __FUNCTION__, retval); 326 err("%s - failed sending serial line settings - %d", __FUNCTION__, retval);
326 else { 327 else {
327 spin_lock_irqsave(&priv->lock, flags); 328 spin_lock_irqsave(&priv->lock, flags);
328 priv->baud_rate = n_baud_rate; 329 priv->baud_rate = new_baudrate;
329 priv->cbr_mask = baud_mask; 330 priv->cbr_mask = baud_mask;
330 priv->current_config = config; 331 priv->current_config = feature_buffer[4];
331 ++priv->cmd_count;
332 spin_unlock_irqrestore(&priv->lock, flags); 332 spin_unlock_irqrestore(&priv->lock, flags);
333 } 333 }
334 break; 334 break;
335 case CYPRESS_GET_CONFIG: 335 case CYPRESS_GET_CONFIG:
336 dbg("%s - retreiving serial line settings", __FUNCTION__); 336 dbg("%s - retreiving serial line settings", __FUNCTION__);
337 /* reset values in feature buffer */ 337 /* set initial values in feature buffer */
338 memset(feature_buffer, 0, 5); 338 memset(feature_buffer, 0, 8);
339 339
340 do {
340 retval = usb_control_msg (port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0), 341 retval = usb_control_msg (port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0),
341 HID_REQ_GET_REPORT, USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS, 342 HID_REQ_GET_REPORT, USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS,
342 0x0300, 0, feature_buffer, 5, 500); 343 0x0300, 0, feature_buffer, 8, 500);
344
345 if (tries++ >= 3)
346 break;
347
348 if (retval == EPIPE)
349 usb_clear_halt(port->serial->dev, 0x00);
350 } while (retval != 5 && retval != ENODEV);
351
343 if (retval != 5) { 352 if (retval != 5) {
344 err("%s - failed to retreive serial line settings - %d", __FUNCTION__, retval); 353 err("%s - failed to retreive serial line settings - %d", __FUNCTION__, retval);
345 return retval; 354 return retval;
346 } else { 355 } else {
347 spin_lock_irqsave(&priv->lock, flags); 356 spin_lock_irqsave(&priv->lock, flags);
357
348 /* store the config in one byte, and later use bit masks to check values */ 358 /* store the config in one byte, and later use bit masks to check values */
349 priv->current_config = feature_buffer[4]; 359 priv->current_config = feature_buffer[4];
350 /* reverse the process above to get the baud_mask value */ 360 priv->baud_rate = *((u_int32_t *)feature_buffer);
351 n_baud_rate = 0; // reset bits
352 for (i = 0; i < 4; ++i) {
353 n_baud_rate |= ( feature_buffer[i] << (i*8) );
354 }
355 361
356 priv->baud_rate = n_baud_rate; 362 if ( (priv->cbr_mask = rate_to_mask(priv->baud_rate)) == 0x40)
357 if ( (priv->cbr_mask = rate_to_mask(n_baud_rate)) == 0x40)
358 dbg("%s - failed setting the baud mask (not defined)", __FUNCTION__); 363 dbg("%s - failed setting the baud mask (not defined)", __FUNCTION__);
359 ++priv->cmd_count;
360 spin_unlock_irqrestore(&priv->lock, flags); 364 spin_unlock_irqrestore(&priv->lock, flags);
361 } 365 }
362 break;
363 default:
364 err("%s - unsupported serial control command issued", __FUNCTION__);
365 } 366 }
367 spin_lock_irqsave(&priv->lock, flags);
368 ++priv->cmd_count;
369 spin_unlock_irqrestore(&priv->lock, flags);
370
366 return retval; 371 return retval;
367} /* cypress_serial_control */ 372} /* cypress_serial_control */
368 373
369 374
370/* given a baud mask, it will return speed on success */ 375/* given a baud mask, it will return integer baud on success */
371static int mask_to_rate (unsigned mask) 376static int mask_to_rate (unsigned mask)
372{ 377{
373 int rate; 378 int rate;
@@ -438,11 +443,12 @@ static int generic_startup (struct usb_serial *serial)
438 443
439 usb_reset_configuration (serial->dev); 444 usb_reset_configuration (serial->dev);
440 445
446 interval = 1;
441 priv->cmd_ctrl = 0; 447 priv->cmd_ctrl = 0;
442 priv->line_control = 0; 448 priv->line_control = 0;
443 priv->termios_initialized = 0; 449 priv->termios_initialized = 0;
444 priv->calledfromopen = 0;
445 priv->rx_flags = 0; 450 priv->rx_flags = 0;
451 priv->cbr_mask = B300;
446 usb_set_serial_port_data(serial->port[0], priv); 452 usb_set_serial_port_data(serial->port[0], priv);
447 453
448 return (0); 454 return (0);
@@ -513,7 +519,6 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp)
513 dbg("%s - port %d", __FUNCTION__, port->number); 519 dbg("%s - port %d", __FUNCTION__, port->number);
514 520
515 /* clear halts before open */ 521 /* clear halts before open */
516 usb_clear_halt(serial->dev, 0x00);
517 usb_clear_halt(serial->dev, 0x81); 522 usb_clear_halt(serial->dev, 0x81);
518 usb_clear_halt(serial->dev, 0x02); 523 usb_clear_halt(serial->dev, 0x02);
519 524
@@ -531,7 +536,6 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp)
531 /* raise both lines and set termios */ 536 /* raise both lines and set termios */
532 spin_lock_irqsave(&priv->lock, flags); 537 spin_lock_irqsave(&priv->lock, flags);
533 priv->line_control = CONTROL_DTR | CONTROL_RTS; 538 priv->line_control = CONTROL_DTR | CONTROL_RTS;
534 priv->calledfromopen = 1;
535 priv->cmd_ctrl = 1; 539 priv->cmd_ctrl = 1;
536 spin_unlock_irqrestore(&priv->lock, flags); 540 spin_unlock_irqrestore(&priv->lock, flags);
537 result = cypress_write(port, NULL, 0); 541 result = cypress_write(port, NULL, 0);
@@ -553,7 +557,7 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp)
553 usb_fill_int_urb(port->interrupt_in_urb, serial->dev, 557 usb_fill_int_urb(port->interrupt_in_urb, serial->dev,
554 usb_rcvintpipe(serial->dev, port->interrupt_in_endpointAddress), 558 usb_rcvintpipe(serial->dev, port->interrupt_in_endpointAddress),
555 port->interrupt_in_urb->transfer_buffer, port->interrupt_in_urb->transfer_buffer_length, 559 port->interrupt_in_urb->transfer_buffer, port->interrupt_in_urb->transfer_buffer_length,
556 cypress_read_int_callback, port, port->interrupt_in_urb->interval); 560 cypress_read_int_callback, port, interval);
557 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 561 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
558 562
559 if (result){ 563 if (result){
@@ -680,12 +684,12 @@ static void cypress_send(struct usb_serial_port *port)
680 spin_lock_irqsave(&priv->lock, flags); 684 spin_lock_irqsave(&priv->lock, flags);
681 switch (port->interrupt_out_size) { 685 switch (port->interrupt_out_size) {
682 case 32: 686 case 32:
683 // this is for the CY7C64013... 687 /* this is for the CY7C64013... */
684 offset = 2; 688 offset = 2;
685 port->interrupt_out_buffer[0] = priv->line_control; 689 port->interrupt_out_buffer[0] = priv->line_control;
686 break; 690 break;
687 case 8: 691 case 8:
688 // this is for the CY7C63743... 692 /* this is for the CY7C63743... */
689 offset = 1; 693 offset = 1;
690 port->interrupt_out_buffer[0] = priv->line_control; 694 port->interrupt_out_buffer[0] = priv->line_control;
691 break; 695 break;
@@ -738,6 +742,7 @@ send:
738 742
739 port->interrupt_out_urb->transfer_buffer_length = actual_size; 743 port->interrupt_out_urb->transfer_buffer_length = actual_size;
740 port->interrupt_out_urb->dev = port->serial->dev; 744 port->interrupt_out_urb->dev = port->serial->dev;
745 port->interrupt_out_urb->interval = interval;
741 result = usb_submit_urb (port->interrupt_out_urb, GFP_ATOMIC); 746 result = usb_submit_urb (port->interrupt_out_urb, GFP_ATOMIC);
742 if (result) { 747 if (result) {
743 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, 748 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__,
@@ -910,7 +915,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
910 unsigned cflag, iflag, baud_mask; 915 unsigned cflag, iflag, baud_mask;
911 unsigned long flags; 916 unsigned long flags;
912 __u8 oldlines; 917 __u8 oldlines;
913 int linechange; 918 int linechange = 0;
914 919
915 dbg("%s - port %d", __FUNCTION__, port->number); 920 dbg("%s - port %d", __FUNCTION__, port->number);
916 921
@@ -996,15 +1001,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
996 case B115200: dbg("%s - setting baud 115200bps", __FUNCTION__); break; 1001 case B115200: dbg("%s - setting baud 115200bps", __FUNCTION__); break;
997 default: dbg("%s - unknown masked baud rate", __FUNCTION__); 1002 default: dbg("%s - unknown masked baud rate", __FUNCTION__);
998 } 1003 }
999 priv->line_control |= CONTROL_DTR; 1004 priv->line_control = (CONTROL_DTR | CONTROL_RTS);
1000
1001 /* toggle CRTSCTS? - don't do this if being called from cypress_open */
1002 if (!priv->calledfromopen) {
1003 if (cflag & CRTSCTS)
1004 priv->line_control |= CONTROL_RTS;
1005 else
1006 priv->line_control &= ~CONTROL_RTS;
1007 }
1008 } 1005 }
1009 spin_unlock_irqrestore(&priv->lock, flags); 1006 spin_unlock_irqrestore(&priv->lock, flags);
1010 1007
@@ -1014,8 +1011,6 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
1014 cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable, 1011 cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable,
1015 parity_type, 0, CYPRESS_SET_CONFIG); 1012 parity_type, 0, CYPRESS_SET_CONFIG);
1016 1013
1017 msleep(50); /* give some time between change and read (50ms) */
1018
1019 /* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure 1014 /* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure
1020 * this should confirm that all is working if it returns what we just set */ 1015 * this should confirm that all is working if it returns what we just set */
1021 cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG); 1016 cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG);
@@ -1031,7 +1026,6 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
1031 dbg("Using custom termios settings for a baud rate of 4800bps."); 1026 dbg("Using custom termios settings for a baud rate of 4800bps.");
1032 /* define custom termios settings for NMEA protocol */ 1027 /* define custom termios settings for NMEA protocol */
1033 1028
1034
1035 tty->termios->c_iflag /* input modes - */ 1029 tty->termios->c_iflag /* input modes - */
1036 &= ~(IGNBRK /* disable ignore break */ 1030 &= ~(IGNBRK /* disable ignore break */
1037 | BRKINT /* disable break causes interrupt */ 1031 | BRKINT /* disable break causes interrupt */
@@ -1052,23 +1046,16 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o
1052 | ISIG /* disable interrupt, quit, and suspend special characters */ 1046 | ISIG /* disable interrupt, quit, and suspend special characters */
1053 | IEXTEN); /* disable non-POSIX special characters */ 1047 | IEXTEN); /* disable non-POSIX special characters */
1054 1048
1055 } else if (priv->chiptype == CT_CYPHIDCOM) { 1049 } /* CT_CYPHIDCOM: Application should handle this for device */
1056
1057 // Software app handling it for device...
1058 1050
1059 }
1060 linechange = (priv->line_control != oldlines); 1051 linechange = (priv->line_control != oldlines);
1061 spin_unlock_irqrestore(&priv->lock, flags); 1052 spin_unlock_irqrestore(&priv->lock, flags);
1062 1053
1063 /* if necessary, set lines */ 1054 /* if necessary, set lines */
1064 if (!priv->calledfromopen && linechange) { 1055 if (linechange) {
1065 priv->cmd_ctrl = 1; 1056 priv->cmd_ctrl = 1;
1066 cypress_write(port, NULL, 0); 1057 cypress_write(port, NULL, 0);
1067 } 1058 }
1068
1069 if (priv->calledfromopen)
1070 priv->calledfromopen = 0;
1071
1072} /* cypress_set_termios */ 1059} /* cypress_set_termios */
1073 1060
1074 1061
@@ -1164,7 +1151,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)
1164 spin_lock_irqsave(&priv->lock, flags); 1151 spin_lock_irqsave(&priv->lock, flags);
1165 switch(urb->actual_length) { 1152 switch(urb->actual_length) {
1166 case 32: 1153 case 32:
1167 // This is for the CY7C64013... 1154 /* This is for the CY7C64013... */
1168 priv->current_status = data[0] & 0xF8; 1155 priv->current_status = data[0] & 0xF8;
1169 bytes = data[1]+2; 1156 bytes = data[1]+2;
1170 i=2; 1157 i=2;
@@ -1172,7 +1159,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs)
1172 havedata = 1; 1159 havedata = 1;
1173 break; 1160 break;
1174 case 8: 1161 case 8:
1175 // This is for the CY7C63743... 1162 /* This is for the CY7C63743... */
1176 priv->current_status = data[0] & 0xF8; 1163 priv->current_status = data[0] & 0xF8;
1177 bytes = (data[0] & 0x07)+1; 1164 bytes = (data[0] & 0x07)+1;
1178 i=1; 1165 i=1;
@@ -1245,7 +1232,7 @@ continue_read:
1245 port->interrupt_in_urb->transfer_buffer, 1232 port->interrupt_in_urb->transfer_buffer,
1246 port->interrupt_in_urb->transfer_buffer_length, 1233 port->interrupt_in_urb->transfer_buffer_length,
1247 cypress_read_int_callback, port, 1234 cypress_read_int_callback, port,
1248 port->interrupt_in_urb->interval); 1235 interval);
1249 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 1236 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
1250 if (result) 1237 if (result)
1251 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); 1238 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
@@ -1274,6 +1261,8 @@ static void cypress_write_int_callback(struct urb *urb, struct pt_regs *regs)
1274 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 1261 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
1275 priv->write_urb_in_use = 0; 1262 priv->write_urb_in_use = 0;
1276 return; 1263 return;
1264 case -EPIPE: /* no break needed */
1265 usb_clear_halt(port->serial->dev, 0x02);
1277 default: 1266 default:
1278 /* error in the urb, so we have to resubmit it */ 1267 /* error in the urb, so we have to resubmit it */
1279 dbg("%s - Overflow in write", __FUNCTION__); 1268 dbg("%s - Overflow in write", __FUNCTION__);
@@ -1535,3 +1524,5 @@ module_param(debug, bool, S_IRUGO | S_IWUSR);
1535MODULE_PARM_DESC(debug, "Debug enabled or not"); 1524MODULE_PARM_DESC(debug, "Debug enabled or not");
1536module_param(stats, bool, S_IRUGO | S_IWUSR); 1525module_param(stats, bool, S_IRUGO | S_IWUSR);
1537MODULE_PARM_DESC(stats, "Enable statistics or not"); 1526MODULE_PARM_DESC(stats, "Enable statistics or not");
1527module_param(interval, int, S_IRUGO | S_IWUSR);
1528MODULE_PARM_DESC(interval, "Overrides interrupt interval");
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 4c788c767a97..52394f08a947 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -76,7 +76,7 @@
76 * Defererence pointers after any paranoid checks, not before. 76 * Defererence pointers after any paranoid checks, not before.
77 * 77 *
78 * (21/Jun/2003) Erik Nygren 78 * (21/Jun/2003) Erik Nygren
79 * Added support for Home Electronics Tira-1 IR tranceiver using FT232BM chip. 79 * Added support for Home Electronics Tira-1 IR transceiver using FT232BM chip.
80 * See <http://www.home-electro.com/tira1.htm>. Only operates properly 80 * See <http://www.home-electro.com/tira1.htm>. Only operates properly
81 * at 100000 and RTS-CTS, so set custom divisor mode on startup. 81 * at 100000 and RTS-CTS, so set custom divisor mode on startup.
82 * Also force the Tira-1 and USB-UIRT to only use their custom baud rates. 82 * Also force the Tira-1 and USB-UIRT to only use their custom baud rates.
@@ -91,7 +91,7 @@
91 * Minor whitespace and comment changes. 91 * Minor whitespace and comment changes.
92 * 92 *
93 * (12/Jun/2003) David Norwood 93 * (12/Jun/2003) David Norwood
94 * Added support for USB-UIRT IR tranceiver using 8U232AM chip. 94 * Added support for USB-UIRT IR transceiver using 8U232AM chip.
95 * See <http://home.earthlink.net/~jrhees/USBUIRT/index.htm>. Only 95 * See <http://home.earthlink.net/~jrhees/USBUIRT/index.htm>. Only
96 * operates properly at 312500, so set custom divisor mode on startup. 96 * operates properly at 312500, so set custom divisor mode on startup.
97 * 97 *
@@ -272,6 +272,7 @@ static int debug;
272 272
273static struct usb_device_id id_table_sio [] = { 273static struct usb_device_id id_table_sio [] = {
274 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, 274 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
275 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
275 { } /* Terminating entry */ 276 { } /* Terminating entry */
276}; 277};
277 278
@@ -296,7 +297,6 @@ static struct usb_device_id id_table_8U232AM [] = {
296 { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0, 0x3ff) }, 297 { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0, 0x3ff) },
297 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0, 0x3ff) }, 298 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0, 0x3ff) },
298 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0, 0x3ff) }, 299 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0, 0x3ff) },
299 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID, 0, 0x3ff) },
300 { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0, 0x3ff) }, 300 { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0, 0x3ff) },
301 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 301 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
302 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 302 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
@@ -369,11 +369,14 @@ static struct usb_device_id id_table_8U232AM [] = {
369 { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0, 0x3ff) }, 369 { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0, 0x3ff) },
370 { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0, 0x3ff) }, 370 { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0, 0x3ff) },
371 { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0, 0x3ff) }, 371 { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0, 0x3ff) },
372 { USB_DEVICE_VER(FTDI_RM_VID, FTDI_RMCANVIEW_PID, 0, 0x3ff) }, 372 { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0, 0x3ff) },
373 { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) }, 373 { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) },
374 { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) }, 374 { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) },
375 { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) }, 375 { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) },
376 { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0, 0x3ff) }, 376 { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0, 0x3ff) },
377 { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0, 0x3ff) },
378 { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0, 0x3ff) },
379 { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0, 0x3ff) },
377 { } /* Terminating entry */ 380 { } /* Terminating entry */
378}; 381};
379 382
@@ -382,7 +385,6 @@ static struct usb_device_id id_table_FT232BM [] = {
382 { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0x400, 0xffff) }, 385 { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0x400, 0xffff) },
383 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0x400, 0xffff) }, 386 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0x400, 0xffff) },
384 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0x400, 0xffff) }, 387 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0x400, 0xffff) },
385 { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID, 0x400, 0xffff) },
386 { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0x400, 0xffff) }, 388 { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0x400, 0xffff) },
387 { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0x400, 0xffff) }, 389 { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0x400, 0xffff) },
388 { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0x400, 0xffff) }, 390 { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0x400, 0xffff) },
@@ -485,11 +487,15 @@ static struct usb_device_id id_table_FT232BM [] = {
485 { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0x400, 0xffff) }, 487 { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0x400, 0xffff) },
486 { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0x400, 0xffff) }, 488 { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0x400, 0xffff) },
487 { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0x400, 0xffff) }, 489 { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0x400, 0xffff) },
488 { USB_DEVICE_VER(FTDI_RM_VID, FTDI_RMCANVIEW_PID, 0x400, 0xffff) }, 490 { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0x400, 0xffff) },
489 { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) }, 491 { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) },
490 { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) }, 492 { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) },
491 { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) }, 493 { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) },
492 { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0x400, 0xffff) }, 494 { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0x400, 0xffff) },
495 { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0x400, 0xffff) },
496 { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0x400, 0xffff) },
497 { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0x400, 0xffff) },
498 { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) },
493 { } /* Terminating entry */ 499 { } /* Terminating entry */
494}; 500};
495 501
@@ -517,7 +523,6 @@ static struct usb_device_id id_table_combined [] = {
517 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, 523 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
518 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, 524 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
519 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, 525 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) },
520 { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID) },
521 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, 526 { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
522 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, 527 { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
523 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 528 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
@@ -596,6 +601,22 @@ static struct usb_device_id id_table_combined [] = {
596 { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) }, 601 { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) },
597 { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) }, 602 { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) },
598 { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) }, 603 { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) },
604 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E808_PID, 0x400, 0xffff) },
605 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E809_PID, 0x400, 0xffff) },
606 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80A_PID, 0x400, 0xffff) },
607 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80B_PID, 0x400, 0xffff) },
608 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80C_PID, 0x400, 0xffff) },
609 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80D_PID, 0x400, 0xffff) },
610 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80E_PID, 0x400, 0xffff) },
611 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80F_PID, 0x400, 0xffff) },
612 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E888_PID, 0x400, 0xffff) },
613 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E889_PID, 0x400, 0xffff) },
614 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88A_PID, 0x400, 0xffff) },
615 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88B_PID, 0x400, 0xffff) },
616 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88C_PID, 0x400, 0xffff) },
617 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88D_PID, 0x400, 0xffff) },
618 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88E_PID, 0x400, 0xffff) },
619 { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88F_PID, 0x400, 0xffff) },
599 { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, 620 { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) },
600 { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) }, 621 { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) },
601 { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) }, 622 { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) },
@@ -609,11 +630,16 @@ static struct usb_device_id id_table_combined [] = {
609 { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, 630 { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) },
610 { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, 631 { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) },
611 { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, 632 { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) },
612 { USB_DEVICE(FTDI_RM_VID, FTDI_RMCANVIEW_PID) }, 633 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
613 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 634 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
614 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 635 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
615 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, 636 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
616 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, 637 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
638 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID) },
639 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
640 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
641 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
642 { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) },
617 { } /* Terminating entry */ 643 { } /* Terminating entry */
618}; 644};
619 645
@@ -1457,10 +1483,10 @@ static int ftdi_FT2232C_startup (struct usb_serial *serial)
1457 inter = serial->interface->altsetting->desc.bInterfaceNumber; 1483 inter = serial->interface->altsetting->desc.bInterfaceNumber;
1458 1484
1459 if (inter) { 1485 if (inter) {
1460 priv->interface = INTERFACE_B; 1486 priv->interface = PIT_SIOB;
1461 } 1487 }
1462 else { 1488 else {
1463 priv->interface = INTERFACE_A; 1489 priv->interface = PIT_SIOA;
1464 } 1490 }
1465 priv->baud_base = 48000000 / 2; /* Would be / 16, but FT2232C supports multiple of 0.125 divisor fractions! */ 1491 priv->baud_base = 48000000 / 2; /* Would be / 16, but FT2232C supports multiple of 0.125 divisor fractions! */
1466 1492
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index be5d60bf90b9..a52bb13a9ce4 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -26,7 +26,6 @@
26#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */ 26#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */
27#define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ 27#define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */
28#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ 28#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
29#define FTDI_8U232AM_ALT_ALT_PID 0xf3c0 /* FTDI's second alternate PID for above */
30#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ 29#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
31#define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ 30#define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */
32#define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ 31#define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */
@@ -137,7 +136,7 @@
137/* 136/*
138 * Home Electronics (www.home-electro.com) USB gadgets 137 * Home Electronics (www.home-electro.com) USB gadgets
139 */ 138 */
140#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR tranceiver */ 139#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR transceiver */
141 140
142/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */ 141/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */
143/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ 142/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */
@@ -157,7 +156,8 @@
157 */ 156 */
158#define OCT_VID 0x0B39 /* OCT vendor ID */ 157#define OCT_VID 0x0B39 /* OCT vendor ID */
159/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ 158/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */
160/* Also rebadged as SIIG Inc. model US2308 */ 159/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */
160/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */
161#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ 161#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
162 162
163/* an infrared receiver for user access control with IR tags */ 163/* an infrared receiver for user access control with IR tags */
@@ -236,10 +236,10 @@
236 236
237/* 237/*
238 * RM Michaelides CANview USB (http://www.rmcan.com) 238 * RM Michaelides CANview USB (http://www.rmcan.com)
239 * CAN filedbus interface adapter, addad by port GmbH www.port.de) 239 * CAN fieldbus interface adapter, added by port GmbH www.port.de)
240 * Ian Abbott changed the macro names for consistency.
240 */ 241 */
241#define FTDI_RM_VID 0x0403 /* Vendor Id */ 242#define FTDI_RM_CANVIEW_PID 0xfd60 /* Product Id */
242#define FTDI_RMCANVIEW_PID 0xfd60 /* Product Id */
243 243
244/* 244/*
245 * EVER Eco Pro UPS (http://www.ever.com.pl/) 245 * EVER Eco Pro UPS (http://www.ever.com.pl/)
@@ -247,6 +247,26 @@
247 247
248#define EVER_ECO_PRO_CDS 0xe520 /* RS-232 converter */ 248#define EVER_ECO_PRO_CDS 0xe520 /* RS-232 converter */
249 249
250/*
251 * 4N-GALAXY.DE PIDs for CAN-USB, USB-RS232, USB-RS422, USB-RS485,
252 * USB-TTY activ, USB-TTY passiv. Some PIDs are used by several devices
253 * and I'm not entirely sure which are used by which.
254 */
255#define FTDI_4N_GALAXY_DE_0_PID 0x8372
256#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
257#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
258
259/*
260 * Mobility Electronics products.
261 */
262#define MOBILITY_VID 0x1342
263#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */
264
265/*
266 * Active Robots product ids.
267 */
268#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */
269
250/* Commands */ 270/* Commands */
251#define FTDI_SIO_RESET 0 /* Reset the port */ 271#define FTDI_SIO_RESET 0 /* Reset the port */
252#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 272#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
@@ -259,10 +279,6 @@
259#define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */ 279#define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */
260#define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */ 280#define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */
261 281
262/* Port interface code for FT2232C */
263#define INTERFACE_A 1
264#define INTERFACE_B 2
265
266 282
267/* 283/*
268 * BmRequestType: 1100 0000b 284 * BmRequestType: 1100 0000b
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c
new file mode 100644
index 000000000000..64d55fbd206e
--- /dev/null
+++ b/drivers/usb/serial/hp4x.c
@@ -0,0 +1,85 @@
1/*
2 * HP4x Calculators Serial USB driver
3 *
4 * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net)
5 * Copyright (C) 2001-2005 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, or
10 * (at your option) any later version.
11 *
12 * See Documentation/usb/usb-serial.txt for more information on using this driver
13 */
14
15#include <linux/config.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/tty.h>
19#include <linux/module.h>
20#include <linux/usb.h>
21#include "usb-serial.h"
22
23/*
24 * Version Information
25 */
26#define DRIVER_VERSION "v1.00"
27#define DRIVER_DESC "HP4x (48/49) Generic Serial driver"
28
29#define HP_VENDOR_ID 0x03f0
30#define HP49GP_PRODUCT_ID 0x0121
31
32static struct usb_device_id id_table [] = {
33 { USB_DEVICE(HP_VENDOR_ID, HP49GP_PRODUCT_ID) },
34 { } /* Terminating entry */
35};
36
37MODULE_DEVICE_TABLE(usb, id_table);
38
39static struct usb_driver hp49gp_driver = {
40 .owner = THIS_MODULE,
41 .name = "HP4X",
42 .probe = usb_serial_probe,
43 .disconnect = usb_serial_disconnect,
44 .id_table = id_table,
45};
46
47static struct usb_serial_device_type hp49gp_device = {
48 .owner = THIS_MODULE,
49 .name = "HP4X",
50 .id_table = id_table,
51 .num_interrupt_in = NUM_DONT_CARE,
52 .num_bulk_in = NUM_DONT_CARE,
53 .num_bulk_out = NUM_DONT_CARE,
54 .num_ports = 1,
55};
56
57static int __init hp49gp_init(void)
58{
59 int retval;
60 retval = usb_serial_register(&hp49gp_device);
61 if (retval)
62 goto failed_usb_serial_register;
63 retval = usb_register(&hp49gp_driver);
64 if (retval)
65 goto failed_usb_register;
66 info(DRIVER_DESC " " DRIVER_VERSION);
67 return 0;
68failed_usb_register:
69 usb_serial_deregister(&hp49gp_device);
70failed_usb_serial_register:
71 return retval;
72}
73
74static void __exit hp49gp_exit(void)
75{
76 usb_deregister(&hp49gp_driver);
77 usb_serial_deregister(&hp49gp_device);
78}
79
80module_init(hp49gp_init);
81module_exit(hp49gp_exit);
82
83MODULE_DESCRIPTION(DRIVER_DESC);
84MODULE_VERSION(DRIVER_VERSION);
85MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/io_usbvend.h b/drivers/usb/serial/io_usbvend.h
index 8c1fa5e722b1..f1804fd5a3dd 100644
--- a/drivers/usb/serial/io_usbvend.h
+++ b/drivers/usb/serial/io_usbvend.h
@@ -289,7 +289,7 @@
289// 289//
290 290
291// 291//
292// Edgeport Compatiblity Descriptor 292// Edgeport Compatibility Descriptor
293// 293//
294// This descriptor is only returned by Edgeport-compatible devices 294// This descriptor is only returned by Edgeport-compatible devices
295// supporting the EPiC spec. True ION devices do not return this 295// supporting the EPiC spec. True ION devices do not return this
diff --git a/drivers/usb/serial/keyspan_usa90msg.h b/drivers/usb/serial/keyspan_usa90msg.h
index dd935b62c1a8..86708ecd8735 100644
--- a/drivers/usb/serial/keyspan_usa90msg.h
+++ b/drivers/usb/serial/keyspan_usa90msg.h
@@ -19,7 +19,7 @@
19 19
20 This file is available under a BSD-style copyright 20 This file is available under a BSD-style copyright
21 21
22 2. The name of InnoSys Incorprated may not be used to endorse or promote 22 2. The name of InnoSys Incorporated may not be used to endorse or promote
23 products derived from this software without specific prior written 23 products derived from this software without specific prior written
24 permission. 24 permission.
25 25
diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
index d76483706bc9..5a9321705a74 100644
--- a/drivers/usb/storage/debug.c
+++ b/drivers/usb/storage/debug.c
@@ -47,6 +47,7 @@
47#include <linux/cdrom.h> 47#include <linux/cdrom.h>
48#include <scsi/scsi.h> 48#include <scsi/scsi.h>
49#include <scsi/scsi_cmnd.h> 49#include <scsi/scsi_cmnd.h>
50#include <scsi/scsi_dbg.h>
50 51
51#include "debug.h" 52#include "debug.h"
52#include "scsi.h" 53#include "scsi.h"
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 7eff03d9b041..f3b60288696c 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -786,7 +786,7 @@ static int usbat_flash_check_media(struct us_data *us,
786 if (rc != USB_STOR_XFER_GOOD) 786 if (rc != USB_STOR_XFER_GOOD)
787 return USB_STOR_TRANSPORT_ERROR; 787 return USB_STOR_TRANSPORT_ERROR;
788 788
789 // Check for media existance 789 // Check for media existence
790 rc = usbat_flash_check_media_present(uio); 790 rc = usbat_flash_check_media_present(uio);
791 if (rc == USBAT_FLASH_MEDIA_NONE) { 791 if (rc == USBAT_FLASH_MEDIA_NONE) {
792 info->sense_key = 0x02; 792 info->sense_key = 0x02;
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index fa68dea6bc6f..d2891f475793 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1,5 +1,5 @@
1/* Driver for USB Mass Storage compliant devices 1/* Driver for USB Mass Storage compliant devices
2 * Ununsual Devices File 2 * Unusual Devices File
3 * 3 *
4 * $Id: unusual_devs.h,v 1.32 2002/02/25 02:41:24 mdharm Exp $ 4 * $Id: unusual_devs.h,v 1.32 2002/02/25 02:41:24 mdharm Exp $
5 * 5 *
@@ -48,6 +48,14 @@
48 * USB development list <linux-usb-devel@lists.sourceforge.net>. 48 * USB development list <linux-usb-devel@lists.sourceforge.net>.
49 */ 49 */
50 50
51/* patch submitted by Vivian Bregier <Vivian.Bregier@imag.fr>
52 */
53UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100,
54 "ATMEL",
55 "SND1 Storage",
56 US_SC_DEVICE, US_PR_DEVICE, NULL,
57 US_FL_IGNORE_RESIDUE),
58
51UNUSUAL_DEV( 0x03ee, 0x6901, 0x0000, 0x0100, 59UNUSUAL_DEV( 0x03ee, 0x6901, 0x0000, 0x0100,
52 "Mitsumi", 60 "Mitsumi",
53 "USB FDD", 61 "USB FDD",
@@ -517,14 +525,32 @@ UNUSUAL_DEV( 0x05ab, 0x5701, 0x0100, 0x0110,
517 0 ), 525 0 ),
518#endif 526#endif
519 527
528/* Submitted by Sven Anderson <sven-linux@anderson.de>
529 * There are at least four ProductIDs used for iPods, so I added 0x1202 and
530 * 0x1204. They just need the US_FL_FIX_CAPACITY. As the bcdDevice appears
531 * to change with firmware updates, I changed the range to maximum for all
532 * iPod entries.
533 */
534UNUSUAL_DEV( 0x05ac, 0x1202, 0x0000, 0x9999,
535 "Apple",
536 "iPod",
537 US_SC_DEVICE, US_PR_DEVICE, NULL,
538 US_FL_FIX_CAPACITY ),
539
520/* Reported by Avi Kivity <avi@argo.co.il> */ 540/* Reported by Avi Kivity <avi@argo.co.il> */
521UNUSUAL_DEV( 0x05ac, 0x1203, 0x0001, 0x0001, 541UNUSUAL_DEV( 0x05ac, 0x1203, 0x0000, 0x9999,
522 "Apple", 542 "Apple",
523 "iPod", 543 "iPod",
524 US_SC_DEVICE, US_PR_DEVICE, NULL, 544 US_SC_DEVICE, US_PR_DEVICE, NULL,
525 US_FL_FIX_CAPACITY ), 545 US_FL_FIX_CAPACITY ),
526 546
527UNUSUAL_DEV( 0x05ac, 0x1205, 0x0001, 0x0001, 547UNUSUAL_DEV( 0x05ac, 0x1204, 0x0000, 0x9999,
548 "Apple",
549 "iPod",
550 US_SC_DEVICE, US_PR_DEVICE, NULL,
551 US_FL_FIX_CAPACITY ),
552
553UNUSUAL_DEV( 0x05ac, 0x1205, 0x0000, 0x9999,
528 "Apple", 554 "Apple",
529 "iPod", 555 "iPod",
530 US_SC_DEVICE, US_PR_DEVICE, NULL, 556 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -976,6 +1002,13 @@ UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x9999,
976 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 1002 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
977 0 ), 1003 0 ),
978 1004
1005/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
1006UNUSUAL_DEV( 0x132b, 0x000b, 0x0001, 0x0001,
1007 "Minolta",
1008 "Dimage Z10",
1009 US_SC_DEVICE, US_PR_DEVICE, NULL,
1010 0 ),
1011
979/* Reported by Kotrla Vitezslav <kotrla@ceb.cz> */ 1012/* Reported by Kotrla Vitezslav <kotrla@ceb.cz> */
980UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, 1013UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110,
981 "SWISSBIT", 1014 "SWISSBIT",