aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2011-11-26 22:46:19 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-26 22:46:48 -0500
commit47b649590dbbea182f854d6470ee1cd59b7b7684 (patch)
treea2de3610f9c5e963234cffb35b9d559aab62e164 /drivers/usb
parent3af5154a869bc278a829bb03e65a709480e821b0 (diff)
parentcaca6a03d365883564885f2c1da3e88dcf65d139 (diff)
Merge 3.2-rc3 into usb-linus
This pulls in the latest USB bugfixes and helps a few of the drivers merge nicer in the future due to changes in both branches. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/class/cdc-acm.c8
-rw-r--r--drivers/usb/core/hub.c6
-rw-r--r--drivers/usb/core/quirks.c27
-rw-r--r--drivers/usb/dwc3/gadget.c1
-rw-r--r--drivers/usb/gadget/Kconfig9
-rw-r--r--drivers/usb/gadget/ci13xxx_msm.c2
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.c21
-rw-r--r--drivers/usb/gadget/f_mass_storage.c6
-rw-r--r--drivers/usb/gadget/f_midi.c138
-rw-r--r--drivers/usb/gadget/f_phonet.c2
-rw-r--r--drivers/usb/gadget/file_storage.c4
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c5
-rw-r--r--drivers/usb/gadget/inode.c5
-rw-r--r--drivers/usb/gadget/pch_udc.c10
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c30
-rw-r--r--drivers/usb/gadget/udc-core.c10
-rw-r--r--drivers/usb/host/ehci-sched.c15
-rw-r--r--drivers/usb/host/ehci-xls.c2
-rw-r--r--drivers/usb/host/ohci-at91.c6
-rw-r--r--drivers/usb/host/ohci-hcd.c15
-rw-r--r--drivers/usb/host/ohci-pci.c26
-rw-r--r--drivers/usb/host/ohci.h1
-rw-r--r--drivers/usb/host/pci-quirks.c57
-rw-r--r--drivers/usb/host/xhci-mem.c5
-rw-r--r--drivers/usb/host/xhci-ring.c13
-rw-r--r--drivers/usb/host/xhci.c34
-rw-r--r--drivers/usb/musb/Kconfig3
-rw-r--r--drivers/usb/musb/am35x.c1
-rw-r--r--drivers/usb/musb/da8xx.c1
-rw-r--r--drivers/usb/musb/musb_core.c3
-rw-r--r--drivers/usb/musb/musb_gadget.c4
-rw-r--r--drivers/usb/renesas_usbhs/common.c2
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c4
-rw-r--r--drivers/usb/renesas_usbhs/mod.h8
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c4
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c63
-rw-r--r--drivers/usb/serial/ark3116.c10
-rw-r--r--drivers/usb/serial/ftdi_sio.c14
-rw-r--r--drivers/usb/serial/option.c28
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h4
-rw-r--r--drivers/usb/storage/ene_ub6250.c3
-rw-r--r--drivers/usb/storage/protocol.c7
43 files changed, 334 insertions, 284 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 6960715c5063..e8c564a53346 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -539,7 +539,6 @@ static void acm_port_down(struct acm *acm)
539{ 539{
540 int i; 540 int i;
541 541
542 mutex_lock(&open_mutex);
543 if (acm->dev) { 542 if (acm->dev) {
544 usb_autopm_get_interface(acm->control); 543 usb_autopm_get_interface(acm->control);
545 acm_set_control(acm, acm->ctrlout = 0); 544 acm_set_control(acm, acm->ctrlout = 0);
@@ -551,14 +550,15 @@ static void acm_port_down(struct acm *acm)
551 acm->control->needs_remote_wakeup = 0; 550 acm->control->needs_remote_wakeup = 0;
552 usb_autopm_put_interface(acm->control); 551 usb_autopm_put_interface(acm->control);
553 } 552 }
554 mutex_unlock(&open_mutex);
555} 553}
556 554
557static void acm_tty_hangup(struct tty_struct *tty) 555static void acm_tty_hangup(struct tty_struct *tty)
558{ 556{
559 struct acm *acm = tty->driver_data; 557 struct acm *acm = tty->driver_data;
560 tty_port_hangup(&acm->port); 558 tty_port_hangup(&acm->port);
559 mutex_lock(&open_mutex);
561 acm_port_down(acm); 560 acm_port_down(acm);
561 mutex_unlock(&open_mutex);
562} 562}
563 563
564static void acm_tty_close(struct tty_struct *tty, struct file *filp) 564static void acm_tty_close(struct tty_struct *tty, struct file *filp)
@@ -569,8 +569,9 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
569 shutdown */ 569 shutdown */
570 if (!acm) 570 if (!acm)
571 return; 571 return;
572
573 mutex_lock(&open_mutex);
572 if (tty_port_close_start(&acm->port, tty, filp) == 0) { 574 if (tty_port_close_start(&acm->port, tty, filp) == 0) {
573 mutex_lock(&open_mutex);
574 if (!acm->dev) { 575 if (!acm->dev) {
575 tty_port_tty_set(&acm->port, NULL); 576 tty_port_tty_set(&acm->port, NULL);
576 acm_tty_unregister(acm); 577 acm_tty_unregister(acm);
@@ -582,6 +583,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
582 acm_port_down(acm); 583 acm_port_down(acm);
583 tty_port_close_end(&acm->port, tty); 584 tty_port_close_end(&acm->port, tty);
584 tty_port_tty_set(&acm->port, NULL); 585 tty_port_tty_set(&acm->port, NULL);
586 mutex_unlock(&open_mutex);
585} 587}
586 588
587static int acm_tty_write(struct tty_struct *tty, 589static int acm_tty_write(struct tty_struct *tty,
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 96f05b29c9ad..79781461eec9 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -813,6 +813,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
813 USB_PORT_FEAT_C_PORT_LINK_STATE); 813 USB_PORT_FEAT_C_PORT_LINK_STATE);
814 } 814 }
815 815
816 if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
817 hub_is_superspeed(hub->hdev)) {
818 need_debounce_delay = true;
819 clear_port_feature(hub->hdev, port1,
820 USB_PORT_FEAT_C_BH_PORT_RESET);
821 }
816 /* We can forget about a "removed" device when there's a 822 /* We can forget about a "removed" device when there's a
817 * physical disconnect or the connect status changes. 823 * physical disconnect or the connect status changes.
818 */ 824 */
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d6a8d8269bfb..ecf12e15a7ef 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -50,15 +50,42 @@ static const struct usb_device_id usb_quirk_list[] = {
50 /* Logitech Webcam B/C500 */ 50 /* Logitech Webcam B/C500 */
51 { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME }, 51 { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
52 52
53 /* Logitech Webcam C600 */
54 { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
55
53 /* Logitech Webcam Pro 9000 */ 56 /* Logitech Webcam Pro 9000 */
54 { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME }, 57 { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
55 58
59 /* Logitech Webcam C905 */
60 { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
61
62 /* Logitech Webcam C210 */
63 { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
64
65 /* Logitech Webcam C260 */
66 { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
67
56 /* Logitech Webcam C310 */ 68 /* Logitech Webcam C310 */
57 { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME }, 69 { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
58 70
71 /* Logitech Webcam C910 */
72 { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
73
74 /* Logitech Webcam C160 */
75 { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
76
59 /* Logitech Webcam C270 */ 77 /* Logitech Webcam C270 */
60 { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, 78 { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
61 79
80 /* Logitech Quickcam Pro 9000 */
81 { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
82
83 /* Logitech Quickcam E3500 */
84 { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
85
86 /* Logitech Quickcam Vision Pro */
87 { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
88
62 /* Logitech Harmony 700-series */ 89 /* Logitech Harmony 700-series */
63 { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT }, 90 { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
64 91
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index fa824cfdd2eb..25dbd8614e72 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1284,6 +1284,7 @@ static int __devinit dwc3_gadget_init_endpoints(struct dwc3 *dwc)
1284 int ret; 1284 int ret;
1285 1285
1286 dep->endpoint.maxpacket = 1024; 1286 dep->endpoint.maxpacket = 1024;
1287 dep->endpoint.max_streams = 15;
1287 dep->endpoint.ops = &dwc3_gadget_ep_ops; 1288 dep->endpoint.ops = &dwc3_gadget_ep_ops;
1288 list_add_tail(&dep->endpoint.ep_list, 1289 list_add_tail(&dep->endpoint.ep_list,
1289 &dwc->gadget.ep_list); 1290 &dwc->gadget.ep_list);
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index a11dbc85d08b..3162a7da8724 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -470,7 +470,7 @@ config USB_LANGWELL
470 gadget drivers to also be dynamically linked. 470 gadget drivers to also be dynamically linked.
471 471
472config USB_EG20T 472config USB_EG20T
473 tristate "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC" 473 tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC"
474 depends on PCI 474 depends on PCI
475 select USB_GADGET_DUALSPEED 475 select USB_GADGET_DUALSPEED
476 help 476 help
@@ -486,10 +486,11 @@ config USB_EG20T
486 This driver dose not support interrupt transfer or isochronous 486 This driver dose not support interrupt transfer or isochronous
487 transfer modes. 487 transfer modes.
488 488
489 This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is 489 This driver also can be used for LAPIS Semiconductor's ML7213 which is
490 for IVI(In-Vehicle Infotainment) use. 490 for IVI(In-Vehicle Infotainment) use.
491 ML7213 is companion chip for Intel Atom E6xx series. 491 ML7831 is for general purpose use.
492 ML7213 is completely compatible for Intel EG20T PCH. 492 ML7213/ML7831 is companion chip for Intel Atom E6xx series.
493 ML7213/ML7831 is completely compatible for Intel EG20T PCH.
493 494
494config USB_CI13XXX_MSM 495config USB_CI13XXX_MSM
495 tristate "MIPS USB CI13xxx for MSM" 496 tristate "MIPS USB CI13xxx for MSM"
diff --git a/drivers/usb/gadget/ci13xxx_msm.c b/drivers/usb/gadget/ci13xxx_msm.c
index 4eedfe557154..1fc612914c52 100644
--- a/drivers/usb/gadget/ci13xxx_msm.c
+++ b/drivers/usb/gadget/ci13xxx_msm.c
@@ -122,3 +122,5 @@ static int __init ci13xxx_msm_init(void)
122 return platform_driver_register(&ci13xxx_msm_driver); 122 return platform_driver_register(&ci13xxx_msm_driver);
123} 123}
124module_init(ci13xxx_msm_init); 124module_init(ci13xxx_msm_init);
125
126MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 83428f56253b..9a0c3979ff43 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -71,6 +71,9 @@
71/****************************************************************************** 71/******************************************************************************
72 * DEFINE 72 * DEFINE
73 *****************************************************************************/ 73 *****************************************************************************/
74
75#define DMA_ADDR_INVALID (~(dma_addr_t)0)
76
74/* ctrl register bank access */ 77/* ctrl register bank access */
75static DEFINE_SPINLOCK(udc_lock); 78static DEFINE_SPINLOCK(udc_lock);
76 79
@@ -1434,7 +1437,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
1434 return -EALREADY; 1437 return -EALREADY;
1435 1438
1436 mReq->req.status = -EALREADY; 1439 mReq->req.status = -EALREADY;
1437 if (length && !mReq->req.dma) { 1440 if (length && mReq->req.dma == DMA_ADDR_INVALID) {
1438 mReq->req.dma = \ 1441 mReq->req.dma = \
1439 dma_map_single(mEp->device, mReq->req.buf, 1442 dma_map_single(mEp->device, mReq->req.buf,
1440 length, mEp->dir ? DMA_TO_DEVICE : 1443 length, mEp->dir ? DMA_TO_DEVICE :
@@ -1453,7 +1456,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
1453 dma_unmap_single(mEp->device, mReq->req.dma, 1456 dma_unmap_single(mEp->device, mReq->req.dma,
1454 length, mEp->dir ? DMA_TO_DEVICE : 1457 length, mEp->dir ? DMA_TO_DEVICE :
1455 DMA_FROM_DEVICE); 1458 DMA_FROM_DEVICE);
1456 mReq->req.dma = 0; 1459 mReq->req.dma = DMA_ADDR_INVALID;
1457 mReq->map = 0; 1460 mReq->map = 0;
1458 } 1461 }
1459 return -ENOMEM; 1462 return -ENOMEM;
@@ -1549,7 +1552,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
1549 if (mReq->map) { 1552 if (mReq->map) {
1550 dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length, 1553 dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length,
1551 mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); 1554 mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
1552 mReq->req.dma = 0; 1555 mReq->req.dma = DMA_ADDR_INVALID;
1553 mReq->map = 0; 1556 mReq->map = 0;
1554 } 1557 }
1555 1558
@@ -1610,7 +1613,6 @@ __acquires(mEp->lock)
1610 * @gadget: gadget 1613 * @gadget: gadget
1611 * 1614 *
1612 * This function returns an error code 1615 * This function returns an error code
1613 * Caller must hold lock
1614 */ 1616 */
1615static int _gadget_stop_activity(struct usb_gadget *gadget) 1617static int _gadget_stop_activity(struct usb_gadget *gadget)
1616{ 1618{
@@ -2189,6 +2191,7 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
2189 mReq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags); 2191 mReq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags);
2190 if (mReq != NULL) { 2192 if (mReq != NULL) {
2191 INIT_LIST_HEAD(&mReq->queue); 2193 INIT_LIST_HEAD(&mReq->queue);
2194 mReq->req.dma = DMA_ADDR_INVALID;
2192 2195
2193 mReq->ptr = dma_pool_alloc(mEp->td_pool, gfp_flags, 2196 mReq->ptr = dma_pool_alloc(mEp->td_pool, gfp_flags,
2194 &mReq->dma); 2197 &mReq->dma);
@@ -2328,7 +2331,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
2328 if (mReq->map) { 2331 if (mReq->map) {
2329 dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length, 2332 dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length,
2330 mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE); 2333 mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
2331 mReq->req.dma = 0; 2334 mReq->req.dma = DMA_ADDR_INVALID;
2332 mReq->map = 0; 2335 mReq->map = 0;
2333 } 2336 }
2334 req->status = -ECONNRESET; 2337 req->status = -ECONNRESET;
@@ -2500,12 +2503,12 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget)
2500 spin_lock_irqsave(udc->lock, flags); 2503 spin_lock_irqsave(udc->lock, flags);
2501 if (!udc->remote_wakeup) { 2504 if (!udc->remote_wakeup) {
2502 ret = -EOPNOTSUPP; 2505 ret = -EOPNOTSUPP;
2503 dbg_trace("remote wakeup feature is not enabled\n"); 2506 trace("remote wakeup feature is not enabled\n");
2504 goto out; 2507 goto out;
2505 } 2508 }
2506 if (!hw_cread(CAP_PORTSC, PORTSC_SUSP)) { 2509 if (!hw_cread(CAP_PORTSC, PORTSC_SUSP)) {
2507 ret = -EINVAL; 2510 ret = -EINVAL;
2508 dbg_trace("port is not suspended\n"); 2511 trace("port is not suspended\n");
2509 goto out; 2512 goto out;
2510 } 2513 }
2511 hw_cwrite(CAP_PORTSC, PORTSC_FPR, PORTSC_FPR); 2514 hw_cwrite(CAP_PORTSC, PORTSC_FPR, PORTSC_FPR);
@@ -2703,7 +2706,9 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
2703 if (udc->udc_driver->notify_event) 2706 if (udc->udc_driver->notify_event)
2704 udc->udc_driver->notify_event(udc, 2707 udc->udc_driver->notify_event(udc,
2705 CI13XXX_CONTROLLER_STOPPED_EVENT); 2708 CI13XXX_CONTROLLER_STOPPED_EVENT);
2709 spin_unlock_irqrestore(udc->lock, flags);
2706 _gadget_stop_activity(&udc->gadget); 2710 _gadget_stop_activity(&udc->gadget);
2711 spin_lock_irqsave(udc->lock, flags);
2707 pm_runtime_put(&udc->gadget.dev); 2712 pm_runtime_put(&udc->gadget.dev);
2708 } 2713 }
2709 2714
@@ -2850,7 +2855,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
2850 struct ci13xxx *udc; 2855 struct ci13xxx *udc;
2851 int retval = 0; 2856 int retval = 0;
2852 2857
2853 trace("%p, %p, %p", dev, regs, name); 2858 trace("%p, %p, %p", dev, regs, driver->name);
2854 2859
2855 if (dev == NULL || regs == NULL || driver == NULL || 2860 if (dev == NULL || regs == NULL || driver == NULL ||
2856 driver->name == NULL) 2861 driver->name == NULL)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 52583a235330..c39d58860fa0 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -624,7 +624,8 @@ static int fsg_setup(struct usb_function *f,
624 if (ctrl->bRequestType != 624 if (ctrl->bRequestType !=
625 (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 625 (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE))
626 break; 626 break;
627 if (w_index != fsg->interface_number || w_value != 0) 627 if (w_index != fsg->interface_number || w_value != 0 ||
628 w_length != 0)
628 return -EDOM; 629 return -EDOM;
629 630
630 /* 631 /*
@@ -639,7 +640,8 @@ static int fsg_setup(struct usb_function *f,
639 if (ctrl->bRequestType != 640 if (ctrl->bRequestType !=
640 (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 641 (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE))
641 break; 642 break;
642 if (w_index != fsg->interface_number || w_value != 0) 643 if (w_index != fsg->interface_number || w_value != 0 ||
644 w_length != 1)
643 return -EDOM; 645 return -EDOM;
644 VDBG(fsg, "get max LUN\n"); 646 VDBG(fsg, "get max LUN\n");
645 *(u8 *)req->buf = fsg->common->nluns - 1; 647 *(u8 *)req->buf = fsg->common->nluns - 1;
diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
index 67b222908cf9..3797b3d6c622 100644
--- a/drivers/usb/gadget/f_midi.c
+++ b/drivers/usb/gadget/f_midi.c
@@ -95,7 +95,6 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req);
95 95
96DECLARE_UAC_AC_HEADER_DESCRIPTOR(1); 96DECLARE_UAC_AC_HEADER_DESCRIPTOR(1);
97DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(1); 97DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(1);
98DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(16);
99DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(16); 98DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(16);
100 99
101/* B.3.1 Standard AC Interface Descriptor */ 100/* B.3.1 Standard AC Interface Descriptor */
@@ -140,26 +139,6 @@ static struct usb_ms_header_descriptor ms_header_desc __initdata = {
140 /* .wTotalLength = DYNAMIC */ 139 /* .wTotalLength = DYNAMIC */
141}; 140};
142 141
143/* B.4.3 Embedded MIDI IN Jack Descriptor */
144static struct usb_midi_in_jack_descriptor jack_in_emb_desc = {
145 .bLength = USB_DT_MIDI_IN_SIZE,
146 .bDescriptorType = USB_DT_CS_INTERFACE,
147 .bDescriptorSubtype = USB_MS_MIDI_IN_JACK,
148 .bJackType = USB_MS_EMBEDDED,
149 /* .bJackID = DYNAMIC */
150};
151
152/* B.4.4 Embedded MIDI OUT Jack Descriptor */
153static struct usb_midi_out_jack_descriptor_16 jack_out_emb_desc = {
154 /* .bLength = DYNAMIC */
155 .bDescriptorType = USB_DT_CS_INTERFACE,
156 .bDescriptorSubtype = USB_MS_MIDI_OUT_JACK,
157 .bJackType = USB_MS_EMBEDDED,
158 /* .bJackID = DYNAMIC */
159 /* .bNrInputPins = DYNAMIC */
160 /* .pins = DYNAMIC */
161};
162
163/* B.5.1 Standard Bulk OUT Endpoint Descriptor */ 142/* B.5.1 Standard Bulk OUT Endpoint Descriptor */
164static struct usb_endpoint_descriptor bulk_out_desc = { 143static struct usb_endpoint_descriptor bulk_out_desc = {
165 .bLength = USB_DT_ENDPOINT_AUDIO_SIZE, 144 .bLength = USB_DT_ENDPOINT_AUDIO_SIZE,
@@ -758,9 +737,11 @@ fail:
758static int __init 737static int __init
759f_midi_bind(struct usb_configuration *c, struct usb_function *f) 738f_midi_bind(struct usb_configuration *c, struct usb_function *f)
760{ 739{
761 struct usb_descriptor_header *midi_function[(MAX_PORTS * 2) + 12]; 740 struct usb_descriptor_header **midi_function;
762 struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS]; 741 struct usb_midi_in_jack_descriptor jack_in_ext_desc[MAX_PORTS];
742 struct usb_midi_in_jack_descriptor jack_in_emb_desc[MAX_PORTS];
763 struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS]; 743 struct usb_midi_out_jack_descriptor_1 jack_out_ext_desc[MAX_PORTS];
744 struct usb_midi_out_jack_descriptor_1 jack_out_emb_desc[MAX_PORTS];
764 struct usb_composite_dev *cdev = c->cdev; 745 struct usb_composite_dev *cdev = c->cdev;
765 struct f_midi *midi = func_to_midi(f); 746 struct f_midi *midi = func_to_midi(f);
766 int status, n, jack = 1, i = 0; 747 int status, n, jack = 1, i = 0;
@@ -798,6 +779,14 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f)
798 goto fail; 779 goto fail;
799 midi->out_ep->driver_data = cdev; /* claim */ 780 midi->out_ep->driver_data = cdev; /* claim */
800 781
782 /* allocate temporary function list */
783 midi_function = kcalloc((MAX_PORTS * 4) + 9, sizeof(midi_function),
784 GFP_KERNEL);
785 if (!midi_function) {
786 status = -ENOMEM;
787 goto fail;
788 }
789
801 /* 790 /*
802 * construct the function's descriptor set. As the number of 791 * construct the function's descriptor set. As the number of
803 * input and output MIDI ports is configurable, we have to do 792 * input and output MIDI ports is configurable, we have to do
@@ -811,73 +800,74 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f)
811 800
812 /* calculate the header's wTotalLength */ 801 /* calculate the header's wTotalLength */
813 n = USB_DT_MS_HEADER_SIZE 802 n = USB_DT_MS_HEADER_SIZE
814 + (1 + midi->in_ports) * USB_DT_MIDI_IN_SIZE 803 + (midi->in_ports + midi->out_ports) *
815 + (1 + midi->out_ports) * USB_DT_MIDI_OUT_SIZE(1); 804 (USB_DT_MIDI_IN_SIZE + USB_DT_MIDI_OUT_SIZE(1));
816 ms_header_desc.wTotalLength = cpu_to_le16(n); 805 ms_header_desc.wTotalLength = cpu_to_le16(n);
817 806
818 midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc; 807 midi_function[i++] = (struct usb_descriptor_header *) &ms_header_desc;
819 808
820 /* we have one embedded IN jack */ 809 /* configure the external IN jacks, each linked to an embedded OUT jack */
821 jack_in_emb_desc.bJackID = jack++;
822 midi_function[i++] = (struct usb_descriptor_header *) &jack_in_emb_desc;
823
824 /* and a dynamic amount of external IN jacks */
825 for (n = 0; n < midi->in_ports; n++) {
826 struct usb_midi_in_jack_descriptor *ext = &jack_in_ext_desc[n];
827
828 ext->bLength = USB_DT_MIDI_IN_SIZE;
829 ext->bDescriptorType = USB_DT_CS_INTERFACE;
830 ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
831 ext->bJackType = USB_MS_EXTERNAL;
832 ext->bJackID = jack++;
833 ext->iJack = 0;
834
835 midi_function[i++] = (struct usb_descriptor_header *) ext;
836 }
837
838 /* one embedded OUT jack ... */
839 jack_out_emb_desc.bLength = USB_DT_MIDI_OUT_SIZE(midi->in_ports);
840 jack_out_emb_desc.bJackID = jack++;
841 jack_out_emb_desc.bNrInputPins = midi->in_ports;
842 /* ... which referencess all external IN jacks */
843 for (n = 0; n < midi->in_ports; n++) { 810 for (n = 0; n < midi->in_ports; n++) {
844 jack_out_emb_desc.pins[n].baSourceID = jack_in_ext_desc[n].bJackID; 811 struct usb_midi_in_jack_descriptor *in_ext = &jack_in_ext_desc[n];
845 jack_out_emb_desc.pins[n].baSourcePin = 1; 812 struct usb_midi_out_jack_descriptor_1 *out_emb = &jack_out_emb_desc[n];
813
814 in_ext->bLength = USB_DT_MIDI_IN_SIZE;
815 in_ext->bDescriptorType = USB_DT_CS_INTERFACE;
816 in_ext->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
817 in_ext->bJackType = USB_MS_EXTERNAL;
818 in_ext->bJackID = jack++;
819 in_ext->iJack = 0;
820 midi_function[i++] = (struct usb_descriptor_header *) in_ext;
821
822 out_emb->bLength = USB_DT_MIDI_OUT_SIZE(1);
823 out_emb->bDescriptorType = USB_DT_CS_INTERFACE;
824 out_emb->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
825 out_emb->bJackType = USB_MS_EMBEDDED;
826 out_emb->bJackID = jack++;
827 out_emb->bNrInputPins = 1;
828 out_emb->pins[0].baSourcePin = 1;
829 out_emb->pins[0].baSourceID = in_ext->bJackID;
830 out_emb->iJack = 0;
831 midi_function[i++] = (struct usb_descriptor_header *) out_emb;
832
833 /* link it to the endpoint */
834 ms_in_desc.baAssocJackID[n] = out_emb->bJackID;
846 } 835 }
847 836
848 midi_function[i++] = (struct usb_descriptor_header *) &jack_out_emb_desc; 837 /* configure the external OUT jacks, each linked to an embedded IN jack */
849
850 /* and multiple external OUT jacks ... */
851 for (n = 0; n < midi->out_ports; n++) { 838 for (n = 0; n < midi->out_ports; n++) {
852 struct usb_midi_out_jack_descriptor_1 *ext = &jack_out_ext_desc[n]; 839 struct usb_midi_in_jack_descriptor *in_emb = &jack_in_emb_desc[n];
853 int m; 840 struct usb_midi_out_jack_descriptor_1 *out_ext = &jack_out_ext_desc[n];
854 841
855 ext->bLength = USB_DT_MIDI_OUT_SIZE(1); 842 in_emb->bLength = USB_DT_MIDI_IN_SIZE;
856 ext->bDescriptorType = USB_DT_CS_INTERFACE; 843 in_emb->bDescriptorType = USB_DT_CS_INTERFACE;
857 ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK; 844 in_emb->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
858 ext->bJackType = USB_MS_EXTERNAL; 845 in_emb->bJackType = USB_MS_EMBEDDED;
859 ext->bJackID = jack++; 846 in_emb->bJackID = jack++;
860 ext->bNrInputPins = 1; 847 in_emb->iJack = 0;
861 ext->iJack = 0; 848 midi_function[i++] = (struct usb_descriptor_header *) in_emb;
862 /* ... which all reference the same embedded IN jack */ 849
863 for (m = 0; m < midi->out_ports; m++) { 850 out_ext->bLength = USB_DT_MIDI_OUT_SIZE(1);
864 ext->pins[m].baSourceID = jack_in_emb_desc.bJackID; 851 out_ext->bDescriptorType = USB_DT_CS_INTERFACE;
865 ext->pins[m].baSourcePin = 1; 852 out_ext->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;
866 } 853 out_ext->bJackType = USB_MS_EXTERNAL;
867 854 out_ext->bJackID = jack++;
868 midi_function[i++] = (struct usb_descriptor_header *) ext; 855 out_ext->bNrInputPins = 1;
856 out_ext->iJack = 0;
857 out_ext->pins[0].baSourceID = in_emb->bJackID;
858 out_ext->pins[0].baSourcePin = 1;
859 midi_function[i++] = (struct usb_descriptor_header *) out_ext;
860
861 /* link it to the endpoint */
862 ms_out_desc.baAssocJackID[n] = in_emb->bJackID;
869 } 863 }
870 864
871 /* configure the endpoint descriptors ... */ 865 /* configure the endpoint descriptors ... */
872 ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports); 866 ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
873 ms_out_desc.bNumEmbMIDIJack = midi->in_ports; 867 ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
874 for (n = 0; n < midi->in_ports; n++)
875 ms_out_desc.baAssocJackID[n] = jack_in_emb_desc.bJackID;
876 868
877 ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports); 869 ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
878 ms_in_desc.bNumEmbMIDIJack = midi->out_ports; 870 ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
879 for (n = 0; n < midi->out_ports; n++)
880 ms_in_desc.baAssocJackID[n] = jack_out_emb_desc.bJackID;
881 871
882 /* ... and add them to the list */ 872 /* ... and add them to the list */
883 midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc; 873 midi_function[i++] = (struct usb_descriptor_header *) &bulk_out_desc;
@@ -901,6 +891,8 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f)
901 f->descriptors = usb_copy_descriptors(midi_function); 891 f->descriptors = usb_copy_descriptors(midi_function);
902 } 892 }
903 893
894 kfree(midi_function);
895
904 return 0; 896 return 0;
905 897
906fail: 898fail:
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index 349077033338..16a509ae517b 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -346,7 +346,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req)
346 } 346 }
347 347
348 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 348 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
349 skb->len == 0, req->actual); 349 skb->len <= 1, req->actual);
350 page = NULL; 350 page = NULL;
351 351
352 if (req->actual < req->length) { /* Last fragment */ 352 if (req->actual < req->length) { /* Last fragment */
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index f7e39b0365ce..11b5196284ae 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -859,7 +859,7 @@ static int class_setup_req(struct fsg_dev *fsg,
859 if (ctrl->bRequestType != (USB_DIR_OUT | 859 if (ctrl->bRequestType != (USB_DIR_OUT |
860 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 860 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
861 break; 861 break;
862 if (w_index != 0 || w_value != 0) { 862 if (w_index != 0 || w_value != 0 || w_length != 0) {
863 value = -EDOM; 863 value = -EDOM;
864 break; 864 break;
865 } 865 }
@@ -875,7 +875,7 @@ static int class_setup_req(struct fsg_dev *fsg,
875 if (ctrl->bRequestType != (USB_DIR_IN | 875 if (ctrl->bRequestType != (USB_DIR_IN |
876 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 876 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
877 break; 877 break;
878 if (w_index != 0 || w_value != 0) { 878 if (w_index != 0 || w_value != 0 || w_length != 1) {
879 value = -EDOM; 879 value = -EDOM;
880 break; 880 break;
881 } 881 }
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index b2c44e1d5813..b3b3d83b7c33 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1717,7 +1717,7 @@ static void dtd_complete_irq(struct fsl_udc *udc)
1717 1717
1718static inline enum usb_device_speed portscx_device_speed(u32 reg) 1718static inline enum usb_device_speed portscx_device_speed(u32 reg)
1719{ 1719{
1720 switch (speed & PORTSCX_PORT_SPEED_MASK) { 1720 switch (reg & PORTSCX_PORT_SPEED_MASK) {
1721 case PORTSCX_PORT_SPEED_HIGH: 1721 case PORTSCX_PORT_SPEED_HIGH:
1722 return USB_SPEED_HIGH; 1722 return USB_SPEED_HIGH;
1723 case PORTSCX_PORT_SPEED_FULL: 1723 case PORTSCX_PORT_SPEED_FULL:
@@ -2480,8 +2480,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2480 2480
2481#ifndef CONFIG_ARCH_MXC 2481#ifndef CONFIG_ARCH_MXC
2482 if (pdata->have_sysif_regs) 2482 if (pdata->have_sysif_regs)
2483 usb_sys_regs = (struct usb_sys_interface *) 2483 usb_sys_regs = (void *)dr_regs + USB_DR_SYS_OFFSET;
2484 ((u32)dr_regs + USB_DR_SYS_OFFSET);
2485#endif 2484#endif
2486 2485
2487 /* Initialize USB clocks */ 2486 /* Initialize USB clocks */
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index a392ec0d2d51..6ccae2707e59 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1730,8 +1730,9 @@ static void
1730gadgetfs_disconnect (struct usb_gadget *gadget) 1730gadgetfs_disconnect (struct usb_gadget *gadget)
1731{ 1731{
1732 struct dev_data *dev = get_gadget_data (gadget); 1732 struct dev_data *dev = get_gadget_data (gadget);
1733 unsigned long flags;
1733 1734
1734 spin_lock (&dev->lock); 1735 spin_lock_irqsave (&dev->lock, flags);
1735 if (dev->state == STATE_DEV_UNCONNECTED) 1736 if (dev->state == STATE_DEV_UNCONNECTED)
1736 goto exit; 1737 goto exit;
1737 dev->state = STATE_DEV_UNCONNECTED; 1738 dev->state = STATE_DEV_UNCONNECTED;
@@ -1740,7 +1741,7 @@ gadgetfs_disconnect (struct usb_gadget *gadget)
1740 next_event (dev, GADGETFS_DISCONNECT); 1741 next_event (dev, GADGETFS_DISCONNECT);
1741 ep0_readable (dev); 1742 ep0_readable (dev);
1742exit: 1743exit:
1743 spin_unlock (&dev->lock); 1744 spin_unlock_irqrestore (&dev->lock, flags);
1744} 1745}
1745 1746
1746static void 1747static void
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 550d6dcdf104..5048a0c07640 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. 2 * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -354,6 +354,7 @@ struct pch_udc_dev {
354#define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 354#define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808
355#define PCI_VENDOR_ID_ROHM 0x10DB 355#define PCI_VENDOR_ID_ROHM 0x10DB
356#define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D 356#define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D
357#define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808
357 358
358static const char ep0_string[] = "ep0in"; 359static const char ep0_string[] = "ep0in";
359static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ 360static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */
@@ -2970,6 +2971,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = {
2970 .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, 2971 .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
2971 .class_mask = 0xffffffff, 2972 .class_mask = 0xffffffff,
2972 }, 2973 },
2974 {
2975 PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7831_IOH_UDC),
2976 .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
2977 .class_mask = 0xffffffff,
2978 },
2973 { 0 }, 2979 { 0 },
2974}; 2980};
2975 2981
@@ -2999,5 +3005,5 @@ static void __exit pch_udc_pci_exit(void)
2999module_exit(pch_udc_pci_exit); 3005module_exit(pch_udc_pci_exit);
3000 3006
3001MODULE_DESCRIPTION("Intel EG20T USB Device Controller"); 3007MODULE_DESCRIPTION("Intel EG20T USB Device Controller");
3002MODULE_AUTHOR("OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>"); 3008MODULE_AUTHOR("LAPIS Semiconductor, <tomoya-linux@dsn.lapis-semi.com>");
3003MODULE_LICENSE("GPL"); 3009MODULE_LICENSE("GPL");
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 68a826a1b866..24f84b210ce1 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1718,6 +1718,8 @@ static void r8a66597_fifo_flush(struct usb_ep *_ep)
1718 if (list_empty(&ep->queue) && !ep->busy) { 1718 if (list_empty(&ep->queue) && !ep->busy) {
1719 pipe_stop(ep->r8a66597, ep->pipenum); 1719 pipe_stop(ep->r8a66597, ep->pipenum);
1720 r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr); 1720 r8a66597_bclr(ep->r8a66597, BCLR, ep->fifoctr);
1721 r8a66597_write(ep->r8a66597, ACLRM, ep->pipectr);
1722 r8a66597_write(ep->r8a66597, 0, ep->pipectr);
1721 } 1723 }
1722 spin_unlock_irqrestore(&ep->r8a66597->lock, flags); 1724 spin_unlock_irqrestore(&ep->r8a66597->lock, flags);
1723} 1725}
@@ -1742,7 +1744,6 @@ static int r8a66597_start(struct usb_gadget *gadget,
1742 struct usb_gadget_driver *driver) 1744 struct usb_gadget_driver *driver)
1743{ 1745{
1744 struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); 1746 struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget);
1745 int retval;
1746 1747
1747 if (!driver 1748 if (!driver
1748 || driver->speed != USB_SPEED_HIGH 1749 || driver->speed != USB_SPEED_HIGH
@@ -1752,16 +1753,7 @@ static int r8a66597_start(struct usb_gadget *gadget,
1752 return -ENODEV; 1753 return -ENODEV;
1753 1754
1754 /* hook up the driver */ 1755 /* hook up the driver */
1755 driver->driver.bus = NULL;
1756 r8a66597->driver = driver; 1756 r8a66597->driver = driver;
1757 r8a66597->gadget.dev.driver = &driver->driver;
1758
1759 retval = device_add(&r8a66597->gadget.dev);
1760 if (retval) {
1761 dev_err(r8a66597_to_dev(r8a66597), "device_add error (%d)\n",
1762 retval);
1763 goto error;
1764 }
1765 1757
1766 init_controller(r8a66597); 1758 init_controller(r8a66597);
1767 r8a66597_bset(r8a66597, VBSE, INTENB0); 1759 r8a66597_bset(r8a66597, VBSE, INTENB0);
@@ -1775,12 +1767,6 @@ static int r8a66597_start(struct usb_gadget *gadget,
1775 } 1767 }
1776 1768
1777 return 0; 1769 return 0;
1778
1779error:
1780 r8a66597->driver = NULL;
1781 r8a66597->gadget.dev.driver = NULL;
1782
1783 return retval;
1784} 1770}
1785 1771
1786static int r8a66597_stop(struct usb_gadget *gadget, 1772static int r8a66597_stop(struct usb_gadget *gadget,
@@ -1794,7 +1780,6 @@ static int r8a66597_stop(struct usb_gadget *gadget,
1794 disable_controller(r8a66597); 1780 disable_controller(r8a66597);
1795 spin_unlock_irqrestore(&r8a66597->lock, flags); 1781 spin_unlock_irqrestore(&r8a66597->lock, flags);
1796 1782
1797 device_del(&r8a66597->gadget.dev);
1798 r8a66597->driver = NULL; 1783 r8a66597->driver = NULL;
1799 return 0; 1784 return 0;
1800} 1785}
@@ -1845,6 +1830,7 @@ static int __exit r8a66597_remove(struct platform_device *pdev)
1845 clk_put(r8a66597->clk); 1830 clk_put(r8a66597->clk);
1846 } 1831 }
1847#endif 1832#endif
1833 device_unregister(&r8a66597->gadget.dev);
1848 kfree(r8a66597); 1834 kfree(r8a66597);
1849 return 0; 1835 return 0;
1850} 1836}
@@ -1924,13 +1910,17 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1924 r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; 1910 r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW;
1925 1911
1926 r8a66597->gadget.ops = &r8a66597_gadget_ops; 1912 r8a66597->gadget.ops = &r8a66597_gadget_ops;
1927 device_initialize(&r8a66597->gadget.dev);
1928 dev_set_name(&r8a66597->gadget.dev, "gadget"); 1913 dev_set_name(&r8a66597->gadget.dev, "gadget");
1929 r8a66597->gadget.is_dualspeed = 1; 1914 r8a66597->gadget.is_dualspeed = 1;
1930 r8a66597->gadget.dev.parent = &pdev->dev; 1915 r8a66597->gadget.dev.parent = &pdev->dev;
1931 r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask; 1916 r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask;
1932 r8a66597->gadget.dev.release = pdev->dev.release; 1917 r8a66597->gadget.dev.release = pdev->dev.release;
1933 r8a66597->gadget.name = udc_name; 1918 r8a66597->gadget.name = udc_name;
1919 ret = device_register(&r8a66597->gadget.dev);
1920 if (ret < 0) {
1921 dev_err(&pdev->dev, "device_register failed\n");
1922 goto clean_up;
1923 }
1934 1924
1935 init_timer(&r8a66597->timer); 1925 init_timer(&r8a66597->timer);
1936 r8a66597->timer.function = r8a66597_timer; 1926 r8a66597->timer.function = r8a66597_timer;
@@ -1945,7 +1935,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1945 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", 1935 dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
1946 clk_name); 1936 clk_name);
1947 ret = PTR_ERR(r8a66597->clk); 1937 ret = PTR_ERR(r8a66597->clk);
1948 goto clean_up; 1938 goto clean_up_dev;
1949 } 1939 }
1950 clk_enable(r8a66597->clk); 1940 clk_enable(r8a66597->clk);
1951 } 1941 }
@@ -2014,7 +2004,9 @@ clean_up2:
2014 clk_disable(r8a66597->clk); 2004 clk_disable(r8a66597->clk);
2015 clk_put(r8a66597->clk); 2005 clk_put(r8a66597->clk);
2016 } 2006 }
2007clean_up_dev:
2017#endif 2008#endif
2009 device_unregister(&r8a66597->gadget.dev);
2018clean_up: 2010clean_up:
2019 if (r8a66597) { 2011 if (r8a66597) {
2020 if (r8a66597->sudmac_reg) 2012 if (r8a66597->sudmac_reg)
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 022baeca7c94..6939e17f4580 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -210,10 +210,10 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
210 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); 210 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
211 211
212 if (udc_is_newstyle(udc)) { 212 if (udc_is_newstyle(udc)) {
213 usb_gadget_disconnect(udc->gadget); 213 udc->driver->disconnect(udc->gadget);
214 udc->driver->unbind(udc->gadget); 214 udc->driver->unbind(udc->gadget);
215 usb_gadget_udc_stop(udc->gadget, udc->driver); 215 usb_gadget_udc_stop(udc->gadget, udc->driver);
216 216 usb_gadget_disconnect(udc->gadget);
217 } else { 217 } else {
218 usb_gadget_stop(udc->gadget, udc->driver); 218 usb_gadget_stop(udc->gadget, udc->driver);
219 } 219 }
@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_unregister_driver);
344static ssize_t usb_udc_srp_store(struct device *dev, 344static ssize_t usb_udc_srp_store(struct device *dev,
345 struct device_attribute *attr, const char *buf, size_t n) 345 struct device_attribute *attr, const char *buf, size_t n)
346{ 346{
347 struct usb_udc *udc = dev_get_drvdata(dev); 347 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
348 348
349 if (sysfs_streq(buf, "1")) 349 if (sysfs_streq(buf, "1"))
350 usb_gadget_wakeup(udc->gadget); 350 usb_gadget_wakeup(udc->gadget);
@@ -378,7 +378,7 @@ static ssize_t usb_udc_speed_show(struct device *dev,
378 return snprintf(buf, PAGE_SIZE, "%s\n", 378 return snprintf(buf, PAGE_SIZE, "%s\n",
379 usb_speed_string(udc->gadget->speed)); 379 usb_speed_string(udc->gadget->speed));
380} 380}
381static DEVICE_ATTR(speed, S_IRUSR, usb_udc_speed_show, NULL); 381static DEVICE_ATTR(speed, S_IRUGO, usb_udc_speed_show, NULL);
382 382
383#define USB_UDC_ATTR(name) \ 383#define USB_UDC_ATTR(name) \
384ssize_t usb_udc_##name##_show(struct device *dev, \ 384ssize_t usb_udc_##name##_show(struct device *dev, \
@@ -389,7 +389,7 @@ ssize_t usb_udc_##name##_show(struct device *dev, \
389 \ 389 \
390 return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \ 390 return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \
391} \ 391} \
392static DEVICE_ATTR(name, S_IRUSR, usb_udc_##name##_show, NULL) 392static DEVICE_ATTR(name, S_IRUGO, usb_udc_##name##_show, NULL)
393 393
394static USB_UDC_ATTR(is_dualspeed); 394static USB_UDC_ATTR(is_dualspeed);
395static USB_UDC_ATTR(is_otg); 395static USB_UDC_ATTR(is_otg);
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 2e829fae6482..56a32033adb3 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1479,10 +1479,15 @@ iso_stream_schedule (
1479 1479
1480 /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ 1480 /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
1481 1481
1482 /* find a uframe slot with enough bandwidth */ 1482 /* find a uframe slot with enough bandwidth.
1483 next = start + period; 1483 * Early uframes are more precious because full-speed
1484 for (; start < next; start++) { 1484 * iso IN transfers can't use late uframes,
1485 1485 * and therefore they should be allocated last.
1486 */
1487 next = start;
1488 start += period;
1489 do {
1490 start--;
1486 /* check schedule: enough space? */ 1491 /* check schedule: enough space? */
1487 if (stream->highspeed) { 1492 if (stream->highspeed) {
1488 if (itd_slot_ok(ehci, mod, start, 1493 if (itd_slot_ok(ehci, mod, start,
@@ -1495,7 +1500,7 @@ iso_stream_schedule (
1495 start, sched, period)) 1500 start, sched, period))
1496 break; 1501 break;
1497 } 1502 }
1498 } 1503 } while (start > next);
1499 1504
1500 /* no room in the schedule */ 1505 /* no room in the schedule */
1501 if (start == next) { 1506 if (start == next) {
diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c
index 1078d6746d27..72f08196f8cd 100644
--- a/drivers/usb/host/ehci-xls.c
+++ b/drivers/usb/host/ehci-xls.c
@@ -19,7 +19,7 @@ static int ehci_xls_setup(struct usb_hcd *hcd)
19 19
20 ehci->caps = hcd->regs; 20 ehci->caps = hcd->regs;
21 ehci->regs = hcd->regs + 21 ehci->regs = hcd->regs +
22 HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); 22 HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
23 dbg_hcs_params(ehci, "reset"); 23 dbg_hcs_params(ehci, "reset");
24 dbg_hcc_params(ehci, "reset"); 24 dbg_hcc_params(ehci, "reset");
25 25
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index ba3a46b78b75..95a9fec38e89 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -223,6 +223,9 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
223 if (port < 0 || port >= 2) 223 if (port < 0 || port >= 2)
224 return; 224 return;
225 225
226 if (pdata->vbus_pin[port] <= 0)
227 return;
228
226 gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); 229 gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable);
227} 230}
228 231
@@ -231,6 +234,9 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
231 if (port < 0 || port >= 2) 234 if (port < 0 || port >= 2)
232 return -EINVAL; 235 return -EINVAL;
233 236
237 if (pdata->vbus_pin[port] <= 0)
238 return -EINVAL;
239
234 return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; 240 return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted;
235} 241}
236 242
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 95d639cd5b8c..4fa5d8c4d239 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -390,17 +390,14 @@ ohci_shutdown (struct usb_hcd *hcd)
390 struct ohci_hcd *ohci; 390 struct ohci_hcd *ohci;
391 391
392 ohci = hcd_to_ohci (hcd); 392 ohci = hcd_to_ohci (hcd);
393 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); 393 ohci_writel(ohci, (u32) ~0, &ohci->regs->intrdisable);
394 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
395 394
396 /* If the SHUTDOWN quirk is set, don't put the controller in RESET */ 395 /* Software reset, after which the controller goes into SUSPEND */
397 ohci->hc_control &= (ohci->flags & OHCI_QUIRK_SHUTDOWN ? 396 ohci_writel(ohci, OHCI_HCR, &ohci->regs->cmdstatus);
398 OHCI_CTRL_RWC | OHCI_CTRL_HCFS : 397 ohci_readl(ohci, &ohci->regs->cmdstatus); /* flush the writes */
399 OHCI_CTRL_RWC); 398 udelay(10);
400 ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
401 399
402 /* flush the writes */ 400 ohci_writel(ohci, ohci->fminterval, &ohci->regs->fminterval);
403 (void) ohci_readl (ohci, &ohci->regs->control);
404} 401}
405 402
406static int check_ed(struct ohci_hcd *ohci, struct ed *ed) 403static int check_ed(struct ohci_hcd *ohci, struct ed *ed)
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 847187df50a1..6109810cc2d3 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -175,28 +175,6 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
175 return 0; 175 return 0;
176} 176}
177 177
178/* nVidia controllers continue to drive Reset signalling on the bus
179 * even after system shutdown, wasting power. This flag tells the
180 * shutdown routine to leave the controller OPERATIONAL instead of RESET.
181 */
182static int ohci_quirk_nvidia_shutdown(struct usb_hcd *hcd)
183{
184 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
185 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
186
187 /* Evidently nVidia fixed their later hardware; this is a guess at
188 * the changeover point.
189 */
190#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB 0x026d
191
192 if (pdev->device < PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB) {
193 ohci->flags |= OHCI_QUIRK_SHUTDOWN;
194 ohci_dbg(ohci, "enabled nVidia shutdown quirk\n");
195 }
196
197 return 0;
198}
199
200static void sb800_prefetch(struct ohci_hcd *ohci, int on) 178static void sb800_prefetch(struct ohci_hcd *ohci, int on)
201{ 179{
202 struct pci_dev *pdev; 180 struct pci_dev *pdev;
@@ -260,10 +238,6 @@ static const struct pci_device_id ohci_pci_quirks[] = {
260 PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399), 238 PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
261 .driver_data = (unsigned long)ohci_quirk_amd700, 239 .driver_data = (unsigned long)ohci_quirk_amd700,
262 }, 240 },
263 {
264 PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
265 .driver_data = (unsigned long) ohci_quirk_nvidia_shutdown,
266 },
267 241
268 /* FIXME for some of the early AMD 760 southbridges, OHCI 242 /* FIXME for some of the early AMD 760 southbridges, OHCI
269 * won't work at all. blacklist them. 243 * won't work at all. blacklist them.
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 3a978a2130cb..8ff6f7ea96fd 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -410,7 +410,6 @@ struct ohci_hcd {
410#define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ 410#define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */
411#define OHCI_QUIRK_AMD_PLL 0x200 /* AMD PLL quirk*/ 411#define OHCI_QUIRK_AMD_PLL 0x200 /* AMD PLL quirk*/
412#define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ 412#define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */
413#define OHCI_QUIRK_SHUTDOWN 0x800 /* nVidia power bug */
414 // there are also chip quirks/bugs in init logic 413 // there are also chip quirks/bugs in init logic
415 414
416 struct work_struct nec_work; /* Worker for NEC quirk */ 415 struct work_struct nec_work; /* Worker for NEC quirk */
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 27a3dec32fa2..caf87428ca43 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -37,6 +37,7 @@
37#define OHCI_INTRENABLE 0x10 37#define OHCI_INTRENABLE 0x10
38#define OHCI_INTRDISABLE 0x14 38#define OHCI_INTRDISABLE 0x14
39#define OHCI_FMINTERVAL 0x34 39#define OHCI_FMINTERVAL 0x34
40#define OHCI_HCFS (3 << 6) /* hc functional state */
40#define OHCI_HCR (1 << 0) /* host controller reset */ 41#define OHCI_HCR (1 << 0) /* host controller reset */
41#define OHCI_OCR (1 << 3) /* ownership change request */ 42#define OHCI_OCR (1 << 3) /* ownership change request */
42#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */ 43#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */
@@ -466,6 +467,8 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
466{ 467{
467 void __iomem *base; 468 void __iomem *base;
468 u32 control; 469 u32 control;
470 u32 fminterval;
471 int cnt;
469 472
470 if (!mmio_resource_enabled(pdev, 0)) 473 if (!mmio_resource_enabled(pdev, 0))
471 return; 474 return;
@@ -498,41 +501,32 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
498 } 501 }
499#endif 502#endif
500 503
501 /* reset controller, preserving RWC (and possibly IR) */ 504 /* disable interrupts */
502 writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL); 505 writel((u32) ~0, base + OHCI_INTRDISABLE);
503 readl(base + OHCI_CONTROL);
504 506
505 /* Some NVIDIA controllers stop working if kept in RESET for too long */ 507 /* Reset the USB bus, if the controller isn't already in RESET */
506 if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) { 508 if (control & OHCI_HCFS) {
507 u32 fminterval; 509 /* Go into RESET, preserving RWC (and possibly IR) */
508 int cnt; 510 writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL);
511 readl(base + OHCI_CONTROL);
509 512
510 /* drive reset for at least 50 ms (7.1.7.5) */ 513 /* drive bus reset for at least 50 ms (7.1.7.5) */
511 msleep(50); 514 msleep(50);
515 }
512 516
513 /* software reset of the controller, preserving HcFmInterval */ 517 /* software reset of the controller, preserving HcFmInterval */
514 fminterval = readl(base + OHCI_FMINTERVAL); 518 fminterval = readl(base + OHCI_FMINTERVAL);
515 writel(OHCI_HCR, base + OHCI_CMDSTATUS); 519 writel(OHCI_HCR, base + OHCI_CMDSTATUS);
516 520
517 /* reset requires max 10 us delay */ 521 /* reset requires max 10 us delay */
518 for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */ 522 for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */
519 if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0) 523 if ((readl(base + OHCI_CMDSTATUS) & OHCI_HCR) == 0)
520 break; 524 break;
521 udelay(1); 525 udelay(1);
522 }
523 writel(fminterval, base + OHCI_FMINTERVAL);
524
525 /* Now we're in the SUSPEND state with all devices reset
526 * and wakeups and interrupts disabled
527 */
528 } 526 }
527 writel(fminterval, base + OHCI_FMINTERVAL);
529 528
530 /* 529 /* Now the controller is safely in SUSPEND and nothing can wake it up */
531 * disable interrupts
532 */
533 writel(~(u32)0, base + OHCI_INTRDISABLE);
534 writel(~(u32)0, base + OHCI_INTRSTATUS);
535
536 iounmap(base); 530 iounmap(base);
537} 531}
538 532
@@ -627,7 +621,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
627 void __iomem *base, *op_reg_base; 621 void __iomem *base, *op_reg_base;
628 u32 hcc_params, cap, val; 622 u32 hcc_params, cap, val;
629 u8 offset, cap_length; 623 u8 offset, cap_length;
630 int wait_time, delta, count = 256/4; 624 int wait_time, count = 256/4;
631 625
632 if (!mmio_resource_enabled(pdev, 0)) 626 if (!mmio_resource_enabled(pdev, 0))
633 return; 627 return;
@@ -673,11 +667,10 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
673 writel(val, op_reg_base + EHCI_USBCMD); 667 writel(val, op_reg_base + EHCI_USBCMD);
674 668
675 wait_time = 2000; 669 wait_time = 2000;
676 delta = 100;
677 do { 670 do {
678 writel(0x3f, op_reg_base + EHCI_USBSTS); 671 writel(0x3f, op_reg_base + EHCI_USBSTS);
679 udelay(delta); 672 udelay(100);
680 wait_time -= delta; 673 wait_time -= 100;
681 val = readl(op_reg_base + EHCI_USBSTS); 674 val = readl(op_reg_base + EHCI_USBSTS);
682 if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) { 675 if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {
683 break; 676 break;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 42a22b8e6922..0e4b25fa3bcd 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -982,7 +982,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
982 struct xhci_virt_device *dev; 982 struct xhci_virt_device *dev;
983 struct xhci_ep_ctx *ep0_ctx; 983 struct xhci_ep_ctx *ep0_ctx;
984 struct xhci_slot_ctx *slot_ctx; 984 struct xhci_slot_ctx *slot_ctx;
985 struct xhci_input_control_ctx *ctrl_ctx;
986 u32 port_num; 985 u32 port_num;
987 struct usb_device *top_dev; 986 struct usb_device *top_dev;
988 987
@@ -994,12 +993,8 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
994 return -EINVAL; 993 return -EINVAL;
995 } 994 }
996 ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0); 995 ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0);
997 ctrl_ctx = xhci_get_input_control_ctx(xhci, dev->in_ctx);
998 slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx); 996 slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx);
999 997
1000 /* 2) New slot context and endpoint 0 context are valid*/
1001 ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
1002
1003 /* 3) Only the control endpoint is valid - one endpoint context */ 998 /* 3) Only the control endpoint is valid - one endpoint context */
1004 slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route); 999 slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
1005 switch (udev->speed) { 1000 switch (udev->speed) {
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 2f8c17381c6c..133ce302c860 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -816,23 +816,24 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
816 struct xhci_ring *ring; 816 struct xhci_ring *ring;
817 struct xhci_td *cur_td; 817 struct xhci_td *cur_td;
818 int ret, i, j; 818 int ret, i, j;
819 unsigned long flags;
819 820
820 ep = (struct xhci_virt_ep *) arg; 821 ep = (struct xhci_virt_ep *) arg;
821 xhci = ep->xhci; 822 xhci = ep->xhci;
822 823
823 spin_lock(&xhci->lock); 824 spin_lock_irqsave(&xhci->lock, flags);
824 825
825 ep->stop_cmds_pending--; 826 ep->stop_cmds_pending--;
826 if (xhci->xhc_state & XHCI_STATE_DYING) { 827 if (xhci->xhc_state & XHCI_STATE_DYING) {
827 xhci_dbg(xhci, "Stop EP timer ran, but another timer marked " 828 xhci_dbg(xhci, "Stop EP timer ran, but another timer marked "
828 "xHCI as DYING, exiting.\n"); 829 "xHCI as DYING, exiting.\n");
829 spin_unlock(&xhci->lock); 830 spin_unlock_irqrestore(&xhci->lock, flags);
830 return; 831 return;
831 } 832 }
832 if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) { 833 if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) {
833 xhci_dbg(xhci, "Stop EP timer ran, but no command pending, " 834 xhci_dbg(xhci, "Stop EP timer ran, but no command pending, "
834 "exiting.\n"); 835 "exiting.\n");
835 spin_unlock(&xhci->lock); 836 spin_unlock_irqrestore(&xhci->lock, flags);
836 return; 837 return;
837 } 838 }
838 839
@@ -844,11 +845,11 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
844 xhci->xhc_state |= XHCI_STATE_DYING; 845 xhci->xhc_state |= XHCI_STATE_DYING;
845 /* Disable interrupts from the host controller and start halting it */ 846 /* Disable interrupts from the host controller and start halting it */
846 xhci_quiesce(xhci); 847 xhci_quiesce(xhci);
847 spin_unlock(&xhci->lock); 848 spin_unlock_irqrestore(&xhci->lock, flags);
848 849
849 ret = xhci_halt(xhci); 850 ret = xhci_halt(xhci);
850 851
851 spin_lock(&xhci->lock); 852 spin_lock_irqsave(&xhci->lock, flags);
852 if (ret < 0) { 853 if (ret < 0) {
853 /* This is bad; the host is not responding to commands and it's 854 /* This is bad; the host is not responding to commands and it's
854 * not allowing itself to be halted. At least interrupts are 855 * not allowing itself to be halted. At least interrupts are
@@ -896,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
896 } 897 }
897 } 898 }
898 } 899 }
899 spin_unlock(&xhci->lock); 900 spin_unlock_irqrestore(&xhci->lock, flags);
900 xhci_dbg(xhci, "Calling usb_hc_died()\n"); 901 xhci_dbg(xhci, "Calling usb_hc_died()\n");
901 usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); 902 usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
902 xhci_dbg(xhci, "xHCI host controller is dead.\n"); 903 xhci_dbg(xhci, "xHCI host controller is dead.\n");
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 1ff95a0df576..aa94c0195791 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -799,7 +799,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
799 u32 command, temp = 0; 799 u32 command, temp = 0;
800 struct usb_hcd *hcd = xhci_to_hcd(xhci); 800 struct usb_hcd *hcd = xhci_to_hcd(xhci);
801 struct usb_hcd *secondary_hcd; 801 struct usb_hcd *secondary_hcd;
802 int retval; 802 int retval = 0;
803 803
804 /* Wait a bit if either of the roothubs need to settle from the 804 /* Wait a bit if either of the roothubs need to settle from the
805 * transition into bus suspend. 805 * transition into bus suspend.
@@ -809,6 +809,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
809 xhci->bus_state[1].next_statechange)) 809 xhci->bus_state[1].next_statechange))
810 msleep(100); 810 msleep(100);
811 811
812 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
813 set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
814
812 spin_lock_irq(&xhci->lock); 815 spin_lock_irq(&xhci->lock);
813 if (xhci->quirks & XHCI_RESET_ON_RESUME) 816 if (xhci->quirks & XHCI_RESET_ON_RESUME)
814 hibernated = true; 817 hibernated = true;
@@ -878,20 +881,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
878 return retval; 881 return retval;
879 xhci_dbg(xhci, "Start the primary HCD\n"); 882 xhci_dbg(xhci, "Start the primary HCD\n");
880 retval = xhci_run(hcd->primary_hcd); 883 retval = xhci_run(hcd->primary_hcd);
881 if (retval)
882 goto failed_restart;
883
884 xhci_dbg(xhci, "Start the secondary HCD\n");
885 retval = xhci_run(secondary_hcd);
886 if (!retval) { 884 if (!retval) {
887 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 885 xhci_dbg(xhci, "Start the secondary HCD\n");
888 set_bit(HCD_FLAG_HW_ACCESSIBLE, 886 retval = xhci_run(secondary_hcd);
889 &xhci->shared_hcd->flags);
890 } 887 }
891failed_restart:
892 hcd->state = HC_STATE_SUSPENDED; 888 hcd->state = HC_STATE_SUSPENDED;
893 xhci->shared_hcd->state = HC_STATE_SUSPENDED; 889 xhci->shared_hcd->state = HC_STATE_SUSPENDED;
894 return retval; 890 goto done;
895 } 891 }
896 892
897 /* step 4: set Run/Stop bit */ 893 /* step 4: set Run/Stop bit */
@@ -910,11 +906,14 @@ failed_restart:
910 * Running endpoints by ringing their doorbells 906 * Running endpoints by ringing their doorbells
911 */ 907 */
912 908
913 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
914 set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
915
916 spin_unlock_irq(&xhci->lock); 909 spin_unlock_irq(&xhci->lock);
917 return 0; 910
911 done:
912 if (retval == 0) {
913 usb_hcd_resume_root_hub(hcd);
914 usb_hcd_resume_root_hub(xhci->shared_hcd);
915 }
916 return retval;
918} 917}
919#endif /* CONFIG_PM */ 918#endif /* CONFIG_PM */
920 919
@@ -3504,6 +3503,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
3504 /* Otherwise, update the control endpoint ring enqueue pointer. */ 3503 /* Otherwise, update the control endpoint ring enqueue pointer. */
3505 else 3504 else
3506 xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); 3505 xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
3506 ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
3507 ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
3508 ctrl_ctx->drop_flags = 0;
3509
3507 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); 3510 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
3508 xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); 3511 xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
3509 3512
@@ -3585,7 +3588,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
3585 virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK) 3588 virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK)
3586 + 1; 3589 + 1;
3587 /* Zero the input context control for later use */ 3590 /* Zero the input context control for later use */
3588 ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
3589 ctrl_ctx->add_flags = 0; 3591 ctrl_ctx->add_flags = 0;
3590 ctrl_ctx->drop_flags = 0; 3592 ctrl_ctx->drop_flags = 0;
3591 3593
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index fc34b8b11910..07a03460a598 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC
11 select TWL4030_USB if MACH_OMAP_3430SDP 11 select TWL4030_USB if MACH_OMAP_3430SDP
12 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 12 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
13 select USB_OTG_UTILS 13 select USB_OTG_UTILS
14 select USB_GADGET_DUALSPEED
14 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 15 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
15 help 16 help
16 Say Y here if your system has a dual role high speed USB 17 Say Y here if your system has a dual role high speed USB
@@ -60,7 +61,7 @@ config USB_MUSB_BLACKFIN
60 61
61config USB_MUSB_UX500 62config USB_MUSB_UX500
62 tristate "U8500 and U5500" 63 tristate "U8500 and U5500"
63 depends on (ARCH_U8500 && AB8500_USB) || (ARCH_U5500) 64 depends on (ARCH_U8500 && AB8500_USB)
64 65
65endchoice 66endchoice
66 67
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 08f1d0b662a3..e233d2b7d335 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -27,6 +27,7 @@
27 */ 27 */
28 28
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/module.h>
30#include <linux/clk.h> 31#include <linux/clk.h>
31#include <linux/io.h> 32#include <linux/io.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 4da7492ddbdb..2613bfdb09b6 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -27,6 +27,7 @@
27 */ 27 */
28 28
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/module.h>
30#include <linux/clk.h> 31#include <linux/clk.h>
31#include <linux/io.h> 32#include <linux/io.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 12044c473c38..549585086798 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1476,8 +1476,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1476/*-------------------------------------------------------------------------*/ 1476/*-------------------------------------------------------------------------*/
1477 1477
1478#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \ 1478#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \
1479 defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500) || \ 1479 defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500)
1480 defined(CONFIG_ARCH_U5500)
1481 1480
1482static irqreturn_t generic_interrupt(int irq, void *__hci) 1481static irqreturn_t generic_interrupt(int irq, void *__hci)
1483{ 1482{
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index ae4a20acef6c..d51043acfe1a 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1999,10 +1999,6 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
1999 nuke(&hw_ep->ep_out, -ESHUTDOWN); 1999 nuke(&hw_ep->ep_out, -ESHUTDOWN);
2000 } 2000 }
2001 } 2001 }
2002
2003 spin_unlock(&musb->lock);
2004 driver->disconnect(&musb->g);
2005 spin_lock(&musb->lock);
2006 } 2002 }
2007} 2003}
2008 2004
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index d2e2efaba658..08c679c0dde5 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -405,7 +405,7 @@ int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
405/* 405/*
406 * platform functions 406 * platform functions
407 */ 407 */
408static int __devinit usbhs_probe(struct platform_device *pdev) 408static int usbhs_probe(struct platform_device *pdev)
409{ 409{
410 struct renesas_usbhs_platform_info *info = pdev->dev.platform_data; 410 struct renesas_usbhs_platform_info *info = pdev->dev.platform_data;
411 struct renesas_usbhs_driver_callback *dfunc; 411 struct renesas_usbhs_driver_callback *dfunc;
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 8da685e796d1..ffdf5d15085e 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -820,7 +820,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
820 if (len % 4) /* 32bit alignment */ 820 if (len % 4) /* 32bit alignment */
821 goto usbhsf_pio_prepare_push; 821 goto usbhsf_pio_prepare_push;
822 822
823 if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ 823 if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
824 goto usbhsf_pio_prepare_push; 824 goto usbhsf_pio_prepare_push;
825 825
826 /* get enable DMA fifo */ 826 /* get enable DMA fifo */
@@ -897,7 +897,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done)
897 if (!fifo) 897 if (!fifo)
898 goto usbhsf_pio_prepare_pop; 898 goto usbhsf_pio_prepare_pop;
899 899
900 if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ 900 if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
901 goto usbhsf_pio_prepare_pop; 901 goto usbhsf_pio_prepare_pop;
902 902
903 ret = usbhsf_fifo_select(pipe, fifo, 0); 903 ret = usbhsf_fifo_select(pipe, fifo, 0);
diff --git a/drivers/usb/renesas_usbhs/mod.h b/drivers/usb/renesas_usbhs/mod.h
index 8ae3733031cd..6c6875533f01 100644
--- a/drivers/usb/renesas_usbhs/mod.h
+++ b/drivers/usb/renesas_usbhs/mod.h
@@ -143,8 +143,8 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod);
143 */ 143 */
144#if defined(CONFIG_USB_RENESAS_USBHS_HCD) || \ 144#if defined(CONFIG_USB_RENESAS_USBHS_HCD) || \
145 defined(CONFIG_USB_RENESAS_USBHS_HCD_MODULE) 145 defined(CONFIG_USB_RENESAS_USBHS_HCD_MODULE)
146extern int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv); 146extern int usbhs_mod_host_probe(struct usbhs_priv *priv);
147extern int __devexit usbhs_mod_host_remove(struct usbhs_priv *priv); 147extern int usbhs_mod_host_remove(struct usbhs_priv *priv);
148#else 148#else
149static inline int usbhs_mod_host_probe(struct usbhs_priv *priv) 149static inline int usbhs_mod_host_probe(struct usbhs_priv *priv)
150{ 150{
@@ -157,8 +157,8 @@ static inline void usbhs_mod_host_remove(struct usbhs_priv *priv)
157 157
158#if defined(CONFIG_USB_RENESAS_USBHS_UDC) || \ 158#if defined(CONFIG_USB_RENESAS_USBHS_UDC) || \
159 defined(CONFIG_USB_RENESAS_USBHS_UDC_MODULE) 159 defined(CONFIG_USB_RENESAS_USBHS_UDC_MODULE)
160extern int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv); 160extern int usbhs_mod_gadget_probe(struct usbhs_priv *priv);
161extern void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv); 161extern void usbhs_mod_gadget_remove(struct usbhs_priv *priv);
162#else 162#else
163static inline int usbhs_mod_gadget_probe(struct usbhs_priv *priv) 163static inline int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
164{ 164{
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 4cc7ee0babc6..d9717e0bc1ff 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -830,7 +830,7 @@ static int usbhsg_stop(struct usbhs_priv *priv)
830 return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); 830 return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED);
831} 831}
832 832
833int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv) 833int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
834{ 834{
835 struct usbhsg_gpriv *gpriv; 835 struct usbhsg_gpriv *gpriv;
836 struct usbhsg_uep *uep; 836 struct usbhsg_uep *uep;
@@ -927,7 +927,7 @@ usbhs_mod_gadget_probe_err_gpriv:
927 return ret; 927 return ret;
928} 928}
929 929
930void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv) 930void usbhs_mod_gadget_remove(struct usbhs_priv *priv)
931{ 931{
932 struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); 932 struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv);
933 933
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index 1a7208a50afc..bade761a1e52 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -103,7 +103,7 @@ struct usbhsh_hpriv {
103 103
104 u32 port_stat; /* USB_PORT_STAT_xxx */ 104 u32 port_stat; /* USB_PORT_STAT_xxx */
105 105
106 struct completion *done; 106 struct completion setup_ack_done;
107 107
108 /* see usbhsh_req_alloc/free */ 108 /* see usbhsh_req_alloc/free */
109 struct list_head ureq_link_active; 109 struct list_head ureq_link_active;
@@ -355,6 +355,7 @@ static void usbhsh_device_free(struct usbhsh_hpriv *hpriv,
355struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, 355struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
356 struct usbhsh_device *udev, 356 struct usbhsh_device *udev,
357 struct usb_host_endpoint *ep, 357 struct usb_host_endpoint *ep,
358 int dir_in_req,
358 gfp_t mem_flags) 359 gfp_t mem_flags)
359{ 360{
360 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); 361 struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
@@ -364,27 +365,38 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
364 struct usbhs_pipe *pipe, *best_pipe; 365 struct usbhs_pipe *pipe, *best_pipe;
365 struct device *dev = usbhsh_hcd_to_dev(hcd); 366 struct device *dev = usbhsh_hcd_to_dev(hcd);
366 struct usb_endpoint_descriptor *desc = &ep->desc; 367 struct usb_endpoint_descriptor *desc = &ep->desc;
367 int type, i; 368 int type, i, dir_in;
368 unsigned int min_usr; 369 unsigned int min_usr;
369 370
371 dir_in_req = !!dir_in_req;
372
370 uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags); 373 uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags);
371 if (!uep) { 374 if (!uep) {
372 dev_err(dev, "usbhsh_ep alloc fail\n"); 375 dev_err(dev, "usbhsh_ep alloc fail\n");
373 return NULL; 376 return NULL;
374 } 377 }
375 type = usb_endpoint_type(desc); 378
379 if (usb_endpoint_xfer_control(desc)) {
380 best_pipe = usbhsh_hpriv_to_dcp(hpriv);
381 goto usbhsh_endpoint_alloc_find_pipe;
382 }
376 383
377 /* 384 /*
378 * find best pipe for endpoint 385 * find best pipe for endpoint
379 * see 386 * see
380 * HARDWARE LIMITATION 387 * HARDWARE LIMITATION
381 */ 388 */
389 type = usb_endpoint_type(desc);
382 min_usr = ~0; 390 min_usr = ~0;
383 best_pipe = NULL; 391 best_pipe = NULL;
384 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { 392 usbhs_for_each_pipe(pipe, priv, i) {
385 if (!usbhs_pipe_type_is(pipe, type)) 393 if (!usbhs_pipe_type_is(pipe, type))
386 continue; 394 continue;
387 395
396 dir_in = !!usbhs_pipe_is_dir_in(pipe);
397 if (0 != (dir_in - dir_in_req))
398 continue;
399
388 info = usbhsh_pipe_info(pipe); 400 info = usbhsh_pipe_info(pipe);
389 401
390 if (min_usr > info->usr_cnt) { 402 if (min_usr > info->usr_cnt) {
@@ -398,7 +410,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
398 kfree(uep); 410 kfree(uep);
399 return NULL; 411 return NULL;
400 } 412 }
401 413usbhsh_endpoint_alloc_find_pipe:
402 /* 414 /*
403 * init uep 415 * init uep
404 */ 416 */
@@ -423,6 +435,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
423 * see 435 * see
424 * DCPMAXP/PIPEMAXP 436 * DCPMAXP/PIPEMAXP
425 */ 437 */
438 usbhs_pipe_sequence_data0(uep->pipe);
426 usbhs_pipe_config_update(uep->pipe, 439 usbhs_pipe_config_update(uep->pipe,
427 usbhsh_device_number(hpriv, udev), 440 usbhsh_device_number(hpriv, udev),
428 usb_endpoint_num(desc), 441 usb_endpoint_num(desc),
@@ -430,7 +443,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
430 443
431 dev_dbg(dev, "%s [%d-%s](%p)\n", __func__, 444 dev_dbg(dev, "%s [%d-%s](%p)\n", __func__,
432 usbhsh_device_number(hpriv, udev), 445 usbhsh_device_number(hpriv, udev),
433 usbhs_pipe_name(pipe), uep); 446 usbhs_pipe_name(uep->pipe), uep);
434 447
435 return uep; 448 return uep;
436} 449}
@@ -549,8 +562,7 @@ static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv,
549 * usbhsh_irq_setup_ack() 562 * usbhsh_irq_setup_ack()
550 * usbhsh_irq_setup_err() 563 * usbhsh_irq_setup_err()
551 */ 564 */
552 DECLARE_COMPLETION(done); 565 init_completion(&hpriv->setup_ack_done);
553 hpriv->done = &done;
554 566
555 /* copy original request */ 567 /* copy original request */
556 memcpy(&req, urb->setup_packet, sizeof(struct usb_ctrlrequest)); 568 memcpy(&req, urb->setup_packet, sizeof(struct usb_ctrlrequest));
@@ -572,8 +584,7 @@ static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv,
572 /* 584 /*
573 * wait setup packet ACK 585 * wait setup packet ACK
574 */ 586 */
575 wait_for_completion(&done); 587 wait_for_completion(&hpriv->setup_ack_done);
576 hpriv->done = NULL;
577 588
578 dev_dbg(dev, "%s done\n", __func__); 589 dev_dbg(dev, "%s done\n", __func__);
579} 590}
@@ -724,11 +735,11 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,
724 struct usbhsh_device *udev, *new_udev = NULL; 735 struct usbhsh_device *udev, *new_udev = NULL;
725 struct usbhs_pipe *pipe; 736 struct usbhs_pipe *pipe;
726 struct usbhsh_ep *uep; 737 struct usbhsh_ep *uep;
738 int is_dir_in = usb_pipein(urb->pipe);
727 739
728 int ret; 740 int ret;
729 741
730 dev_dbg(dev, "%s (%s)\n", 742 dev_dbg(dev, "%s (%s)\n", __func__, is_dir_in ? "in" : "out");
731 __func__, usb_pipein(urb->pipe) ? "in" : "out");
732 743
733 ret = usb_hcd_link_urb_to_ep(hcd, urb); 744 ret = usb_hcd_link_urb_to_ep(hcd, urb);
734 if (ret) 745 if (ret)
@@ -751,7 +762,8 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,
751 */ 762 */
752 uep = usbhsh_ep_to_uep(ep); 763 uep = usbhsh_ep_to_uep(ep);
753 if (!uep) { 764 if (!uep) {
754 uep = usbhsh_endpoint_alloc(hpriv, udev, ep, mem_flags); 765 uep = usbhsh_endpoint_alloc(hpriv, udev, ep,
766 is_dir_in, mem_flags);
755 if (!uep) 767 if (!uep)
756 goto usbhsh_urb_enqueue_error_free_device; 768 goto usbhsh_urb_enqueue_error_free_device;
757 } 769 }
@@ -1095,10 +1107,7 @@ static int usbhsh_irq_setup_ack(struct usbhs_priv *priv,
1095 1107
1096 dev_dbg(dev, "setup packet OK\n"); 1108 dev_dbg(dev, "setup packet OK\n");
1097 1109
1098 if (unlikely(!hpriv->done)) 1110 complete(&hpriv->setup_ack_done); /* see usbhsh_urb_enqueue() */
1099 dev_err(dev, "setup ack happen without necessary data\n");
1100 else
1101 complete(hpriv->done); /* see usbhsh_urb_enqueue() */
1102 1111
1103 return 0; 1112 return 0;
1104} 1113}
@@ -1111,10 +1120,7 @@ static int usbhsh_irq_setup_err(struct usbhs_priv *priv,
1111 1120
1112 dev_dbg(dev, "setup packet Err\n"); 1121 dev_dbg(dev, "setup packet Err\n");
1113 1122
1114 if (unlikely(!hpriv->done)) 1123 complete(&hpriv->setup_ack_done); /* see usbhsh_urb_enqueue() */
1115 dev_err(dev, "setup err happen without necessary data\n");
1116 else
1117 complete(hpriv->done); /* see usbhsh_urb_enqueue() */
1118 1124
1119 return 0; 1125 return 0;
1120} 1126}
@@ -1221,8 +1227,18 @@ static int usbhsh_stop(struct usbhs_priv *priv)
1221{ 1227{
1222 struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); 1228 struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);
1223 struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); 1229 struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);
1230 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
1224 struct device *dev = usbhs_priv_to_dev(priv); 1231 struct device *dev = usbhs_priv_to_dev(priv);
1225 1232
1233 /*
1234 * disable irq callback
1235 */
1236 mod->irq_attch = NULL;
1237 mod->irq_dtch = NULL;
1238 mod->irq_sack = NULL;
1239 mod->irq_sign = NULL;
1240 usbhs_irq_callback_update(priv, mod);
1241
1226 usb_remove_hcd(hcd); 1242 usb_remove_hcd(hcd);
1227 1243
1228 /* disable sys */ 1244 /* disable sys */
@@ -1235,7 +1251,7 @@ static int usbhsh_stop(struct usbhs_priv *priv)
1235 return 0; 1251 return 0;
1236} 1252}
1237 1253
1238int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv) 1254int usbhs_mod_host_probe(struct usbhs_priv *priv)
1239{ 1255{
1240 struct usbhsh_hpriv *hpriv; 1256 struct usbhsh_hpriv *hpriv;
1241 struct usb_hcd *hcd; 1257 struct usb_hcd *hcd;
@@ -1279,7 +1295,6 @@ int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv)
1279 hpriv->mod.stop = usbhsh_stop; 1295 hpriv->mod.stop = usbhsh_stop;
1280 hpriv->pipe_info = pipe_info; 1296 hpriv->pipe_info = pipe_info;
1281 hpriv->pipe_size = pipe_size; 1297 hpriv->pipe_size = pipe_size;
1282 hpriv->done = NULL;
1283 usbhsh_req_list_init(hpriv); 1298 usbhsh_req_list_init(hpriv);
1284 usbhsh_port_stat_init(hpriv); 1299 usbhsh_port_stat_init(hpriv);
1285 1300
@@ -1299,7 +1314,7 @@ usbhs_mod_host_probe_err:
1299 return -ENOMEM; 1314 return -ENOMEM;
1300} 1315}
1301 1316
1302int __devexit usbhs_mod_host_remove(struct usbhs_priv *priv) 1317int usbhs_mod_host_remove(struct usbhs_priv *priv)
1303{ 1318{
1304 struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); 1319 struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);
1305 struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); 1320 struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 5cdb9d912275..18e875b92e00 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -42,7 +42,7 @@ static int debug;
42 * Version information 42 * Version information
43 */ 43 */
44 44
45#define DRIVER_VERSION "v0.6" 45#define DRIVER_VERSION "v0.7"
46#define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@gmail.com>" 46#define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@gmail.com>"
47#define DRIVER_DESC "USB ARK3116 serial/IrDA driver" 47#define DRIVER_DESC "USB ARK3116 serial/IrDA driver"
48#define DRIVER_DEV_DESC "ARK3116 RS232/IrDA" 48#define DRIVER_DEV_DESC "ARK3116 RS232/IrDA"
@@ -380,10 +380,6 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
380 goto err_out; 380 goto err_out;
381 } 381 }
382 382
383 /* setup termios */
384 if (tty)
385 ark3116_set_termios(tty, port, NULL);
386
387 /* remove any data still left: also clears error state */ 383 /* remove any data still left: also clears error state */
388 ark3116_read_reg(serial, UART_RX, buf); 384 ark3116_read_reg(serial, UART_RX, buf);
389 385
@@ -406,6 +402,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
406 /* enable DMA */ 402 /* enable DMA */
407 ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT); 403 ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT);
408 404
405 /* setup termios */
406 if (tty)
407 ark3116_set_termios(tty, port, NULL);
408
409err_out: 409err_out:
410 kfree(buf); 410 kfree(buf);
411 return result; 411 return result;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8fe034d2d3e7..bd4298bb6750 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2104,13 +2104,19 @@ static void ftdi_set_termios(struct tty_struct *tty,
2104 2104
2105 cflag = termios->c_cflag; 2105 cflag = termios->c_cflag;
2106 2106
2107 /* FIXME -For this cut I don't care if the line is really changing or 2107 if (old_termios->c_cflag == termios->c_cflag
2108 not - so just do the change regardless - should be able to 2108 && old_termios->c_ispeed == termios->c_ispeed
2109 compare old_termios and tty->termios */ 2109 && old_termios->c_ospeed == termios->c_ospeed)
2110 goto no_c_cflag_changes;
2111
2110 /* NOTE These routines can get interrupted by 2112 /* NOTE These routines can get interrupted by
2111 ftdi_sio_read_bulk_callback - need to examine what this means - 2113 ftdi_sio_read_bulk_callback - need to examine what this means -
2112 don't see any problems yet */ 2114 don't see any problems yet */
2113 2115
2116 if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
2117 (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
2118 goto no_data_parity_stop_changes;
2119
2114 /* Set number of data bits, parity, stop bits */ 2120 /* Set number of data bits, parity, stop bits */
2115 2121
2116 urb_value = 0; 2122 urb_value = 0;
@@ -2151,6 +2157,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
2151 } 2157 }
2152 2158
2153 /* Now do the baudrate */ 2159 /* Now do the baudrate */
2160no_data_parity_stop_changes:
2154 if ((cflag & CBAUD) == B0) { 2161 if ((cflag & CBAUD) == B0) {
2155 /* Disable flow control */ 2162 /* Disable flow control */
2156 if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 2163 if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
@@ -2178,6 +2185,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
2178 2185
2179 /* Set flow control */ 2186 /* Set flow control */
2180 /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ 2187 /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
2188no_c_cflag_changes:
2181 if (cflag & CRTSCTS) { 2189 if (cflag & CRTSCTS) {
2182 dbg("%s Setting to CRTSCTS flow control", __func__); 2190 dbg("%s Setting to CRTSCTS flow control", __func__);
2183 if (usb_control_msg(dev, 2191 if (usb_control_msg(dev,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 89ae1f65e1b1..d865878c9f97 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -156,6 +156,7 @@ static void option_instat_callback(struct urb *urb);
156#define HUAWEI_PRODUCT_K4511 0x14CC 156#define HUAWEI_PRODUCT_K4511 0x14CC
157#define HUAWEI_PRODUCT_ETS1220 0x1803 157#define HUAWEI_PRODUCT_ETS1220 0x1803
158#define HUAWEI_PRODUCT_E353 0x1506 158#define HUAWEI_PRODUCT_E353 0x1506
159#define HUAWEI_PRODUCT_E173S 0x1C05
159 160
160#define QUANTA_VENDOR_ID 0x0408 161#define QUANTA_VENDOR_ID 0x0408
161#define QUANTA_PRODUCT_Q101 0xEA02 162#define QUANTA_PRODUCT_Q101 0xEA02
@@ -316,6 +317,9 @@ static void option_instat_callback(struct urb *urb);
316#define ZTE_PRODUCT_AC8710 0xfff1 317#define ZTE_PRODUCT_AC8710 0xfff1
317#define ZTE_PRODUCT_AC2726 0xfff5 318#define ZTE_PRODUCT_AC2726 0xfff5
318#define ZTE_PRODUCT_AC8710T 0xffff 319#define ZTE_PRODUCT_AC8710T 0xffff
320#define ZTE_PRODUCT_MC2718 0xffe8
321#define ZTE_PRODUCT_AD3812 0xffeb
322#define ZTE_PRODUCT_MC2716 0xffed
319 323
320#define BENQ_VENDOR_ID 0x04a5 324#define BENQ_VENDOR_ID 0x04a5
321#define BENQ_PRODUCT_H10 0x4068 325#define BENQ_PRODUCT_H10 0x4068
@@ -468,6 +472,10 @@ static void option_instat_callback(struct urb *urb);
468#define YUGA_PRODUCT_CLU528 0x260D 472#define YUGA_PRODUCT_CLU528 0x260D
469#define YUGA_PRODUCT_CLU526 0x260F 473#define YUGA_PRODUCT_CLU526 0x260F
470 474
475/* Viettel products */
476#define VIETTEL_VENDOR_ID 0x2262
477#define VIETTEL_PRODUCT_VT1000 0x0002
478
471/* some devices interfaces need special handling due to a number of reasons */ 479/* some devices interfaces need special handling due to a number of reasons */
472enum option_blacklist_reason { 480enum option_blacklist_reason {
473 OPTION_BLACKLIST_NONE = 0, 481 OPTION_BLACKLIST_NONE = 0,
@@ -500,6 +508,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = {
500 .reserved = BIT(4), 508 .reserved = BIT(4),
501}; 509};
502 510
511static const struct option_blacklist_info zte_ad3812_z_blacklist = {
512 .sendsetup = BIT(0) | BIT(1) | BIT(2),
513};
514
515static const struct option_blacklist_info zte_mc2718_z_blacklist = {
516 .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
517};
518
519static const struct option_blacklist_info zte_mc2716_z_blacklist = {
520 .sendsetup = BIT(1) | BIT(2) | BIT(3),
521};
522
503static const struct option_blacklist_info huawei_cdc12_blacklist = { 523static const struct option_blacklist_info huawei_cdc12_blacklist = {
504 .reserved = BIT(1) | BIT(2), 524 .reserved = BIT(1) | BIT(2),
505}; 525};
@@ -622,6 +642,7 @@ static const struct usb_device_id option_ids[] = {
622 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, 642 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
623 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, 643 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
624 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, 644 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
645 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
625 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), 646 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
626 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 647 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
627 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), 648 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
@@ -1043,6 +1064,12 @@ static const struct usb_device_id option_ids[] = {
1043 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 1064 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1044 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 1065 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1045 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, 1066 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
1067 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
1068 .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
1069 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
1070 .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
1071 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
1072 .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
1046 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, 1073 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
1047 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, 1074 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
1048 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ 1075 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
@@ -1141,6 +1168,7 @@ static const struct usb_device_id option_ids[] = {
1141 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) }, 1168 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) },
1142 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) }, 1169 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) },
1143 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, 1170 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
1171 { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
1144 { } /* Terminating entry */ 1172 { } /* Terminating entry */
1145}; 1173};
1146MODULE_DEVICE_TABLE(usb, option_ids); 1174MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 56aa1e6cc380..329295615d06 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -91,7 +91,6 @@ static const struct usb_device_id id_table[] = {
91 { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, 91 { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
92 { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, 92 { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
93 { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, 93 { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
94 { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) },
95 { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, 94 { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
96 { } /* Terminating entry */ 95 { } /* Terminating entry */
97}; 96};
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 3d10d7f02072..c38b8c00c06f 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -145,10 +145,6 @@
145#define ADLINK_VENDOR_ID 0x0b63 145#define ADLINK_VENDOR_ID 0x0b63
146#define ADLINK_ND6530_PRODUCT_ID 0x6530 146#define ADLINK_ND6530_PRODUCT_ID 0x6530
147 147
148/* WinChipHead USB->RS 232 adapter */
149#define WINCHIPHEAD_VENDOR_ID 0x4348
150#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
151
152/* SMART USB Serial Adapter */ 148/* SMART USB Serial Adapter */
153#define SMART_VENDOR_ID 0x0b8c 149#define SMART_VENDOR_ID 0x0b8c
154#define SMART_PRODUCT_ID 0x2303 150#define SMART_PRODUCT_ID 0x2303
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 9665f15f52a7..b990726f144a 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -1762,10 +1762,9 @@ static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb)
1762 result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1); 1762 result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1);
1763 } else { 1763 } else {
1764 void *buf; 1764 void *buf;
1765 int offset; 1765 int offset = 0;
1766 u16 PhyBlockAddr; 1766 u16 PhyBlockAddr;
1767 u8 PageNum; 1767 u8 PageNum;
1768 u32 result;
1769 u16 len, oldphy, newphy; 1768 u16 len, oldphy, newphy;
1770 1769
1771 buf = kmalloc(blenByte, GFP_KERNEL); 1770 buf = kmalloc(blenByte, GFP_KERNEL);
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index 93c1a4d86f51..82dd834709c7 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -59,7 +59,9 @@
59 59
60void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us) 60void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
61{ 61{
62 /* Pad the SCSI command with zeros out to 12 bytes 62 /*
63 * Pad the SCSI command with zeros out to 12 bytes. If the
64 * command already is 12 bytes or longer, leave it alone.
63 * 65 *
64 * NOTE: This only works because a scsi_cmnd struct field contains 66 * NOTE: This only works because a scsi_cmnd struct field contains
65 * a unsigned char cmnd[16], so we know we have storage available 67 * a unsigned char cmnd[16], so we know we have storage available
@@ -67,9 +69,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
67 for (; srb->cmd_len<12; srb->cmd_len++) 69 for (; srb->cmd_len<12; srb->cmd_len++)
68 srb->cmnd[srb->cmd_len] = 0; 70 srb->cmnd[srb->cmd_len] = 0;
69 71
70 /* set command length to 12 bytes */
71 srb->cmd_len = 12;
72
73 /* send the command to the transport layer */ 72 /* send the command to the transport layer */
74 usb_stor_invoke_transport(srb, us); 73 usb_stor_invoke_transport(srb, us);
75} 74}