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 tag 'usb-5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are some small fixes for 5.3-rc2. All of these resolve some
reported issues, some more than others :)

Included in here is:

- xhci fix for an annoying issue with odd devices

- reversion of some usb251xb patches that should not have been merged

- usb pci quirk additions and fixups

- usb storage fix

- usb host controller error test fix

All of these have been in linux-next with no reported issues"

* tag 'usb-5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
xhci: Fix crash if scatter gather is used with Immediate Data Transfer (IDT).
usb: usb251xb: Reallow swap-dx-lanes to apply to the upstream port
Revert "usb: usb251xb: Add US port lanes inversion property"
Revert "usb: usb251xb: Add US lanes inversion dts-bindings"
usb: wusbcore: fix unbalanced get/put cluster_id
usb/hcd: Fix a NULL vs IS_ERR() bug in usb_hcd_setup_local_mem()
usb-storage: Add a limitation for blk_queue_max_hw_sectors()
usb: pci-quirks: Minor cleanup for AMD PLL quirk
usb: pci-quirks: Correct AMD PLL quirk detection

+57 -39
+2 -4
Documentation/devicetree/bindings/usb/usb251xb.txt
··· 64 64 - power-on-time-ms : Specifies the time it takes from the time the host 65 65 initiates the power-on sequence to a port until the port has adequate 66 66 power. The value is given in ms in a 0 - 510 range (default is 100ms). 67 - - swap-dx-lanes : Specifies the downstream ports which will swap the 68 - differential-pair (D+/D-), default is not-swapped. 69 - - swap-us-lanes : Selects the upstream port differential-pair (D+/D-) 70 - swapping (boolean, default is not-swapped) 67 + - swap-dx-lanes : Specifies the ports which will swap the differential-pair 68 + (D+/D-), default is not-swapped. 71 69 72 70 Examples: 73 71 usb2512b@2c {
+2 -2
drivers/usb/core/hcd.c
··· 3052 3052 3053 3053 local_mem = devm_memremap(hcd->self.sysdev, phys_addr, 3054 3054 size, MEMREMAP_WC); 3055 - if (!local_mem) 3056 - return -ENOMEM; 3055 + if (IS_ERR(local_mem)) 3056 + return PTR_ERR(local_mem); 3057 3057 3058 3058 /* 3059 3059 * Here we pass a dma_addr_t but the arg type is a phys_addr_t.
+2 -2
drivers/usb/host/ehci-pci.c
··· 149 149 break; 150 150 case PCI_VENDOR_ID_AMD: 151 151 /* AMD PLL quirk */ 152 - if (usb_amd_find_chipset_info()) 152 + if (usb_amd_quirk_pll_check()) 153 153 ehci->amd_pll_fix = 1; 154 154 /* AMD8111 EHCI doesn't work, according to AMD errata */ 155 155 if (pdev->device == 0x7463) { ··· 186 186 break; 187 187 case PCI_VENDOR_ID_ATI: 188 188 /* AMD PLL quirk */ 189 - if (usb_amd_find_chipset_info()) 189 + if (usb_amd_quirk_pll_check()) 190 190 ehci->amd_pll_fix = 1; 191 191 192 192 /*
+1 -1
drivers/usb/host/hwa-hc.c
··· 159 159 return result; 160 160 161 161 error_set_cluster_id: 162 - wusb_cluster_id_put(wusbhc->cluster_id); 162 + wusb_cluster_id_put(addr); 163 163 error_cluster_id_get: 164 164 goto out; 165 165
+1 -1
drivers/usb/host/ohci-pci.c
··· 152 152 { 153 153 struct ohci_hcd *ohci = hcd_to_ohci(hcd); 154 154 155 - if (usb_amd_find_chipset_info()) 155 + if (usb_amd_quirk_pll_check()) 156 156 ohci->flags |= OHCI_QUIRK_AMD_PLL; 157 157 158 158 /* SB800 needs pre-fetch fix */
+27 -18
drivers/usb/host/pci-quirks.c
··· 132 132 struct amd_chipset_type sb_type; 133 133 int isoc_reqs; 134 134 int probe_count; 135 - int probe_result; 135 + bool need_pll_quirk; 136 136 } amd_chipset; 137 137 138 138 static DEFINE_SPINLOCK(amd_lock); ··· 201 201 } 202 202 EXPORT_SYMBOL_GPL(sb800_prefetch); 203 203 204 - int usb_amd_find_chipset_info(void) 204 + static void usb_amd_find_chipset_info(void) 205 205 { 206 206 unsigned long flags; 207 207 struct amd_chipset_info info; 208 - int ret; 208 + info.need_pll_quirk = 0; 209 209 210 210 spin_lock_irqsave(&amd_lock, flags); 211 211 ··· 213 213 if (amd_chipset.probe_count > 0) { 214 214 amd_chipset.probe_count++; 215 215 spin_unlock_irqrestore(&amd_lock, flags); 216 - return amd_chipset.probe_result; 216 + return; 217 217 } 218 218 memset(&info, 0, sizeof(info)); 219 219 spin_unlock_irqrestore(&amd_lock, flags); 220 220 221 221 if (!amd_chipset_sb_type_init(&info)) { 222 - ret = 0; 223 222 goto commit; 224 223 } 225 224 226 - /* Below chipset generations needn't enable AMD PLL quirk */ 227 - if (info.sb_type.gen == AMD_CHIPSET_UNKNOWN || 228 - info.sb_type.gen == AMD_CHIPSET_SB600 || 229 - info.sb_type.gen == AMD_CHIPSET_YANGTZE || 230 - (info.sb_type.gen == AMD_CHIPSET_SB700 && 231 - info.sb_type.rev > 0x3b)) { 225 + switch (info.sb_type.gen) { 226 + case AMD_CHIPSET_SB700: 227 + info.need_pll_quirk = info.sb_type.rev <= 0x3B; 228 + break; 229 + case AMD_CHIPSET_SB800: 230 + case AMD_CHIPSET_HUDSON2: 231 + case AMD_CHIPSET_BOLTON: 232 + info.need_pll_quirk = 1; 233 + break; 234 + default: 235 + info.need_pll_quirk = 0; 236 + break; 237 + } 238 + 239 + if (!info.need_pll_quirk) { 232 240 if (info.smbus_dev) { 233 241 pci_dev_put(info.smbus_dev); 234 242 info.smbus_dev = NULL; 235 243 } 236 - ret = 0; 237 244 goto commit; 238 245 } 239 246 ··· 259 252 } 260 253 } 261 254 262 - ret = info.probe_result = 1; 263 255 printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); 264 256 265 257 commit: ··· 269 263 270 264 /* Mark that we where here */ 271 265 amd_chipset.probe_count++; 272 - ret = amd_chipset.probe_result; 273 266 274 267 spin_unlock_irqrestore(&amd_lock, flags); 275 268 ··· 281 276 amd_chipset = info; 282 277 spin_unlock_irqrestore(&amd_lock, flags); 283 278 } 284 - 285 - return ret; 286 279 } 287 - EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); 288 280 289 281 int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev) 290 282 { ··· 316 314 return amd_chipset.sb_type.gen == AMD_CHIPSET_SB800; 317 315 } 318 316 EXPORT_SYMBOL_GPL(usb_amd_prefetch_quirk); 317 + 318 + bool usb_amd_quirk_pll_check(void) 319 + { 320 + usb_amd_find_chipset_info(); 321 + return amd_chipset.need_pll_quirk; 322 + } 323 + EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_check); 319 324 320 325 /* 321 326 * The hardware normally enables the A-link power management feature, which ··· 529 520 amd_chipset.nb_type = 0; 530 521 memset(&amd_chipset.sb_type, 0, sizeof(amd_chipset.sb_type)); 531 522 amd_chipset.isoc_reqs = 0; 532 - amd_chipset.probe_result = 0; 523 + amd_chipset.need_pll_quirk = 0; 533 524 534 525 spin_unlock_irqrestore(&amd_lock, flags); 535 526
+1 -1
drivers/usb/host/pci-quirks.h
··· 5 5 #ifdef CONFIG_USB_PCI 6 6 void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); 7 7 int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); 8 - int usb_amd_find_chipset_info(void); 9 8 int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); 10 9 bool usb_amd_hang_symptom_quirk(void); 11 10 bool usb_amd_prefetch_quirk(void); 12 11 void usb_amd_dev_put(void); 12 + bool usb_amd_quirk_pll_check(void); 13 13 void usb_amd_quirk_pll_disable(void); 14 14 void usb_amd_quirk_pll_enable(void); 15 15 void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
+1 -1
drivers/usb/host/xhci-pci.c
··· 130 130 xhci->quirks |= XHCI_AMD_0x96_HOST; 131 131 132 132 /* AMD PLL quirk */ 133 - if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) 133 + if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_quirk_pll_check()) 134 134 xhci->quirks |= XHCI_AMD_PLL_FIX; 135 135 136 136 if (pdev->vendor == PCI_VENDOR_ID_AMD &&
+2 -1
drivers/usb/host/xhci.h
··· 2175 2175 if (!usb_endpoint_xfer_isoc(&urb->ep->desc) && usb_urb_dir_out(urb) && 2176 2176 usb_endpoint_maxp(&urb->ep->desc) >= TRB_IDT_MAX_SIZE && 2177 2177 urb->transfer_buffer_length <= TRB_IDT_MAX_SIZE && 2178 - !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) 2178 + !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) && 2179 + !urb->num_sgs) 2179 2180 return true; 2180 2181 2181 2182 return false;
+7 -8
drivers/usb/misc/usb251xb.c
··· 375 375 376 376 #ifdef CONFIG_OF 377 377 static void usb251xb_get_ports_field(struct usb251xb *hub, 378 - const char *prop_name, u8 port_cnt, u8 *fld) 378 + const char *prop_name, u8 port_cnt, 379 + bool ds_only, u8 *fld) 379 380 { 380 381 struct device *dev = hub->dev; 381 382 struct property *prop; ··· 384 383 u32 port; 385 384 386 385 of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) { 387 - if ((port >= 1) && (port <= port_cnt)) 386 + if ((port >= ds_only ? 1 : 0) && (port <= port_cnt)) 388 387 *fld |= BIT(port); 389 388 else 390 389 dev_warn(dev, "port %u doesn't exist\n", port); ··· 502 501 503 502 hub->non_rem_dev = USB251XB_DEF_NON_REMOVABLE_DEVICES; 504 503 usb251xb_get_ports_field(hub, "non-removable-ports", data->port_cnt, 505 - &hub->non_rem_dev); 504 + true, &hub->non_rem_dev); 506 505 507 506 hub->port_disable_sp = USB251XB_DEF_PORT_DISABLE_SELF; 508 507 usb251xb_get_ports_field(hub, "sp-disabled-ports", data->port_cnt, 509 - &hub->port_disable_sp); 508 + true, &hub->port_disable_sp); 510 509 511 510 hub->port_disable_bp = USB251XB_DEF_PORT_DISABLE_BUS; 512 511 usb251xb_get_ports_field(hub, "bp-disabled-ports", data->port_cnt, 513 - &hub->port_disable_bp); 512 + true, &hub->port_disable_bp); 514 513 515 514 hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF; 516 515 if (!of_property_read_u32(np, "sp-max-total-current-microamp", ··· 574 573 */ 575 574 hub->port_swap = USB251XB_DEF_PORT_SWAP; 576 575 usb251xb_get_ports_field(hub, "swap-dx-lanes", data->port_cnt, 577 - &hub->port_swap); 578 - if (of_get_property(np, "swap-us-lanes", NULL)) 579 - hub->port_swap |= BIT(0); 576 + false, &hub->port_swap); 580 577 581 578 /* The following parameters are currently not exposed to devicetree, but 582 579 * may be as soon as needed.
+11
drivers/usb/storage/scsiglue.c
··· 28 28 * status of a command. 29 29 */ 30 30 31 + #include <linux/blkdev.h> 32 + #include <linux/dma-mapping.h> 31 33 #include <linux/module.h> 32 34 #include <linux/mutex.h> 33 35 ··· 101 99 static int slave_configure(struct scsi_device *sdev) 102 100 { 103 101 struct us_data *us = host_to_us(sdev->host); 102 + struct device *dev = us->pusb_dev->bus->sysdev; 104 103 105 104 /* 106 105 * Many devices have trouble transferring more than 32KB at a time, ··· 130 127 */ 131 128 blk_queue_max_hw_sectors(sdev->request_queue, 2048); 132 129 } 130 + 131 + /* 132 + * The max_hw_sectors should be up to maximum size of a mapping for 133 + * the device. Otherwise, a DMA API might fail on swiotlb environment. 134 + */ 135 + blk_queue_max_hw_sectors(sdev->request_queue, 136 + min_t(size_t, queue_max_hw_sectors(sdev->request_queue), 137 + dma_max_mapping_size(dev) >> SECTOR_SHIFT)); 133 138 134 139 /* 135 140 * Some USB host controllers can't do DMA; they have to use PIO.