Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (42 commits)
usb: gadget: composite: avoid access beyond array max length
USB: serial: handle Data Carrier Detect changes
USB: gadget: Fix endpoint representation in ci13xxx_udc
USB: gadget: Fix error path in ci13xxx_udc gadget probe function
usb: pch_udc: Fix the worning log issue at gadget driver remove
USB: serial: Updated support for ICOM devices
USB: ehci-mxc: add work-around for efika mx/sb bug
USB: unbreak ehci-mxc on otg port of i.MX27
drivers: update to pl2303 usb-serial to support Motorola cables
USB: adding USB support for Cinterion's HC2x, EU3 and PH8 products
USB serial: add missing .usb_driver field in serial drivers
USB: ehci-fsl: Fix 'have_sysif_regs' detection
USB: g_printer: fix bug in module parameter definitions
USB: g_printer: fix bug in unregistration
USB: uss720: remove duplicate USB device
MAINTAINERS: add ueagle-atm entry
USB: EHCI: fix DMA deallocation bug
USB: pch_udc: support new device ML7213 IOH
usb: pch_udc: Fixed issue which does not work with g_serial
usb: set ep_dev async suspend should be later than device_initialize
...

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