aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-01 13:41:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-01 13:41:05 -0500
commite272a186435e747b25b01afb38d172853219fbda (patch)
treee7344dd9370bdf2e76a92f235ebc80792f77c620 /drivers
parente8ed34ced175f2670f86c0bebc41af1628952b92 (diff)
parent0ec8648379334f1e127ebd5e57a625890f116824 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: USB: Add support for Mobilcom Debitel USB UMTS Surf-Stick to option driver USB: work around for EHCI with quirky periodic schedules USB: musb: Fix CPPI IRQs not being signaled USB: musb: respect usb_request->zero in control requests USB: musb: fix ISOC Tx programming for CPPI DMAs USB: musb: Remove unwanted message in boot log usb: amd5536udc: fixed shared interrupt bug and warning oops USB: ftdi_sio: Keep going when write errors are encountered. USB: musb_gadget: fix STALL handling USB: EHCI: don't send Clear-TT-Buffer following a STALL
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/gadget/amd5536udc.c49
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-pci.c4
-rw-r--r--drivers/usb/host/ehci-q.c16
-rw-r--r--drivers/usb/host/ehci-sched.c12
-rw-r--r--drivers/usb/host/ehci.h2
-rw-r--r--drivers/usb/musb/cppi_dma.c10
-rw-r--r--drivers/usb/musb/musb_core.c4
-rw-r--r--drivers/usb/musb/musb_gadget.c79
-rw-r--r--drivers/usb/musb/musb_gadget_ep0.c3
-rw-r--r--drivers/usb/musb/musb_host.c5
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/option.c5
14 files changed, 118 insertions, 78 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 5ce839137ad6..0f857e645058 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -444,7 +444,7 @@ resubmit:
444static inline int 444static inline int
445hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) 445hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
446{ 446{
447 return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), 447 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
448 HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo, 448 HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
449 tt, NULL, 0, 1000); 449 tt, NULL, 0, 1000);
450} 450}
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index d5b65962dd36..731150d4b1d9 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -1213,7 +1213,12 @@ udc_queue(struct usb_ep *usbep, struct usb_request *usbreq, gfp_t gfp)
1213 tmp &= AMD_UNMASK_BIT(ep->num); 1213 tmp &= AMD_UNMASK_BIT(ep->num);
1214 writel(tmp, &dev->regs->ep_irqmsk); 1214 writel(tmp, &dev->regs->ep_irqmsk);
1215 } 1215 }
1216 } 1216 } else if (ep->in) {
1217 /* enable ep irq */
1218 tmp = readl(&dev->regs->ep_irqmsk);
1219 tmp &= AMD_UNMASK_BIT(ep->num);
1220 writel(tmp, &dev->regs->ep_irqmsk);
1221 }
1217 1222
1218 } else if (ep->dma) { 1223 } else if (ep->dma) {
1219 1224
@@ -2005,18 +2010,17 @@ __acquires(dev->lock)
2005{ 2010{
2006 int tmp; 2011 int tmp;
2007 2012
2008 /* empty queues and init hardware */
2009 udc_basic_init(dev);
2010 for (tmp = 0; tmp < UDC_EP_NUM; tmp++) {
2011 empty_req_queue(&dev->ep[tmp]);
2012 }
2013
2014 if (dev->gadget.speed != USB_SPEED_UNKNOWN) { 2013 if (dev->gadget.speed != USB_SPEED_UNKNOWN) {
2015 spin_unlock(&dev->lock); 2014 spin_unlock(&dev->lock);
2016 driver->disconnect(&dev->gadget); 2015 driver->disconnect(&dev->gadget);
2017 spin_lock(&dev->lock); 2016 spin_lock(&dev->lock);
2018 } 2017 }
2019 /* init */ 2018
2019 /* empty queues and init hardware */
2020 udc_basic_init(dev);
2021 for (tmp = 0; tmp < UDC_EP_NUM; tmp++)
2022 empty_req_queue(&dev->ep[tmp]);
2023
2020 udc_setup_endpoints(dev); 2024 udc_setup_endpoints(dev);
2021} 2025}
2022 2026
@@ -2472,6 +2476,13 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
2472 } 2476 }
2473 } 2477 }
2474 2478
2479 } else if (!use_dma && ep->in) {
2480 /* disable interrupt */
2481 tmp = readl(
2482 &dev->regs->ep_irqmsk);
2483 tmp |= AMD_BIT(ep->num);
2484 writel(tmp,
2485 &dev->regs->ep_irqmsk);
2475 } 2486 }
2476 } 2487 }
2477 /* clear status bits */ 2488 /* clear status bits */
@@ -3279,6 +3290,17 @@ static int udc_pci_probe(
3279 goto finished; 3290 goto finished;
3280 } 3291 }
3281 3292
3293 spin_lock_init(&dev->lock);
3294 /* udc csr registers base */
3295 dev->csr = dev->virt_addr + UDC_CSR_ADDR;
3296 /* dev registers base */
3297 dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR;
3298 /* ep registers base */
3299 dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR;
3300 /* fifo's base */
3301 dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR);
3302 dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR);
3303
3282 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { 3304 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) {
3283 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); 3305 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq);
3284 kfree(dev); 3306 kfree(dev);
@@ -3331,7 +3353,6 @@ static int udc_probe(struct udc *dev)
3331 udc_pollstall_timer.data = 0; 3353 udc_pollstall_timer.data = 0;
3332 3354
3333 /* device struct setup */ 3355 /* device struct setup */
3334 spin_lock_init(&dev->lock);
3335 dev->gadget.ops = &udc_ops; 3356 dev->gadget.ops = &udc_ops;
3336 3357
3337 dev_set_name(&dev->gadget.dev, "gadget"); 3358 dev_set_name(&dev->gadget.dev, "gadget");
@@ -3340,16 +3361,6 @@ static int udc_probe(struct udc *dev)
3340 dev->gadget.name = name; 3361 dev->gadget.name = name;
3341 dev->gadget.is_dualspeed = 1; 3362 dev->gadget.is_dualspeed = 1;
3342 3363
3343 /* udc csr registers base */
3344 dev->csr = dev->virt_addr + UDC_CSR_ADDR;
3345 /* dev registers base */
3346 dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR;
3347 /* ep registers base */
3348 dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR;
3349 /* fifo's base */
3350 dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR);
3351 dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR);
3352
3353 /* init registers, interrupts, ... */ 3364 /* init registers, interrupts, ... */
3354 startup_registers(dev); 3365 startup_registers(dev);
3355 3366
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 9835e0713943..f5f5601701c9 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -28,6 +28,7 @@
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/timer.h> 30#include <linux/timer.h>
31#include <linux/ktime.h>
31#include <linux/list.h> 32#include <linux/list.h>
32#include <linux/interrupt.h> 33#include <linux/interrupt.h>
33#include <linux/usb.h> 34#include <linux/usb.h>
@@ -676,6 +677,7 @@ static int ehci_run (struct usb_hcd *hcd)
676 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ 677 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
677 msleep(5); 678 msleep(5);
678 up_write(&ehci_cf_port_reset_rwsem); 679 up_write(&ehci_cf_port_reset_rwsem);
680 ehci->last_periodic_enable = ktime_get_real();
679 681
680 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); 682 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
681 ehci_info (ehci, 683 ehci_info (ehci,
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 378861b9d79a..ead5f4f2aa5a 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -111,6 +111,10 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
111 switch (pdev->vendor) { 111 switch (pdev->vendor) {
112 case PCI_VENDOR_ID_INTEL: 112 case PCI_VENDOR_ID_INTEL:
113 ehci->need_io_watchdog = 0; 113 ehci->need_io_watchdog = 0;
114 if (pdev->device == 0x27cc) {
115 ehci->broken_periodic = 1;
116 ehci_info(ehci, "using broken periodic workaround\n");
117 }
114 break; 118 break;
115 case PCI_VENDOR_ID_TDI: 119 case PCI_VENDOR_ID_TDI:
116 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 120 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 00ad9ce392ed..139a2cc3f641 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -487,8 +487,20 @@ halt:
487 * we must clear the TT buffer (11.17.5). 487 * we must clear the TT buffer (11.17.5).
488 */ 488 */
489 if (unlikely(last_status != -EINPROGRESS && 489 if (unlikely(last_status != -EINPROGRESS &&
490 last_status != -EREMOTEIO)) 490 last_status != -EREMOTEIO)) {
491 ehci_clear_tt_buffer(ehci, qh, urb, token); 491 /* The TT's in some hubs malfunction when they
492 * receive this request following a STALL (they
493 * stop sending isochronous packets). Since a
494 * STALL can't leave the TT buffer in a busy
495 * state (if you believe Figures 11-48 - 11-51
496 * in the USB 2.0 spec), we won't clear the TT
497 * buffer in this case. Strictly speaking this
498 * is a violation of the spec.
499 */
500 if (last_status != -EPIPE)
501 ehci_clear_tt_buffer(ehci, qh, urb,
502 token);
503 }
492 } 504 }
493 505
494 /* if we're removing something not at the queue head, 506 /* if we're removing something not at the queue head,
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index b25cdea93a1f..a5535b5e3fe2 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -475,6 +475,8 @@ static int enable_periodic (struct ehci_hcd *ehci)
475 /* make sure ehci_work scans these */ 475 /* make sure ehci_work scans these */
476 ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index) 476 ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index)
477 % (ehci->periodic_size << 3); 477 % (ehci->periodic_size << 3);
478 if (unlikely(ehci->broken_periodic))
479 ehci->last_periodic_enable = ktime_get_real();
478 return 0; 480 return 0;
479} 481}
480 482
@@ -486,6 +488,16 @@ static int disable_periodic (struct ehci_hcd *ehci)
486 if (--ehci->periodic_sched) 488 if (--ehci->periodic_sched)
487 return 0; 489 return 0;
488 490
491 if (unlikely(ehci->broken_periodic)) {
492 /* delay experimentally determined */
493 ktime_t safe = ktime_add_us(ehci->last_periodic_enable, 1000);
494 ktime_t now = ktime_get_real();
495 s64 delay = ktime_us_delta(safe, now);
496
497 if (unlikely(delay > 0))
498 udelay(delay);
499 }
500
489 /* did setting PSE not take effect yet? 501 /* did setting PSE not take effect yet?
490 * takes effect only at frame boundaries... 502 * takes effect only at frame boundaries...
491 */ 503 */
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 064e76821ff5..2d85e21ff282 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -118,6 +118,7 @@ struct ehci_hcd { /* one per controller */
118 unsigned stamp; 118 unsigned stamp;
119 unsigned random_frame; 119 unsigned random_frame;
120 unsigned long next_statechange; 120 unsigned long next_statechange;
121 ktime_t last_periodic_enable;
121 u32 command; 122 u32 command;
122 123
123 /* SILICON QUIRKS */ 124 /* SILICON QUIRKS */
@@ -127,6 +128,7 @@ struct ehci_hcd { /* one per controller */
127 unsigned big_endian_desc:1; 128 unsigned big_endian_desc:1;
128 unsigned has_amcc_usb23:1; 129 unsigned has_amcc_usb23:1;
129 unsigned need_io_watchdog:1; 130 unsigned need_io_watchdog:1;
131 unsigned broken_periodic:1;
130 132
131 /* required for usb32 quirk */ 133 /* required for usb32 quirk */
132 #define OHCI_CTRL_HCFS (3 << 6) 134 #define OHCI_CTRL_HCFS (3 << 6)
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index c3577bbbae6c..ef2332a9941d 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -1442,11 +1442,6 @@ static int cppi_channel_abort(struct dma_channel *channel)
1442 musb_writew(regs, MUSB_TXCSR, value); 1442 musb_writew(regs, MUSB_TXCSR, value);
1443 musb_writew(regs, MUSB_TXCSR, value); 1443 musb_writew(regs, MUSB_TXCSR, value);
1444 1444
1445 /* re-enable interrupt */
1446 if (enabled)
1447 musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG,
1448 (1 << cppi_ch->index));
1449
1450 /* While we scrub the TX state RAM, ensure that we clean 1445 /* While we scrub the TX state RAM, ensure that we clean
1451 * up any interrupt that's currently asserted: 1446 * up any interrupt that's currently asserted:
1452 * 1. Write to completion Ptr value 0x1(bit 0 set) 1447 * 1. Write to completion Ptr value 0x1(bit 0 set)
@@ -1459,6 +1454,11 @@ static int cppi_channel_abort(struct dma_channel *channel)
1459 cppi_reset_tx(tx_ram, 1); 1454 cppi_reset_tx(tx_ram, 1);
1460 musb_writel(&tx_ram->tx_complete, 0, 0); 1455 musb_writel(&tx_ram->tx_complete, 0, 0);
1461 1456
1457 /* re-enable interrupt */
1458 if (enabled)
1459 musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG,
1460 (1 << cppi_ch->index));
1461
1462 cppi_dump_tx(5, cppi_ch, " (done teardown)"); 1462 cppi_dump_tx(5, cppi_ch, " (done teardown)");
1463 1463
1464 /* REVISIT tx side _should_ clean up the same way 1464 /* REVISIT tx side _should_ clean up the same way
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 3a61ddb62bd2..547e0e390726 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1450,7 +1450,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1450#endif 1450#endif
1451 1451
1452 if (hw_ep->max_packet_sz_tx) { 1452 if (hw_ep->max_packet_sz_tx) {
1453 printk(KERN_DEBUG 1453 DBG(1,
1454 "%s: hw_ep %d%s, %smax %d\n", 1454 "%s: hw_ep %d%s, %smax %d\n",
1455 musb_driver_name, i, 1455 musb_driver_name, i,
1456 hw_ep->is_shared_fifo ? "shared" : "tx", 1456 hw_ep->is_shared_fifo ? "shared" : "tx",
@@ -1459,7 +1459,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1459 hw_ep->max_packet_sz_tx); 1459 hw_ep->max_packet_sz_tx);
1460 } 1460 }
1461 if (hw_ep->max_packet_sz_rx && !hw_ep->is_shared_fifo) { 1461 if (hw_ep->max_packet_sz_rx && !hw_ep->is_shared_fifo) {
1462 printk(KERN_DEBUG 1462 DBG(1,
1463 "%s: hw_ep %d%s, %smax %d\n", 1463 "%s: hw_ep %d%s, %smax %d\n",
1464 musb_driver_name, i, 1464 musb_driver_name, i,
1465 "rx", 1465 "rx",
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 8b3c4e2ed7b8..74073f9a43f0 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -4,6 +4,7 @@
4 * Copyright 2005 Mentor Graphics Corporation 4 * Copyright 2005 Mentor Graphics Corporation
5 * Copyright (C) 2005-2006 by Texas Instruments 5 * Copyright (C) 2005-2006 by Texas Instruments
6 * Copyright (C) 2006-2007 Nokia Corporation 6 * Copyright (C) 2006-2007 Nokia Corporation
7 * Copyright (C) 2009 MontaVista Software, Inc. <source@mvista.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
@@ -436,14 +437,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
436 csr |= MUSB_TXCSR_P_WZC_BITS; 437 csr |= MUSB_TXCSR_P_WZC_BITS;
437 csr &= ~MUSB_TXCSR_P_SENTSTALL; 438 csr &= ~MUSB_TXCSR_P_SENTSTALL;
438 musb_writew(epio, MUSB_TXCSR, csr); 439 musb_writew(epio, MUSB_TXCSR, csr);
439 if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
440 dma->status = MUSB_DMA_STATUS_CORE_ABORT;
441 musb->dma_controller->channel_abort(dma);
442 }
443
444 if (request)
445 musb_g_giveback(musb_ep, request, -EPIPE);
446
447 break; 440 break;
448 } 441 }
449 442
@@ -582,15 +575,25 @@ void musb_g_tx(struct musb *musb, u8 epnum)
582 */ 575 */
583static void rxstate(struct musb *musb, struct musb_request *req) 576static void rxstate(struct musb *musb, struct musb_request *req)
584{ 577{
585 u16 csr = 0;
586 const u8 epnum = req->epnum; 578 const u8 epnum = req->epnum;
587 struct usb_request *request = &req->request; 579 struct usb_request *request = &req->request;
588 struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; 580 struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out;
589 void __iomem *epio = musb->endpoints[epnum].regs; 581 void __iomem *epio = musb->endpoints[epnum].regs;
590 unsigned fifo_count = 0; 582 unsigned fifo_count = 0;
591 u16 len = musb_ep->packet_sz; 583 u16 len = musb_ep->packet_sz;
584 u16 csr = musb_readw(epio, MUSB_RXCSR);
592 585
593 csr = musb_readw(epio, MUSB_RXCSR); 586 /* We shouldn't get here while DMA is active, but we do... */
587 if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) {
588 DBG(4, "DMA pending...\n");
589 return;
590 }
591
592 if (csr & MUSB_RXCSR_P_SENDSTALL) {
593 DBG(5, "%s stalling, RXCSR %04x\n",
594 musb_ep->end_point.name, csr);
595 return;
596 }
594 597
595 if (is_cppi_enabled() && musb_ep->dma) { 598 if (is_cppi_enabled() && musb_ep->dma) {
596 struct dma_controller *c = musb->dma_controller; 599 struct dma_controller *c = musb->dma_controller;
@@ -761,19 +764,10 @@ void musb_g_rx(struct musb *musb, u8 epnum)
761 csr, dma ? " (dma)" : "", request); 764 csr, dma ? " (dma)" : "", request);
762 765
763 if (csr & MUSB_RXCSR_P_SENTSTALL) { 766 if (csr & MUSB_RXCSR_P_SENTSTALL) {
764 if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
765 dma->status = MUSB_DMA_STATUS_CORE_ABORT;
766 (void) musb->dma_controller->channel_abort(dma);
767 request->actual += musb_ep->dma->actual_len;
768 }
769
770 csr |= MUSB_RXCSR_P_WZC_BITS; 767 csr |= MUSB_RXCSR_P_WZC_BITS;
771 csr &= ~MUSB_RXCSR_P_SENTSTALL; 768 csr &= ~MUSB_RXCSR_P_SENTSTALL;
772 musb_writew(epio, MUSB_RXCSR, csr); 769 musb_writew(epio, MUSB_RXCSR, csr);
773 770 return;
774 if (request)
775 musb_g_giveback(musb_ep, request, -EPIPE);
776 goto done;
777 } 771 }
778 772
779 if (csr & MUSB_RXCSR_P_OVERRUN) { 773 if (csr & MUSB_RXCSR_P_OVERRUN) {
@@ -795,7 +789,7 @@ void musb_g_rx(struct musb *musb, u8 epnum)
795 DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1, 789 DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1,
796 "%s busy, csr %04x\n", 790 "%s busy, csr %04x\n",
797 musb_ep->end_point.name, csr); 791 musb_ep->end_point.name, csr);
798 goto done; 792 return;
799 } 793 }
800 794
801 if (dma && (csr & MUSB_RXCSR_DMAENAB)) { 795 if (dma && (csr & MUSB_RXCSR_DMAENAB)) {
@@ -826,22 +820,15 @@ void musb_g_rx(struct musb *musb, u8 epnum)
826 if ((request->actual < request->length) 820 if ((request->actual < request->length)
827 && (musb_ep->dma->actual_len 821 && (musb_ep->dma->actual_len
828 == musb_ep->packet_sz)) 822 == musb_ep->packet_sz))
829 goto done; 823 return;
830#endif 824#endif
831 musb_g_giveback(musb_ep, request, 0); 825 musb_g_giveback(musb_ep, request, 0);
832 826
833 request = next_request(musb_ep); 827 request = next_request(musb_ep);
834 if (!request) 828 if (!request)
835 goto done; 829 return;
836
837 /* don't start more i/o till the stall clears */
838 musb_ep_select(mbase, epnum);
839 csr = musb_readw(epio, MUSB_RXCSR);
840 if (csr & MUSB_RXCSR_P_SENDSTALL)
841 goto done;
842 } 830 }
843 831
844
845 /* analyze request if the ep is hot */ 832 /* analyze request if the ep is hot */
846 if (request) 833 if (request)
847 rxstate(musb, to_musb_request(request)); 834 rxstate(musb, to_musb_request(request));
@@ -849,8 +836,6 @@ void musb_g_rx(struct musb *musb, u8 epnum)
849 DBG(3, "packet waiting for %s%s request\n", 836 DBG(3, "packet waiting for %s%s request\n",
850 musb_ep->desc ? "" : "inactive ", 837 musb_ep->desc ? "" : "inactive ",
851 musb_ep->end_point.name); 838 musb_ep->end_point.name);
852
853done:
854 return; 839 return;
855} 840}
856 841
@@ -1244,7 +1229,7 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value)
1244 void __iomem *mbase; 1229 void __iomem *mbase;
1245 unsigned long flags; 1230 unsigned long flags;
1246 u16 csr; 1231 u16 csr;
1247 struct musb_request *request = NULL; 1232 struct musb_request *request;
1248 int status = 0; 1233 int status = 0;
1249 1234
1250 if (!ep) 1235 if (!ep)
@@ -1260,24 +1245,29 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value)
1260 1245
1261 musb_ep_select(mbase, epnum); 1246 musb_ep_select(mbase, epnum);
1262 1247
1263 /* cannot portably stall with non-empty FIFO */
1264 request = to_musb_request(next_request(musb_ep)); 1248 request = to_musb_request(next_request(musb_ep));
1265 if (value && musb_ep->is_in) { 1249 if (value) {
1266 csr = musb_readw(epio, MUSB_TXCSR); 1250 if (request) {
1267 if (csr & MUSB_TXCSR_FIFONOTEMPTY) { 1251 DBG(3, "request in progress, cannot halt %s\n",
1268 DBG(3, "%s fifo busy, cannot halt\n", ep->name); 1252 ep->name);
1269 spin_unlock_irqrestore(&musb->lock, flags); 1253 status = -EAGAIN;
1270 return -EAGAIN; 1254 goto done;
1255 }
1256 /* Cannot portably stall with non-empty FIFO */
1257 if (musb_ep->is_in) {
1258 csr = musb_readw(epio, MUSB_TXCSR);
1259 if (csr & MUSB_TXCSR_FIFONOTEMPTY) {
1260 DBG(3, "FIFO busy, cannot halt %s\n", ep->name);
1261 status = -EAGAIN;
1262 goto done;
1263 }
1271 } 1264 }
1272
1273 } 1265 }
1274 1266
1275 /* set/clear the stall and toggle bits */ 1267 /* set/clear the stall and toggle bits */
1276 DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear"); 1268 DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear");
1277 if (musb_ep->is_in) { 1269 if (musb_ep->is_in) {
1278 csr = musb_readw(epio, MUSB_TXCSR); 1270 csr = musb_readw(epio, MUSB_TXCSR);
1279 if (csr & MUSB_TXCSR_FIFONOTEMPTY)
1280 csr |= MUSB_TXCSR_FLUSHFIFO;
1281 csr |= MUSB_TXCSR_P_WZC_BITS 1271 csr |= MUSB_TXCSR_P_WZC_BITS
1282 | MUSB_TXCSR_CLRDATATOG; 1272 | MUSB_TXCSR_CLRDATATOG;
1283 if (value) 1273 if (value)
@@ -1300,14 +1290,13 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value)
1300 musb_writew(epio, MUSB_RXCSR, csr); 1290 musb_writew(epio, MUSB_RXCSR, csr);
1301 } 1291 }
1302 1292
1303done:
1304
1305 /* maybe start the first request in the queue */ 1293 /* maybe start the first request in the queue */
1306 if (!musb_ep->busy && !value && request) { 1294 if (!musb_ep->busy && !value && request) {
1307 DBG(3, "restarting the request\n"); 1295 DBG(3, "restarting the request\n");
1308 musb_ep_restart(musb, request); 1296 musb_ep_restart(musb, request);
1309 } 1297 }
1310 1298
1299done:
1311 spin_unlock_irqrestore(&musb->lock, flags); 1300 spin_unlock_irqrestore(&musb->lock, flags);
1312 return status; 1301 return status;
1313} 1302}
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 7a6778675ad3..522efb31b56b 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -511,7 +511,8 @@ static void ep0_txstate(struct musb *musb)
511 511
512 /* update the flags */ 512 /* update the flags */
513 if (fifo_count < MUSB_MAX_END0_PACKET 513 if (fifo_count < MUSB_MAX_END0_PACKET
514 || request->actual == request->length) { 514 || (request->actual == request->length
515 && !request->zero)) {
515 musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT; 516 musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT;
516 csr |= MUSB_CSR0_P_DATAEND; 517 csr |= MUSB_CSR0_P_DATAEND;
517 } else 518 } else
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index cf94511485f2..e3ab40a966eb 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1301,8 +1301,11 @@ void musb_host_tx(struct musb *musb, u8 epnum)
1301 return; 1301 return;
1302 } else if (usb_pipeisoc(pipe) && dma) { 1302 } else if (usb_pipeisoc(pipe) && dma) {
1303 if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, 1303 if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb,
1304 offset, length)) 1304 offset, length)) {
1305 if (is_cppi_enabled() || tusb_dma_omap())
1306 musb_h_tx_dma_start(hw_ep);
1305 return; 1307 return;
1308 }
1306 } else if (tx_csr & MUSB_TXCSR_DMAENAB) { 1309 } else if (tx_csr & MUSB_TXCSR_DMAENAB) {
1307 DBG(1, "not complete, but DMA enabled?\n"); 1310 DBG(1, "not complete, but DMA enabled?\n");
1308 return; 1311 return;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 9c60d6d4908a..ebcc6d0e2e91 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1937,7 +1937,7 @@ static void ftdi_write_bulk_callback(struct urb *urb)
1937 return; 1937 return;
1938 } 1938 }
1939 /* account for transferred data */ 1939 /* account for transferred data */
1940 countback = urb->actual_length; 1940 countback = urb->transfer_buffer_length;
1941 data_offset = priv->write_offset; 1941 data_offset = priv->write_offset;
1942 if (data_offset > 0) { 1942 if (data_offset > 0) {
1943 /* Subtract the control bytes */ 1943 /* Subtract the control bytes */
@@ -1950,7 +1950,6 @@ static void ftdi_write_bulk_callback(struct urb *urb)
1950 1950
1951 if (status) { 1951 if (status) {
1952 dbg("nonzero write bulk status received: %d", status); 1952 dbg("nonzero write bulk status received: %d", status);
1953 return;
1954 } 1953 }
1955 1954
1956 usb_serial_port_softint(port); 1955 usb_serial_port_softint(port);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 319aaf9725b3..0577e4b61114 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -336,6 +336,10 @@ static int option_resume(struct usb_serial *serial);
336#define AIRPLUS_VENDOR_ID 0x1011 336#define AIRPLUS_VENDOR_ID 0x1011
337#define AIRPLUS_PRODUCT_MCD650 0x3198 337#define AIRPLUS_PRODUCT_MCD650 0x3198
338 338
339/* 4G Systems products */
340#define FOUR_G_SYSTEMS_VENDOR_ID 0x1c9e
341#define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
342
339static struct usb_device_id option_ids[] = { 343static struct usb_device_id option_ids[] = {
340 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 344 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
341 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 345 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -599,6 +603,7 @@ static struct usb_device_id option_ids[] = {
599 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, 603 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
600 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, 604 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
601 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, 605 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
606 { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14) },
602 { } /* Terminating entry */ 607 { } /* Terminating entry */
603}; 608};
604MODULE_DEVICE_TABLE(usb, option_ids); 609MODULE_DEVICE_TABLE(usb, option_ids);