Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: (43 commits)
Revert "USB: isp1760-hcd: move imask clear after pending work is done"
xHCI: Implement AMD PLL quirk
xhci: Tell USB core both roothubs lost power.
usbcore: Bug fix: system can't suspend with USB3.0 device connected to USB3.0 hub
USB: Fix unplug of device with active streams
USB: xhci - also free streams when resetting devices
xhci: Fix NULL pointer deref in handle_port_status()
USB: xhci - fix math in xhci_get_endpoint_interval()
USB: xhci: simplify logic of skipping missed isoc TDs
USB: xhci - remove excessive 'inline' markings
USB: xhci: unsigned char never equals -1
USB: xhci - fix unsafe macro definitions
USB: fix formatting of SuperSpeed endpoints in /proc/bus/usb/devices
USB: isp1760-hcd: move imask clear after pending work is done
USB: fsl_qe_udc: send ZLP when zero flag and length % maxpacket == 0
usb: qcserial add missing errorpath kfrees
usb: qcserial avoid pointing to freed memory
usb: Fix qcserial memory leak on rmmod
USB: ftdi_sio: add ids for Hameg HO720 and HO730
USB: option: Added support for Samsung GT-B3730/GT-B3710 LTE USB modem.
...

+483 -219
-1
arch/microblaze/Kconfig
··· 6 6 select HAVE_FUNCTION_GRAPH_TRACER 7 7 select HAVE_DYNAMIC_FTRACE 8 8 select HAVE_FTRACE_MCOUNT_RECORD 9 - select USB_ARCH_HAS_EHCI 10 9 select ARCH_WANT_OPTIONAL_GPIOLIB 11 10 select HAVE_OPROFILE 12 11 select HAVE_ARCH_KGDB
+1
drivers/usb/Kconfig
··· 66 66 default y if ARCH_VT8500 67 67 default y if PLAT_SPEAR 68 68 default y if ARCH_MSM 69 + default y if MICROBLAZE 69 70 default PCI 70 71 71 72 # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
+6 -4
drivers/usb/core/devices.c
··· 221 221 break; 222 222 case USB_ENDPOINT_XFER_INT: 223 223 type = "Int."; 224 - if (speed == USB_SPEED_HIGH) 224 + if (speed == USB_SPEED_HIGH || speed == USB_SPEED_SUPER) 225 225 interval = 1 << (desc->bInterval - 1); 226 226 else 227 227 interval = desc->bInterval; ··· 229 229 default: /* "can't happen" */ 230 230 return start; 231 231 } 232 - interval *= (speed == USB_SPEED_HIGH) ? 125 : 1000; 232 + interval *= (speed == USB_SPEED_HIGH || 233 + speed == USB_SPEED_SUPER) ? 125 : 1000; 233 234 if (interval % 1000) 234 235 unit = 'u'; 235 236 else { ··· 543 542 if (level == 0) { 544 543 int max; 545 544 546 - /* high speed reserves 80%, full/low reserves 90% */ 547 - if (usbdev->speed == USB_SPEED_HIGH) 545 + /* super/high speed reserves 80%, full/low reserves 90% */ 546 + if (usbdev->speed == USB_SPEED_HIGH || 547 + usbdev->speed == USB_SPEED_SUPER) 548 548 max = 800; 549 549 else 550 550 max = FRAME_TIME_MAX_USECS_ALLOC;
+1 -1
drivers/usb/core/hcd.c
··· 1908 1908 1909 1909 /* Streams only apply to bulk endpoints. */ 1910 1910 for (i = 0; i < num_eps; i++) 1911 - if (!usb_endpoint_xfer_bulk(&eps[i]->desc)) 1911 + if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc)) 1912 1912 return; 1913 1913 1914 1914 hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags);
+11 -1
drivers/usb/core/hub.c
··· 2285 2285 } 2286 2286 2287 2287 /* see 7.1.7.6 */ 2288 - status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND); 2288 + /* Clear PORT_POWER if it's a USB3.0 device connected to USB 3.0 2289 + * external hub. 2290 + * FIXME: this is a temporary workaround to make the system able 2291 + * to suspend/resume. 2292 + */ 2293 + if ((hub->hdev->parent != NULL) && hub_is_superspeed(hub->hdev)) 2294 + status = clear_port_feature(hub->hdev, port1, 2295 + USB_PORT_FEAT_POWER); 2296 + else 2297 + status = set_port_feature(hub->hdev, port1, 2298 + USB_PORT_FEAT_SUSPEND); 2289 2299 if (status) { 2290 2300 dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", 2291 2301 port1, status);
+1
drivers/usb/gadget/f_audio.c
··· 706 706 struct f_audio *audio = func_to_audio(f); 707 707 708 708 usb_free_descriptors(f->descriptors); 709 + usb_free_descriptors(f->hs_descriptors); 709 710 kfree(audio); 710 711 } 711 712
+6 -2
drivers/usb/gadget/f_eem.c
··· 314 314 315 315 static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) 316 316 { 317 + struct sk_buff *skb = (struct sk_buff *)req->context; 318 + 319 + dev_kfree_skb_any(skb); 317 320 } 318 321 319 322 /* ··· 431 428 skb_trim(skb2, len); 432 429 put_unaligned_le16(BIT(15) | BIT(11) | len, 433 430 skb_push(skb2, 2)); 434 - skb_copy_bits(skb, 0, req->buf, skb->len); 435 - req->length = skb->len; 431 + skb_copy_bits(skb2, 0, req->buf, skb2->len); 432 + req->length = skb2->len; 436 433 req->complete = eem_cmd_complete; 437 434 req->zero = 1; 435 + req->context = skb2; 438 436 if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) 439 437 DBG(cdev, "echo response queue fail\n"); 440 438 break;
+18 -2
drivers/usb/gadget/fsl_qe_udc.c
··· 1148 1148 static int txcomplete(struct qe_ep *ep, unsigned char restart) 1149 1149 { 1150 1150 if (ep->tx_req != NULL) { 1151 + struct qe_req *req = ep->tx_req; 1152 + unsigned zlp = 0, last_len = 0; 1153 + 1154 + last_len = min_t(unsigned, req->req.length - ep->sent, 1155 + ep->ep.maxpacket); 1156 + 1151 1157 if (!restart) { 1152 1158 int asent = ep->last; 1153 1159 ep->sent += asent; ··· 1162 1156 ep->last = 0; 1163 1157 } 1164 1158 1159 + /* zlp needed when req->re.zero is set */ 1160 + if (req->req.zero) { 1161 + if (last_len == 0 || 1162 + (req->req.length % ep->ep.maxpacket) != 0) 1163 + zlp = 0; 1164 + else 1165 + zlp = 1; 1166 + } else 1167 + zlp = 0; 1168 + 1165 1169 /* a request already were transmitted completely */ 1166 - if ((ep->tx_req->req.length - ep->sent) <= 0) { 1167 - ep->tx_req->req.actual = (unsigned int)ep->sent; 1170 + if (((ep->tx_req->req.length - ep->sent) <= 0) && !zlp) { 1168 1171 done(ep, ep->tx_req, 0); 1169 1172 ep->tx_req = NULL; 1170 1173 ep->last = 0; ··· 1206 1191 buf = (u8 *)ep->tx_req->req.buf + ep->sent; 1207 1192 if (buf && size) { 1208 1193 ep->last = size; 1194 + ep->tx_req->req.actual += size; 1209 1195 frame_set_data(frame, buf); 1210 1196 frame_set_length(frame, size); 1211 1197 frame_set_status(frame, FRAME_OK);
+3 -1
drivers/usb/gadget/inode.c
··· 386 386 387 387 /* halt any endpoint by doing a "wrong direction" i/o call */ 388 388 if (usb_endpoint_dir_in(&data->desc)) { 389 - if (usb_endpoint_xfer_isoc(&data->desc)) 389 + if (usb_endpoint_xfer_isoc(&data->desc)) { 390 + mutex_unlock(&data->lock); 390 391 return -EINVAL; 392 + } 391 393 DBG (data->dev, "%s halt\n", data->name); 392 394 spin_lock_irq (&data->dev->lock); 393 395 if (likely (data->ep != NULL))
+5 -3
drivers/usb/gadget/pch_udc.c
··· 1608 1608 return -EINVAL; 1609 1609 if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) 1610 1610 return -ESHUTDOWN; 1611 - spin_lock_irqsave(&ep->dev->lock, iflags); 1611 + spin_lock_irqsave(&dev->lock, iflags); 1612 1612 /* map the buffer for dma */ 1613 1613 if (usbreq->length && 1614 1614 ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { ··· 1625 1625 DMA_FROM_DEVICE); 1626 1626 } else { 1627 1627 req->buf = kzalloc(usbreq->length, GFP_ATOMIC); 1628 - if (!req->buf) 1629 - return -ENOMEM; 1628 + if (!req->buf) { 1629 + retval = -ENOMEM; 1630 + goto probe_end; 1631 + } 1630 1632 if (ep->in) { 1631 1633 memcpy(req->buf, usbreq->buf, usbreq->length); 1632 1634 req->dma = dma_map_single(&dev->pdev->dev,
+2
drivers/usb/gadget/r8a66597-udc.c
··· 1083 1083 1084 1084 if (dvsq == DS_DFLT) { 1085 1085 /* bus reset */ 1086 + spin_unlock(&r8a66597->lock); 1086 1087 r8a66597->driver->disconnect(&r8a66597->gadget); 1088 + spin_lock(&r8a66597->lock); 1087 1089 r8a66597_update_usb_speed(r8a66597); 1088 1090 } 1089 1091 if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG)
+9 -6
drivers/usb/host/ehci-q.c
··· 1247 1247 1248 1248 static void scan_async (struct ehci_hcd *ehci) 1249 1249 { 1250 + bool stopped; 1250 1251 struct ehci_qh *qh; 1251 1252 enum ehci_timer_action action = TIMER_IO_WATCHDOG; 1252 1253 1253 1254 ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); 1254 1255 timer_action_done (ehci, TIMER_ASYNC_SHRINK); 1255 1256 rescan: 1257 + stopped = !HC_IS_RUNNING(ehci_to_hcd(ehci)->state); 1256 1258 qh = ehci->async->qh_next.qh; 1257 1259 if (likely (qh != NULL)) { 1258 1260 do { 1259 1261 /* clean any finished work for this qh */ 1260 - if (!list_empty (&qh->qtd_list) 1261 - && qh->stamp != ehci->stamp) { 1262 + if (!list_empty(&qh->qtd_list) && (stopped || 1263 + qh->stamp != ehci->stamp)) { 1262 1264 int temp; 1263 1265 1264 1266 /* unlinks could happen here; completion 1265 1267 * reporting drops the lock. rescan using 1266 1268 * the latest schedule, but don't rescan 1267 - * qhs we already finished (no looping). 1269 + * qhs we already finished (no looping) 1270 + * unless the controller is stopped. 1268 1271 */ 1269 1272 qh = qh_get (qh); 1270 1273 qh->stamp = ehci->stamp; ··· 1288 1285 */ 1289 1286 if (list_empty(&qh->qtd_list) 1290 1287 && qh->qh_state == QH_STATE_LINKED) { 1291 - if (!ehci->reclaim 1292 - && ((ehci->stamp - qh->stamp) & 0x1fff) 1293 - >= (EHCI_SHRINK_FRAMES * 8)) 1288 + if (!ehci->reclaim && (stopped || 1289 + ((ehci->stamp - qh->stamp) & 0x1fff) 1290 + >= EHCI_SHRINK_FRAMES * 8)) 1294 1291 start_unlink_async(ehci, qh); 1295 1292 else 1296 1293 action = TIMER_ASYNC_SHRINK;
+1 -1
drivers/usb/host/isp1760-hcd.c
··· 295 295 } 296 296 297 297 dev_err(hcd->self.controller, 298 - "%s: Can not allocate %lu bytes of memory\n" 298 + "%s: Cannot allocate %zu bytes of memory\n" 299 299 "Current memory map:\n", 300 300 __func__, qtd->length); 301 301 for (i = 0; i < BLOCKS; i++) {
+1 -1
drivers/usb/host/ohci-au1xxx.c
··· 33 33 34 34 #ifdef __LITTLE_ENDIAN 35 35 #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) 36 - #elif __BIG_ENDIAN 36 + #elif defined(__BIG_ENDIAN) 37 37 #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ 38 38 USBH_ENABLE_BE) 39 39 #else
+74 -43
drivers/usb/host/pci-quirks.c
··· 84 84 { 85 85 u8 rev = 0; 86 86 unsigned long flags; 87 + struct amd_chipset_info info; 88 + int ret; 87 89 88 90 spin_lock_irqsave(&amd_lock, flags); 89 91 90 - amd_chipset.probe_count++; 91 92 /* probe only once */ 92 - if (amd_chipset.probe_count > 1) { 93 + if (amd_chipset.probe_count > 0) { 94 + amd_chipset.probe_count++; 93 95 spin_unlock_irqrestore(&amd_lock, flags); 94 96 return amd_chipset.probe_result; 95 97 } 98 + memset(&info, 0, sizeof(info)); 99 + spin_unlock_irqrestore(&amd_lock, flags); 96 100 97 - amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); 98 - if (amd_chipset.smbus_dev) { 99 - rev = amd_chipset.smbus_dev->revision; 101 + info.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); 102 + if (info.smbus_dev) { 103 + rev = info.smbus_dev->revision; 100 104 if (rev >= 0x40) 101 - amd_chipset.sb_type = 1; 105 + info.sb_type = 1; 102 106 else if (rev >= 0x30 && rev <= 0x3b) 103 - amd_chipset.sb_type = 3; 107 + info.sb_type = 3; 104 108 } else { 105 - amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 106 - 0x780b, NULL); 107 - if (!amd_chipset.smbus_dev) { 108 - spin_unlock_irqrestore(&amd_lock, flags); 109 - return 0; 109 + info.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 110 + 0x780b, NULL); 111 + if (!info.smbus_dev) { 112 + ret = 0; 113 + goto commit; 110 114 } 111 - rev = amd_chipset.smbus_dev->revision; 115 + 116 + rev = info.smbus_dev->revision; 112 117 if (rev >= 0x11 && rev <= 0x18) 113 - amd_chipset.sb_type = 2; 118 + info.sb_type = 2; 114 119 } 115 120 116 - if (amd_chipset.sb_type == 0) { 117 - if (amd_chipset.smbus_dev) { 118 - pci_dev_put(amd_chipset.smbus_dev); 119 - amd_chipset.smbus_dev = NULL; 121 + if (info.sb_type == 0) { 122 + if (info.smbus_dev) { 123 + pci_dev_put(info.smbus_dev); 124 + info.smbus_dev = NULL; 120 125 } 121 - spin_unlock_irqrestore(&amd_lock, flags); 122 - return 0; 126 + ret = 0; 127 + goto commit; 123 128 } 124 129 125 - amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); 126 - if (amd_chipset.nb_dev) { 127 - amd_chipset.nb_type = 1; 130 + info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); 131 + if (info.nb_dev) { 132 + info.nb_type = 1; 128 133 } else { 129 - amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 130 - 0x1510, NULL); 131 - if (amd_chipset.nb_dev) { 132 - amd_chipset.nb_type = 2; 133 - } else { 134 - amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 135 - 0x9600, NULL); 136 - if (amd_chipset.nb_dev) 137 - amd_chipset.nb_type = 3; 134 + info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); 135 + if (info.nb_dev) { 136 + info.nb_type = 2; 137 + } else { 138 + info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 139 + 0x9600, NULL); 140 + if (info.nb_dev) 141 + info.nb_type = 3; 138 142 } 139 143 } 140 144 141 - amd_chipset.probe_result = 1; 145 + ret = info.probe_result = 1; 142 146 printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); 143 147 144 - spin_unlock_irqrestore(&amd_lock, flags); 145 - return amd_chipset.probe_result; 148 + commit: 149 + 150 + spin_lock_irqsave(&amd_lock, flags); 151 + if (amd_chipset.probe_count > 0) { 152 + /* race - someone else was faster - drop devices */ 153 + 154 + /* Mark that we where here */ 155 + amd_chipset.probe_count++; 156 + ret = amd_chipset.probe_result; 157 + 158 + spin_unlock_irqrestore(&amd_lock, flags); 159 + 160 + if (info.nb_dev) 161 + pci_dev_put(info.nb_dev); 162 + if (info.smbus_dev) 163 + pci_dev_put(info.smbus_dev); 164 + 165 + } else { 166 + /* no race - commit the result */ 167 + info.probe_count++; 168 + amd_chipset = info; 169 + spin_unlock_irqrestore(&amd_lock, flags); 170 + } 171 + 172 + return ret; 146 173 } 147 174 EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); 148 175 ··· 311 284 312 285 void usb_amd_dev_put(void) 313 286 { 287 + struct pci_dev *nb, *smbus; 314 288 unsigned long flags; 315 289 316 290 spin_lock_irqsave(&amd_lock, flags); ··· 322 294 return; 323 295 } 324 296 325 - if (amd_chipset.nb_dev) { 326 - pci_dev_put(amd_chipset.nb_dev); 327 - amd_chipset.nb_dev = NULL; 328 - } 329 - if (amd_chipset.smbus_dev) { 330 - pci_dev_put(amd_chipset.smbus_dev); 331 - amd_chipset.smbus_dev = NULL; 332 - } 297 + /* save them to pci_dev_put outside of spinlock */ 298 + nb = amd_chipset.nb_dev; 299 + smbus = amd_chipset.smbus_dev; 300 + 301 + amd_chipset.nb_dev = NULL; 302 + amd_chipset.smbus_dev = NULL; 333 303 amd_chipset.nb_type = 0; 334 304 amd_chipset.sb_type = 0; 335 305 amd_chipset.isoc_reqs = 0; 336 306 amd_chipset.probe_result = 0; 337 307 338 308 spin_unlock_irqrestore(&amd_lock, flags); 309 + 310 + if (nb) 311 + pci_dev_put(nb); 312 + if (smbus) 313 + pci_dev_put(smbus); 339 314 } 340 315 EXPORT_SYMBOL_GPL(usb_amd_dev_put); 341 316
+70 -36
drivers/usb/host/xhci-mem.c
··· 846 846 * Skip ports that don't have known speeds, or have duplicate 847 847 * Extended Capabilities port speed entries. 848 848 */ 849 - if (port_speed == 0 || port_speed == -1) 849 + if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) 850 850 continue; 851 851 852 852 /* ··· 974 974 return 0; 975 975 } 976 976 977 + /* 978 + * Convert interval expressed as 2^(bInterval - 1) == interval into 979 + * straight exponent value 2^n == interval. 980 + * 981 + */ 982 + static unsigned int xhci_parse_exponent_interval(struct usb_device *udev, 983 + struct usb_host_endpoint *ep) 984 + { 985 + unsigned int interval; 986 + 987 + interval = clamp_val(ep->desc.bInterval, 1, 16) - 1; 988 + if (interval != ep->desc.bInterval - 1) 989 + dev_warn(&udev->dev, 990 + "ep %#x - rounding interval to %d microframes\n", 991 + ep->desc.bEndpointAddress, 992 + 1 << interval); 993 + 994 + return interval; 995 + } 996 + 997 + /* 998 + * Convert bInterval expressed in frames (in 1-255 range) to exponent of 999 + * microframes, rounded down to nearest power of 2. 1000 + */ 1001 + static unsigned int xhci_parse_frame_interval(struct usb_device *udev, 1002 + struct usb_host_endpoint *ep) 1003 + { 1004 + unsigned int interval; 1005 + 1006 + interval = fls(8 * ep->desc.bInterval) - 1; 1007 + interval = clamp_val(interval, 3, 10); 1008 + if ((1 << interval) != 8 * ep->desc.bInterval) 1009 + dev_warn(&udev->dev, 1010 + "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n", 1011 + ep->desc.bEndpointAddress, 1012 + 1 << interval, 1013 + 8 * ep->desc.bInterval); 1014 + 1015 + return interval; 1016 + } 1017 + 977 1018 /* Return the polling or NAK interval. 978 1019 * 979 1020 * The polling interval is expressed in "microframes". If xHCI's Interval field ··· 1023 982 * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval 1024 983 * is set to 0. 1025 984 */ 1026 - static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, 985 + static unsigned int xhci_get_endpoint_interval(struct usb_device *udev, 1027 986 struct usb_host_endpoint *ep) 1028 987 { 1029 988 unsigned int interval = 0; ··· 1032 991 case USB_SPEED_HIGH: 1033 992 /* Max NAK rate */ 1034 993 if (usb_endpoint_xfer_control(&ep->desc) || 1035 - usb_endpoint_xfer_bulk(&ep->desc)) 994 + usb_endpoint_xfer_bulk(&ep->desc)) { 1036 995 interval = ep->desc.bInterval; 996 + break; 997 + } 1037 998 /* Fall through - SS and HS isoc/int have same decoding */ 999 + 1038 1000 case USB_SPEED_SUPER: 1039 1001 if (usb_endpoint_xfer_int(&ep->desc) || 1040 - usb_endpoint_xfer_isoc(&ep->desc)) { 1041 - if (ep->desc.bInterval == 0) 1042 - interval = 0; 1043 - else 1044 - interval = ep->desc.bInterval - 1; 1045 - if (interval > 15) 1046 - interval = 15; 1047 - if (interval != ep->desc.bInterval + 1) 1048 - dev_warn(&udev->dev, "ep %#x - rounding interval to %d microframes\n", 1049 - ep->desc.bEndpointAddress, 1 << interval); 1002 + usb_endpoint_xfer_isoc(&ep->desc)) { 1003 + interval = xhci_parse_exponent_interval(udev, ep); 1050 1004 } 1051 1005 break; 1052 - /* Convert bInterval (in 1-255 frames) to microframes and round down to 1053 - * nearest power of 2. 1054 - */ 1006 + 1055 1007 case USB_SPEED_FULL: 1008 + if (usb_endpoint_xfer_int(&ep->desc)) { 1009 + interval = xhci_parse_exponent_interval(udev, ep); 1010 + break; 1011 + } 1012 + /* 1013 + * Fall through for isochronous endpoint interval decoding 1014 + * since it uses the same rules as low speed interrupt 1015 + * endpoints. 1016 + */ 1017 + 1056 1018 case USB_SPEED_LOW: 1057 1019 if (usb_endpoint_xfer_int(&ep->desc) || 1058 - usb_endpoint_xfer_isoc(&ep->desc)) { 1059 - interval = fls(8*ep->desc.bInterval) - 1; 1060 - if (interval > 10) 1061 - interval = 10; 1062 - if (interval < 3) 1063 - interval = 3; 1064 - if ((1 << interval) != 8*ep->desc.bInterval) 1065 - dev_warn(&udev->dev, 1066 - "ep %#x - rounding interval" 1067 - " to %d microframes, " 1068 - "ep desc says %d microframes\n", 1069 - ep->desc.bEndpointAddress, 1070 - 1 << interval, 1071 - 8*ep->desc.bInterval); 1020 + usb_endpoint_xfer_isoc(&ep->desc)) { 1021 + 1022 + interval = xhci_parse_frame_interval(udev, ep); 1072 1023 } 1073 1024 break; 1025 + 1074 1026 default: 1075 1027 BUG(); 1076 1028 } ··· 1075 1041 * transaction opportunities per microframe", but that goes in the Max Burst 1076 1042 * endpoint context field. 1077 1043 */ 1078 - static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, 1044 + static u32 xhci_get_endpoint_mult(struct usb_device *udev, 1079 1045 struct usb_host_endpoint *ep) 1080 1046 { 1081 1047 if (udev->speed != USB_SPEED_SUPER || ··· 1084 1050 return ep->ss_ep_comp.bmAttributes; 1085 1051 } 1086 1052 1087 - static inline u32 xhci_get_endpoint_type(struct usb_device *udev, 1053 + static u32 xhci_get_endpoint_type(struct usb_device *udev, 1088 1054 struct usb_host_endpoint *ep) 1089 1055 { 1090 1056 int in; ··· 1118 1084 * Basically, this is the maxpacket size, multiplied by the burst size 1119 1085 * and mult size. 1120 1086 */ 1121 - static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, 1087 + static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, 1122 1088 struct usb_device *udev, 1123 1089 struct usb_host_endpoint *ep) 1124 1090 { ··· 1761 1727 * found a similar duplicate. 1762 1728 */ 1763 1729 if (xhci->port_array[i] != major_revision && 1764 - xhci->port_array[i] != (u8) -1) { 1730 + xhci->port_array[i] != DUPLICATE_ENTRY) { 1765 1731 if (xhci->port_array[i] == 0x03) 1766 1732 xhci->num_usb3_ports--; 1767 1733 else 1768 1734 xhci->num_usb2_ports--; 1769 - xhci->port_array[i] = (u8) -1; 1735 + xhci->port_array[i] = DUPLICATE_ENTRY; 1770 1736 } 1771 1737 /* FIXME: Should we disable the port? */ 1772 1738 continue; ··· 1865 1831 for (i = 0; i < num_ports; i++) { 1866 1832 if (xhci->port_array[i] == 0x03 || 1867 1833 xhci->port_array[i] == 0 || 1868 - xhci->port_array[i] == -1) 1834 + xhci->port_array[i] == DUPLICATE_ENTRY) 1869 1835 continue; 1870 1836 1871 1837 xhci->usb2_ports[port_index] =
+4
drivers/usb/host/xhci-pci.c
··· 114 114 if (pdev->vendor == PCI_VENDOR_ID_NEC) 115 115 xhci->quirks |= XHCI_NEC_HOST; 116 116 117 + /* AMD PLL quirk */ 118 + if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) 119 + xhci->quirks |= XHCI_AMD_PLL_FIX; 120 + 117 121 /* Make sure the HC is halted. */ 118 122 retval = xhci_halt(xhci); 119 123 if (retval)
+134 -85
drivers/usb/host/xhci-ring.c
··· 93 93 /* Does this link TRB point to the first segment in a ring, 94 94 * or was the previous TRB the last TRB on the last segment in the ERST? 95 95 */ 96 - static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, 96 + static bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, 97 97 struct xhci_segment *seg, union xhci_trb *trb) 98 98 { 99 99 if (ring == xhci->event_ring) ··· 107 107 * segment? I.e. would the updated event TRB pointer step off the end of the 108 108 * event seg? 109 109 */ 110 - static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, 110 + static int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, 111 111 struct xhci_segment *seg, union xhci_trb *trb) 112 112 { 113 113 if (ring == xhci->event_ring) ··· 116 116 return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK); 117 117 } 118 118 119 - static inline int enqueue_is_link_trb(struct xhci_ring *ring) 119 + static int enqueue_is_link_trb(struct xhci_ring *ring) 120 120 { 121 121 struct xhci_link_trb *link = &ring->enqueue->link; 122 122 return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK)); ··· 592 592 ep->ep_state |= SET_DEQ_PENDING; 593 593 } 594 594 595 - static inline void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, 595 + static void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, 596 596 struct xhci_virt_ep *ep) 597 597 { 598 598 ep->ep_state &= ~EP_HALT_PENDING; ··· 619 619 620 620 /* Only giveback urb when this is the last td in urb */ 621 621 if (urb_priv->td_cnt == urb_priv->length) { 622 + if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { 623 + xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; 624 + if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) { 625 + if (xhci->quirks & XHCI_AMD_PLL_FIX) 626 + usb_amd_quirk_pll_enable(); 627 + } 628 + } 622 629 usb_hcd_unlink_urb_from_ep(hcd, urb); 623 630 xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb); 624 631 ··· 1216 1209 * Skip ports that don't have known speeds, or have duplicate 1217 1210 * Extended Capabilities port speed entries. 1218 1211 */ 1219 - if (port_speed == 0 || port_speed == -1) 1212 + if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) 1220 1213 continue; 1221 1214 1222 1215 /* ··· 1242 1235 u8 major_revision; 1243 1236 struct xhci_bus_state *bus_state; 1244 1237 u32 __iomem **port_array; 1238 + bool bogus_port_status = false; 1245 1239 1246 1240 /* Port status change events always have a successful completion code */ 1247 1241 if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) { ··· 1255 1247 max_ports = HCS_MAX_PORTS(xhci->hcs_params1); 1256 1248 if ((port_id <= 0) || (port_id > max_ports)) { 1257 1249 xhci_warn(xhci, "Invalid port id %d\n", port_id); 1250 + bogus_port_status = true; 1258 1251 goto cleanup; 1259 1252 } 1260 1253 ··· 1267 1258 xhci_warn(xhci, "Event for port %u not in " 1268 1259 "Extended Capabilities, ignoring.\n", 1269 1260 port_id); 1261 + bogus_port_status = true; 1270 1262 goto cleanup; 1271 1263 } 1272 - if (major_revision == (u8) -1) { 1264 + if (major_revision == DUPLICATE_ENTRY) { 1273 1265 xhci_warn(xhci, "Event for port %u duplicated in" 1274 1266 "Extended Capabilities, ignoring.\n", 1275 1267 port_id); 1268 + bogus_port_status = true; 1276 1269 goto cleanup; 1277 1270 } 1278 1271 ··· 1345 1334 cleanup: 1346 1335 /* Update event ring dequeue pointer before dropping the lock */ 1347 1336 inc_deq(xhci, xhci->event_ring, true); 1337 + 1338 + /* Don't make the USB core poll the roothub if we got a bad port status 1339 + * change event. Besides, at that point we can't tell which roothub 1340 + * (USB 2.0 or USB 3.0) to kick. 1341 + */ 1342 + if (bogus_port_status) 1343 + return; 1348 1344 1349 1345 spin_unlock(&xhci->lock); 1350 1346 /* Pass this up to the core */ ··· 1572 1554 1573 1555 urb_priv->td_cnt++; 1574 1556 /* Giveback the urb when all the tds are completed */ 1575 - if (urb_priv->td_cnt == urb_priv->length) 1557 + if (urb_priv->td_cnt == urb_priv->length) { 1576 1558 ret = 1; 1559 + if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { 1560 + xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; 1561 + if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs 1562 + == 0) { 1563 + if (xhci->quirks & XHCI_AMD_PLL_FIX) 1564 + usb_amd_quirk_pll_enable(); 1565 + } 1566 + } 1567 + } 1577 1568 } 1578 1569 1579 1570 return ret; ··· 1702 1675 struct urb_priv *urb_priv; 1703 1676 int idx; 1704 1677 int len = 0; 1705 - int skip_td = 0; 1706 1678 union xhci_trb *cur_trb; 1707 1679 struct xhci_segment *cur_seg; 1680 + struct usb_iso_packet_descriptor *frame; 1708 1681 u32 trb_comp_code; 1682 + bool skip_td = false; 1709 1683 1710 1684 ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); 1711 1685 trb_comp_code = GET_COMP_CODE(event->transfer_len); 1712 1686 urb_priv = td->urb->hcpriv; 1713 1687 idx = urb_priv->td_cnt; 1688 + frame = &td->urb->iso_frame_desc[idx]; 1714 1689 1715 - if (ep->skip) { 1716 - /* The transfer is partly done */ 1717 - *status = -EXDEV; 1718 - td->urb->iso_frame_desc[idx].status = -EXDEV; 1719 - } else { 1720 - /* handle completion code */ 1721 - switch (trb_comp_code) { 1722 - case COMP_SUCCESS: 1723 - td->urb->iso_frame_desc[idx].status = 0; 1724 - xhci_dbg(xhci, "Successful isoc transfer!\n"); 1725 - break; 1726 - case COMP_SHORT_TX: 1727 - if (td->urb->transfer_flags & URB_SHORT_NOT_OK) 1728 - td->urb->iso_frame_desc[idx].status = 1729 - -EREMOTEIO; 1730 - else 1731 - td->urb->iso_frame_desc[idx].status = 0; 1732 - break; 1733 - case COMP_BW_OVER: 1734 - td->urb->iso_frame_desc[idx].status = -ECOMM; 1735 - skip_td = 1; 1736 - break; 1737 - case COMP_BUFF_OVER: 1738 - case COMP_BABBLE: 1739 - td->urb->iso_frame_desc[idx].status = -EOVERFLOW; 1740 - skip_td = 1; 1741 - break; 1742 - case COMP_STALL: 1743 - td->urb->iso_frame_desc[idx].status = -EPROTO; 1744 - skip_td = 1; 1745 - break; 1746 - case COMP_STOP: 1747 - case COMP_STOP_INVAL: 1748 - break; 1749 - default: 1750 - td->urb->iso_frame_desc[idx].status = -1; 1751 - break; 1752 - } 1690 + /* handle completion code */ 1691 + switch (trb_comp_code) { 1692 + case COMP_SUCCESS: 1693 + frame->status = 0; 1694 + xhci_dbg(xhci, "Successful isoc transfer!\n"); 1695 + break; 1696 + case COMP_SHORT_TX: 1697 + frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ? 1698 + -EREMOTEIO : 0; 1699 + break; 1700 + case COMP_BW_OVER: 1701 + frame->status = -ECOMM; 1702 + skip_td = true; 1703 + break; 1704 + case COMP_BUFF_OVER: 1705 + case COMP_BABBLE: 1706 + frame->status = -EOVERFLOW; 1707 + skip_td = true; 1708 + break; 1709 + case COMP_STALL: 1710 + frame->status = -EPROTO; 1711 + skip_td = true; 1712 + break; 1713 + case COMP_STOP: 1714 + case COMP_STOP_INVAL: 1715 + break; 1716 + default: 1717 + frame->status = -1; 1718 + break; 1753 1719 } 1754 1720 1755 - /* calc actual length */ 1756 - if (ep->skip) { 1757 - td->urb->iso_frame_desc[idx].actual_length = 0; 1758 - /* Update ring dequeue pointer */ 1759 - while (ep_ring->dequeue != td->last_trb) 1760 - inc_deq(xhci, ep_ring, false); 1761 - inc_deq(xhci, ep_ring, false); 1762 - return finish_td(xhci, td, event_trb, event, ep, status, true); 1763 - } 1764 - 1765 - if (trb_comp_code == COMP_SUCCESS || skip_td == 1) { 1766 - td->urb->iso_frame_desc[idx].actual_length = 1767 - td->urb->iso_frame_desc[idx].length; 1768 - td->urb->actual_length += 1769 - td->urb->iso_frame_desc[idx].length; 1721 + if (trb_comp_code == COMP_SUCCESS || skip_td) { 1722 + frame->actual_length = frame->length; 1723 + td->urb->actual_length += frame->length; 1770 1724 } else { 1771 1725 for (cur_trb = ep_ring->dequeue, 1772 1726 cur_seg = ep_ring->deq_seg; cur_trb != event_trb; ··· 1763 1755 TRB_LEN(event->transfer_len); 1764 1756 1765 1757 if (trb_comp_code != COMP_STOP_INVAL) { 1766 - td->urb->iso_frame_desc[idx].actual_length = len; 1758 + frame->actual_length = len; 1767 1759 td->urb->actual_length += len; 1768 1760 } 1769 1761 } ··· 1772 1764 *status = 0; 1773 1765 1774 1766 return finish_td(xhci, td, event_trb, event, ep, status, false); 1767 + } 1768 + 1769 + static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, 1770 + struct xhci_transfer_event *event, 1771 + struct xhci_virt_ep *ep, int *status) 1772 + { 1773 + struct xhci_ring *ep_ring; 1774 + struct urb_priv *urb_priv; 1775 + struct usb_iso_packet_descriptor *frame; 1776 + int idx; 1777 + 1778 + ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); 1779 + urb_priv = td->urb->hcpriv; 1780 + idx = urb_priv->td_cnt; 1781 + frame = &td->urb->iso_frame_desc[idx]; 1782 + 1783 + /* The transfer is partly done */ 1784 + *status = -EXDEV; 1785 + frame->status = -EXDEV; 1786 + 1787 + /* calc actual length */ 1788 + frame->actual_length = 0; 1789 + 1790 + /* Update ring dequeue pointer */ 1791 + while (ep_ring->dequeue != td->last_trb) 1792 + inc_deq(xhci, ep_ring, false); 1793 + inc_deq(xhci, ep_ring, false); 1794 + 1795 + return finish_td(xhci, td, NULL, event, ep, status, true); 1775 1796 } 1776 1797 1777 1798 /* ··· 2061 2024 } 2062 2025 2063 2026 td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); 2027 + 2064 2028 /* Is this a TRB in the currently executing TD? */ 2065 2029 event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, 2066 2030 td->last_trb, event_dma); 2067 - if (event_seg && ep->skip) { 2031 + if (!event_seg) { 2032 + if (!ep->skip || 2033 + !usb_endpoint_xfer_isoc(&td->urb->ep->desc)) { 2034 + /* HC is busted, give up! */ 2035 + xhci_err(xhci, 2036 + "ERROR Transfer event TRB DMA ptr not " 2037 + "part of current TD\n"); 2038 + return -ESHUTDOWN; 2039 + } 2040 + 2041 + ret = skip_isoc_td(xhci, td, event, ep, &status); 2042 + goto cleanup; 2043 + } 2044 + 2045 + if (ep->skip) { 2068 2046 xhci_dbg(xhci, "Found td. Clear skip flag.\n"); 2069 2047 ep->skip = false; 2070 2048 } 2071 - if (!event_seg && 2072 - (!ep->skip || !usb_endpoint_xfer_isoc(&td->urb->ep->desc))) { 2073 - /* HC is busted, give up! */ 2074 - xhci_err(xhci, "ERROR Transfer event TRB DMA ptr not " 2075 - "part of current TD\n"); 2076 - return -ESHUTDOWN; 2077 - } 2078 2049 2079 - if (event_seg) { 2080 - event_trb = &event_seg->trbs[(event_dma - 2081 - event_seg->dma) / sizeof(*event_trb)]; 2082 - /* 2083 - * No-op TRB should not trigger interrupts. 2084 - * If event_trb is a no-op TRB, it means the 2085 - * corresponding TD has been cancelled. Just ignore 2086 - * the TD. 2087 - */ 2088 - if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) 2089 - == TRB_TYPE(TRB_TR_NOOP)) { 2090 - xhci_dbg(xhci, "event_trb is a no-op TRB. " 2091 - "Skip it\n"); 2092 - goto cleanup; 2093 - } 2050 + event_trb = &event_seg->trbs[(event_dma - event_seg->dma) / 2051 + sizeof(*event_trb)]; 2052 + /* 2053 + * No-op TRB should not trigger interrupts. 2054 + * If event_trb is a no-op TRB, it means the 2055 + * corresponding TD has been cancelled. Just ignore 2056 + * the TD. 2057 + */ 2058 + if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) 2059 + == TRB_TYPE(TRB_TR_NOOP)) { 2060 + xhci_dbg(xhci, 2061 + "event_trb is a no-op TRB. Skip it\n"); 2062 + goto cleanup; 2094 2063 } 2095 2064 2096 2065 /* Now update the urb's actual_length and give back to ··· 3168 3125 return -EINVAL; 3169 3126 } 3170 3127 } 3128 + 3129 + if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) { 3130 + if (xhci->quirks & XHCI_AMD_PLL_FIX) 3131 + usb_amd_quirk_pll_disable(); 3132 + } 3133 + xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs++; 3171 3134 3172 3135 giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, 3173 3136 start_cycle, start_trb);
+18 -5
drivers/usb/host/xhci.c
··· 550 550 del_timer_sync(&xhci->event_ring_timer); 551 551 #endif 552 552 553 + if (xhci->quirks & XHCI_AMD_PLL_FIX) 554 + usb_amd_dev_put(); 555 + 553 556 xhci_dbg(xhci, "// Disabling event ring interrupts\n"); 554 557 temp = xhci_readl(xhci, &xhci->op_regs->status); 555 558 xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); ··· 774 771 775 772 /* If restore operation fails, re-initialize the HC during resume */ 776 773 if ((temp & STS_SRE) || hibernated) { 777 - usb_root_hub_lost_power(hcd->self.root_hub); 774 + /* Let the USB core know _both_ roothubs lost power. */ 775 + usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); 776 + usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); 778 777 779 778 xhci_dbg(xhci, "Stop HCD\n"); 780 779 xhci_halt(xhci); ··· 2391 2386 /* Everything but endpoint 0 is disabled, so free or cache the rings. */ 2392 2387 last_freed_endpoint = 1; 2393 2388 for (i = 1; i < 31; ++i) { 2394 - if (!virt_dev->eps[i].ring) 2395 - continue; 2396 - xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); 2397 - last_freed_endpoint = i; 2389 + struct xhci_virt_ep *ep = &virt_dev->eps[i]; 2390 + 2391 + if (ep->ep_state & EP_HAS_STREAMS) { 2392 + xhci_free_stream_info(xhci, ep->stream_info); 2393 + ep->stream_info = NULL; 2394 + ep->ep_state &= ~EP_HAS_STREAMS; 2395 + } 2396 + 2397 + if (ep->ring) { 2398 + xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); 2399 + last_freed_endpoint = i; 2400 + } 2398 2401 } 2399 2402 xhci_dbg(xhci, "Output context after successful reset device cmd:\n"); 2400 2403 xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint);
+8 -3
drivers/usb/host/xhci.h
··· 30 30 31 31 /* Code sharing between pci-quirks and xhci hcd */ 32 32 #include "xhci-ext-caps.h" 33 + #include "pci-quirks.h" 33 34 34 35 /* xHCI PCI Configuration Registers */ 35 36 #define XHCI_SBRN_OFFSET (0x60) ··· 233 232 * notification type that matches a bit set in this bit field. 234 233 */ 235 234 #define DEV_NOTE_MASK (0xffff) 236 - #define ENABLE_DEV_NOTE(x) (1 << x) 235 + #define ENABLE_DEV_NOTE(x) (1 << (x)) 237 236 /* Most of the device notification types should only be used for debug. 238 237 * SW does need to pay attention to function wake notifications. 239 238 */ ··· 348 347 #define PORT_DEV_REMOVE (1 << 30) 349 348 /* Initiate a warm port reset - complete when PORT_WRC is '1' */ 350 349 #define PORT_WR (1 << 31) 350 + 351 + /* We mark duplicate entries with -1 */ 352 + #define DUPLICATE_ENTRY ((u8)(-1)) 351 353 352 354 /* Port Power Management Status and Control - port_power_base bitmasks */ 353 355 /* Inactivity timer value for transitions into U1, in microseconds. ··· 605 601 #define EP_STATE_STOPPED 3 606 602 #define EP_STATE_ERROR 4 607 603 /* Mult - Max number of burtst within an interval, in EP companion desc. */ 608 - #define EP_MULT(p) ((p & 0x3) << 8) 604 + #define EP_MULT(p) (((p) & 0x3) << 8) 609 605 /* bits 10:14 are Max Primary Streams */ 610 606 /* bit 15 is Linear Stream Array */ 611 607 /* Interval - period between requests to an endpoint - 125u increments. */ 612 - #define EP_INTERVAL(p) ((p & 0xff) << 16) 608 + #define EP_INTERVAL(p) (((p) & 0xff) << 16) 613 609 #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) 614 610 #define EP_MAXPSTREAMS_MASK (0x1f << 10) 615 611 #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) ··· 1280 1276 #define XHCI_LINK_TRB_QUIRK (1 << 0) 1281 1277 #define XHCI_RESET_EP_QUIRK (1 << 1) 1282 1278 #define XHCI_NEC_HOST (1 << 2) 1279 + #define XHCI_AMD_PLL_FIX (1 << 3) 1283 1280 /* There are two roothubs to keep track of bus suspend info for */ 1284 1281 struct xhci_bus_state bus_state[2]; 1285 1282 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
+3 -3
drivers/usb/musb/Kconfig
··· 14 14 select TWL4030_USB if MACH_OMAP_3430SDP 15 15 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 16 16 select USB_OTG_UTILS 17 - tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 17 + bool 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 18 18 help 19 19 Say Y here if your system has a dual role high speed USB 20 20 controller based on the Mentor Graphics silicon IP. Then ··· 30 30 31 31 If you do not know what this is, please say N. 32 32 33 - To compile this driver as a module, choose M here; the 34 - module will be called "musb-hdrc". 33 + # To compile this driver as a module, choose M here; the 34 + # module will be called "musb-hdrc". 35 35 36 36 choice 37 37 prompt "Platform Glue Layer"
+24
drivers/usb/musb/blackfin.c
··· 21 21 #include <asm/cacheflush.h> 22 22 23 23 #include "musb_core.h" 24 + #include "musbhsdma.h" 24 25 #include "blackfin.h" 25 26 26 27 struct bfin_glue { ··· 333 332 return -EIO; 334 333 } 335 334 335 + static int bfin_musb_adjust_channel_params(struct dma_channel *channel, 336 + u16 packet_sz, u8 *mode, 337 + dma_addr_t *dma_addr, u32 *len) 338 + { 339 + struct musb_dma_channel *musb_channel = channel->private_data; 340 + 341 + /* 342 + * Anomaly 05000450 might cause data corruption when using DMA 343 + * MODE 1 transmits with short packet. So to work around this, 344 + * we truncate all MODE 1 transfers down to a multiple of the 345 + * max packet size, and then do the last short packet transfer 346 + * (if there is any) using MODE 0. 347 + */ 348 + if (ANOMALY_05000450) { 349 + if (musb_channel->transmit && *mode == 1) 350 + *len = *len - (*len % packet_sz); 351 + } 352 + 353 + return 0; 354 + } 355 + 336 356 static void bfin_musb_reg_init(struct musb *musb) 337 357 { 338 358 if (ANOMALY_05000346) { ··· 452 430 453 431 .vbus_status = bfin_musb_vbus_status, 454 432 .set_vbus = bfin_musb_set_vbus, 433 + 434 + .adjust_channel_params = bfin_musb_adjust_channel_params, 455 435 }; 456 436 457 437 static u64 bfin_dmamask = DMA_BIT_MASK(32);
+16 -11
drivers/usb/musb/cppi_dma.c
··· 597 597 length = min(n_bds * maxpacket, length); 598 598 } 599 599 600 - DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%x len %u\n", 600 + DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%llx len %u\n", 601 601 tx->index, 602 602 maxpacket, 603 603 rndis ? "rndis" : "transparent", 604 604 n_bds, 605 - addr, length); 605 + (unsigned long long)addr, length); 606 606 607 607 cppi_rndis_update(tx, 0, musb->ctrl_base, rndis); 608 608 ··· 820 820 length = min(n_bds * maxpacket, length); 821 821 822 822 DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) " 823 - "dma 0x%x len %u %u/%u\n", 823 + "dma 0x%llx len %u %u/%u\n", 824 824 rx->index, maxpacket, 825 825 onepacket 826 826 ? (is_rndis ? "rndis" : "onepacket") ··· 829 829 musb_readl(tibase, 830 830 DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4)) 831 831 & 0xffff, 832 - addr, length, rx->channel.actual_len, rx->buf_len); 832 + (unsigned long long)addr, length, 833 + rx->channel.actual_len, rx->buf_len); 833 834 834 835 /* only queue one segment at a time, since the hardware prevents 835 836 * correct queue shutdown after unexpected short packets ··· 1040 1039 if (!completed && (bd->hw_options & CPPI_OWN_SET)) 1041 1040 break; 1042 1041 1043 - DBG(5, "C/RXBD %08x: nxt %08x buf %08x " 1042 + DBG(5, "C/RXBD %llx: nxt %08x buf %08x " 1044 1043 "off.len %08x opt.len %08x (%d)\n", 1045 - bd->dma, bd->hw_next, bd->hw_bufp, 1044 + (unsigned long long)bd->dma, bd->hw_next, bd->hw_bufp, 1046 1045 bd->hw_off_len, bd->hw_options, 1047 1046 rx->channel.actual_len); 1048 1047 ··· 1112 1111 musb_ep_select(cppi->mregs, rx->index + 1); 1113 1112 csr = musb_readw(regs, MUSB_RXCSR); 1114 1113 if (csr & MUSB_RXCSR_DMAENAB) { 1115 - DBG(4, "list%d %p/%p, last %08x%s, csr %04x\n", 1114 + DBG(4, "list%d %p/%p, last %llx%s, csr %04x\n", 1116 1115 rx->index, 1117 1116 rx->head, rx->tail, 1118 1117 rx->last_processed 1119 - ? rx->last_processed->dma 1118 + ? (unsigned long long) 1119 + rx->last_processed->dma 1120 1120 : 0, 1121 1121 completed ? ", completed" : "", 1122 1122 csr); ··· 1169 1167 tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG); 1170 1168 rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG); 1171 1169 1172 - if (!tx && !rx) 1170 + if (!tx && !rx) { 1171 + if (cppi->irq) 1172 + spin_unlock_irqrestore(&musb->lock, flags); 1173 1173 return IRQ_NONE; 1174 + } 1174 1175 1175 1176 DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx); 1176 1177 ··· 1204 1199 */ 1205 1200 if (NULL == bd) { 1206 1201 DBG(1, "null BD\n"); 1207 - tx_ram->tx_complete = 0; 1202 + musb_writel(&tx_ram->tx_complete, 0, 0); 1208 1203 continue; 1209 1204 } 1210 1205 ··· 1457 1452 * compare mode by writing 1 to the tx_complete register. 1458 1453 */ 1459 1454 cppi_reset_tx(tx_ram, 1); 1460 - cppi_ch->head = 0; 1455 + cppi_ch->head = NULL; 1461 1456 musb_writel(&tx_ram->tx_complete, 0, 1); 1462 1457 cppi_dump_tx(5, cppi_ch, " (done teardown)"); 1463 1458
+2
drivers/usb/musb/musb_core.c
··· 1030 1030 struct musb *musb = dev_to_musb(&pdev->dev); 1031 1031 unsigned long flags; 1032 1032 1033 + pm_runtime_get_sync(musb->controller); 1033 1034 spin_lock_irqsave(&musb->lock, flags); 1034 1035 musb_platform_disable(musb); 1035 1036 musb_generic_disable(musb); ··· 1041 1040 musb_writeb(musb->mregs, MUSB_DEVCTL, 0); 1042 1041 musb_platform_exit(musb); 1043 1042 1043 + pm_runtime_put(musb->controller); 1044 1044 /* FIXME power down */ 1045 1045 } 1046 1046
+5
drivers/usb/musb/musb_core.h
··· 261 261 * @try_ilde: tries to idle the IP 262 262 * @vbus_status: returns vbus status if possible 263 263 * @set_vbus: forces vbus status 264 + * @channel_program: pre check for standard dma channel_program func 264 265 */ 265 266 struct musb_platform_ops { 266 267 int (*init)(struct musb *musb); ··· 275 274 276 275 int (*vbus_status)(struct musb *musb); 277 276 void (*set_vbus)(struct musb *musb, int on); 277 + 278 + int (*adjust_channel_params)(struct dma_channel *channel, 279 + u16 packet_sz, u8 *mode, 280 + dma_addr_t *dma_addr, u32 *len); 278 281 }; 279 282 280 283 /*
+2 -2
drivers/usb/musb/musb_gadget.c
··· 535 535 is_dma = 1; 536 536 csr |= MUSB_TXCSR_P_WZC_BITS; 537 537 csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | 538 - MUSB_TXCSR_TXPKTRDY); 538 + MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET); 539 539 musb_writew(epio, MUSB_TXCSR, csr); 540 540 /* Ensure writebuffer is empty. */ 541 541 csr = musb_readw(epio, MUSB_TXCSR); ··· 1296 1296 } 1297 1297 1298 1298 /* if the hardware doesn't have the request, easy ... */ 1299 - if (musb_ep->req_list.next != &request->list || musb_ep->busy) 1299 + if (musb_ep->req_list.next != &req->list || musb_ep->busy) 1300 1300 musb_g_giveback(musb_ep, request, -ECONNRESET); 1301 1301 1302 1302 /* ... else abort the dma transfer ... */
+8
drivers/usb/musb/musbhsdma.c
··· 169 169 BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || 170 170 channel->status == MUSB_DMA_STATUS_BUSY); 171 171 172 + /* Let targets check/tweak the arguments */ 173 + if (musb->ops->adjust_channel_params) { 174 + int ret = musb->ops->adjust_channel_params(channel, 175 + packet_sz, &mode, &dma_addr, &len); 176 + if (ret) 177 + return ret; 178 + } 179 + 172 180 /* 173 181 * The DMA engine in RTL1.8 and above cannot handle 174 182 * DMA addresses that are not aligned to a 4 byte boundary.
+2 -1
drivers/usb/musb/omap2430.c
··· 259 259 case USB_EVENT_VBUS: 260 260 DBG(4, "VBUS Connect\n"); 261 261 262 + #ifdef CONFIG_USB_GADGET_MUSB_HDRC 262 263 if (musb->gadget_driver) 263 264 pm_runtime_get_sync(musb->controller); 264 - 265 + #endif 265 266 otg_init(musb->xceiv); 266 267 break; 267 268
+2
drivers/usb/musb/ux500.c
··· 93 93 } 94 94 95 95 musb->dev.parent = &pdev->dev; 96 + musb->dev.dma_mask = pdev->dev.dma_mask; 97 + musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; 96 98 97 99 glue->dev = &pdev->dev; 98 100 glue->musb = musb;
+5
drivers/usb/serial/ftdi_sio.c
··· 151 151 * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! 152 152 */ 153 153 static struct usb_device_id id_table_combined [] = { 154 + { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, 155 + { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, 154 156 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, 155 157 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, 156 158 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, ··· 527 525 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, 528 526 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, 529 527 { USB_DEVICE(OCT_VID, OCT_US101_PID) }, 528 + { USB_DEVICE(OCT_VID, OCT_DK201_PID) }, 530 529 { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), 531 530 .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, 532 531 { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), ··· 790 787 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 791 788 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 792 789 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, 790 + { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, 791 + { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) }, 793 792 { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, 794 793 { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, 795 794 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
+12
drivers/usb/serial/ftdi_sio_ids.h
··· 300 300 * Hameg HO820 and HO870 interface (using VID 0x0403) 301 301 */ 302 302 #define HAMEG_HO820_PID 0xed74 303 + #define HAMEG_HO730_PID 0xed73 304 + #define HAMEG_HO720_PID 0xed72 303 305 #define HAMEG_HO870_PID 0xed71 304 306 305 307 /* ··· 574 572 /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ 575 573 /* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ 576 574 /* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ 575 + #define OCT_DK201_PID 0x0103 /* OCT DK201 USB docking station */ 577 576 #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ 578 577 579 578 /* ··· 1143 1140 */ 1144 1141 #define QIHARDWARE_VID 0x20B7 1145 1142 #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 1143 + 1144 + /* 1145 + * CTI GmbH RS485 Converter http://www.cti-lean.com/ 1146 + */ 1147 + /* USB-485-Mini*/ 1148 + #define FTDI_CTI_MINI_PID 0xF608 1149 + /* USB-Nano-485*/ 1150 + #define FTDI_CTI_NANO_PID 0xF60B 1151 + 1146 1152
+5
drivers/usb/serial/option.c
··· 407 407 /* ONDA MT825UP HSDPA 14.2 modem */ 408 408 #define ONDA_MT825UP 0x000b 409 409 410 + /* Samsung products */ 411 + #define SAMSUNG_VENDOR_ID 0x04e8 412 + #define SAMSUNG_PRODUCT_GT_B3730 0x6889 413 + 410 414 /* some devices interfaces need special handling due to a number of reasons */ 411 415 enum option_blacklist_reason { 412 416 OPTION_BLACKLIST_NONE = 0, ··· 972 968 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, 973 969 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ 974 970 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ 971 + { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730/GT-B3710 LTE USB modem.*/ 975 972 { } /* Terminating entry */ 976 973 }; 977 974 MODULE_DEVICE_TABLE(usb, option_ids);
+24 -7
drivers/usb/serial/qcserial.c
··· 111 111 ifnum = intf->desc.bInterfaceNumber; 112 112 dbg("This Interface = %d", ifnum); 113 113 114 - data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), 114 + data = kzalloc(sizeof(struct usb_wwan_intf_private), 115 115 GFP_KERNEL); 116 116 if (!data) 117 117 return -ENOMEM; ··· 134 134 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { 135 135 dbg("QDL port found"); 136 136 137 - if (serial->interface->num_altsetting == 1) 138 - return 0; 137 + if (serial->interface->num_altsetting == 1) { 138 + retval = 0; /* Success */ 139 + break; 140 + } 139 141 140 142 retval = usb_set_interface(serial->dev, ifnum, 1); 141 143 if (retval < 0) { ··· 147 145 retval = -ENODEV; 148 146 kfree(data); 149 147 } 150 - return retval; 151 148 } 152 149 break; 153 150 ··· 167 166 "Could not set interface, error %d\n", 168 167 retval); 169 168 retval = -ENODEV; 169 + kfree(data); 170 170 } 171 171 } else if (ifnum == 2) { 172 172 dbg("Modem port found"); ··· 179 177 retval = -ENODEV; 180 178 kfree(data); 181 179 } 182 - return retval; 183 180 } else if (ifnum==3) { 184 181 /* 185 182 * NMEA (serial line 9600 8N1) ··· 192 191 "Could not set interface, error %d\n", 193 192 retval); 194 193 retval = -ENODEV; 194 + kfree(data); 195 195 } 196 196 } 197 197 break; ··· 201 199 dev_err(&serial->dev->dev, 202 200 "unknown number of interfaces: %d\n", nintf); 203 201 kfree(data); 204 - return -ENODEV; 202 + retval = -ENODEV; 205 203 } 206 204 205 + /* Set serial->private if not returning -ENODEV */ 206 + if (retval != -ENODEV) 207 + usb_set_serial_data(serial, data); 207 208 return retval; 209 + } 210 + 211 + static void qc_release(struct usb_serial *serial) 212 + { 213 + struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); 214 + 215 + dbg("%s", __func__); 216 + 217 + /* Call usb_wwan release & free the private data allocated in qcprobe */ 218 + usb_wwan_release(serial); 219 + usb_set_serial_data(serial, NULL); 220 + kfree(priv); 208 221 } 209 222 210 223 static struct usb_serial_driver qcdevice = { ··· 239 222 .chars_in_buffer = usb_wwan_chars_in_buffer, 240 223 .attach = usb_wwan_startup, 241 224 .disconnect = usb_wwan_disconnect, 242 - .release = usb_wwan_release, 225 + .release = qc_release, 243 226 #ifdef CONFIG_PM 244 227 .suspend = usb_wwan_suspend, 245 228 .resume = usb_wwan_resume,