diff options
Diffstat (limited to 'drivers/usb')
46 files changed, 561 insertions, 384 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 6ee4451bfe2d..47085e5879ab 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -342,7 +342,7 @@ static ssize_t wdm_write | |||
342 | goto outnp; | 342 | goto outnp; |
343 | } | 343 | } |
344 | 344 | ||
345 | if (!file->f_flags && O_NONBLOCK) | 345 | if (!(file->f_flags & O_NONBLOCK)) |
346 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, | 346 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, |
347 | &desc->flags)); | 347 | &desc->flags)); |
348 | else | 348 | else |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index bcc24779ba0e..18d02e32a3d5 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -123,9 +123,9 @@ config USB_OTG | |||
123 | 123 | ||
124 | config USB_OTG_WHITELIST | 124 | config USB_OTG_WHITELIST |
125 | bool "Rely on OTG Targeted Peripherals List" | 125 | bool "Rely on OTG Targeted Peripherals List" |
126 | depends on USB_OTG || EMBEDDED | 126 | depends on USB_OTG || EXPERT |
127 | default y if USB_OTG | 127 | default y if USB_OTG |
128 | default n if EMBEDDED | 128 | default n if EXPERT |
129 | help | 129 | help |
130 | If you say Y here, the "otg_whitelist.h" file will be used as a | 130 | If you say Y here, the "otg_whitelist.h" file will be used as a |
131 | product whitelist, so USB peripherals not listed there will be | 131 | product whitelist, so USB peripherals not listed there will be |
@@ -141,7 +141,7 @@ config USB_OTG_WHITELIST | |||
141 | 141 | ||
142 | config USB_OTG_BLACKLIST_HUB | 142 | config USB_OTG_BLACKLIST_HUB |
143 | bool "Disable external hubs" | 143 | bool "Disable external hubs" |
144 | depends on USB_OTG || EMBEDDED | 144 | depends on USB_OTG || EXPERT |
145 | help | 145 | help |
146 | If you say Y here, then Linux will refuse to enumerate | 146 | If you say Y here, then Linux will refuse to enumerate |
147 | external hubs. OTG hosts are allowed to reduce hardware | 147 | external hubs. OTG hosts are allowed to reduce hardware |
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 9da250563027..df502a98d0df 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c | |||
@@ -192,12 +192,12 @@ int usb_create_ep_devs(struct device *parent, | |||
192 | ep_dev->dev.parent = parent; | 192 | ep_dev->dev.parent = parent; |
193 | ep_dev->dev.release = ep_device_release; | 193 | ep_dev->dev.release = ep_device_release; |
194 | dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress); | 194 | dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress); |
195 | device_enable_async_suspend(&ep_dev->dev); | ||
196 | 195 | ||
197 | retval = device_register(&ep_dev->dev); | 196 | retval = device_register(&ep_dev->dev); |
198 | if (retval) | 197 | if (retval) |
199 | goto error_register; | 198 | goto error_register; |
200 | 199 | ||
200 | device_enable_async_suspend(&ep_dev->dev); | ||
201 | endpoint->ep_dev = ep_dev; | 201 | endpoint->ep_dev = ep_dev; |
202 | return retval; | 202 | return retval; |
203 | 203 | ||
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index b55d46070a25..f71e8e307e0f 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -405,7 +405,12 @@ static int suspend_common(struct device *dev, bool do_wakeup) | |||
405 | return retval; | 405 | return retval; |
406 | } | 406 | } |
407 | 407 | ||
408 | synchronize_irq(pci_dev->irq); | 408 | /* If MSI-X is enabled, the driver will have synchronized all vectors |
409 | * in pci_suspend(). If MSI or legacy PCI is enabled, that will be | ||
410 | * synchronized here. | ||
411 | */ | ||
412 | if (!hcd->msix_enabled) | ||
413 | synchronize_irq(pci_dev->irq); | ||
409 | 414 | ||
410 | /* Downstream ports from this root hub should already be quiesced, so | 415 | /* Downstream ports from this root hub should already be quiesced, so |
411 | * there will be no DMA activity. Now we can shut down the upstream | 416 | * there will be no DMA activity. Now we can shut down the upstream |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b98efae6a1cf..4310cc4b1cb5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -676,6 +676,8 @@ static void hub_init_func3(struct work_struct *ws); | |||
676 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | 676 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
677 | { | 677 | { |
678 | struct usb_device *hdev = hub->hdev; | 678 | struct usb_device *hdev = hub->hdev; |
679 | struct usb_hcd *hcd; | ||
680 | int ret; | ||
679 | int port1; | 681 | int port1; |
680 | int status; | 682 | int status; |
681 | bool need_debounce_delay = false; | 683 | bool need_debounce_delay = false; |
@@ -714,6 +716,25 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
714 | usb_autopm_get_interface_no_resume( | 716 | usb_autopm_get_interface_no_resume( |
715 | to_usb_interface(hub->intfdev)); | 717 | to_usb_interface(hub->intfdev)); |
716 | return; /* Continues at init2: below */ | 718 | return; /* Continues at init2: below */ |
719 | } else if (type == HUB_RESET_RESUME) { | ||
720 | /* The internal host controller state for the hub device | ||
721 | * may be gone after a host power loss on system resume. | ||
722 | * Update the device's info so the HW knows it's a hub. | ||
723 | */ | ||
724 | hcd = bus_to_hcd(hdev->bus); | ||
725 | if (hcd->driver->update_hub_device) { | ||
726 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
727 | &hub->tt, GFP_NOIO); | ||
728 | if (ret < 0) { | ||
729 | dev_err(hub->intfdev, "Host not " | ||
730 | "accepting hub info " | ||
731 | "update.\n"); | ||
732 | dev_err(hub->intfdev, "LS/FS devices " | ||
733 | "and hubs may not work " | ||
734 | "under this hub\n."); | ||
735 | } | ||
736 | } | ||
737 | hub_power_on(hub, true); | ||
717 | } else { | 738 | } else { |
718 | hub_power_on(hub, true); | 739 | hub_power_on(hub, true); |
719 | } | 740 | } |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1dc9739277b4..06bb9d4587e9 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -509,7 +509,7 @@ config USB_LANGWELL | |||
509 | select USB_GADGET_SELECTED | 509 | select USB_GADGET_SELECTED |
510 | 510 | ||
511 | config USB_GADGET_EG20T | 511 | config USB_GADGET_EG20T |
512 | boolean "Intel EG20T(Topcliff) USB Device controller" | 512 | boolean "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC" |
513 | depends on PCI | 513 | depends on PCI |
514 | select USB_GADGET_DUALSPEED | 514 | select USB_GADGET_DUALSPEED |
515 | help | 515 | help |
@@ -525,6 +525,11 @@ config USB_GADGET_EG20T | |||
525 | This driver dose not support interrupt transfer or isochronous | 525 | This driver dose not support interrupt transfer or isochronous |
526 | transfer modes. | 526 | transfer modes. |
527 | 527 | ||
528 | This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is | ||
529 | for IVI(In-Vehicle Infotainment) use. | ||
530 | ML7213 is companion chip for Intel Atom E6xx series. | ||
531 | ML7213 is completely compatible for Intel EG20T PCH. | ||
532 | |||
528 | config USB_EG20T | 533 | config USB_EG20T |
529 | tristate | 534 | tristate |
530 | depends on USB_GADGET_EG20T | 535 | depends on USB_GADGET_EG20T |
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 31656a2b4ab4..a1c67ae1572a 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -76,10 +76,21 @@ static DEFINE_SPINLOCK(udc_lock); | |||
76 | 76 | ||
77 | /* control endpoint description */ | 77 | /* control endpoint description */ |
78 | static const struct usb_endpoint_descriptor | 78 | static const struct usb_endpoint_descriptor |
79 | ctrl_endpt_desc = { | 79 | ctrl_endpt_out_desc = { |
80 | .bLength = USB_DT_ENDPOINT_SIZE, | 80 | .bLength = USB_DT_ENDPOINT_SIZE, |
81 | .bDescriptorType = USB_DT_ENDPOINT, | 81 | .bDescriptorType = USB_DT_ENDPOINT, |
82 | 82 | ||
83 | .bEndpointAddress = USB_DIR_OUT, | ||
84 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, | ||
85 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), | ||
86 | }; | ||
87 | |||
88 | static const struct usb_endpoint_descriptor | ||
89 | ctrl_endpt_in_desc = { | ||
90 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
91 | .bDescriptorType = USB_DT_ENDPOINT, | ||
92 | |||
93 | .bEndpointAddress = USB_DIR_IN, | ||
83 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, | 94 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, |
84 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), | 95 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), |
85 | }; | 96 | }; |
@@ -265,10 +276,10 @@ static int hw_device_init(void __iomem *base) | |||
265 | hw_bank.size /= sizeof(u32); | 276 | hw_bank.size /= sizeof(u32); |
266 | 277 | ||
267 | reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN); | 278 | reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN); |
268 | if (reg == 0 || reg > ENDPT_MAX) | 279 | hw_ep_max = reg * 2; /* cache hw ENDPT_MAX */ |
269 | return -ENODEV; | ||
270 | 280 | ||
271 | hw_ep_max = reg; /* cache hw ENDPT_MAX */ | 281 | if (hw_ep_max == 0 || hw_ep_max > ENDPT_MAX) |
282 | return -ENODEV; | ||
272 | 283 | ||
273 | /* setup lock mode ? */ | 284 | /* setup lock mode ? */ |
274 | 285 | ||
@@ -1197,16 +1208,17 @@ static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, | |||
1197 | } | 1208 | } |
1198 | 1209 | ||
1199 | spin_lock_irqsave(udc->lock, flags); | 1210 | spin_lock_irqsave(udc->lock, flags); |
1200 | for (i = 0; i < hw_ep_max; i++) { | 1211 | for (i = 0; i < hw_ep_max/2; i++) { |
1201 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 1212 | struct ci13xxx_ep *mEpRx = &udc->ci13xxx_ep[i]; |
1213 | struct ci13xxx_ep *mEpTx = &udc->ci13xxx_ep[i + hw_ep_max/2]; | ||
1202 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1214 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1203 | "EP=%02i: RX=%08X TX=%08X\n", | 1215 | "EP=%02i: RX=%08X TX=%08X\n", |
1204 | i, (u32)mEp->qh[RX].dma, (u32)mEp->qh[TX].dma); | 1216 | i, (u32)mEpRx->qh.dma, (u32)mEpTx->qh.dma); |
1205 | for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) { | 1217 | for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) { |
1206 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1218 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1207 | " %04X: %08X %08X\n", j, | 1219 | " %04X: %08X %08X\n", j, |
1208 | *((u32 *)mEp->qh[RX].ptr + j), | 1220 | *((u32 *)mEpRx->qh.ptr + j), |
1209 | *((u32 *)mEp->qh[TX].ptr + j)); | 1221 | *((u32 *)mEpTx->qh.ptr + j)); |
1210 | } | 1222 | } |
1211 | } | 1223 | } |
1212 | spin_unlock_irqrestore(udc->lock, flags); | 1224 | spin_unlock_irqrestore(udc->lock, flags); |
@@ -1293,7 +1305,7 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | |||
1293 | unsigned long flags; | 1305 | unsigned long flags; |
1294 | struct list_head *ptr = NULL; | 1306 | struct list_head *ptr = NULL; |
1295 | struct ci13xxx_req *req = NULL; | 1307 | struct ci13xxx_req *req = NULL; |
1296 | unsigned i, j, k, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); | 1308 | unsigned i, j, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); |
1297 | 1309 | ||
1298 | dbg_trace("[%s] %p\n", __func__, buf); | 1310 | dbg_trace("[%s] %p\n", __func__, buf); |
1299 | if (attr == NULL || buf == NULL) { | 1311 | if (attr == NULL || buf == NULL) { |
@@ -1303,22 +1315,20 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | |||
1303 | 1315 | ||
1304 | spin_lock_irqsave(udc->lock, flags); | 1316 | spin_lock_irqsave(udc->lock, flags); |
1305 | for (i = 0; i < hw_ep_max; i++) | 1317 | for (i = 0; i < hw_ep_max; i++) |
1306 | for (k = RX; k <= TX; k++) | 1318 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh.queue) |
1307 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh[k].queue) | 1319 | { |
1308 | { | 1320 | req = list_entry(ptr, struct ci13xxx_req, queue); |
1309 | req = list_entry(ptr, | 1321 | |
1310 | struct ci13xxx_req, queue); | 1322 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1323 | "EP=%02i: TD=%08X %s\n", | ||
1324 | i % hw_ep_max/2, (u32)req->dma, | ||
1325 | ((i < hw_ep_max/2) ? "RX" : "TX")); | ||
1311 | 1326 | ||
1327 | for (j = 0; j < qSize; j++) | ||
1312 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1328 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1313 | "EP=%02i: TD=%08X %s\n", | 1329 | " %04X: %08X\n", j, |
1314 | i, (u32)req->dma, | 1330 | *((u32 *)req->ptr + j)); |
1315 | ((k == RX) ? "RX" : "TX")); | 1331 | } |
1316 | |||
1317 | for (j = 0; j < qSize; j++) | ||
1318 | n += scnprintf(buf + n, PAGE_SIZE - n, | ||
1319 | " %04X: %08X\n", j, | ||
1320 | *((u32 *)req->ptr + j)); | ||
1321 | } | ||
1322 | spin_unlock_irqrestore(udc->lock, flags); | 1332 | spin_unlock_irqrestore(udc->lock, flags); |
1323 | 1333 | ||
1324 | return n; | 1334 | return n; |
@@ -1467,12 +1477,12 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
1467 | * At this point it's guaranteed exclusive access to qhead | 1477 | * At this point it's guaranteed exclusive access to qhead |
1468 | * (endpt is not primed) so it's no need to use tripwire | 1478 | * (endpt is not primed) so it's no need to use tripwire |
1469 | */ | 1479 | */ |
1470 | mEp->qh[mEp->dir].ptr->td.next = mReq->dma; /* TERMINATE = 0 */ | 1480 | mEp->qh.ptr->td.next = mReq->dma; /* TERMINATE = 0 */ |
1471 | mEp->qh[mEp->dir].ptr->td.token &= ~TD_STATUS; /* clear status */ | 1481 | mEp->qh.ptr->td.token &= ~TD_STATUS; /* clear status */ |
1472 | if (mReq->req.zero == 0) | 1482 | if (mReq->req.zero == 0) |
1473 | mEp->qh[mEp->dir].ptr->cap |= QH_ZLT; | 1483 | mEp->qh.ptr->cap |= QH_ZLT; |
1474 | else | 1484 | else |
1475 | mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT; | 1485 | mEp->qh.ptr->cap &= ~QH_ZLT; |
1476 | 1486 | ||
1477 | wmb(); /* synchronize before ep prime */ | 1487 | wmb(); /* synchronize before ep prime */ |
1478 | 1488 | ||
@@ -1542,11 +1552,11 @@ __acquires(mEp->lock) | |||
1542 | 1552 | ||
1543 | hw_ep_flush(mEp->num, mEp->dir); | 1553 | hw_ep_flush(mEp->num, mEp->dir); |
1544 | 1554 | ||
1545 | while (!list_empty(&mEp->qh[mEp->dir].queue)) { | 1555 | while (!list_empty(&mEp->qh.queue)) { |
1546 | 1556 | ||
1547 | /* pop oldest request */ | 1557 | /* pop oldest request */ |
1548 | struct ci13xxx_req *mReq = \ | 1558 | struct ci13xxx_req *mReq = \ |
1549 | list_entry(mEp->qh[mEp->dir].queue.next, | 1559 | list_entry(mEp->qh.queue.next, |
1550 | struct ci13xxx_req, queue); | 1560 | struct ci13xxx_req, queue); |
1551 | list_del_init(&mReq->queue); | 1561 | list_del_init(&mReq->queue); |
1552 | mReq->req.status = -ESHUTDOWN; | 1562 | mReq->req.status = -ESHUTDOWN; |
@@ -1571,8 +1581,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1571 | { | 1581 | { |
1572 | struct usb_ep *ep; | 1582 | struct usb_ep *ep; |
1573 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); | 1583 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); |
1574 | struct ci13xxx_ep *mEp = container_of(gadget->ep0, | ||
1575 | struct ci13xxx_ep, ep); | ||
1576 | 1584 | ||
1577 | trace("%p", gadget); | 1585 | trace("%p", gadget); |
1578 | 1586 | ||
@@ -1583,7 +1591,8 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1583 | gadget_for_each_ep(ep, gadget) { | 1591 | gadget_for_each_ep(ep, gadget) { |
1584 | usb_ep_fifo_flush(ep); | 1592 | usb_ep_fifo_flush(ep); |
1585 | } | 1593 | } |
1586 | usb_ep_fifo_flush(gadget->ep0); | 1594 | usb_ep_fifo_flush(&udc->ep0out.ep); |
1595 | usb_ep_fifo_flush(&udc->ep0in.ep); | ||
1587 | 1596 | ||
1588 | udc->driver->disconnect(gadget); | 1597 | udc->driver->disconnect(gadget); |
1589 | 1598 | ||
@@ -1591,11 +1600,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1591 | gadget_for_each_ep(ep, gadget) { | 1600 | gadget_for_each_ep(ep, gadget) { |
1592 | usb_ep_disable(ep); | 1601 | usb_ep_disable(ep); |
1593 | } | 1602 | } |
1594 | usb_ep_disable(gadget->ep0); | 1603 | usb_ep_disable(&udc->ep0out.ep); |
1604 | usb_ep_disable(&udc->ep0in.ep); | ||
1595 | 1605 | ||
1596 | if (mEp->status != NULL) { | 1606 | if (udc->status != NULL) { |
1597 | usb_ep_free_request(gadget->ep0, mEp->status); | 1607 | usb_ep_free_request(&udc->ep0in.ep, udc->status); |
1598 | mEp->status = NULL; | 1608 | udc->status = NULL; |
1599 | } | 1609 | } |
1600 | 1610 | ||
1601 | return 0; | 1611 | return 0; |
@@ -1614,7 +1624,6 @@ static void isr_reset_handler(struct ci13xxx *udc) | |||
1614 | __releases(udc->lock) | 1624 | __releases(udc->lock) |
1615 | __acquires(udc->lock) | 1625 | __acquires(udc->lock) |
1616 | { | 1626 | { |
1617 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[0]; | ||
1618 | int retval; | 1627 | int retval; |
1619 | 1628 | ||
1620 | trace("%p", udc); | 1629 | trace("%p", udc); |
@@ -1635,11 +1644,15 @@ __acquires(udc->lock) | |||
1635 | if (retval) | 1644 | if (retval) |
1636 | goto done; | 1645 | goto done; |
1637 | 1646 | ||
1638 | retval = usb_ep_enable(&mEp->ep, &ctrl_endpt_desc); | 1647 | retval = usb_ep_enable(&udc->ep0out.ep, &ctrl_endpt_out_desc); |
1648 | if (retval) | ||
1649 | goto done; | ||
1650 | |||
1651 | retval = usb_ep_enable(&udc->ep0in.ep, &ctrl_endpt_in_desc); | ||
1639 | if (!retval) { | 1652 | if (!retval) { |
1640 | mEp->status = usb_ep_alloc_request(&mEp->ep, GFP_ATOMIC); | 1653 | udc->status = usb_ep_alloc_request(&udc->ep0in.ep, GFP_ATOMIC); |
1641 | if (mEp->status == NULL) { | 1654 | if (udc->status == NULL) { |
1642 | usb_ep_disable(&mEp->ep); | 1655 | usb_ep_disable(&udc->ep0out.ep); |
1643 | retval = -ENOMEM; | 1656 | retval = -ENOMEM; |
1644 | } | 1657 | } |
1645 | } | 1658 | } |
@@ -1672,16 +1685,17 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) | |||
1672 | 1685 | ||
1673 | /** | 1686 | /** |
1674 | * isr_get_status_response: get_status request response | 1687 | * isr_get_status_response: get_status request response |
1675 | * @ep: endpoint | 1688 | * @udc: udc struct |
1676 | * @setup: setup request packet | 1689 | * @setup: setup request packet |
1677 | * | 1690 | * |
1678 | * This function returns an error code | 1691 | * This function returns an error code |
1679 | */ | 1692 | */ |
1680 | static int isr_get_status_response(struct ci13xxx_ep *mEp, | 1693 | static int isr_get_status_response(struct ci13xxx *udc, |
1681 | struct usb_ctrlrequest *setup) | 1694 | struct usb_ctrlrequest *setup) |
1682 | __releases(mEp->lock) | 1695 | __releases(mEp->lock) |
1683 | __acquires(mEp->lock) | 1696 | __acquires(mEp->lock) |
1684 | { | 1697 | { |
1698 | struct ci13xxx_ep *mEp = &udc->ep0in; | ||
1685 | struct usb_request *req = NULL; | 1699 | struct usb_request *req = NULL; |
1686 | gfp_t gfp_flags = GFP_ATOMIC; | 1700 | gfp_t gfp_flags = GFP_ATOMIC; |
1687 | int dir, num, retval; | 1701 | int dir, num, retval; |
@@ -1736,27 +1750,23 @@ __acquires(mEp->lock) | |||
1736 | 1750 | ||
1737 | /** | 1751 | /** |
1738 | * isr_setup_status_phase: queues the status phase of a setup transation | 1752 | * isr_setup_status_phase: queues the status phase of a setup transation |
1739 | * @mEp: endpoint | 1753 | * @udc: udc struct |
1740 | * | 1754 | * |
1741 | * This function returns an error code | 1755 | * This function returns an error code |
1742 | */ | 1756 | */ |
1743 | static int isr_setup_status_phase(struct ci13xxx_ep *mEp) | 1757 | static int isr_setup_status_phase(struct ci13xxx *udc) |
1744 | __releases(mEp->lock) | 1758 | __releases(mEp->lock) |
1745 | __acquires(mEp->lock) | 1759 | __acquires(mEp->lock) |
1746 | { | 1760 | { |
1747 | int retval; | 1761 | int retval; |
1762 | struct ci13xxx_ep *mEp; | ||
1748 | 1763 | ||
1749 | trace("%p", mEp); | 1764 | trace("%p", udc); |
1750 | |||
1751 | /* mEp is always valid & configured */ | ||
1752 | |||
1753 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | ||
1754 | mEp->dir = (mEp->dir == TX) ? RX : TX; | ||
1755 | 1765 | ||
1756 | mEp->status->no_interrupt = 1; | 1766 | mEp = (udc->ep0_dir == TX) ? &udc->ep0out : &udc->ep0in; |
1757 | 1767 | ||
1758 | spin_unlock(mEp->lock); | 1768 | spin_unlock(mEp->lock); |
1759 | retval = usb_ep_queue(&mEp->ep, mEp->status, GFP_ATOMIC); | 1769 | retval = usb_ep_queue(&mEp->ep, udc->status, GFP_ATOMIC); |
1760 | spin_lock(mEp->lock); | 1770 | spin_lock(mEp->lock); |
1761 | 1771 | ||
1762 | return retval; | 1772 | return retval; |
@@ -1778,11 +1788,11 @@ __acquires(mEp->lock) | |||
1778 | 1788 | ||
1779 | trace("%p", mEp); | 1789 | trace("%p", mEp); |
1780 | 1790 | ||
1781 | if (list_empty(&mEp->qh[mEp->dir].queue)) | 1791 | if (list_empty(&mEp->qh.queue)) |
1782 | return -EINVAL; | 1792 | return -EINVAL; |
1783 | 1793 | ||
1784 | /* pop oldest request */ | 1794 | /* pop oldest request */ |
1785 | mReq = list_entry(mEp->qh[mEp->dir].queue.next, | 1795 | mReq = list_entry(mEp->qh.queue.next, |
1786 | struct ci13xxx_req, queue); | 1796 | struct ci13xxx_req, queue); |
1787 | list_del_init(&mReq->queue); | 1797 | list_del_init(&mReq->queue); |
1788 | 1798 | ||
@@ -1794,10 +1804,10 @@ __acquires(mEp->lock) | |||
1794 | 1804 | ||
1795 | dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); | 1805 | dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); |
1796 | 1806 | ||
1797 | if (!list_empty(&mEp->qh[mEp->dir].queue)) { | 1807 | if (!list_empty(&mEp->qh.queue)) { |
1798 | struct ci13xxx_req* mReqEnq; | 1808 | struct ci13xxx_req* mReqEnq; |
1799 | 1809 | ||
1800 | mReqEnq = list_entry(mEp->qh[mEp->dir].queue.next, | 1810 | mReqEnq = list_entry(mEp->qh.queue.next, |
1801 | struct ci13xxx_req, queue); | 1811 | struct ci13xxx_req, queue); |
1802 | _hardware_enqueue(mEp, mReqEnq); | 1812 | _hardware_enqueue(mEp, mReqEnq); |
1803 | } | 1813 | } |
@@ -1836,16 +1846,14 @@ __acquires(udc->lock) | |||
1836 | int type, num, err = -EINVAL; | 1846 | int type, num, err = -EINVAL; |
1837 | struct usb_ctrlrequest req; | 1847 | struct usb_ctrlrequest req; |
1838 | 1848 | ||
1839 | |||
1840 | if (mEp->desc == NULL) | 1849 | if (mEp->desc == NULL) |
1841 | continue; /* not configured */ | 1850 | continue; /* not configured */ |
1842 | 1851 | ||
1843 | if ((mEp->dir == RX && hw_test_and_clear_complete(i)) || | 1852 | if (hw_test_and_clear_complete(i)) { |
1844 | (mEp->dir == TX && hw_test_and_clear_complete(i + 16))) { | ||
1845 | err = isr_tr_complete_low(mEp); | 1853 | err = isr_tr_complete_low(mEp); |
1846 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { | 1854 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { |
1847 | if (err > 0) /* needs status phase */ | 1855 | if (err > 0) /* needs status phase */ |
1848 | err = isr_setup_status_phase(mEp); | 1856 | err = isr_setup_status_phase(udc); |
1849 | if (err < 0) { | 1857 | if (err < 0) { |
1850 | dbg_event(_usb_addr(mEp), | 1858 | dbg_event(_usb_addr(mEp), |
1851 | "ERROR", err); | 1859 | "ERROR", err); |
@@ -1866,15 +1874,22 @@ __acquires(udc->lock) | |||
1866 | continue; | 1874 | continue; |
1867 | } | 1875 | } |
1868 | 1876 | ||
1877 | /* | ||
1878 | * Flush data and handshake transactions of previous | ||
1879 | * setup packet. | ||
1880 | */ | ||
1881 | _ep_nuke(&udc->ep0out); | ||
1882 | _ep_nuke(&udc->ep0in); | ||
1883 | |||
1869 | /* read_setup_packet */ | 1884 | /* read_setup_packet */ |
1870 | do { | 1885 | do { |
1871 | hw_test_and_set_setup_guard(); | 1886 | hw_test_and_set_setup_guard(); |
1872 | memcpy(&req, &mEp->qh[RX].ptr->setup, sizeof(req)); | 1887 | memcpy(&req, &mEp->qh.ptr->setup, sizeof(req)); |
1873 | } while (!hw_test_and_clear_setup_guard()); | 1888 | } while (!hw_test_and_clear_setup_guard()); |
1874 | 1889 | ||
1875 | type = req.bRequestType; | 1890 | type = req.bRequestType; |
1876 | 1891 | ||
1877 | mEp->dir = (type & USB_DIR_IN) ? TX : RX; | 1892 | udc->ep0_dir = (type & USB_DIR_IN) ? TX : RX; |
1878 | 1893 | ||
1879 | dbg_setup(_usb_addr(mEp), &req); | 1894 | dbg_setup(_usb_addr(mEp), &req); |
1880 | 1895 | ||
@@ -1895,7 +1910,7 @@ __acquires(udc->lock) | |||
1895 | if (err) | 1910 | if (err) |
1896 | break; | 1911 | break; |
1897 | } | 1912 | } |
1898 | err = isr_setup_status_phase(mEp); | 1913 | err = isr_setup_status_phase(udc); |
1899 | break; | 1914 | break; |
1900 | case USB_REQ_GET_STATUS: | 1915 | case USB_REQ_GET_STATUS: |
1901 | if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && | 1916 | if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && |
@@ -1905,7 +1920,7 @@ __acquires(udc->lock) | |||
1905 | if (le16_to_cpu(req.wLength) != 2 || | 1920 | if (le16_to_cpu(req.wLength) != 2 || |
1906 | le16_to_cpu(req.wValue) != 0) | 1921 | le16_to_cpu(req.wValue) != 0) |
1907 | break; | 1922 | break; |
1908 | err = isr_get_status_response(mEp, &req); | 1923 | err = isr_get_status_response(udc, &req); |
1909 | break; | 1924 | break; |
1910 | case USB_REQ_SET_ADDRESS: | 1925 | case USB_REQ_SET_ADDRESS: |
1911 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) | 1926 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) |
@@ -1916,7 +1931,7 @@ __acquires(udc->lock) | |||
1916 | err = hw_usb_set_address((u8)le16_to_cpu(req.wValue)); | 1931 | err = hw_usb_set_address((u8)le16_to_cpu(req.wValue)); |
1917 | if (err) | 1932 | if (err) |
1918 | break; | 1933 | break; |
1919 | err = isr_setup_status_phase(mEp); | 1934 | err = isr_setup_status_phase(udc); |
1920 | break; | 1935 | break; |
1921 | case USB_REQ_SET_FEATURE: | 1936 | case USB_REQ_SET_FEATURE: |
1922 | if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) && | 1937 | if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) && |
@@ -1932,12 +1947,12 @@ __acquires(udc->lock) | |||
1932 | spin_lock(udc->lock); | 1947 | spin_lock(udc->lock); |
1933 | if (err) | 1948 | if (err) |
1934 | break; | 1949 | break; |
1935 | err = isr_setup_status_phase(mEp); | 1950 | err = isr_setup_status_phase(udc); |
1936 | break; | 1951 | break; |
1937 | default: | 1952 | default: |
1938 | delegate: | 1953 | delegate: |
1939 | if (req.wLength == 0) /* no data phase */ | 1954 | if (req.wLength == 0) /* no data phase */ |
1940 | mEp->dir = TX; | 1955 | udc->ep0_dir = TX; |
1941 | 1956 | ||
1942 | spin_unlock(udc->lock); | 1957 | spin_unlock(udc->lock); |
1943 | err = udc->driver->setup(&udc->gadget, &req); | 1958 | err = udc->driver->setup(&udc->gadget, &req); |
@@ -1968,7 +1983,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1968 | const struct usb_endpoint_descriptor *desc) | 1983 | const struct usb_endpoint_descriptor *desc) |
1969 | { | 1984 | { |
1970 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); | 1985 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); |
1971 | int direction, retval = 0; | 1986 | int retval = 0; |
1972 | unsigned long flags; | 1987 | unsigned long flags; |
1973 | 1988 | ||
1974 | trace("%p, %p", ep, desc); | 1989 | trace("%p, %p", ep, desc); |
@@ -1982,7 +1997,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1982 | 1997 | ||
1983 | mEp->desc = desc; | 1998 | mEp->desc = desc; |
1984 | 1999 | ||
1985 | if (!list_empty(&mEp->qh[mEp->dir].queue)) | 2000 | if (!list_empty(&mEp->qh.queue)) |
1986 | warn("enabling a non-empty endpoint!"); | 2001 | warn("enabling a non-empty endpoint!"); |
1987 | 2002 | ||
1988 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; | 2003 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; |
@@ -1991,29 +2006,22 @@ static int ep_enable(struct usb_ep *ep, | |||
1991 | 2006 | ||
1992 | mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize); | 2007 | mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize); |
1993 | 2008 | ||
1994 | direction = mEp->dir; | 2009 | dbg_event(_usb_addr(mEp), "ENABLE", 0); |
1995 | do { | ||
1996 | dbg_event(_usb_addr(mEp), "ENABLE", 0); | ||
1997 | 2010 | ||
1998 | mEp->qh[mEp->dir].ptr->cap = 0; | 2011 | mEp->qh.ptr->cap = 0; |
1999 | 2012 | ||
2000 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 2013 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) |
2001 | mEp->qh[mEp->dir].ptr->cap |= QH_IOS; | 2014 | mEp->qh.ptr->cap |= QH_IOS; |
2002 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) | 2015 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) |
2003 | mEp->qh[mEp->dir].ptr->cap &= ~QH_MULT; | 2016 | mEp->qh.ptr->cap &= ~QH_MULT; |
2004 | else | 2017 | else |
2005 | mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT; | 2018 | mEp->qh.ptr->cap &= ~QH_ZLT; |
2006 | |||
2007 | mEp->qh[mEp->dir].ptr->cap |= | ||
2008 | (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT; | ||
2009 | mEp->qh[mEp->dir].ptr->td.next |= TD_TERMINATE; /* needed? */ | ||
2010 | |||
2011 | retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type); | ||
2012 | 2019 | ||
2013 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 2020 | mEp->qh.ptr->cap |= |
2014 | mEp->dir = (mEp->dir == TX) ? RX : TX; | 2021 | (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT; |
2022 | mEp->qh.ptr->td.next |= TD_TERMINATE; /* needed? */ | ||
2015 | 2023 | ||
2016 | } while (mEp->dir != direction); | 2024 | retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type); |
2017 | 2025 | ||
2018 | spin_unlock_irqrestore(mEp->lock, flags); | 2026 | spin_unlock_irqrestore(mEp->lock, flags); |
2019 | return retval; | 2027 | return retval; |
@@ -2146,7 +2154,7 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
2146 | spin_lock_irqsave(mEp->lock, flags); | 2154 | spin_lock_irqsave(mEp->lock, flags); |
2147 | 2155 | ||
2148 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL && | 2156 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL && |
2149 | !list_empty(&mEp->qh[mEp->dir].queue)) { | 2157 | !list_empty(&mEp->qh.queue)) { |
2150 | _ep_nuke(mEp); | 2158 | _ep_nuke(mEp); |
2151 | retval = -EOVERFLOW; | 2159 | retval = -EOVERFLOW; |
2152 | warn("endpoint ctrl %X nuked", _usb_addr(mEp)); | 2160 | warn("endpoint ctrl %X nuked", _usb_addr(mEp)); |
@@ -2170,9 +2178,9 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
2170 | /* push request */ | 2178 | /* push request */ |
2171 | mReq->req.status = -EINPROGRESS; | 2179 | mReq->req.status = -EINPROGRESS; |
2172 | mReq->req.actual = 0; | 2180 | mReq->req.actual = 0; |
2173 | list_add_tail(&mReq->queue, &mEp->qh[mEp->dir].queue); | 2181 | list_add_tail(&mReq->queue, &mEp->qh.queue); |
2174 | 2182 | ||
2175 | if (list_is_singular(&mEp->qh[mEp->dir].queue)) | 2183 | if (list_is_singular(&mEp->qh.queue)) |
2176 | retval = _hardware_enqueue(mEp, mReq); | 2184 | retval = _hardware_enqueue(mEp, mReq); |
2177 | 2185 | ||
2178 | if (retval == -EALREADY) { | 2186 | if (retval == -EALREADY) { |
@@ -2199,7 +2207,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
2199 | trace("%p, %p", ep, req); | 2207 | trace("%p, %p", ep, req); |
2200 | 2208 | ||
2201 | if (ep == NULL || req == NULL || mEp->desc == NULL || | 2209 | if (ep == NULL || req == NULL || mEp->desc == NULL || |
2202 | list_empty(&mReq->queue) || list_empty(&mEp->qh[mEp->dir].queue)) | 2210 | list_empty(&mReq->queue) || list_empty(&mEp->qh.queue)) |
2203 | return -EINVAL; | 2211 | return -EINVAL; |
2204 | 2212 | ||
2205 | spin_lock_irqsave(mEp->lock, flags); | 2213 | spin_lock_irqsave(mEp->lock, flags); |
@@ -2244,7 +2252,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) | |||
2244 | #ifndef STALL_IN | 2252 | #ifndef STALL_IN |
2245 | /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ | 2253 | /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ |
2246 | if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX && | 2254 | if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX && |
2247 | !list_empty(&mEp->qh[mEp->dir].queue)) { | 2255 | !list_empty(&mEp->qh.queue)) { |
2248 | spin_unlock_irqrestore(mEp->lock, flags); | 2256 | spin_unlock_irqrestore(mEp->lock, flags); |
2249 | return -EAGAIN; | 2257 | return -EAGAIN; |
2250 | } | 2258 | } |
@@ -2355,7 +2363,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
2355 | if (is_active) { | 2363 | if (is_active) { |
2356 | pm_runtime_get_sync(&_gadget->dev); | 2364 | pm_runtime_get_sync(&_gadget->dev); |
2357 | hw_device_reset(udc); | 2365 | hw_device_reset(udc); |
2358 | hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma); | 2366 | hw_device_state(udc->ep0out.qh.dma); |
2359 | } else { | 2367 | } else { |
2360 | hw_device_state(0); | 2368 | hw_device_state(0); |
2361 | if (udc->udc_driver->notify_event) | 2369 | if (udc->udc_driver->notify_event) |
@@ -2390,7 +2398,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2390 | int (*bind)(struct usb_gadget *)) | 2398 | int (*bind)(struct usb_gadget *)) |
2391 | { | 2399 | { |
2392 | struct ci13xxx *udc = _udc; | 2400 | struct ci13xxx *udc = _udc; |
2393 | unsigned long i, k, flags; | 2401 | unsigned long flags; |
2402 | int i, j; | ||
2394 | int retval = -ENOMEM; | 2403 | int retval = -ENOMEM; |
2395 | 2404 | ||
2396 | trace("%p", driver); | 2405 | trace("%p", driver); |
@@ -2427,45 +2436,46 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2427 | 2436 | ||
2428 | info("hw_ep_max = %d", hw_ep_max); | 2437 | info("hw_ep_max = %d", hw_ep_max); |
2429 | 2438 | ||
2430 | udc->driver = driver; | ||
2431 | udc->gadget.dev.driver = NULL; | 2439 | udc->gadget.dev.driver = NULL; |
2432 | 2440 | ||
2433 | retval = 0; | 2441 | retval = 0; |
2434 | for (i = 0; i < hw_ep_max; i++) { | 2442 | for (i = 0; i < hw_ep_max/2; i++) { |
2435 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 2443 | for (j = RX; j <= TX; j++) { |
2444 | int k = i + j * hw_ep_max/2; | ||
2445 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[k]; | ||
2436 | 2446 | ||
2437 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i", (int)i); | 2447 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i%s", i, |
2448 | (j == TX) ? "in" : "out"); | ||
2438 | 2449 | ||
2439 | mEp->lock = udc->lock; | 2450 | mEp->lock = udc->lock; |
2440 | mEp->device = &udc->gadget.dev; | 2451 | mEp->device = &udc->gadget.dev; |
2441 | mEp->td_pool = udc->td_pool; | 2452 | mEp->td_pool = udc->td_pool; |
2442 | 2453 | ||
2443 | mEp->ep.name = mEp->name; | 2454 | mEp->ep.name = mEp->name; |
2444 | mEp->ep.ops = &usb_ep_ops; | 2455 | mEp->ep.ops = &usb_ep_ops; |
2445 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; | 2456 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; |
2446 | 2457 | ||
2447 | /* this allocation cannot be random */ | 2458 | INIT_LIST_HEAD(&mEp->qh.queue); |
2448 | for (k = RX; k <= TX; k++) { | ||
2449 | INIT_LIST_HEAD(&mEp->qh[k].queue); | ||
2450 | spin_unlock_irqrestore(udc->lock, flags); | 2459 | spin_unlock_irqrestore(udc->lock, flags); |
2451 | mEp->qh[k].ptr = dma_pool_alloc(udc->qh_pool, | 2460 | mEp->qh.ptr = dma_pool_alloc(udc->qh_pool, GFP_KERNEL, |
2452 | GFP_KERNEL, | 2461 | &mEp->qh.dma); |
2453 | &mEp->qh[k].dma); | ||
2454 | spin_lock_irqsave(udc->lock, flags); | 2462 | spin_lock_irqsave(udc->lock, flags); |
2455 | if (mEp->qh[k].ptr == NULL) | 2463 | if (mEp->qh.ptr == NULL) |
2456 | retval = -ENOMEM; | 2464 | retval = -ENOMEM; |
2457 | else | 2465 | else |
2458 | memset(mEp->qh[k].ptr, 0, | 2466 | memset(mEp->qh.ptr, 0, sizeof(*mEp->qh.ptr)); |
2459 | sizeof(*mEp->qh[k].ptr)); | 2467 | |
2460 | } | 2468 | /* skip ep0 out and in endpoints */ |
2461 | if (i == 0) | 2469 | if (i == 0) |
2462 | udc->gadget.ep0 = &mEp->ep; | 2470 | continue; |
2463 | else | 2471 | |
2464 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); | 2472 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); |
2473 | } | ||
2465 | } | 2474 | } |
2466 | if (retval) | 2475 | if (retval) |
2467 | goto done; | 2476 | goto done; |
2468 | 2477 | ||
2478 | udc->gadget.ep0 = &udc->ep0in.ep; | ||
2469 | /* bind gadget */ | 2479 | /* bind gadget */ |
2470 | driver->driver.bus = NULL; | 2480 | driver->driver.bus = NULL; |
2471 | udc->gadget.dev.driver = &driver->driver; | 2481 | udc->gadget.dev.driver = &driver->driver; |
@@ -2479,6 +2489,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2479 | goto done; | 2489 | goto done; |
2480 | } | 2490 | } |
2481 | 2491 | ||
2492 | udc->driver = driver; | ||
2482 | pm_runtime_get_sync(&udc->gadget.dev); | 2493 | pm_runtime_get_sync(&udc->gadget.dev); |
2483 | if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { | 2494 | if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { |
2484 | if (udc->vbus_active) { | 2495 | if (udc->vbus_active) { |
@@ -2490,14 +2501,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2490 | } | 2501 | } |
2491 | } | 2502 | } |
2492 | 2503 | ||
2493 | retval = hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma); | 2504 | retval = hw_device_state(udc->ep0out.qh.dma); |
2494 | if (retval) | 2505 | if (retval) |
2495 | pm_runtime_put_sync(&udc->gadget.dev); | 2506 | pm_runtime_put_sync(&udc->gadget.dev); |
2496 | 2507 | ||
2497 | done: | 2508 | done: |
2498 | spin_unlock_irqrestore(udc->lock, flags); | 2509 | spin_unlock_irqrestore(udc->lock, flags); |
2499 | if (retval) | ||
2500 | usb_gadget_unregister_driver(driver); | ||
2501 | return retval; | 2510 | return retval; |
2502 | } | 2511 | } |
2503 | EXPORT_SYMBOL(usb_gadget_probe_driver); | 2512 | EXPORT_SYMBOL(usb_gadget_probe_driver); |
@@ -2510,7 +2519,7 @@ EXPORT_SYMBOL(usb_gadget_probe_driver); | |||
2510 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 2519 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) |
2511 | { | 2520 | { |
2512 | struct ci13xxx *udc = _udc; | 2521 | struct ci13xxx *udc = _udc; |
2513 | unsigned long i, k, flags; | 2522 | unsigned long i, flags; |
2514 | 2523 | ||
2515 | trace("%p", driver); | 2524 | trace("%p", driver); |
2516 | 2525 | ||
@@ -2546,17 +2555,14 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2546 | for (i = 0; i < hw_ep_max; i++) { | 2555 | for (i = 0; i < hw_ep_max; i++) { |
2547 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 2556 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; |
2548 | 2557 | ||
2549 | if (i == 0) | 2558 | if (!list_empty(&mEp->ep.ep_list)) |
2550 | udc->gadget.ep0 = NULL; | ||
2551 | else if (!list_empty(&mEp->ep.ep_list)) | ||
2552 | list_del_init(&mEp->ep.ep_list); | 2559 | list_del_init(&mEp->ep.ep_list); |
2553 | 2560 | ||
2554 | for (k = RX; k <= TX; k++) | 2561 | if (mEp->qh.ptr != NULL) |
2555 | if (mEp->qh[k].ptr != NULL) | 2562 | dma_pool_free(udc->qh_pool, mEp->qh.ptr, mEp->qh.dma); |
2556 | dma_pool_free(udc->qh_pool, | ||
2557 | mEp->qh[k].ptr, mEp->qh[k].dma); | ||
2558 | } | 2563 | } |
2559 | 2564 | ||
2565 | udc->gadget.ep0 = NULL; | ||
2560 | udc->driver = NULL; | 2566 | udc->driver = NULL; |
2561 | 2567 | ||
2562 | spin_unlock_irqrestore(udc->lock, flags); | 2568 | spin_unlock_irqrestore(udc->lock, flags); |
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h index f61fed07f76b..a2492b65f98c 100644 --- a/drivers/usb/gadget/ci13xxx_udc.h +++ b/drivers/usb/gadget/ci13xxx_udc.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * DEFINE | 20 | * DEFINE |
21 | *****************************************************************************/ | 21 | *****************************************************************************/ |
22 | #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ | 22 | #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ |
23 | #define ENDPT_MAX (16) | 23 | #define ENDPT_MAX (32) |
24 | #define CTRL_PAYLOAD_MAX (64) | 24 | #define CTRL_PAYLOAD_MAX (64) |
25 | #define RX (0) /* similar to USB_DIR_OUT but can be used as an index */ | 25 | #define RX (0) /* similar to USB_DIR_OUT but can be used as an index */ |
26 | #define TX (1) /* similar to USB_DIR_IN but can be used as an index */ | 26 | #define TX (1) /* similar to USB_DIR_IN but can be used as an index */ |
@@ -88,8 +88,7 @@ struct ci13xxx_ep { | |||
88 | struct list_head queue; | 88 | struct list_head queue; |
89 | struct ci13xxx_qh *ptr; | 89 | struct ci13xxx_qh *ptr; |
90 | dma_addr_t dma; | 90 | dma_addr_t dma; |
91 | } qh[2]; | 91 | } qh; |
92 | struct usb_request *status; | ||
93 | int wedge; | 92 | int wedge; |
94 | 93 | ||
95 | /* global resources */ | 94 | /* global resources */ |
@@ -119,9 +118,13 @@ struct ci13xxx { | |||
119 | 118 | ||
120 | struct dma_pool *qh_pool; /* DMA pool for queue heads */ | 119 | struct dma_pool *qh_pool; /* DMA pool for queue heads */ |
121 | struct dma_pool *td_pool; /* DMA pool for transfer descs */ | 120 | struct dma_pool *td_pool; /* DMA pool for transfer descs */ |
121 | struct usb_request *status; /* ep0 status request */ | ||
122 | 122 | ||
123 | struct usb_gadget gadget; /* USB slave device */ | 123 | struct usb_gadget gadget; /* USB slave device */ |
124 | struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ | 124 | struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ |
125 | u32 ep0_dir; /* ep0 direction */ | ||
126 | #define ep0out ci13xxx_ep[0] | ||
127 | #define ep0in ci13xxx_ep[16] | ||
125 | 128 | ||
126 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ | 129 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ |
127 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ | 130 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index f6ff8456d52d..1ba4befe336b 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -928,8 +928,9 @@ unknown: | |||
928 | */ | 928 | */ |
929 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 929 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
930 | case USB_RECIP_INTERFACE: | 930 | case USB_RECIP_INTERFACE: |
931 | if (cdev->config) | 931 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) |
932 | f = cdev->config->interface[intf]; | 932 | break; |
933 | f = cdev->config->interface[intf]; | ||
933 | break; | 934 | break; |
934 | 935 | ||
935 | case USB_RECIP_ENDPOINT: | 936 | case USB_RECIP_ENDPOINT: |
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c index 0c8dd81dddca..b120dbb64d0f 100644 --- a/drivers/usb/gadget/pch_udc.c +++ b/drivers/usb/gadget/pch_udc.c | |||
@@ -198,10 +198,10 @@ | |||
198 | #define PCH_UDC_BRLEN 0x0F /* Burst length */ | 198 | #define PCH_UDC_BRLEN 0x0F /* Burst length */ |
199 | #define PCH_UDC_THLEN 0x1F /* Threshold length */ | 199 | #define PCH_UDC_THLEN 0x1F /* Threshold length */ |
200 | /* Value of EP Buffer Size */ | 200 | /* Value of EP Buffer Size */ |
201 | #define UDC_EP0IN_BUFF_SIZE 64 | 201 | #define UDC_EP0IN_BUFF_SIZE 16 |
202 | #define UDC_EPIN_BUFF_SIZE 512 | 202 | #define UDC_EPIN_BUFF_SIZE 256 |
203 | #define UDC_EP0OUT_BUFF_SIZE 64 | 203 | #define UDC_EP0OUT_BUFF_SIZE 16 |
204 | #define UDC_EPOUT_BUFF_SIZE 512 | 204 | #define UDC_EPOUT_BUFF_SIZE 256 |
205 | /* Value of EP maximum packet size */ | 205 | /* Value of EP maximum packet size */ |
206 | #define UDC_EP0IN_MAX_PKT_SIZE 64 | 206 | #define UDC_EP0IN_MAX_PKT_SIZE 64 |
207 | #define UDC_EP0OUT_MAX_PKT_SIZE 64 | 207 | #define UDC_EP0OUT_MAX_PKT_SIZE 64 |
@@ -351,7 +351,7 @@ struct pch_udc_dev { | |||
351 | struct pci_pool *data_requests; | 351 | struct pci_pool *data_requests; |
352 | struct pci_pool *stp_requests; | 352 | struct pci_pool *stp_requests; |
353 | dma_addr_t dma_addr; | 353 | dma_addr_t dma_addr; |
354 | unsigned long ep0out_buf[64]; | 354 | void *ep0out_buf; |
355 | struct usb_ctrlrequest setup_data; | 355 | struct usb_ctrlrequest setup_data; |
356 | unsigned long phys_addr; | 356 | unsigned long phys_addr; |
357 | void __iomem *base_addr; | 357 | void __iomem *base_addr; |
@@ -361,6 +361,8 @@ struct pch_udc_dev { | |||
361 | 361 | ||
362 | #define PCH_UDC_PCI_BAR 1 | 362 | #define PCH_UDC_PCI_BAR 1 |
363 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 | 363 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 |
364 | #define PCI_VENDOR_ID_ROHM 0x10DB | ||
365 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D | ||
364 | 366 | ||
365 | static const char ep0_string[] = "ep0in"; | 367 | static const char ep0_string[] = "ep0in"; |
366 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ | 368 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ |
@@ -1219,11 +1221,11 @@ static void complete_req(struct pch_udc_ep *ep, struct pch_udc_request *req, | |||
1219 | dev = ep->dev; | 1221 | dev = ep->dev; |
1220 | if (req->dma_mapped) { | 1222 | if (req->dma_mapped) { |
1221 | if (ep->in) | 1223 | if (ep->in) |
1222 | pci_unmap_single(dev->pdev, req->req.dma, | 1224 | dma_unmap_single(&dev->pdev->dev, req->req.dma, |
1223 | req->req.length, PCI_DMA_TODEVICE); | 1225 | req->req.length, DMA_TO_DEVICE); |
1224 | else | 1226 | else |
1225 | pci_unmap_single(dev->pdev, req->req.dma, | 1227 | dma_unmap_single(&dev->pdev->dev, req->req.dma, |
1226 | req->req.length, PCI_DMA_FROMDEVICE); | 1228 | req->req.length, DMA_FROM_DEVICE); |
1227 | req->dma_mapped = 0; | 1229 | req->dma_mapped = 0; |
1228 | req->req.dma = DMA_ADDR_INVALID; | 1230 | req->req.dma = DMA_ADDR_INVALID; |
1229 | } | 1231 | } |
@@ -1414,7 +1416,6 @@ static void pch_udc_start_rxrequest(struct pch_udc_ep *ep, | |||
1414 | 1416 | ||
1415 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); | 1417 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); |
1416 | td_data = req->td_data; | 1418 | td_data = req->td_data; |
1417 | ep->td_data = req->td_data; | ||
1418 | /* Set the status bits for all descriptors */ | 1419 | /* Set the status bits for all descriptors */ |
1419 | while (1) { | 1420 | while (1) { |
1420 | td_data->status = (td_data->status & ~PCH_UDC_BUFF_STS) | | 1421 | td_data->status = (td_data->status & ~PCH_UDC_BUFF_STS) | |
@@ -1613,15 +1614,19 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1613 | if (usbreq->length && | 1614 | if (usbreq->length && |
1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { | 1615 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { |
1615 | if (ep->in) | 1616 | if (ep->in) |
1616 | usbreq->dma = pci_map_single(dev->pdev, usbreq->buf, | 1617 | usbreq->dma = dma_map_single(&dev->pdev->dev, |
1617 | usbreq->length, PCI_DMA_TODEVICE); | 1618 | usbreq->buf, |
1619 | usbreq->length, | ||
1620 | DMA_TO_DEVICE); | ||
1618 | else | 1621 | else |
1619 | usbreq->dma = pci_map_single(dev->pdev, usbreq->buf, | 1622 | usbreq->dma = dma_map_single(&dev->pdev->dev, |
1620 | usbreq->length, PCI_DMA_FROMDEVICE); | 1623 | usbreq->buf, |
1624 | usbreq->length, | ||
1625 | DMA_FROM_DEVICE); | ||
1621 | req->dma_mapped = 1; | 1626 | req->dma_mapped = 1; |
1622 | } | 1627 | } |
1623 | if (usbreq->length > 0) { | 1628 | if (usbreq->length > 0) { |
1624 | retval = prepare_dma(ep, req, gfp); | 1629 | retval = prepare_dma(ep, req, GFP_ATOMIC); |
1625 | if (retval) | 1630 | if (retval) |
1626 | goto probe_end; | 1631 | goto probe_end; |
1627 | } | 1632 | } |
@@ -1646,7 +1651,6 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1646 | pch_udc_wait_ep_stall(ep); | 1651 | pch_udc_wait_ep_stall(ep); |
1647 | pch_udc_ep_clear_nak(ep); | 1652 | pch_udc_ep_clear_nak(ep); |
1648 | pch_udc_enable_ep_interrupts(ep->dev, (1 << ep->num)); | 1653 | pch_udc_enable_ep_interrupts(ep->dev, (1 << ep->num)); |
1649 | pch_udc_set_dma(dev, DMA_DIR_TX); | ||
1650 | } | 1654 | } |
1651 | } | 1655 | } |
1652 | /* Now add this request to the ep's pending requests */ | 1656 | /* Now add this request to the ep's pending requests */ |
@@ -1926,6 +1930,7 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep) | |||
1926 | PCH_UDC_BS_DMA_DONE) | 1930 | PCH_UDC_BS_DMA_DONE) |
1927 | return; | 1931 | return; |
1928 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); | 1932 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); |
1933 | pch_udc_ep_set_ddptr(ep, 0); | ||
1929 | if ((req->td_data_last->status & PCH_UDC_RXTX_STS) != | 1934 | if ((req->td_data_last->status & PCH_UDC_RXTX_STS) != |
1930 | PCH_UDC_RTS_SUCC) { | 1935 | PCH_UDC_RTS_SUCC) { |
1931 | dev_err(&dev->pdev->dev, "Invalid RXTX status (0x%08x) " | 1936 | dev_err(&dev->pdev->dev, "Invalid RXTX status (0x%08x) " |
@@ -1963,7 +1968,7 @@ static void pch_udc_svc_data_in(struct pch_udc_dev *dev, int ep_num) | |||
1963 | u32 epsts; | 1968 | u32 epsts; |
1964 | struct pch_udc_ep *ep; | 1969 | struct pch_udc_ep *ep; |
1965 | 1970 | ||
1966 | ep = &dev->ep[2*ep_num]; | 1971 | ep = &dev->ep[UDC_EPIN_IDX(ep_num)]; |
1967 | epsts = ep->epsts; | 1972 | epsts = ep->epsts; |
1968 | ep->epsts = 0; | 1973 | ep->epsts = 0; |
1969 | 1974 | ||
@@ -2008,7 +2013,7 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) | |||
2008 | struct pch_udc_ep *ep; | 2013 | struct pch_udc_ep *ep; |
2009 | struct pch_udc_request *req = NULL; | 2014 | struct pch_udc_request *req = NULL; |
2010 | 2015 | ||
2011 | ep = &dev->ep[2*ep_num + 1]; | 2016 | ep = &dev->ep[UDC_EPOUT_IDX(ep_num)]; |
2012 | epsts = ep->epsts; | 2017 | epsts = ep->epsts; |
2013 | ep->epsts = 0; | 2018 | ep->epsts = 0; |
2014 | 2019 | ||
@@ -2025,10 +2030,11 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) | |||
2025 | } | 2030 | } |
2026 | if (epsts & UDC_EPSTS_HE) | 2031 | if (epsts & UDC_EPSTS_HE) |
2027 | return; | 2032 | return; |
2028 | if (epsts & UDC_EPSTS_RSS) | 2033 | if (epsts & UDC_EPSTS_RSS) { |
2029 | pch_udc_ep_set_stall(ep); | 2034 | pch_udc_ep_set_stall(ep); |
2030 | pch_udc_enable_ep_interrupts(ep->dev, | 2035 | pch_udc_enable_ep_interrupts(ep->dev, |
2031 | PCH_UDC_EPINT(ep->in, ep->num)); | 2036 | PCH_UDC_EPINT(ep->in, ep->num)); |
2037 | } | ||
2032 | if (epsts & UDC_EPSTS_RCS) { | 2038 | if (epsts & UDC_EPSTS_RCS) { |
2033 | if (!dev->prot_stall) { | 2039 | if (!dev->prot_stall) { |
2034 | pch_udc_ep_clear_stall(ep); | 2040 | pch_udc_ep_clear_stall(ep); |
@@ -2060,8 +2066,10 @@ static void pch_udc_svc_control_in(struct pch_udc_dev *dev) | |||
2060 | { | 2066 | { |
2061 | u32 epsts; | 2067 | u32 epsts; |
2062 | struct pch_udc_ep *ep; | 2068 | struct pch_udc_ep *ep; |
2069 | struct pch_udc_ep *ep_out; | ||
2063 | 2070 | ||
2064 | ep = &dev->ep[UDC_EP0IN_IDX]; | 2071 | ep = &dev->ep[UDC_EP0IN_IDX]; |
2072 | ep_out = &dev->ep[UDC_EP0OUT_IDX]; | ||
2065 | epsts = ep->epsts; | 2073 | epsts = ep->epsts; |
2066 | ep->epsts = 0; | 2074 | ep->epsts = 0; |
2067 | 2075 | ||
@@ -2073,8 +2081,16 @@ static void pch_udc_svc_control_in(struct pch_udc_dev *dev) | |||
2073 | return; | 2081 | return; |
2074 | if (epsts & UDC_EPSTS_HE) | 2082 | if (epsts & UDC_EPSTS_HE) |
2075 | return; | 2083 | return; |
2076 | if ((epsts & UDC_EPSTS_TDC) && (!dev->stall)) | 2084 | if ((epsts & UDC_EPSTS_TDC) && (!dev->stall)) { |
2077 | pch_udc_complete_transfer(ep); | 2085 | pch_udc_complete_transfer(ep); |
2086 | pch_udc_clear_dma(dev, DMA_DIR_RX); | ||
2087 | ep_out->td_data->status = (ep_out->td_data->status & | ||
2088 | ~PCH_UDC_BUFF_STS) | | ||
2089 | PCH_UDC_BS_HST_RDY; | ||
2090 | pch_udc_ep_clear_nak(ep_out); | ||
2091 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2092 | pch_udc_ep_set_rrdy(ep_out); | ||
2093 | } | ||
2078 | /* On IN interrupt, provide data if we have any */ | 2094 | /* On IN interrupt, provide data if we have any */ |
2079 | if ((epsts & UDC_EPSTS_IN) && !(epsts & UDC_EPSTS_TDC) && | 2095 | if ((epsts & UDC_EPSTS_IN) && !(epsts & UDC_EPSTS_TDC) && |
2080 | !(epsts & UDC_EPSTS_TXEMPTY)) | 2096 | !(epsts & UDC_EPSTS_TXEMPTY)) |
@@ -2102,11 +2118,9 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2102 | dev->stall = 0; | 2118 | dev->stall = 0; |
2103 | dev->ep[UDC_EP0IN_IDX].halted = 0; | 2119 | dev->ep[UDC_EP0IN_IDX].halted = 0; |
2104 | dev->ep[UDC_EP0OUT_IDX].halted = 0; | 2120 | dev->ep[UDC_EP0OUT_IDX].halted = 0; |
2105 | /* In data not ready */ | ||
2106 | pch_udc_ep_set_nak(&(dev->ep[UDC_EP0IN_IDX])); | ||
2107 | dev->setup_data = ep->td_stp->request; | 2121 | dev->setup_data = ep->td_stp->request; |
2108 | pch_udc_init_setup_buff(ep->td_stp); | 2122 | pch_udc_init_setup_buff(ep->td_stp); |
2109 | pch_udc_clear_dma(dev, DMA_DIR_TX); | 2123 | pch_udc_clear_dma(dev, DMA_DIR_RX); |
2110 | pch_udc_ep_fifo_flush(&(dev->ep[UDC_EP0IN_IDX]), | 2124 | pch_udc_ep_fifo_flush(&(dev->ep[UDC_EP0IN_IDX]), |
2111 | dev->ep[UDC_EP0IN_IDX].in); | 2125 | dev->ep[UDC_EP0IN_IDX].in); |
2112 | if ((dev->setup_data.bRequestType & USB_DIR_IN)) | 2126 | if ((dev->setup_data.bRequestType & USB_DIR_IN)) |
@@ -2122,14 +2136,23 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2122 | setup_supported = dev->driver->setup(&dev->gadget, | 2136 | setup_supported = dev->driver->setup(&dev->gadget, |
2123 | &dev->setup_data); | 2137 | &dev->setup_data); |
2124 | spin_lock(&dev->lock); | 2138 | spin_lock(&dev->lock); |
2139 | |||
2140 | if (dev->setup_data.bRequestType & USB_DIR_IN) { | ||
2141 | ep->td_data->status = (ep->td_data->status & | ||
2142 | ~PCH_UDC_BUFF_STS) | | ||
2143 | PCH_UDC_BS_HST_RDY; | ||
2144 | pch_udc_ep_set_ddptr(ep, ep->td_data_phys); | ||
2145 | } | ||
2125 | /* ep0 in returns data on IN phase */ | 2146 | /* ep0 in returns data on IN phase */ |
2126 | if (setup_supported >= 0 && setup_supported < | 2147 | if (setup_supported >= 0 && setup_supported < |
2127 | UDC_EP0IN_MAX_PKT_SIZE) { | 2148 | UDC_EP0IN_MAX_PKT_SIZE) { |
2128 | pch_udc_ep_clear_nak(&(dev->ep[UDC_EP0IN_IDX])); | 2149 | pch_udc_ep_clear_nak(&(dev->ep[UDC_EP0IN_IDX])); |
2129 | /* Gadget would have queued a request when | 2150 | /* Gadget would have queued a request when |
2130 | * we called the setup */ | 2151 | * we called the setup */ |
2131 | pch_udc_set_dma(dev, DMA_DIR_RX); | 2152 | if (!(dev->setup_data.bRequestType & USB_DIR_IN)) { |
2132 | pch_udc_ep_clear_nak(ep); | 2153 | pch_udc_set_dma(dev, DMA_DIR_RX); |
2154 | pch_udc_ep_clear_nak(ep); | ||
2155 | } | ||
2133 | } else if (setup_supported < 0) { | 2156 | } else if (setup_supported < 0) { |
2134 | /* if unsupported request, then stall */ | 2157 | /* if unsupported request, then stall */ |
2135 | pch_udc_ep_set_stall(&(dev->ep[UDC_EP0IN_IDX])); | 2158 | pch_udc_ep_set_stall(&(dev->ep[UDC_EP0IN_IDX])); |
@@ -2142,22 +2165,13 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2142 | } | 2165 | } |
2143 | } else if ((((stat & UDC_EPSTS_OUT_MASK) >> UDC_EPSTS_OUT_SHIFT) == | 2166 | } else if ((((stat & UDC_EPSTS_OUT_MASK) >> UDC_EPSTS_OUT_SHIFT) == |
2144 | UDC_EPSTS_OUT_DATA) && !dev->stall) { | 2167 | UDC_EPSTS_OUT_DATA) && !dev->stall) { |
2145 | if (list_empty(&ep->queue)) { | 2168 | pch_udc_clear_dma(dev, DMA_DIR_RX); |
2146 | dev_err(&dev->pdev->dev, "%s: No request\n", __func__); | 2169 | pch_udc_ep_set_ddptr(ep, 0); |
2147 | ep->td_data->status = (ep->td_data->status & | 2170 | if (!list_empty(&ep->queue)) { |
2148 | ~PCH_UDC_BUFF_STS) | | ||
2149 | PCH_UDC_BS_HST_RDY; | ||
2150 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2151 | } else { | ||
2152 | /* control write */ | ||
2153 | /* next function will pickuo an clear the status */ | ||
2154 | ep->epsts = stat; | 2171 | ep->epsts = stat; |
2155 | 2172 | pch_udc_svc_data_out(dev, PCH_UDC_EP0); | |
2156 | pch_udc_svc_data_out(dev, 0); | ||
2157 | /* re-program desc. pointer for possible ZLPs */ | ||
2158 | pch_udc_ep_set_ddptr(ep, ep->td_data_phys); | ||
2159 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2160 | } | 2173 | } |
2174 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2161 | } | 2175 | } |
2162 | pch_udc_ep_set_rrdy(ep); | 2176 | pch_udc_ep_set_rrdy(ep); |
2163 | } | 2177 | } |
@@ -2174,7 +2188,7 @@ static void pch_udc_postsvc_epinters(struct pch_udc_dev *dev, int ep_num) | |||
2174 | struct pch_udc_ep *ep; | 2188 | struct pch_udc_ep *ep; |
2175 | struct pch_udc_request *req; | 2189 | struct pch_udc_request *req; |
2176 | 2190 | ||
2177 | ep = &dev->ep[2*ep_num]; | 2191 | ep = &dev->ep[UDC_EPIN_IDX(ep_num)]; |
2178 | if (!list_empty(&ep->queue)) { | 2192 | if (!list_empty(&ep->queue)) { |
2179 | req = list_entry(ep->queue.next, struct pch_udc_request, queue); | 2193 | req = list_entry(ep->queue.next, struct pch_udc_request, queue); |
2180 | pch_udc_enable_ep_interrupts(ep->dev, | 2194 | pch_udc_enable_ep_interrupts(ep->dev, |
@@ -2196,13 +2210,13 @@ static void pch_udc_read_all_epstatus(struct pch_udc_dev *dev, u32 ep_intr) | |||
2196 | for (i = 0; i < PCH_UDC_USED_EP_NUM; i++) { | 2210 | for (i = 0; i < PCH_UDC_USED_EP_NUM; i++) { |
2197 | /* IN */ | 2211 | /* IN */ |
2198 | if (ep_intr & (0x1 << i)) { | 2212 | if (ep_intr & (0x1 << i)) { |
2199 | ep = &dev->ep[2*i]; | 2213 | ep = &dev->ep[UDC_EPIN_IDX(i)]; |
2200 | ep->epsts = pch_udc_read_ep_status(ep); | 2214 | ep->epsts = pch_udc_read_ep_status(ep); |
2201 | pch_udc_clear_ep_status(ep, ep->epsts); | 2215 | pch_udc_clear_ep_status(ep, ep->epsts); |
2202 | } | 2216 | } |
2203 | /* OUT */ | 2217 | /* OUT */ |
2204 | if (ep_intr & (0x10000 << i)) { | 2218 | if (ep_intr & (0x10000 << i)) { |
2205 | ep = &dev->ep[2*i+1]; | 2219 | ep = &dev->ep[UDC_EPOUT_IDX(i)]; |
2206 | ep->epsts = pch_udc_read_ep_status(ep); | 2220 | ep->epsts = pch_udc_read_ep_status(ep); |
2207 | pch_udc_clear_ep_status(ep, ep->epsts); | 2221 | pch_udc_clear_ep_status(ep, ep->epsts); |
2208 | } | 2222 | } |
@@ -2563,9 +2577,6 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev) | |||
2563 | dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; | 2577 | dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; |
2564 | dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; | 2578 | dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; |
2565 | 2579 | ||
2566 | dev->dma_addr = pci_map_single(dev->pdev, dev->ep0out_buf, 256, | ||
2567 | PCI_DMA_FROMDEVICE); | ||
2568 | |||
2569 | /* remove ep0 in and out from the list. They have own pointer */ | 2580 | /* remove ep0 in and out from the list. They have own pointer */ |
2570 | list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); | 2581 | list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); |
2571 | list_del_init(&dev->ep[UDC_EP0OUT_IDX].ep.ep_list); | 2582 | list_del_init(&dev->ep[UDC_EP0OUT_IDX].ep.ep_list); |
@@ -2637,6 +2648,13 @@ static int init_dma_pools(struct pch_udc_dev *dev) | |||
2637 | dev->ep[UDC_EP0IN_IDX].td_stp_phys = 0; | 2648 | dev->ep[UDC_EP0IN_IDX].td_stp_phys = 0; |
2638 | dev->ep[UDC_EP0IN_IDX].td_data = NULL; | 2649 | dev->ep[UDC_EP0IN_IDX].td_data = NULL; |
2639 | dev->ep[UDC_EP0IN_IDX].td_data_phys = 0; | 2650 | dev->ep[UDC_EP0IN_IDX].td_data_phys = 0; |
2651 | |||
2652 | dev->ep0out_buf = kzalloc(UDC_EP0OUT_BUFF_SIZE * 4, GFP_KERNEL); | ||
2653 | if (!dev->ep0out_buf) | ||
2654 | return -ENOMEM; | ||
2655 | dev->dma_addr = dma_map_single(&dev->pdev->dev, dev->ep0out_buf, | ||
2656 | UDC_EP0OUT_BUFF_SIZE * 4, | ||
2657 | DMA_FROM_DEVICE); | ||
2640 | return 0; | 2658 | return 0; |
2641 | } | 2659 | } |
2642 | 2660 | ||
@@ -2700,7 +2718,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2700 | 2718 | ||
2701 | pch_udc_disable_interrupts(dev, UDC_DEVINT_MSK); | 2719 | pch_udc_disable_interrupts(dev, UDC_DEVINT_MSK); |
2702 | 2720 | ||
2703 | /* Assues that there are no pending requets with this driver */ | 2721 | /* Assures that there are no pending requests with this driver */ |
2722 | driver->disconnect(&dev->gadget); | ||
2704 | driver->unbind(&dev->gadget); | 2723 | driver->unbind(&dev->gadget); |
2705 | dev->gadget.dev.driver = NULL; | 2724 | dev->gadget.dev.driver = NULL; |
2706 | dev->driver = NULL; | 2725 | dev->driver = NULL; |
@@ -2750,6 +2769,11 @@ static void pch_udc_remove(struct pci_dev *pdev) | |||
2750 | pci_pool_destroy(dev->stp_requests); | 2769 | pci_pool_destroy(dev->stp_requests); |
2751 | } | 2770 | } |
2752 | 2771 | ||
2772 | if (dev->dma_addr) | ||
2773 | dma_unmap_single(&dev->pdev->dev, dev->dma_addr, | ||
2774 | UDC_EP0OUT_BUFF_SIZE * 4, DMA_FROM_DEVICE); | ||
2775 | kfree(dev->ep0out_buf); | ||
2776 | |||
2753 | pch_udc_exit(dev); | 2777 | pch_udc_exit(dev); |
2754 | 2778 | ||
2755 | if (dev->irq_registered) | 2779 | if (dev->irq_registered) |
@@ -2792,11 +2816,7 @@ static int pch_udc_resume(struct pci_dev *pdev) | |||
2792 | int ret; | 2816 | int ret; |
2793 | 2817 | ||
2794 | pci_set_power_state(pdev, PCI_D0); | 2818 | pci_set_power_state(pdev, PCI_D0); |
2795 | ret = pci_restore_state(pdev); | 2819 | pci_restore_state(pdev); |
2796 | if (ret) { | ||
2797 | dev_err(&pdev->dev, "%s: pci_restore_state failed\n", __func__); | ||
2798 | return ret; | ||
2799 | } | ||
2800 | ret = pci_enable_device(pdev); | 2820 | ret = pci_enable_device(pdev); |
2801 | if (ret) { | 2821 | if (ret) { |
2802 | dev_err(&pdev->dev, "%s: pci_enable_device failed\n", __func__); | 2822 | dev_err(&pdev->dev, "%s: pci_enable_device failed\n", __func__); |
@@ -2914,6 +2934,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = { | |||
2914 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | 2934 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, |
2915 | .class_mask = 0xffffffff, | 2935 | .class_mask = 0xffffffff, |
2916 | }, | 2936 | }, |
2937 | { | ||
2938 | PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7213_IOH_UDC), | ||
2939 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | ||
2940 | .class_mask = 0xffffffff, | ||
2941 | }, | ||
2917 | { 0 }, | 2942 | { 0 }, |
2918 | }; | 2943 | }; |
2919 | 2944 | ||
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 2fc8636316c5..12ff6cffedc9 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget; | |||
131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). | 131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static ushort __initdata idVendor; | 134 | static ushort idVendor; |
135 | module_param(idVendor, ushort, S_IRUGO); | 135 | module_param(idVendor, ushort, S_IRUGO); |
136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); | 136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); |
137 | 137 | ||
138 | static ushort __initdata idProduct; | 138 | static ushort idProduct; |
139 | module_param(idProduct, ushort, S_IRUGO); | 139 | module_param(idProduct, ushort, S_IRUGO); |
140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); | 140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); |
141 | 141 | ||
142 | static ushort __initdata bcdDevice; | 142 | static ushort bcdDevice; |
143 | module_param(bcdDevice, ushort, S_IRUGO); | 143 | module_param(bcdDevice, ushort, S_IRUGO); |
144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); | 144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); |
145 | 145 | ||
146 | static char *__initdata iManufacturer; | 146 | static char *iManufacturer; |
147 | module_param(iManufacturer, charp, S_IRUGO); | 147 | module_param(iManufacturer, charp, S_IRUGO); |
148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); | 148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); |
149 | 149 | ||
150 | static char *__initdata iProduct; | 150 | static char *iProduct; |
151 | module_param(iProduct, charp, S_IRUGO); | 151 | module_param(iProduct, charp, S_IRUGO); |
152 | MODULE_PARM_DESC(iProduct, "USB Product string"); | 152 | MODULE_PARM_DESC(iProduct, "USB Product string"); |
153 | 153 | ||
154 | static char *__initdata iSerialNum; | 154 | static char *iSerialNum; |
155 | module_param(iSerialNum, charp, S_IRUGO); | 155 | module_param(iSerialNum, charp, S_IRUGO); |
156 | MODULE_PARM_DESC(iSerialNum, "1"); | 156 | MODULE_PARM_DESC(iSerialNum, "1"); |
157 | 157 | ||
158 | static char *__initdata iPNPstring; | 158 | static char *iPNPstring; |
159 | module_param(iPNPstring, charp, S_IRUGO); | 159 | module_param(iPNPstring, charp, S_IRUGO); |
160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); | 160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); |
161 | 161 | ||
@@ -1596,13 +1596,12 @@ cleanup(void) | |||
1596 | int status; | 1596 | int status; |
1597 | 1597 | ||
1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); | 1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1599 | class_destroy(usb_gadget_class); | ||
1600 | unregister_chrdev_region(g_printer_devno, 2); | ||
1601 | |||
1602 | status = usb_gadget_unregister_driver(&printer_driver); | 1599 | status = usb_gadget_unregister_driver(&printer_driver); |
1603 | if (status) | 1600 | if (status) |
1604 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1601 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1605 | 1602 | ||
1603 | unregister_chrdev_region(g_printer_devno, 2); | ||
1604 | class_destroy(usb_gadget_class); | ||
1606 | mutex_unlock(&usb_printer_gadget.lock_printer_io); | 1605 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1607 | } | 1606 | } |
1608 | module_exit(cleanup); | 1607 | module_exit(cleanup); |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 86e42892016d..5c761df7fa83 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -52,7 +52,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
52 | struct resource *res; | 52 | struct resource *res; |
53 | int irq; | 53 | int irq; |
54 | int retval; | 54 | int retval; |
55 | unsigned int temp; | ||
56 | 55 | ||
57 | pr_debug("initializing FSL-SOC USB Controller\n"); | 56 | pr_debug("initializing FSL-SOC USB Controller\n"); |
58 | 57 | ||
@@ -126,18 +125,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
126 | goto err3; | 125 | goto err3; |
127 | } | 126 | } |
128 | 127 | ||
129 | /* | ||
130 | * Check if it is MPC5121 SoC, otherwise set pdata->have_sysif_regs | ||
131 | * flag for 83xx or 8536 system interface registers. | ||
132 | */ | ||
133 | if (pdata->big_endian_mmio) | ||
134 | temp = in_be32(hcd->regs + FSL_SOC_USB_ID); | ||
135 | else | ||
136 | temp = in_le32(hcd->regs + FSL_SOC_USB_ID); | ||
137 | |||
138 | if ((temp & ID_MSK) != (~((temp & NID_MSK) >> 8) & ID_MSK)) | ||
139 | pdata->have_sysif_regs = 1; | ||
140 | |||
141 | /* Enable USB controller, 83xx or 8536 */ | 128 | /* Enable USB controller, 83xx or 8536 */ |
142 | if (pdata->have_sysif_regs) | 129 | if (pdata->have_sysif_regs) |
143 | setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4); | 130 | setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4); |
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h index 2c8353795226..3fabed33d940 100644 --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h | |||
@@ -19,9 +19,6 @@ | |||
19 | #define _EHCI_FSL_H | 19 | #define _EHCI_FSL_H |
20 | 20 | ||
21 | /* offsets for the non-ehci registers in the FSL SOC USB controller */ | 21 | /* offsets for the non-ehci registers in the FSL SOC USB controller */ |
22 | #define FSL_SOC_USB_ID 0x0 | ||
23 | #define ID_MSK 0x3f | ||
24 | #define NID_MSK 0x3f00 | ||
25 | #define FSL_SOC_USB_ULPIVP 0x170 | 22 | #define FSL_SOC_USB_ULPIVP 0x170 |
26 | #define FSL_SOC_USB_PORTSC1 0x184 | 23 | #define FSL_SOC_USB_PORTSC1 0x184 |
27 | #define PORT_PTS_MSK (3<<30) | 24 | #define PORT_PTS_MSK (3<<30) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6fee3cd58efe..74dcf49bd015 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -572,6 +572,8 @@ static int ehci_init(struct usb_hcd *hcd) | |||
572 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; | 572 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; |
573 | ehci->iaa_watchdog.data = (unsigned long) ehci; | 573 | ehci->iaa_watchdog.data = (unsigned long) ehci; |
574 | 574 | ||
575 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
576 | |||
575 | /* | 577 | /* |
576 | * hw default: 1K periodic list heads, one per frame. | 578 | * hw default: 1K periodic list heads, one per frame. |
577 | * periodic_size can shrink by USBCMD update if hcc_params allows. | 579 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
@@ -579,11 +581,20 @@ static int ehci_init(struct usb_hcd *hcd) | |||
579 | ehci->periodic_size = DEFAULT_I_TDPS; | 581 | ehci->periodic_size = DEFAULT_I_TDPS; |
580 | INIT_LIST_HEAD(&ehci->cached_itd_list); | 582 | INIT_LIST_HEAD(&ehci->cached_itd_list); |
581 | INIT_LIST_HEAD(&ehci->cached_sitd_list); | 583 | INIT_LIST_HEAD(&ehci->cached_sitd_list); |
584 | |||
585 | if (HCC_PGM_FRAMELISTLEN(hcc_params)) { | ||
586 | /* periodic schedule size can be smaller than default */ | ||
587 | switch (EHCI_TUNE_FLS) { | ||
588 | case 0: ehci->periodic_size = 1024; break; | ||
589 | case 1: ehci->periodic_size = 512; break; | ||
590 | case 2: ehci->periodic_size = 256; break; | ||
591 | default: BUG(); | ||
592 | } | ||
593 | } | ||
582 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) | 594 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
583 | return retval; | 595 | return retval; |
584 | 596 | ||
585 | /* controllers may cache some of the periodic schedule ... */ | 597 | /* controllers may cache some of the periodic schedule ... */ |
586 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
587 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache | 598 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
588 | ehci->i_thresh = 2 + 8; | 599 | ehci->i_thresh = 2 + 8; |
589 | else // N microframes cached | 600 | else // N microframes cached |
@@ -637,12 +648,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
637 | /* periodic schedule size can be smaller than default */ | 648 | /* periodic schedule size can be smaller than default */ |
638 | temp &= ~(3 << 2); | 649 | temp &= ~(3 << 2); |
639 | temp |= (EHCI_TUNE_FLS << 2); | 650 | temp |= (EHCI_TUNE_FLS << 2); |
640 | switch (EHCI_TUNE_FLS) { | ||
641 | case 0: ehci->periodic_size = 1024; break; | ||
642 | case 1: ehci->periodic_size = 512; break; | ||
643 | case 2: ehci->periodic_size = 256; break; | ||
644 | default: BUG(); | ||
645 | } | ||
646 | } | 651 | } |
647 | if (HCC_LPM(hcc_params)) { | 652 | if (HCC_LPM(hcc_params)) { |
648 | /* support link power management EHCI 1.1 addendum */ | 653 | /* support link power management EHCI 1.1 addendum */ |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index fa59b26fc5bc..c8e360d7d975 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -21,10 +21,13 @@ | |||
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/usb/otg.h> | 23 | #include <linux/usb/otg.h> |
24 | #include <linux/usb/ulpi.h> | ||
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
25 | 26 | ||
26 | #include <mach/mxc_ehci.h> | 27 | #include <mach/mxc_ehci.h> |
27 | 28 | ||
29 | #include <asm/mach-types.h> | ||
30 | |||
28 | #define ULPI_VIEWPORT_OFFSET 0x170 | 31 | #define ULPI_VIEWPORT_OFFSET 0x170 |
29 | 32 | ||
30 | struct ehci_mxc_priv { | 33 | struct ehci_mxc_priv { |
@@ -114,6 +117,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
114 | struct usb_hcd *hcd; | 117 | struct usb_hcd *hcd; |
115 | struct resource *res; | 118 | struct resource *res; |
116 | int irq, ret; | 119 | int irq, ret; |
120 | unsigned int flags; | ||
117 | struct ehci_mxc_priv *priv; | 121 | struct ehci_mxc_priv *priv; |
118 | struct device *dev = &pdev->dev; | 122 | struct device *dev = &pdev->dev; |
119 | struct ehci_hcd *ehci; | 123 | struct ehci_hcd *ehci; |
@@ -177,8 +181,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
177 | clk_enable(priv->ahbclk); | 181 | clk_enable(priv->ahbclk); |
178 | } | 182 | } |
179 | 183 | ||
180 | /* "dr" device has its own clock */ | 184 | /* "dr" device has its own clock on i.MX51 */ |
181 | if (pdev->id == 0) { | 185 | if (cpu_is_mx51() && (pdev->id == 0)) { |
182 | priv->phy1clk = clk_get(dev, "usb_phy1"); | 186 | priv->phy1clk = clk_get(dev, "usb_phy1"); |
183 | if (IS_ERR(priv->phy1clk)) { | 187 | if (IS_ERR(priv->phy1clk)) { |
184 | ret = PTR_ERR(priv->phy1clk); | 188 | ret = PTR_ERR(priv->phy1clk); |
@@ -240,6 +244,23 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
240 | if (ret) | 244 | if (ret) |
241 | goto err_add; | 245 | goto err_add; |
242 | 246 | ||
247 | if (pdata->otg) { | ||
248 | /* | ||
249 | * efikamx and efikasb have some hardware bug which is | ||
250 | * preventing usb to work unless CHRGVBUS is set. | ||
251 | * It's in violation of USB specs | ||
252 | */ | ||
253 | if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) { | ||
254 | flags = otg_io_read(pdata->otg, ULPI_OTG_CTRL); | ||
255 | flags |= ULPI_OTG_CTRL_CHRGVBUS; | ||
256 | ret = otg_io_write(pdata->otg, flags, ULPI_OTG_CTRL); | ||
257 | if (ret) { | ||
258 | dev_err(dev, "unable to set CHRVBUS\n"); | ||
259 | goto err_add; | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | |||
243 | return 0; | 264 | return 0; |
244 | 265 | ||
245 | err_add: | 266 | err_add: |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 76179c39c0e3..bed07d4aab06 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -44,28 +44,35 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | static int ehci_quirk_amd_SB800(struct ehci_hcd *ehci) | 47 | static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci) |
48 | { | 48 | { |
49 | struct pci_dev *amd_smbus_dev; | 49 | struct pci_dev *amd_smbus_dev; |
50 | u8 rev = 0; | 50 | u8 rev = 0; |
51 | 51 | ||
52 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); | 52 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); |
53 | if (!amd_smbus_dev) | 53 | if (amd_smbus_dev) { |
54 | return 0; | 54 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
55 | 55 | if (rev < 0x40) { | |
56 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | 56 | pci_dev_put(amd_smbus_dev); |
57 | if (rev < 0x40) { | 57 | amd_smbus_dev = NULL; |
58 | pci_dev_put(amd_smbus_dev); | 58 | return 0; |
59 | amd_smbus_dev = NULL; | 59 | } |
60 | return 0; | 60 | } else { |
61 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL); | ||
62 | if (!amd_smbus_dev) | ||
63 | return 0; | ||
64 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | ||
65 | if (rev < 0x11 || rev > 0x18) { | ||
66 | pci_dev_put(amd_smbus_dev); | ||
67 | amd_smbus_dev = NULL; | ||
68 | return 0; | ||
69 | } | ||
61 | } | 70 | } |
62 | 71 | ||
63 | if (!amd_nb_dev) | 72 | if (!amd_nb_dev) |
64 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); | 73 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); |
65 | if (!amd_nb_dev) | ||
66 | ehci_err(ehci, "QUIRK: unable to get AMD NB device\n"); | ||
67 | 74 | ||
68 | ehci_info(ehci, "QUIRK: Enable AMD SB800 L1 fix\n"); | 75 | ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n"); |
69 | 76 | ||
70 | pci_dev_put(amd_smbus_dev); | 77 | pci_dev_put(amd_smbus_dev); |
71 | amd_smbus_dev = NULL; | 78 | amd_smbus_dev = NULL; |
@@ -131,7 +138,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
131 | /* cache this readonly data; minimize chip reads */ | 138 | /* cache this readonly data; minimize chip reads */ |
132 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 139 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
133 | 140 | ||
134 | if (ehci_quirk_amd_SB800(ehci)) | 141 | if (ehci_quirk_amd_hudson(ehci)) |
135 | ehci->amd_l1_fix = 1; | 142 | ehci->amd_l1_fix = 1; |
136 | 143 | ||
137 | retval = ehci_halt(ehci); | 144 | retval = ehci_halt(ehci); |
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 574b99ea0700..79a66d622f9c 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c | |||
@@ -262,19 +262,24 @@ static void fsl_usb2_mpc5121_exit(struct platform_device *pdev) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { | 265 | static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { |
266 | .big_endian_desc = 1, | 266 | .big_endian_desc = 1, |
267 | .big_endian_mmio = 1, | 267 | .big_endian_mmio = 1, |
268 | .es = 1, | 268 | .es = 1, |
269 | .have_sysif_regs = 0, | ||
269 | .le_setup_buf = 1, | 270 | .le_setup_buf = 1, |
270 | .init = fsl_usb2_mpc5121_init, | 271 | .init = fsl_usb2_mpc5121_init, |
271 | .exit = fsl_usb2_mpc5121_exit, | 272 | .exit = fsl_usb2_mpc5121_exit, |
272 | }; | 273 | }; |
273 | #endif /* CONFIG_PPC_MPC512x */ | 274 | #endif /* CONFIG_PPC_MPC512x */ |
274 | 275 | ||
276 | static struct fsl_usb2_platform_data fsl_usb2_mpc8xxx_pd = { | ||
277 | .have_sysif_regs = 1, | ||
278 | }; | ||
279 | |||
275 | static const struct of_device_id fsl_usb2_mph_dr_of_match[] = { | 280 | static const struct of_device_id fsl_usb2_mph_dr_of_match[] = { |
276 | { .compatible = "fsl-usb2-mph", }, | 281 | { .compatible = "fsl-usb2-mph", .data = &fsl_usb2_mpc8xxx_pd, }, |
277 | { .compatible = "fsl-usb2-dr", }, | 282 | { .compatible = "fsl-usb2-dr", .data = &fsl_usb2_mpc8xxx_pd, }, |
278 | #ifdef CONFIG_PPC_MPC512x | 283 | #ifdef CONFIG_PPC_MPC512x |
279 | { .compatible = "fsl,mpc5121-usb2-dr", .data = &fsl_usb2_mpc5121_pd, }, | 284 | { .compatible = "fsl,mpc5121-usb2-dr", .data = &fsl_usb2_mpc5121_pd, }, |
280 | #endif | 285 | #endif |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index df558f6f84e3..3e8211c1ce5a 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -308,11 +308,8 @@ static int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
308 | /* Ring the host controller doorbell after placing a command on the ring */ | 308 | /* Ring the host controller doorbell after placing a command on the ring */ |
309 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) | 309 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) |
310 | { | 310 | { |
311 | u32 temp; | ||
312 | |||
313 | xhci_dbg(xhci, "// Ding dong!\n"); | 311 | xhci_dbg(xhci, "// Ding dong!\n"); |
314 | temp = xhci_readl(xhci, &xhci->dba->doorbell[0]) & DB_MASK; | 312 | xhci_writel(xhci, DB_VALUE_HOST, &xhci->dba->doorbell[0]); |
315 | xhci_writel(xhci, temp | DB_TARGET_HOST, &xhci->dba->doorbell[0]); | ||
316 | /* Flush PCI posted writes */ | 313 | /* Flush PCI posted writes */ |
317 | xhci_readl(xhci, &xhci->dba->doorbell[0]); | 314 | xhci_readl(xhci, &xhci->dba->doorbell[0]); |
318 | } | 315 | } |
@@ -322,26 +319,24 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, | |||
322 | unsigned int ep_index, | 319 | unsigned int ep_index, |
323 | unsigned int stream_id) | 320 | unsigned int stream_id) |
324 | { | 321 | { |
325 | struct xhci_virt_ep *ep; | ||
326 | unsigned int ep_state; | ||
327 | u32 field; | ||
328 | __u32 __iomem *db_addr = &xhci->dba->doorbell[slot_id]; | 322 | __u32 __iomem *db_addr = &xhci->dba->doorbell[slot_id]; |
323 | struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; | ||
324 | unsigned int ep_state = ep->ep_state; | ||
329 | 325 | ||
330 | ep = &xhci->devs[slot_id]->eps[ep_index]; | ||
331 | ep_state = ep->ep_state; | ||
332 | /* Don't ring the doorbell for this endpoint if there are pending | 326 | /* Don't ring the doorbell for this endpoint if there are pending |
333 | * cancellations because the we don't want to interrupt processing. | 327 | * cancellations because we don't want to interrupt processing. |
334 | * We don't want to restart any stream rings if there's a set dequeue | 328 | * We don't want to restart any stream rings if there's a set dequeue |
335 | * pointer command pending because the device can choose to start any | 329 | * pointer command pending because the device can choose to start any |
336 | * stream once the endpoint is on the HW schedule. | 330 | * stream once the endpoint is on the HW schedule. |
337 | * FIXME - check all the stream rings for pending cancellations. | 331 | * FIXME - check all the stream rings for pending cancellations. |
338 | */ | 332 | */ |
339 | if (!(ep_state & EP_HALT_PENDING) && !(ep_state & SET_DEQ_PENDING) | 333 | if ((ep_state & EP_HALT_PENDING) || (ep_state & SET_DEQ_PENDING) || |
340 | && !(ep_state & EP_HALTED)) { | 334 | (ep_state & EP_HALTED)) |
341 | field = xhci_readl(xhci, db_addr) & DB_MASK; | 335 | return; |
342 | field |= EPI_TO_DB(ep_index) | STREAM_ID_TO_DB(stream_id); | 336 | xhci_writel(xhci, DB_VALUE(ep_index, stream_id), db_addr); |
343 | xhci_writel(xhci, field, db_addr); | 337 | /* The CPU has better things to do at this point than wait for a |
344 | } | 338 | * write-posting flush. It'll get there soon enough. |
339 | */ | ||
345 | } | 340 | } |
346 | 341 | ||
347 | /* Ring the doorbell for any rings with pending URBs */ | 342 | /* Ring the doorbell for any rings with pending URBs */ |
@@ -1188,7 +1183,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1188 | 1183 | ||
1189 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); | 1184 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); |
1190 | temp = xhci_readl(xhci, addr); | 1185 | temp = xhci_readl(xhci, addr); |
1191 | if ((temp & PORT_CONNECT) && (hcd->state == HC_STATE_SUSPENDED)) { | 1186 | if (hcd->state == HC_STATE_SUSPENDED) { |
1192 | xhci_dbg(xhci, "resume root hub\n"); | 1187 | xhci_dbg(xhci, "resume root hub\n"); |
1193 | usb_hcd_resume_root_hub(hcd); | 1188 | usb_hcd_resume_root_hub(hcd); |
1194 | } | 1189 | } |
@@ -1710,8 +1705,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1710 | /* Others already handled above */ | 1705 | /* Others already handled above */ |
1711 | break; | 1706 | break; |
1712 | } | 1707 | } |
1713 | dev_dbg(&td->urb->dev->dev, | 1708 | xhci_dbg(xhci, "ep %#x - asked for %d bytes, " |
1714 | "ep %#x - asked for %d bytes, " | ||
1715 | "%d bytes untransferred\n", | 1709 | "%d bytes untransferred\n", |
1716 | td->urb->ep->desc.bEndpointAddress, | 1710 | td->urb->ep->desc.bEndpointAddress, |
1717 | td->urb->transfer_buffer_length, | 1711 | td->urb->transfer_buffer_length, |
@@ -2389,7 +2383,8 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2389 | } | 2383 | } |
2390 | xhci_dbg(xhci, "\n"); | 2384 | xhci_dbg(xhci, "\n"); |
2391 | if (!in_interrupt()) | 2385 | if (!in_interrupt()) |
2392 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %d, sglist used, num_trbs = %d\n", | 2386 | xhci_dbg(xhci, "ep %#x - urb len = %d, sglist used, " |
2387 | "num_trbs = %d\n", | ||
2393 | urb->ep->desc.bEndpointAddress, | 2388 | urb->ep->desc.bEndpointAddress, |
2394 | urb->transfer_buffer_length, | 2389 | urb->transfer_buffer_length, |
2395 | num_trbs); | 2390 | num_trbs); |
@@ -2414,14 +2409,17 @@ static void check_trb_math(struct urb *urb, int num_trbs, int running_total) | |||
2414 | 2409 | ||
2415 | static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id, | 2410 | static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id, |
2416 | unsigned int ep_index, unsigned int stream_id, int start_cycle, | 2411 | unsigned int ep_index, unsigned int stream_id, int start_cycle, |
2417 | struct xhci_generic_trb *start_trb, struct xhci_td *td) | 2412 | struct xhci_generic_trb *start_trb) |
2418 | { | 2413 | { |
2419 | /* | 2414 | /* |
2420 | * Pass all the TRBs to the hardware at once and make sure this write | 2415 | * Pass all the TRBs to the hardware at once and make sure this write |
2421 | * isn't reordered. | 2416 | * isn't reordered. |
2422 | */ | 2417 | */ |
2423 | wmb(); | 2418 | wmb(); |
2424 | start_trb->field[3] |= start_cycle; | 2419 | if (start_cycle) |
2420 | start_trb->field[3] |= start_cycle; | ||
2421 | else | ||
2422 | start_trb->field[3] &= ~0x1; | ||
2425 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); | 2423 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); |
2426 | } | 2424 | } |
2427 | 2425 | ||
@@ -2449,7 +2447,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2449 | * to set the polling interval (once the API is added). | 2447 | * to set the polling interval (once the API is added). |
2450 | */ | 2448 | */ |
2451 | if (xhci_interval != ep_interval) { | 2449 | if (xhci_interval != ep_interval) { |
2452 | if (!printk_ratelimit()) | 2450 | if (printk_ratelimit()) |
2453 | dev_dbg(&urb->dev->dev, "Driver uses different interval" | 2451 | dev_dbg(&urb->dev->dev, "Driver uses different interval" |
2454 | " (%d microframe%s) than xHCI " | 2452 | " (%d microframe%s) than xHCI " |
2455 | "(%d microframe%s)\n", | 2453 | "(%d microframe%s)\n", |
@@ -2551,9 +2549,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2551 | u32 remainder = 0; | 2549 | u32 remainder = 0; |
2552 | 2550 | ||
2553 | /* Don't change the cycle bit of the first TRB until later */ | 2551 | /* Don't change the cycle bit of the first TRB until later */ |
2554 | if (first_trb) | 2552 | if (first_trb) { |
2555 | first_trb = false; | 2553 | first_trb = false; |
2556 | else | 2554 | if (start_cycle == 0) |
2555 | field |= 0x1; | ||
2556 | } else | ||
2557 | field |= ep_ring->cycle_state; | 2557 | field |= ep_ring->cycle_state; |
2558 | 2558 | ||
2559 | /* Chain all the TRBs together; clear the chain bit in the last | 2559 | /* Chain all the TRBs together; clear the chain bit in the last |
@@ -2625,7 +2625,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2625 | 2625 | ||
2626 | check_trb_math(urb, num_trbs, running_total); | 2626 | check_trb_math(urb, num_trbs, running_total); |
2627 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 2627 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
2628 | start_cycle, start_trb, td); | 2628 | start_cycle, start_trb); |
2629 | return 0; | 2629 | return 0; |
2630 | } | 2630 | } |
2631 | 2631 | ||
@@ -2671,7 +2671,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2671 | /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ | 2671 | /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ |
2672 | 2672 | ||
2673 | if (!in_interrupt()) | 2673 | if (!in_interrupt()) |
2674 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %#x (%d), addr = %#llx, num_trbs = %d\n", | 2674 | xhci_dbg(xhci, "ep %#x - urb len = %#x (%d), " |
2675 | "addr = %#llx, num_trbs = %d\n", | ||
2675 | urb->ep->desc.bEndpointAddress, | 2676 | urb->ep->desc.bEndpointAddress, |
2676 | urb->transfer_buffer_length, | 2677 | urb->transfer_buffer_length, |
2677 | urb->transfer_buffer_length, | 2678 | urb->transfer_buffer_length, |
@@ -2711,9 +2712,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2711 | field = 0; | 2712 | field = 0; |
2712 | 2713 | ||
2713 | /* Don't change the cycle bit of the first TRB until later */ | 2714 | /* Don't change the cycle bit of the first TRB until later */ |
2714 | if (first_trb) | 2715 | if (first_trb) { |
2715 | first_trb = false; | 2716 | first_trb = false; |
2716 | else | 2717 | if (start_cycle == 0) |
2718 | field |= 0x1; | ||
2719 | } else | ||
2717 | field |= ep_ring->cycle_state; | 2720 | field |= ep_ring->cycle_state; |
2718 | 2721 | ||
2719 | /* Chain all the TRBs together; clear the chain bit in the last | 2722 | /* Chain all the TRBs together; clear the chain bit in the last |
@@ -2757,7 +2760,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2757 | 2760 | ||
2758 | check_trb_math(urb, num_trbs, running_total); | 2761 | check_trb_math(urb, num_trbs, running_total); |
2759 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 2762 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
2760 | start_cycle, start_trb, td); | 2763 | start_cycle, start_trb); |
2761 | return 0; | 2764 | return 0; |
2762 | } | 2765 | } |
2763 | 2766 | ||
@@ -2818,13 +2821,17 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2818 | /* Queue setup TRB - see section 6.4.1.2.1 */ | 2821 | /* Queue setup TRB - see section 6.4.1.2.1 */ |
2819 | /* FIXME better way to translate setup_packet into two u32 fields? */ | 2822 | /* FIXME better way to translate setup_packet into two u32 fields? */ |
2820 | setup = (struct usb_ctrlrequest *) urb->setup_packet; | 2823 | setup = (struct usb_ctrlrequest *) urb->setup_packet; |
2824 | field = 0; | ||
2825 | field |= TRB_IDT | TRB_TYPE(TRB_SETUP); | ||
2826 | if (start_cycle == 0) | ||
2827 | field |= 0x1; | ||
2821 | queue_trb(xhci, ep_ring, false, true, | 2828 | queue_trb(xhci, ep_ring, false, true, |
2822 | /* FIXME endianness is probably going to bite my ass here. */ | 2829 | /* FIXME endianness is probably going to bite my ass here. */ |
2823 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, | 2830 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, |
2824 | setup->wIndex | setup->wLength << 16, | 2831 | setup->wIndex | setup->wLength << 16, |
2825 | TRB_LEN(8) | TRB_INTR_TARGET(0), | 2832 | TRB_LEN(8) | TRB_INTR_TARGET(0), |
2826 | /* Immediate data in pointer */ | 2833 | /* Immediate data in pointer */ |
2827 | TRB_IDT | TRB_TYPE(TRB_SETUP)); | 2834 | field); |
2828 | 2835 | ||
2829 | /* If there's data, queue data TRBs */ | 2836 | /* If there's data, queue data TRBs */ |
2830 | field = 0; | 2837 | field = 0; |
@@ -2859,7 +2866,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2859 | field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); | 2866 | field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); |
2860 | 2867 | ||
2861 | giveback_first_trb(xhci, slot_id, ep_index, 0, | 2868 | giveback_first_trb(xhci, slot_id, ep_index, 0, |
2862 | start_cycle, start_trb, td); | 2869 | start_cycle, start_trb); |
2863 | return 0; | 2870 | return 0; |
2864 | } | 2871 | } |
2865 | 2872 | ||
@@ -2900,6 +2907,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2900 | int running_total, trb_buff_len, td_len, td_remain_len, ret; | 2907 | int running_total, trb_buff_len, td_len, td_remain_len, ret; |
2901 | u64 start_addr, addr; | 2908 | u64 start_addr, addr; |
2902 | int i, j; | 2909 | int i, j; |
2910 | bool more_trbs_coming; | ||
2903 | 2911 | ||
2904 | ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; | 2912 | ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; |
2905 | 2913 | ||
@@ -2910,7 +2918,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2910 | } | 2918 | } |
2911 | 2919 | ||
2912 | if (!in_interrupt()) | 2920 | if (!in_interrupt()) |
2913 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %#x (%d)," | 2921 | xhci_dbg(xhci, "ep %#x - urb len = %#x (%d)," |
2914 | " addr = %#llx, num_tds = %d\n", | 2922 | " addr = %#llx, num_tds = %d\n", |
2915 | urb->ep->desc.bEndpointAddress, | 2923 | urb->ep->desc.bEndpointAddress, |
2916 | urb->transfer_buffer_length, | 2924 | urb->transfer_buffer_length, |
@@ -2950,7 +2958,10 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2950 | field |= TRB_TYPE(TRB_ISOC); | 2958 | field |= TRB_TYPE(TRB_ISOC); |
2951 | /* Assume URB_ISO_ASAP is set */ | 2959 | /* Assume URB_ISO_ASAP is set */ |
2952 | field |= TRB_SIA; | 2960 | field |= TRB_SIA; |
2953 | if (i > 0) | 2961 | if (i == 0) { |
2962 | if (start_cycle == 0) | ||
2963 | field |= 0x1; | ||
2964 | } else | ||
2954 | field |= ep_ring->cycle_state; | 2965 | field |= ep_ring->cycle_state; |
2955 | first_trb = false; | 2966 | first_trb = false; |
2956 | } else { | 2967 | } else { |
@@ -2965,9 +2976,11 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2965 | */ | 2976 | */ |
2966 | if (j < trbs_per_td - 1) { | 2977 | if (j < trbs_per_td - 1) { |
2967 | field |= TRB_CHAIN; | 2978 | field |= TRB_CHAIN; |
2979 | more_trbs_coming = true; | ||
2968 | } else { | 2980 | } else { |
2969 | td->last_trb = ep_ring->enqueue; | 2981 | td->last_trb = ep_ring->enqueue; |
2970 | field |= TRB_IOC; | 2982 | field |= TRB_IOC; |
2983 | more_trbs_coming = false; | ||
2971 | } | 2984 | } |
2972 | 2985 | ||
2973 | /* Calculate TRB length */ | 2986 | /* Calculate TRB length */ |
@@ -2980,7 +2993,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2980 | length_field = TRB_LEN(trb_buff_len) | | 2993 | length_field = TRB_LEN(trb_buff_len) | |
2981 | remainder | | 2994 | remainder | |
2982 | TRB_INTR_TARGET(0); | 2995 | TRB_INTR_TARGET(0); |
2983 | queue_trb(xhci, ep_ring, false, false, | 2996 | queue_trb(xhci, ep_ring, false, more_trbs_coming, |
2984 | lower_32_bits(addr), | 2997 | lower_32_bits(addr), |
2985 | upper_32_bits(addr), | 2998 | upper_32_bits(addr), |
2986 | length_field, | 2999 | length_field, |
@@ -3003,10 +3016,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3003 | } | 3016 | } |
3004 | } | 3017 | } |
3005 | 3018 | ||
3006 | wmb(); | 3019 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
3007 | start_trb->field[3] |= start_cycle; | 3020 | start_cycle, start_trb); |
3008 | |||
3009 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, urb->stream_id); | ||
3010 | return 0; | 3021 | return 0; |
3011 | } | 3022 | } |
3012 | 3023 | ||
@@ -3064,7 +3075,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3064 | * to set the polling interval (once the API is added). | 3075 | * to set the polling interval (once the API is added). |
3065 | */ | 3076 | */ |
3066 | if (xhci_interval != ep_interval) { | 3077 | if (xhci_interval != ep_interval) { |
3067 | if (!printk_ratelimit()) | 3078 | if (printk_ratelimit()) |
3068 | dev_dbg(&urb->dev->dev, "Driver uses different interval" | 3079 | dev_dbg(&urb->dev->dev, "Driver uses different interval" |
3069 | " (%d microframe%s) than xHCI " | 3080 | " (%d microframe%s) than xHCI " |
3070 | "(%d microframe%s)\n", | 3081 | "(%d microframe%s)\n", |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 45e4a3108cc3..34cf4e165877 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -226,7 +226,8 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) | |||
226 | static int xhci_setup_msix(struct xhci_hcd *xhci) | 226 | static int xhci_setup_msix(struct xhci_hcd *xhci) |
227 | { | 227 | { |
228 | int i, ret = 0; | 228 | int i, ret = 0; |
229 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 229 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
230 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
230 | 231 | ||
231 | /* | 232 | /* |
232 | * calculate number of msi-x vectors supported. | 233 | * calculate number of msi-x vectors supported. |
@@ -265,6 +266,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) | |||
265 | goto disable_msix; | 266 | goto disable_msix; |
266 | } | 267 | } |
267 | 268 | ||
269 | hcd->msix_enabled = 1; | ||
268 | return ret; | 270 | return ret; |
269 | 271 | ||
270 | disable_msix: | 272 | disable_msix: |
@@ -280,7 +282,8 @@ free_entries: | |||
280 | /* Free any IRQs and disable MSI-X */ | 282 | /* Free any IRQs and disable MSI-X */ |
281 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) | 283 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) |
282 | { | 284 | { |
283 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 285 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
286 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
284 | 287 | ||
285 | xhci_free_irq(xhci); | 288 | xhci_free_irq(xhci); |
286 | 289 | ||
@@ -292,6 +295,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) | |||
292 | pci_disable_msi(pdev); | 295 | pci_disable_msi(pdev); |
293 | } | 296 | } |
294 | 297 | ||
298 | hcd->msix_enabled = 0; | ||
295 | return; | 299 | return; |
296 | } | 300 | } |
297 | 301 | ||
@@ -508,9 +512,10 @@ void xhci_stop(struct usb_hcd *hcd) | |||
508 | spin_lock_irq(&xhci->lock); | 512 | spin_lock_irq(&xhci->lock); |
509 | xhci_halt(xhci); | 513 | xhci_halt(xhci); |
510 | xhci_reset(xhci); | 514 | xhci_reset(xhci); |
511 | xhci_cleanup_msix(xhci); | ||
512 | spin_unlock_irq(&xhci->lock); | 515 | spin_unlock_irq(&xhci->lock); |
513 | 516 | ||
517 | xhci_cleanup_msix(xhci); | ||
518 | |||
514 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 519 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
515 | /* Tell the event ring poll function not to reschedule */ | 520 | /* Tell the event ring poll function not to reschedule */ |
516 | xhci->zombie = 1; | 521 | xhci->zombie = 1; |
@@ -544,9 +549,10 @@ void xhci_shutdown(struct usb_hcd *hcd) | |||
544 | 549 | ||
545 | spin_lock_irq(&xhci->lock); | 550 | spin_lock_irq(&xhci->lock); |
546 | xhci_halt(xhci); | 551 | xhci_halt(xhci); |
547 | xhci_cleanup_msix(xhci); | ||
548 | spin_unlock_irq(&xhci->lock); | 552 | spin_unlock_irq(&xhci->lock); |
549 | 553 | ||
554 | xhci_cleanup_msix(xhci); | ||
555 | |||
550 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", | 556 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", |
551 | xhci_readl(xhci, &xhci->op_regs->status)); | 557 | xhci_readl(xhci, &xhci->op_regs->status)); |
552 | } | 558 | } |
@@ -647,6 +653,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
647 | int rc = 0; | 653 | int rc = 0; |
648 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 654 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
649 | u32 command; | 655 | u32 command; |
656 | int i; | ||
650 | 657 | ||
651 | spin_lock_irq(&xhci->lock); | 658 | spin_lock_irq(&xhci->lock); |
652 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 659 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
@@ -677,10 +684,15 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
677 | spin_unlock_irq(&xhci->lock); | 684 | spin_unlock_irq(&xhci->lock); |
678 | return -ETIMEDOUT; | 685 | return -ETIMEDOUT; |
679 | } | 686 | } |
680 | /* step 5: remove core well power */ | ||
681 | xhci_cleanup_msix(xhci); | ||
682 | spin_unlock_irq(&xhci->lock); | 687 | spin_unlock_irq(&xhci->lock); |
683 | 688 | ||
689 | /* step 5: remove core well power */ | ||
690 | /* synchronize irq when using MSI-X */ | ||
691 | if (xhci->msix_entries) { | ||
692 | for (i = 0; i < xhci->msix_count; i++) | ||
693 | synchronize_irq(xhci->msix_entries[i].vector); | ||
694 | } | ||
695 | |||
684 | return rc; | 696 | return rc; |
685 | } | 697 | } |
686 | 698 | ||
@@ -694,7 +706,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
694 | { | 706 | { |
695 | u32 command, temp = 0; | 707 | u32 command, temp = 0; |
696 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 708 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
697 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
698 | int old_state, retval; | 709 | int old_state, retval; |
699 | 710 | ||
700 | old_state = hcd->state; | 711 | old_state = hcd->state; |
@@ -729,9 +740,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
729 | xhci_dbg(xhci, "Stop HCD\n"); | 740 | xhci_dbg(xhci, "Stop HCD\n"); |
730 | xhci_halt(xhci); | 741 | xhci_halt(xhci); |
731 | xhci_reset(xhci); | 742 | xhci_reset(xhci); |
732 | if (hibernated) | ||
733 | xhci_cleanup_msix(xhci); | ||
734 | spin_unlock_irq(&xhci->lock); | 743 | spin_unlock_irq(&xhci->lock); |
744 | xhci_cleanup_msix(xhci); | ||
735 | 745 | ||
736 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 746 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
737 | /* Tell the event ring poll function not to reschedule */ | 747 | /* Tell the event ring poll function not to reschedule */ |
@@ -765,30 +775,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
765 | return retval; | 775 | return retval; |
766 | } | 776 | } |
767 | 777 | ||
768 | spin_unlock_irq(&xhci->lock); | ||
769 | /* Re-setup MSI-X */ | ||
770 | if (hcd->irq) | ||
771 | free_irq(hcd->irq, hcd); | ||
772 | hcd->irq = -1; | ||
773 | |||
774 | retval = xhci_setup_msix(xhci); | ||
775 | if (retval) | ||
776 | /* fall back to msi*/ | ||
777 | retval = xhci_setup_msi(xhci); | ||
778 | |||
779 | if (retval) { | ||
780 | /* fall back to legacy interrupt*/ | ||
781 | retval = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | ||
782 | hcd->irq_descr, hcd); | ||
783 | if (retval) { | ||
784 | xhci_err(xhci, "request interrupt %d failed\n", | ||
785 | pdev->irq); | ||
786 | return retval; | ||
787 | } | ||
788 | hcd->irq = pdev->irq; | ||
789 | } | ||
790 | |||
791 | spin_lock_irq(&xhci->lock); | ||
792 | /* step 4: set Run/Stop bit */ | 778 | /* step 4: set Run/Stop bit */ |
793 | command = xhci_readl(xhci, &xhci->op_regs->command); | 779 | command = xhci_readl(xhci, &xhci->op_regs->command); |
794 | command |= CMD_RUN; | 780 | command |= CMD_RUN; |
@@ -2445,8 +2431,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2445 | xhci_err(xhci, "Error while assigning device slot ID\n"); | 2431 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
2446 | return 0; | 2432 | return 0; |
2447 | } | 2433 | } |
2448 | /* xhci_alloc_virt_device() does not touch rings; no need to lock */ | 2434 | /* xhci_alloc_virt_device() does not touch rings; no need to lock. |
2449 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { | 2435 | * Use GFP_NOIO, since this function can be called from |
2436 | * xhci_discover_or_reset_device(), which may be called as part of | ||
2437 | * mass storage driver error handling. | ||
2438 | */ | ||
2439 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { | ||
2450 | /* Disable slot, if we can do it without mem alloc */ | 2440 | /* Disable slot, if we can do it without mem alloc */ |
2451 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); | 2441 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
2452 | spin_lock_irqsave(&xhci->lock, flags); | 2442 | spin_lock_irqsave(&xhci->lock, flags); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 170c367112d2..7f236fd22015 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -436,22 +436,18 @@ struct xhci_run_regs { | |||
436 | /** | 436 | /** |
437 | * struct doorbell_array | 437 | * struct doorbell_array |
438 | * | 438 | * |
439 | * Bits 0 - 7: Endpoint target | ||
440 | * Bits 8 - 15: RsvdZ | ||
441 | * Bits 16 - 31: Stream ID | ||
442 | * | ||
439 | * Section 5.6 | 443 | * Section 5.6 |
440 | */ | 444 | */ |
441 | struct xhci_doorbell_array { | 445 | struct xhci_doorbell_array { |
442 | u32 doorbell[256]; | 446 | u32 doorbell[256]; |
443 | }; | 447 | }; |
444 | 448 | ||
445 | #define DB_TARGET_MASK 0xFFFFFF00 | 449 | #define DB_VALUE(ep, stream) ((((ep) + 1) & 0xff) | ((stream) << 16)) |
446 | #define DB_STREAM_ID_MASK 0x0000FFFF | 450 | #define DB_VALUE_HOST 0x00000000 |
447 | #define DB_TARGET_HOST 0x0 | ||
448 | #define DB_STREAM_ID_HOST 0x0 | ||
449 | #define DB_MASK (0xff << 8) | ||
450 | |||
451 | /* Endpoint Target - bits 0:7 */ | ||
452 | #define EPI_TO_DB(p) (((p) + 1) & 0xff) | ||
453 | #define STREAM_ID_TO_DB(p) (((p) & 0xffff) << 16) | ||
454 | |||
455 | 451 | ||
456 | /** | 452 | /** |
457 | * struct xhci_protocol_caps | 453 | * struct xhci_protocol_caps |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 1732d9bc097e..1616ad1793a4 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -45,7 +45,7 @@ struct usb_led { | |||
45 | 45 | ||
46 | static void change_color(struct usb_led *led) | 46 | static void change_color(struct usb_led *led) |
47 | { | 47 | { |
48 | int retval; | 48 | int retval = 0; |
49 | unsigned char *buffer; | 49 | unsigned char *buffer; |
50 | 50 | ||
51 | buffer = kmalloc(8, GFP_KERNEL); | 51 | buffer = kmalloc(8, GFP_KERNEL); |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 4ff21587ab03..f7a205738032 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -776,7 +776,6 @@ static const struct usb_device_id uss720_table[] = { | |||
776 | { USB_DEVICE(0x0557, 0x2001) }, | 776 | { USB_DEVICE(0x0557, 0x2001) }, |
777 | { USB_DEVICE(0x0729, 0x1284) }, | 777 | { USB_DEVICE(0x0729, 0x1284) }, |
778 | { USB_DEVICE(0x1293, 0x0002) }, | 778 | { USB_DEVICE(0x1293, 0x0002) }, |
779 | { USB_DEVICE(0x1293, 0x0002) }, | ||
780 | { USB_DEVICE(0x050d, 0x0002) }, | 779 | { USB_DEVICE(0x050d, 0x0002) }, |
781 | { } /* Terminating entry */ | 780 | { } /* Terminating entry */ |
782 | }; | 781 | }; |
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index e70014ab0976..8acf165fe13b 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -132,6 +132,8 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
132 | 132 | ||
133 | platform_set_drvdata(pdev, nop); | 133 | platform_set_drvdata(pdev, nop); |
134 | 134 | ||
135 | BLOCKING_INIT_NOTIFIER_HEAD(&nop->otg.notifier); | ||
136 | |||
135 | return 0; | 137 | return 0; |
136 | exit: | 138 | exit: |
137 | kfree(nop); | 139 | kfree(nop); |
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c index 059d9ac0ab5b..770d799d5afb 100644 --- a/drivers/usb/otg/ulpi.c +++ b/drivers/usb/otg/ulpi.c | |||
@@ -45,7 +45,7 @@ struct ulpi_info { | |||
45 | /* ULPI hardcoded IDs, used for probing */ | 45 | /* ULPI hardcoded IDs, used for probing */ |
46 | static struct ulpi_info ulpi_ids[] = { | 46 | static struct ulpi_info ulpi_ids[] = { |
47 | ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"), | 47 | ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"), |
48 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB3319"), | 48 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"), |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) | 51 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 63f7cc45bcac..7b8815ddf368 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -486,12 +486,22 @@ static void ch341_read_int_callback(struct urb *urb) | |||
486 | if (actual_length >= 4) { | 486 | if (actual_length >= 4) { |
487 | struct ch341_private *priv = usb_get_serial_port_data(port); | 487 | struct ch341_private *priv = usb_get_serial_port_data(port); |
488 | unsigned long flags; | 488 | unsigned long flags; |
489 | u8 prev_line_status = priv->line_status; | ||
489 | 490 | ||
490 | spin_lock_irqsave(&priv->lock, flags); | 491 | spin_lock_irqsave(&priv->lock, flags); |
491 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; | 492 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; |
492 | if ((data[1] & CH341_MULT_STAT)) | 493 | if ((data[1] & CH341_MULT_STAT)) |
493 | priv->multi_status_change = 1; | 494 | priv->multi_status_change = 1; |
494 | spin_unlock_irqrestore(&priv->lock, flags); | 495 | spin_unlock_irqrestore(&priv->lock, flags); |
496 | |||
497 | if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) { | ||
498 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
499 | if (tty) | ||
500 | usb_serial_handle_dcd_change(port, tty, | ||
501 | priv->line_status & CH341_BIT_DCD); | ||
502 | tty_kref_put(tty); | ||
503 | } | ||
504 | |||
495 | wake_up_interruptible(&priv->delta_msr_wait); | 505 | wake_up_interruptible(&priv->delta_msr_wait); |
496 | } | 506 | } |
497 | 507 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 8d7731dbf478..735ea03157ab 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -49,7 +49,6 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, | |||
49 | static void cp210x_break_ctl(struct tty_struct *, int); | 49 | static void cp210x_break_ctl(struct tty_struct *, int); |
50 | static int cp210x_startup(struct usb_serial *); | 50 | static int cp210x_startup(struct usb_serial *); |
51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); | 51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); |
52 | static int cp210x_carrier_raised(struct usb_serial_port *p); | ||
53 | 52 | ||
54 | static int debug; | 53 | static int debug; |
55 | 54 | ||
@@ -87,7 +86,6 @@ static const struct usb_device_id id_table[] = { | |||
87 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ | 86 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ |
88 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 87 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
89 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ | 88 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
90 | { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ | ||
91 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 89 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
92 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 90 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
93 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 91 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
@@ -110,7 +108,9 @@ static const struct usb_device_id id_table[] = { | |||
110 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ | 108 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
111 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ | 109 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
112 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ | 110 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ |
111 | { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ | ||
113 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ | 112 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
113 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ | ||
114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ | 114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ | 115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
@@ -165,8 +165,7 @@ static struct usb_serial_driver cp210x_device = { | |||
165 | .tiocmget = cp210x_tiocmget, | 165 | .tiocmget = cp210x_tiocmget, |
166 | .tiocmset = cp210x_tiocmset, | 166 | .tiocmset = cp210x_tiocmset, |
167 | .attach = cp210x_startup, | 167 | .attach = cp210x_startup, |
168 | .dtr_rts = cp210x_dtr_rts, | 168 | .dtr_rts = cp210x_dtr_rts |
169 | .carrier_raised = cp210x_carrier_raised | ||
170 | }; | 169 | }; |
171 | 170 | ||
172 | /* Config request types */ | 171 | /* Config request types */ |
@@ -765,15 +764,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | |||
765 | return result; | 764 | return result; |
766 | } | 765 | } |
767 | 766 | ||
768 | static int cp210x_carrier_raised(struct usb_serial_port *p) | ||
769 | { | ||
770 | unsigned int control; | ||
771 | cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); | ||
772 | if (control & CONTROL_DCD) | ||
773 | return 1; | ||
774 | return 0; | ||
775 | } | ||
776 | |||
777 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | 767 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
778 | { | 768 | { |
779 | struct usb_serial_port *port = tty->driver_data; | 769 | struct usb_serial_port *port = tty->driver_data; |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index b92070c103cd..666e5a6edd82 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -455,7 +455,6 @@ static int digi_write_room(struct tty_struct *tty); | |||
455 | static int digi_chars_in_buffer(struct tty_struct *tty); | 455 | static int digi_chars_in_buffer(struct tty_struct *tty); |
456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); | 456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); |
457 | static void digi_close(struct usb_serial_port *port); | 457 | static void digi_close(struct usb_serial_port *port); |
458 | static int digi_carrier_raised(struct usb_serial_port *port); | ||
459 | static void digi_dtr_rts(struct usb_serial_port *port, int on); | 458 | static void digi_dtr_rts(struct usb_serial_port *port, int on); |
460 | static int digi_startup_device(struct usb_serial *serial); | 459 | static int digi_startup_device(struct usb_serial *serial); |
461 | static int digi_startup(struct usb_serial *serial); | 460 | static int digi_startup(struct usb_serial *serial); |
@@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
511 | .open = digi_open, | 510 | .open = digi_open, |
512 | .close = digi_close, | 511 | .close = digi_close, |
513 | .dtr_rts = digi_dtr_rts, | 512 | .dtr_rts = digi_dtr_rts, |
514 | .carrier_raised = digi_carrier_raised, | ||
515 | .write = digi_write, | 513 | .write = digi_write, |
516 | .write_room = digi_write_room, | 514 | .write_room = digi_write_room, |
517 | .write_bulk_callback = digi_write_bulk_callback, | 515 | .write_bulk_callback = digi_write_bulk_callback, |
@@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on) | |||
1339 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); | 1337 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); |
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | static int digi_carrier_raised(struct usb_serial_port *port) | ||
1343 | { | ||
1344 | struct digi_port *priv = usb_get_serial_port_data(port); | ||
1345 | if (priv->dp_modem_signals & TIOCM_CD) | ||
1346 | return 1; | ||
1347 | return 0; | ||
1348 | } | ||
1349 | |||
1350 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) | 1340 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) |
1351 | { | 1341 | { |
1352 | int ret; | 1342 | int ret; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a2668d089260..4787c0cd063f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -676,7 +676,17 @@ static struct usb_device_id id_table_combined [] = { | |||
676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | 676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, | 677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, |
678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
679 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 679 | { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, |
680 | { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, | ||
681 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, | ||
682 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, | ||
683 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, | ||
684 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, | ||
685 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, | ||
686 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, | ||
687 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, | ||
688 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, | ||
689 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, | ||
680 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 690 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
681 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 691 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
682 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 692 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index bf0867285481..ed160def8584 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -569,11 +569,23 @@ | |||
569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
570 | 570 | ||
571 | /* | 571 | /* |
572 | * Icom ID-1 digital transceiver | 572 | * Definitions for Icom Inc. devices |
573 | */ | 573 | */ |
574 | 574 | #define ICOM_VID 0x0C26 /* Icom vendor ID */ | |
575 | #define ICOM_ID1_VID 0x0C26 | 575 | /* Note: ID-1 is a communications tranceiver for HAM-radio operators */ |
576 | #define ICOM_ID1_PID 0x0004 | 576 | #define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ |
577 | /* Note: OPC is an Optional cable to connect an Icom Tranceiver */ | ||
578 | #define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ | ||
579 | /* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ | ||
580 | #define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ | ||
581 | #define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */ | ||
582 | #define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/ | ||
583 | #define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */ | ||
584 | #define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */ | ||
585 | #define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */ | ||
586 | #define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */ | ||
587 | #define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */ | ||
588 | #define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */ | ||
577 | 589 | ||
578 | /* | 590 | /* |
579 | * GN Otometrics (http://www.otometrics.com) | 591 | * GN Otometrics (http://www.otometrics.com) |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e6833e216fc9..e4db5ad2bc55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port) | |||
479 | } | 479 | } |
480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); | 480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); |
481 | 481 | ||
482 | /** | ||
483 | * usb_serial_handle_dcd_change - handle a change of carrier detect state | ||
484 | * @port: usb_serial_port structure for the open port | ||
485 | * @tty: tty_struct structure for the port | ||
486 | * @status: new carrier detect status, nonzero if active | ||
487 | */ | ||
488 | void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | ||
489 | struct tty_struct *tty, unsigned int status) | ||
490 | { | ||
491 | struct tty_port *port = &usb_port->port; | ||
492 | |||
493 | dbg("%s - port %d, status %d", __func__, usb_port->number, status); | ||
494 | |||
495 | if (status) | ||
496 | wake_up_interruptible(&port->open_wait); | ||
497 | else if (tty && !C_CLOCAL(tty)) | ||
498 | tty_hangup(tty); | ||
499 | } | ||
500 | EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change); | ||
501 | |||
482 | int usb_serial_generic_resume(struct usb_serial *serial) | 502 | int usb_serial_generic_resume(struct usb_serial *serial) |
483 | { | 503 | { |
484 | struct usb_serial_port *port; | 504 | struct usb_serial_port *port; |
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index 6ab2a3f97fe8..178b22eb32b1 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h | |||
@@ -199,6 +199,7 @@ static struct usb_serial_driver epic_device = { | |||
199 | .name = "epic", | 199 | .name = "epic", |
200 | }, | 200 | }, |
201 | .description = "EPiC device", | 201 | .description = "EPiC device", |
202 | .usb_driver = &io_driver, | ||
202 | .id_table = Epic_port_id_table, | 203 | .id_table = Epic_port_id_table, |
203 | .num_ports = 1, | 204 | .num_ports = 1, |
204 | .open = edge_open, | 205 | .open = edge_open, |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 12ed594f5f80..99b97c04896f 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -1275,6 +1275,7 @@ static struct usb_serial_driver iuu_device = { | |||
1275 | .name = "iuu_phoenix", | 1275 | .name = "iuu_phoenix", |
1276 | }, | 1276 | }, |
1277 | .id_table = id_table, | 1277 | .id_table = id_table, |
1278 | .usb_driver = &iuu_driver, | ||
1278 | .num_ports = 1, | 1279 | .num_ports = 1, |
1279 | .bulk_in_size = 512, | 1280 | .bulk_in_size = 512, |
1280 | .bulk_out_size = 512, | 1281 | .bulk_out_size = 512, |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 2d8baf6ac472..ce134dc28ddf 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -546,6 +546,7 @@ static struct usb_serial_driver keyspan_pre_device = { | |||
546 | .name = "keyspan_no_firm", | 546 | .name = "keyspan_no_firm", |
547 | }, | 547 | }, |
548 | .description = "Keyspan - (without firmware)", | 548 | .description = "Keyspan - (without firmware)", |
549 | .usb_driver = &keyspan_driver, | ||
549 | .id_table = keyspan_pre_ids, | 550 | .id_table = keyspan_pre_ids, |
550 | .num_ports = 1, | 551 | .num_ports = 1, |
551 | .attach = keyspan_fake_startup, | 552 | .attach = keyspan_fake_startup, |
@@ -557,6 +558,7 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
557 | .name = "keyspan_1", | 558 | .name = "keyspan_1", |
558 | }, | 559 | }, |
559 | .description = "Keyspan 1 port adapter", | 560 | .description = "Keyspan 1 port adapter", |
561 | .usb_driver = &keyspan_driver, | ||
560 | .id_table = keyspan_1port_ids, | 562 | .id_table = keyspan_1port_ids, |
561 | .num_ports = 1, | 563 | .num_ports = 1, |
562 | .open = keyspan_open, | 564 | .open = keyspan_open, |
@@ -579,6 +581,7 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
579 | .name = "keyspan_2", | 581 | .name = "keyspan_2", |
580 | }, | 582 | }, |
581 | .description = "Keyspan 2 port adapter", | 583 | .description = "Keyspan 2 port adapter", |
584 | .usb_driver = &keyspan_driver, | ||
582 | .id_table = keyspan_2port_ids, | 585 | .id_table = keyspan_2port_ids, |
583 | .num_ports = 2, | 586 | .num_ports = 2, |
584 | .open = keyspan_open, | 587 | .open = keyspan_open, |
@@ -601,6 +604,7 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
601 | .name = "keyspan_4", | 604 | .name = "keyspan_4", |
602 | }, | 605 | }, |
603 | .description = "Keyspan 4 port adapter", | 606 | .description = "Keyspan 4 port adapter", |
607 | .usb_driver = &keyspan_driver, | ||
604 | .id_table = keyspan_4port_ids, | 608 | .id_table = keyspan_4port_ids, |
605 | .num_ports = 4, | 609 | .num_ports = 4, |
606 | .open = keyspan_open, | 610 | .open = keyspan_open, |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index a10dd5676ccc..554a8693a463 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -679,22 +679,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) | |||
679 | } | 679 | } |
680 | } | 680 | } |
681 | 681 | ||
682 | static int keyspan_pda_carrier_raised(struct usb_serial_port *port) | ||
683 | { | ||
684 | struct usb_serial *serial = port->serial; | ||
685 | unsigned char modembits; | ||
686 | |||
687 | /* If we can read the modem status and the DCD is low then | ||
688 | carrier is not raised yet */ | ||
689 | if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { | ||
690 | if (!(modembits & (1>>6))) | ||
691 | return 0; | ||
692 | } | ||
693 | /* Carrier raised, or we failed (eg disconnected) so | ||
694 | progress accordingly */ | ||
695 | return 1; | ||
696 | } | ||
697 | |||
698 | 682 | ||
699 | static int keyspan_pda_open(struct tty_struct *tty, | 683 | static int keyspan_pda_open(struct tty_struct *tty, |
700 | struct usb_serial_port *port) | 684 | struct usb_serial_port *port) |
@@ -881,7 +865,6 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
881 | .id_table = id_table_std, | 865 | .id_table = id_table_std, |
882 | .num_ports = 1, | 866 | .num_ports = 1, |
883 | .dtr_rts = keyspan_pda_dtr_rts, | 867 | .dtr_rts = keyspan_pda_dtr_rts, |
884 | .carrier_raised = keyspan_pda_carrier_raised, | ||
885 | .open = keyspan_pda_open, | 868 | .open = keyspan_pda_open, |
886 | .close = keyspan_pda_close, | 869 | .close = keyspan_pda_close, |
887 | .write = keyspan_pda_write, | 870 | .write = keyspan_pda_write, |
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c index cf1718394e18..653465f61d4a 100644 --- a/drivers/usb/serial/moto_modem.c +++ b/drivers/usb/serial/moto_modem.c | |||
@@ -44,6 +44,7 @@ static struct usb_serial_driver moto_device = { | |||
44 | .name = "moto-modem", | 44 | .name = "moto-modem", |
45 | }, | 45 | }, |
46 | .id_table = id_table, | 46 | .id_table = id_table, |
47 | .usb_driver = &moto_driver, | ||
47 | .num_ports = 1, | 48 | .num_ports = 1, |
48 | }; | 49 | }; |
49 | 50 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 748778288d94..5f46838dfee5 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -382,7 +382,16 @@ static void option_instat_callback(struct urb *urb); | |||
382 | #define HAIER_VENDOR_ID 0x201e | 382 | #define HAIER_VENDOR_ID 0x201e |
383 | #define HAIER_PRODUCT_CE100 0x2009 | 383 | #define HAIER_PRODUCT_CE100 0x2009 |
384 | 384 | ||
385 | #define CINTERION_VENDOR_ID 0x0681 | 385 | /* Cinterion (formerly Siemens) products */ |
386 | #define SIEMENS_VENDOR_ID 0x0681 | ||
387 | #define CINTERION_VENDOR_ID 0x1e2d | ||
388 | #define CINTERION_PRODUCT_HC25_MDM 0x0047 | ||
389 | #define CINTERION_PRODUCT_HC25_MDMNET 0x0040 | ||
390 | #define CINTERION_PRODUCT_HC28_MDM 0x004C | ||
391 | #define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ | ||
392 | #define CINTERION_PRODUCT_EU3_E 0x0051 | ||
393 | #define CINTERION_PRODUCT_EU3_P 0x0052 | ||
394 | #define CINTERION_PRODUCT_PH8 0x0053 | ||
386 | 395 | ||
387 | /* Olivetti products */ | 396 | /* Olivetti products */ |
388 | #define OLIVETTI_VENDOR_ID 0x0b3c | 397 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -944,7 +953,17 @@ static const struct usb_device_id option_ids[] = { | |||
944 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, | 953 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, |
945 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, | 954 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, |
946 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, | 955 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, |
947 | { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, | 956 | /* Cinterion */ |
957 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | ||
958 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | ||
959 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | ||
960 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | ||
961 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
962 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | ||
963 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | ||
964 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | ||
965 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
966 | |||
948 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 967 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
949 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 968 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
950 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ | 969 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 5be866bb7a41..73613205be7a 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = { | |||
157 | .name = "oti6858", | 157 | .name = "oti6858", |
158 | }, | 158 | }, |
159 | .id_table = id_table, | 159 | .id_table = id_table, |
160 | .usb_driver = &oti6858_driver, | ||
160 | .num_ports = 1, | 161 | .num_ports = 1, |
161 | .open = oti6858_open, | 162 | .open = oti6858_open, |
162 | .close = oti6858_close, | 163 | .close = oti6858_close, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 8ae4c6cbc38a..08c9181b8e48 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = { | |||
50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, | 50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, |
51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, | 51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, | 52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, | ||
53 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 55 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
55 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 56 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
@@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
677 | { | 678 | { |
678 | 679 | ||
679 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 680 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
681 | struct tty_struct *tty; | ||
680 | unsigned long flags; | 682 | unsigned long flags; |
681 | u8 status_idx = UART_STATE; | 683 | u8 status_idx = UART_STATE; |
682 | u8 length = UART_STATE + 1; | 684 | u8 length = UART_STATE + 1; |
685 | u8 prev_line_status; | ||
683 | u16 idv, idp; | 686 | u16 idv, idp; |
684 | 687 | ||
685 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); | 688 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); |
@@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
701 | 704 | ||
702 | /* Save off the uart status for others to look at */ | 705 | /* Save off the uart status for others to look at */ |
703 | spin_lock_irqsave(&priv->lock, flags); | 706 | spin_lock_irqsave(&priv->lock, flags); |
707 | prev_line_status = priv->line_status; | ||
704 | priv->line_status = data[status_idx]; | 708 | priv->line_status = data[status_idx]; |
705 | spin_unlock_irqrestore(&priv->lock, flags); | 709 | spin_unlock_irqrestore(&priv->lock, flags); |
706 | if (priv->line_status & UART_BREAK_ERROR) | 710 | if (priv->line_status & UART_BREAK_ERROR) |
707 | usb_serial_handle_break(port); | 711 | usb_serial_handle_break(port); |
708 | wake_up_interruptible(&priv->delta_msr_wait); | 712 | wake_up_interruptible(&priv->delta_msr_wait); |
713 | |||
714 | tty = tty_port_tty_get(&port->port); | ||
715 | if (!tty) | ||
716 | return; | ||
717 | if ((priv->line_status ^ prev_line_status) & UART_DCD) | ||
718 | usb_serial_handle_dcd_change(port, tty, | ||
719 | priv->line_status & UART_DCD); | ||
720 | tty_kref_put(tty); | ||
709 | } | 721 | } |
710 | 722 | ||
711 | static void pl2303_read_int_callback(struct urb *urb) | 723 | static void pl2303_read_int_callback(struct urb *urb) |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 43eb9bdad422..1b025f75dafd 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define PL2303_PRODUCT_ID_MMX 0x0612 | 21 | #define PL2303_PRODUCT_ID_MMX 0x0612 |
22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 | 22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
23 | #define PL2303_PRODUCT_ID_HCR331 0x331a | 23 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 | ||
24 | 25 | ||
25 | #define ATEN_VENDOR_ID 0x0557 | 26 | #define ATEN_VENDOR_ID 0x0557 |
26 | #define ATEN_VENDOR_ID2 0x0547 | 27 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c index 214a3e504292..30b73e68a904 100644 --- a/drivers/usb/serial/qcaux.c +++ b/drivers/usb/serial/qcaux.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 | 36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 |
37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 | 37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 |
38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 | 38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 |
39 | #define PANTECH_PRODUCT_UML290_VZW 0x3718 | ||
39 | 40 | ||
40 | /* CMOTECH devices */ | 41 | /* CMOTECH devices */ |
41 | #define CMOTECH_VENDOR_ID 0x16d8 | 42 | #define CMOTECH_VENDOR_ID 0x16d8 |
@@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = { | |||
66 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, | 67 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, |
67 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, | 68 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, |
68 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, | 69 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, |
70 | { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, | ||
69 | { }, | 71 | { }, |
70 | }; | 72 | }; |
71 | MODULE_DEVICE_TABLE(usb, id_table); | 73 | MODULE_DEVICE_TABLE(usb, id_table); |
@@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = { | |||
84 | .name = "qcaux", | 86 | .name = "qcaux", |
85 | }, | 87 | }, |
86 | .id_table = id_table, | 88 | .id_table = id_table, |
89 | .usb_driver = &qcaux_driver, | ||
87 | .num_ports = 1, | 90 | .num_ports = 1, |
88 | }; | 91 | }; |
89 | 92 | ||
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c index cb8195cabfde..74cd4ccdb3fc 100644 --- a/drivers/usb/serial/siemens_mpi.c +++ b/drivers/usb/serial/siemens_mpi.c | |||
@@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = { | |||
42 | .name = "siemens_mpi", | 42 | .name = "siemens_mpi", |
43 | }, | 43 | }, |
44 | .id_table = id_table, | 44 | .id_table = id_table, |
45 | .usb_driver = &siemens_usb_mpi_driver, | ||
45 | .num_ports = 1, | 46 | .num_ports = 1, |
46 | }; | 47 | }; |
47 | 48 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 765aa983bf58..cbfb70bffdd0 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg { | |||
133 | 133 | ||
134 | /* how come ??? */ | 134 | /* how come ??? */ |
135 | #define UART_STATE 0x08 | 135 | #define UART_STATE 0x08 |
136 | #define UART_STATE_TRANSIENT_MASK 0x74 | 136 | #define UART_STATE_TRANSIENT_MASK 0x75 |
137 | #define UART_DCD 0x01 | 137 | #define UART_DCD 0x01 |
138 | #define UART_DSR 0x02 | 138 | #define UART_DSR 0x02 |
139 | #define UART_BREAK_ERROR 0x04 | 139 | #define UART_BREAK_ERROR 0x04 |
@@ -525,6 +525,10 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
525 | /* overrun is special, not associated with a char */ | 525 | /* overrun is special, not associated with a char */ |
526 | if (status & UART_OVERRUN_ERROR) | 526 | if (status & UART_OVERRUN_ERROR) |
527 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 527 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
528 | |||
529 | if (status & UART_DCD) | ||
530 | usb_serial_handle_dcd_change(port, tty, | ||
531 | priv->line_status & MSR_STATUS_LINE_DCD); | ||
528 | } | 532 | } |
529 | 533 | ||
530 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, | 534 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, |
@@ -645,6 +649,7 @@ static struct usb_serial_driver spcp8x5_device = { | |||
645 | .name = "SPCP8x5", | 649 | .name = "SPCP8x5", |
646 | }, | 650 | }, |
647 | .id_table = id_table, | 651 | .id_table = id_table, |
652 | .usb_driver = &spcp8x5_driver, | ||
648 | .num_ports = 1, | 653 | .num_ports = 1, |
649 | .open = spcp8x5_open, | 654 | .open = spcp8x5_open, |
650 | .dtr_rts = spcp8x5_dtr_rts, | 655 | .dtr_rts = spcp8x5_dtr_rts, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6954de50c0ff..546a52179bec 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1344,11 +1344,15 @@ int usb_serial_register(struct usb_serial_driver *driver) | |||
1344 | return -ENODEV; | 1344 | return -ENODEV; |
1345 | 1345 | ||
1346 | fixup_generic(driver); | 1346 | fixup_generic(driver); |
1347 | if (driver->usb_driver) | ||
1348 | driver->usb_driver->supports_autosuspend = 1; | ||
1349 | 1347 | ||
1350 | if (!driver->description) | 1348 | if (!driver->description) |
1351 | driver->description = driver->driver.name; | 1349 | driver->description = driver->driver.name; |
1350 | if (!driver->usb_driver) { | ||
1351 | WARN(1, "Serial driver %s has no usb_driver\n", | ||
1352 | driver->description); | ||
1353 | return -EINVAL; | ||
1354 | } | ||
1355 | driver->usb_driver->supports_autosuspend = 1; | ||
1352 | 1356 | ||
1353 | /* Add this device to our list of devices */ | 1357 | /* Add this device to our list of devices */ |
1354 | mutex_lock(&table_lock); | 1358 | mutex_lock(&table_lock); |
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c index f2ed6a31be77..95a82148ee81 100644 --- a/drivers/usb/serial/usb_debug.c +++ b/drivers/usb/serial/usb_debug.c | |||
@@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = { | |||
75 | .name = "debug", | 75 | .name = "debug", |
76 | }, | 76 | }, |
77 | .id_table = id_table, | 77 | .id_table = id_table, |
78 | .usb_driver = &debug_driver, | ||
78 | .num_ports = 1, | 79 | .num_ports = 1, |
79 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, | 80 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, |
80 | .break_ctl = usb_debug_break_ctl, | 81 | .break_ctl = usb_debug_break_ctl, |
diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h index c854fdebe0ae..2c8553026222 100644 --- a/drivers/usb/storage/unusual_cypress.h +++ b/drivers/usb/storage/unusual_cypress.h | |||
@@ -31,4 +31,9 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999, | |||
31 | "Cypress ISD-300LP", | 31 | "Cypress ISD-300LP", |
32 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), | 32 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
33 | 33 | ||
34 | UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999, | ||
35 | "Super Top", | ||
36 | "USB 2.0 SATA BRIDGE", | ||
37 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), | ||
38 | |||
34 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ | 39 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index fcc1e32ce256..24bd5d7c3deb 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1044,6 +1044,15 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110, | |||
1044 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1044 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1045 | US_FL_BULK32), | 1045 | US_FL_BULK32), |
1046 | 1046 | ||
1047 | /* Reported by <ttkspam@free.fr> | ||
1048 | * The device reports a vendor-specific device class, requiring an | ||
1049 | * explicit vendor/product match. | ||
1050 | */ | ||
1051 | UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002, | ||
1052 | "MagicPixel", | ||
1053 | "FW_Omega2", | ||
1054 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, 0), | ||
1055 | |||
1047 | /* Andrew Lunn <andrew@lunn.ch> | 1056 | /* Andrew Lunn <andrew@lunn.ch> |
1048 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL | 1057 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL |
1049 | * on LUN 4. | 1058 | * on LUN 4. |
@@ -1872,6 +1881,15 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
1872 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1881 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1873 | US_FL_NO_READ_DISC_INFO ), | 1882 | US_FL_NO_READ_DISC_INFO ), |
1874 | 1883 | ||
1884 | /* Patch by Richard Schütz <r.schtz@t-online.de> | ||
1885 | * This external hard drive enclosure uses a JMicron chip which | ||
1886 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | ||
1887 | UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000, | ||
1888 | "TrekStor GmbH & Co. KG", | ||
1889 | "DataStation maxi g.u", | ||
1890 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1891 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | ||
1892 | |||
1875 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, | 1893 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
1876 | "ST", | 1894 | "ST", |
1877 | "2A", | 1895 | "2A", |