Skip to content

Commit ca03339

Browse files
committed
Merge tag 'usb-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here is a bunch of USB fixes for 3.14-rc3. Most of these are xhci reverts, fixing a bunch of reported issues with USB 3 host controller issues that loads of people have been hitting (with the exception of kernel developers, all of our machines seem to be working fine, which is why these took so long to get resolved...) There are some other minor fixes and new device ids, as ususal. All have been in linux-next successfully" * tag 'usb-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits) usb: option: blacklist ZTE MF667 net interface Revert "usb: xhci: Link TRB must not occur within a USB payload burst" Revert "xhci: Avoid infinite loop when sg urb requires too many trbs" Revert "xhci: Set scatter-gather limit to avoid failed block writes." xhci 1.0: Limit arbitrarily-aligned scatter gather. Modpost: fixed USB alias generation for ranges including 0x9 and 0xA usb: core: Fix potential memory leak adding dyn USBdevice IDs USB: ftdi_sio: add Tagsys RFID Reader IDs usb: qcserial: add Netgear Aircard 340U usb-storage: enable multi-LUN scanning when needed USB: simple: add Dynastream ANT USB-m Stick device support usb-storage: add unusual-devs entry for BlackBerry 9000 usb-storage: restrict bcdDevice range for Super Top in Cypress ATACB usb: phy: move some error messages to debug usb: ftdi_sio: add Mindstorms EV3 console adapter usb: dwc2: fix memory corruption in dwc2 driver usb: dwc2: fix role switch breakage usb: dwc2: bail out early when booting with "nousb" Revert "xhci: replace xhci_read_64() with readq()" Revert "xhci: replace xhci_write_64() with writeq()" ...
2 parents 40a215f + 3635c7e commit ca03339

25 files changed

Lines changed: 138 additions & 135 deletions

drivers/usb/core/driver.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
6363
dynid->id.idProduct = idProduct;
6464
dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE;
6565
if (fields > 2 && bInterfaceClass) {
66-
if (bInterfaceClass > 255)
67-
return -EINVAL;
66+
if (bInterfaceClass > 255) {
67+
retval = -EINVAL;
68+
goto fail;
69+
}
6870

6971
dynid->id.bInterfaceClass = (u8)bInterfaceClass;
7072
dynid->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS;
@@ -73,17 +75,21 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
7375
if (fields > 4) {
7476
const struct usb_device_id *id = id_table;
7577

76-
if (!id)
77-
return -ENODEV;
78+
if (!id) {
79+
retval = -ENODEV;
80+
goto fail;
81+
}
7882

7983
for (; id->match_flags; id++)
8084
if (id->idVendor == refVendor && id->idProduct == refProduct)
8185
break;
8286

83-
if (id->match_flags)
87+
if (id->match_flags) {
8488
dynid->id.driver_info = id->driver_info;
85-
else
86-
return -ENODEV;
89+
} else {
90+
retval = -ENODEV;
91+
goto fail;
92+
}
8793
}
8894

8995
spin_lock(&dynids->lock);
@@ -95,6 +101,10 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
95101
if (retval)
96102
return retval;
97103
return count;
104+
105+
fail:
106+
kfree(dynid);
107+
return retval;
98108
}
99109
EXPORT_SYMBOL_GPL(usb_store_new_id);
100110

drivers/usb/core/hcd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,6 @@ static int register_root_hub(struct usb_hcd *hcd)
10321032
dev_name(&usb_dev->dev), retval);
10331033
return retval;
10341034
}
1035-
usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev);
10361035
}
10371036

10381037
retval = usb_new_device (usb_dev);

drivers/usb/core/hub.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev)
128128
return usb_get_intfdata(hdev->actconfig->interface[0]);
129129
}
130130

131-
int usb_device_supports_lpm(struct usb_device *udev)
131+
static int usb_device_supports_lpm(struct usb_device *udev)
132132
{
133133
/* USB 2.1 (and greater) devices indicate LPM support through
134134
* their USB 2.0 Extended Capabilities BOS descriptor.
@@ -149,11 +149,6 @@ int usb_device_supports_lpm(struct usb_device *udev)
149149
"Power management will be impacted.\n");
150150
return 0;
151151
}
152-
153-
/* udev is root hub */
154-
if (!udev->parent)
155-
return 1;
156-
157152
if (udev->parent->lpm_capable)
158153
return 1;
159154

drivers/usb/core/usb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ extern int usb_get_device_descriptor(struct usb_device *dev,
3535
unsigned int size);
3636
extern int usb_get_bos_descriptor(struct usb_device *dev);
3737
extern void usb_release_bos_descriptor(struct usb_device *dev);
38-
extern int usb_device_supports_lpm(struct usb_device *udev);
3938
extern char *usb_cache_string(struct usb_device *udev, int index);
4039
extern int usb_set_configuration(struct usb_device *dev, int configuration);
4140
extern int usb_choose_configuration(struct usb_device *udev);

drivers/usb/dwc2/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
216216
int retval = 0;
217217

218218
if (!select_phy)
219-
return -ENODEV;
219+
return 0;
220220

221221
usbcfg = readl(hsotg->regs + GUSBCFG);
222222

drivers/usb/dwc2/hcd.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,25 +2565,14 @@ static void _dwc2_hcd_endpoint_reset(struct usb_hcd *hcd,
25652565
struct usb_host_endpoint *ep)
25662566
{
25672567
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
2568-
int is_control = usb_endpoint_xfer_control(&ep->desc);
2569-
int is_out = usb_endpoint_dir_out(&ep->desc);
2570-
int epnum = usb_endpoint_num(&ep->desc);
2571-
struct usb_device *udev;
25722568
unsigned long flags;
25732569

25742570
dev_dbg(hsotg->dev,
25752571
"DWC OTG HCD EP RESET: bEndpointAddress=0x%02x\n",
25762572
ep->desc.bEndpointAddress);
25772573

2578-
udev = to_usb_device(hsotg->dev);
2579-
25802574
spin_lock_irqsave(&hsotg->lock, flags);
2581-
2582-
usb_settoggle(udev, epnum, is_out, 0);
2583-
if (is_control)
2584-
usb_settoggle(udev, epnum, !is_out, 0);
25852575
dwc2_hcd_endpoint_reset(hsotg, ep);
2586-
25872576
spin_unlock_irqrestore(&hsotg->lock, flags);
25882577
}
25892578

drivers/usb/dwc2/platform.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ static int dwc2_driver_probe(struct platform_device *dev)
124124
int retval;
125125
int irq;
126126

127+
if (usb_disabled())
128+
return -ENODEV;
129+
127130
match = of_match_device(dwc2_of_match_table, &dev->dev);
128131
if (match && match->data) {
129132
params = match->data;

drivers/usb/host/xhci-dbg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num)
203203
addr, (unsigned int)temp);
204204

205205
addr = &ir_set->erst_base;
206-
temp_64 = readq(addr);
206+
temp_64 = xhci_read_64(xhci, addr);
207207
xhci_dbg(xhci, " %p: ir_set.erst_base = @%08llx\n",
208208
addr, temp_64);
209209

210210
addr = &ir_set->erst_dequeue;
211-
temp_64 = readq(addr);
211+
temp_64 = xhci_read_64(xhci, addr);
212212
xhci_dbg(xhci, " %p: ir_set.erst_dequeue = @%08llx\n",
213213
addr, temp_64);
214214
}
@@ -412,7 +412,7 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci)
412412
{
413413
u64 val;
414414

415-
val = readq(&xhci->op_regs->cmd_ring);
415+
val = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
416416
xhci_dbg(xhci, "// xHC command ring deq ptr low bits + flags = @%08x\n",
417417
lower_32_bits(val));
418418
xhci_dbg(xhci, "// xHC command ring deq ptr high bits = @%08x\n",

drivers/usb/host/xhci-mem.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci)
19581958
xhci_warn(xhci, "WARN something wrong with SW event ring "
19591959
"dequeue ptr.\n");
19601960
/* Update HC event ring dequeue pointer */
1961-
temp = readq(&xhci->ir_set->erst_dequeue);
1961+
temp = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue);
19621962
temp &= ERST_PTR_MASK;
19631963
/* Don't clear the EHB bit (which is RW1C) because
19641964
* there might be more events to service.
@@ -1967,7 +1967,7 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci)
19671967
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
19681968
"// Write event ring dequeue pointer, "
19691969
"preserving EHB bit");
1970-
writeq(((u64) deq & (u64) ~ERST_PTR_MASK) | temp,
1970+
xhci_write_64(xhci, ((u64) deq & (u64) ~ERST_PTR_MASK) | temp,
19711971
&xhci->ir_set->erst_dequeue);
19721972
}
19731973

@@ -2269,7 +2269,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
22692269
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
22702270
"// Device context base array address = 0x%llx (DMA), %p (virt)",
22712271
(unsigned long long)xhci->dcbaa->dma, xhci->dcbaa);
2272-
writeq(dma, &xhci->op_regs->dcbaa_ptr);
2272+
xhci_write_64(xhci, dma, &xhci->op_regs->dcbaa_ptr);
22732273

22742274
/*
22752275
* Initialize the ring segment pool. The ring must be a contiguous
@@ -2312,13 +2312,13 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
23122312
(unsigned long long)xhci->cmd_ring->first_seg->dma);
23132313

23142314
/* Set the address in the Command Ring Control register */
2315-
val_64 = readq(&xhci->op_regs->cmd_ring);
2315+
val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
23162316
val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) |
23172317
(xhci->cmd_ring->first_seg->dma & (u64) ~CMD_RING_RSVD_BITS) |
23182318
xhci->cmd_ring->cycle_state;
23192319
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
23202320
"// Setting command ring address to 0x%x", val);
2321-
writeq(val_64, &xhci->op_regs->cmd_ring);
2321+
xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring);
23222322
xhci_dbg_cmd_ptrs(xhci);
23232323

23242324
xhci->lpm_command = xhci_alloc_command(xhci, true, true, flags);
@@ -2396,10 +2396,10 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
23962396
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
23972397
"// Set ERST base address for ir_set 0 = 0x%llx",
23982398
(unsigned long long)xhci->erst.erst_dma_addr);
2399-
val_64 = readq(&xhci->ir_set->erst_base);
2399+
val_64 = xhci_read_64(xhci, &xhci->ir_set->erst_base);
24002400
val_64 &= ERST_PTR_MASK;
24012401
val_64 |= (xhci->erst.erst_dma_addr & (u64) ~ERST_PTR_MASK);
2402-
writeq(val_64, &xhci->ir_set->erst_base);
2402+
xhci_write_64(xhci, val_64, &xhci->ir_set->erst_base);
24032403

24042404
/* Set the event ring dequeue address */
24052405
xhci_set_hc_event_deq(xhci);

drivers/usb/host/xhci-pci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
142142
"QUIRK: Resetting on resume");
143143
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
144144
}
145+
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
146+
pdev->device == 0x0015 &&
147+
pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG &&
148+
pdev->subsystem_device == 0xc0cd)
149+
xhci->quirks |= XHCI_RESET_ON_RESUME;
145150
if (pdev->vendor == PCI_VENDOR_ID_VIA)
146151
xhci->quirks |= XHCI_RESET_ON_RESUME;
147152
}

0 commit comments

Comments
 (0)