Skip to content

Commit 3032f8c

Browse files
committed
Merge tag 'usb-4.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a small clump of USB fixes for 4.16-rc6. Nothing major, just a number of fixes in lots of different drivers, as well as a PHY driver fix that snuck into this tree. Full details are in the shortlog. All of these have been in linux-next with no reported issues" * tag 'usb-4.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits) usb: musb: Fix external abort in musb_remove on omap2430 phy: qcom-ufs: add MODULE_LICENSE tag usb: typec: tcpm: fusb302: Do not log an error on -EPROBE_DEFER USB: OHCI: Fix NULL dereference in HCDs using HCD_LOCAL_MEM usbip: vudc: fix null pointer dereference on udc->lock xhci: Fix front USB ports on ASUS PRIME B350M-A usb: host: xhci-plat: revert "usb: host: xhci-plat: enable clk in resume timing" usb: usbmon: Read text within supplied buffer size usb: host: xhci-rcar: add support for r8a77965 USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h usb: xhci: dbc: Fix lockdep warning xhci: fix endpoint context tracer output Revert "typec: tcpm: Only request matching pdos" usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers usb: quirks: add control message delay for 1b1c:1b20 uas: fix comparison for error code usb: gadget: udc: renesas_usb3: add binging for r8a77965 usb: renesas_usbhs: add binding for r8a77965 usb: dwc2: fix STM32F7 USB OTG HS compatible dt-bindings: usb: fix the STM32F7 DWC2 OTG HS core binding ...
2 parents 6560ca4 + 94e46a4 commit 3032f8c

File tree

26 files changed

+211
-218
lines changed

26 files changed

+211
-218
lines changed

Documentation/devicetree/bindings/usb/dwc2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Required properties:
1919
configured in FS mode;
2020
- "st,stm32f4x9-hsotg": The DWC2 USB HS controller instance in STM32F4x9 SoCs
2121
configured in HS mode;
22-
- "st,stm32f7xx-hsotg": The DWC2 USB HS controller instance in STM32F7xx SoCs
22+
- "st,stm32f7-hsotg": The DWC2 USB HS controller instance in STM32F7 SoCs
2323
configured in HS mode;
2424
- reg : Should contain 1 register range (address and length)
2525
- interrupts : Should contain 1 interrupt

Documentation/devicetree/bindings/usb/renesas_usb3.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Required properties:
44
- compatible: Must contain one of the following:
55
- "renesas,r8a7795-usb3-peri"
66
- "renesas,r8a7796-usb3-peri"
7+
- "renesas,r8a77965-usb3-peri"
78
- "renesas,rcar-gen3-usb3-peri" for a generic R-Car Gen3 compatible
89
device
910

Documentation/devicetree/bindings/usb/renesas_usbhs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Required properties:
1212
- "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
1313
- "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
1414
- "renesas,usbhs-r8a7796" for r8a7796 (R-Car M3-W) compatible device
15+
- "renesas,usbhs-r8a77965" for r8a77965 (R-Car M3-N) compatible device
1516
- "renesas,usbhs-r8a77995" for r8a77995 (R-Car D3) compatible device
1617
- "renesas,usbhs-r7s72100" for r7s72100 (RZ/A1) compatible device
1718
- "renesas,rcar-gen2-usbhs" for R-Car Gen2 or RZ/G1 compatible devices

Documentation/devicetree/bindings/usb/usb-xhci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Required properties:
1313
- "renesas,xhci-r8a7793" for r8a7793 SoC
1414
- "renesas,xhci-r8a7795" for r8a7795 SoC
1515
- "renesas,xhci-r8a7796" for r8a7796 SoC
16+
- "renesas,xhci-r8a77965" for r8a77965 SoC
1617
- "renesas,rcar-gen2-xhci" for a generic R-Car Gen2 or RZ/G1 compatible
1718
device
1819
- "renesas,rcar-gen3-xhci" for a generic R-Car Gen3 compatible device

drivers/phy/qualcomm/phy-qcom-ufs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,3 +675,8 @@ int ufs_qcom_phy_power_off(struct phy *generic_phy)
675675
return 0;
676676
}
677677
EXPORT_SYMBOL_GPL(ufs_qcom_phy_power_off);
678+
679+
MODULE_AUTHOR("Yaniv Gardi <[email protected]>");
680+
MODULE_AUTHOR("Vivek Gautam <[email protected]>");
681+
MODULE_DESCRIPTION("Universal Flash Storage (UFS) QCOM PHY");
682+
MODULE_LICENSE("GPL v2");

drivers/usb/core/message.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
151151

152152
ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout);
153153

154+
/* Linger a bit, prior to the next control message. */
155+
if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG)
156+
msleep(200);
157+
154158
kfree(dr);
155159

156160
return ret;

drivers/usb/core/quirks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ static const struct usb_device_id usb_quirk_list[] = {
230230
{ USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
231231

232232
/* Corsair Strafe RGB */
233-
{ USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT },
233+
{ USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
234+
USB_QUIRK_DELAY_CTRL_MSG },
234235

235236
/* Corsair K70 LUX */
236237
{ USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },

drivers/usb/dwc2/params.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void dwc2_set_stm32f4x9_fsotg_params(struct dwc2_hsotg *hsotg)
137137
p->activate_stm_fs_transceiver = true;
138138
}
139139

140-
static void dwc2_set_stm32f7xx_hsotg_params(struct dwc2_hsotg *hsotg)
140+
static void dwc2_set_stm32f7_hsotg_params(struct dwc2_hsotg *hsotg)
141141
{
142142
struct dwc2_core_params *p = &hsotg->params;
143143

@@ -164,8 +164,8 @@ const struct of_device_id dwc2_of_match_table[] = {
164164
{ .compatible = "st,stm32f4x9-fsotg",
165165
.data = dwc2_set_stm32f4x9_fsotg_params },
166166
{ .compatible = "st,stm32f4x9-hsotg" },
167-
{ .compatible = "st,stm32f7xx-hsotg",
168-
.data = dwc2_set_stm32f7xx_hsotg_params },
167+
{ .compatible = "st,stm32f7-hsotg",
168+
.data = dwc2_set_stm32f7_hsotg_params },
169169
{},
170170
};
171171
MODULE_DEVICE_TABLE(of, dwc2_of_match_table);

drivers/usb/dwc3/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
175175
dwc->desired_dr_role = mode;
176176
spin_unlock_irqrestore(&dwc->lock, flags);
177177

178-
queue_work(system_power_efficient_wq, &dwc->drd_work);
178+
queue_work(system_freezable_wq, &dwc->drd_work);
179179
}
180180

181181
u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type)

drivers/usb/gadget/function/f_fs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,6 @@ ffs_fs_kill_sb(struct super_block *sb)
15381538
if (sb->s_fs_info) {
15391539
ffs_release_dev(sb->s_fs_info);
15401540
ffs_data_closed(sb->s_fs_info);
1541-
ffs_data_put(sb->s_fs_info);
15421541
}
15431542
}
15441543

drivers/usb/host/ohci-hcd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ static int ohci_init (struct ohci_hcd *ohci)
447447
struct usb_hcd *hcd = ohci_to_hcd(ohci);
448448

449449
/* Accept arbitrarily long scatter-gather lists */
450-
hcd->self.sg_tablesize = ~0;
450+
if (!(hcd->driver->flags & HCD_LOCAL_MEM))
451+
hcd->self.sg_tablesize = ~0;
451452

452453
if (distrust_firmware)
453454
ohci->flags |= OHCI_QUIRK_HUB_POWER;

drivers/usb/host/xhci-dbgcap.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,14 @@ dbc_ep_do_queue(struct dbc_ep *dep, struct dbc_request *req)
328328
int dbc_ep_queue(struct dbc_ep *dep, struct dbc_request *req,
329329
gfp_t gfp_flags)
330330
{
331+
unsigned long flags;
331332
struct xhci_dbc *dbc = dep->dbc;
332333
int ret = -ESHUTDOWN;
333334

334-
spin_lock(&dbc->lock);
335+
spin_lock_irqsave(&dbc->lock, flags);
335336
if (dbc->state == DS_CONFIGURED)
336337
ret = dbc_ep_do_queue(dep, req);
337-
spin_unlock(&dbc->lock);
338+
spin_unlock_irqrestore(&dbc->lock, flags);
338339

339340
mod_delayed_work(system_wq, &dbc->event_work, 0);
340341

@@ -521,15 +522,16 @@ static void xhci_do_dbc_stop(struct xhci_hcd *xhci)
521522
static int xhci_dbc_start(struct xhci_hcd *xhci)
522523
{
523524
int ret;
525+
unsigned long flags;
524526
struct xhci_dbc *dbc = xhci->dbc;
525527

526528
WARN_ON(!dbc);
527529

528530
pm_runtime_get_sync(xhci_to_hcd(xhci)->self.controller);
529531

530-
spin_lock(&dbc->lock);
532+
spin_lock_irqsave(&dbc->lock, flags);
531533
ret = xhci_do_dbc_start(xhci);
532-
spin_unlock(&dbc->lock);
534+
spin_unlock_irqrestore(&dbc->lock, flags);
533535

534536
if (ret) {
535537
pm_runtime_put(xhci_to_hcd(xhci)->self.controller);
@@ -541,6 +543,7 @@ static int xhci_dbc_start(struct xhci_hcd *xhci)
541543

542544
static void xhci_dbc_stop(struct xhci_hcd *xhci)
543545
{
546+
unsigned long flags;
544547
struct xhci_dbc *dbc = xhci->dbc;
545548
struct dbc_port *port = &dbc->port;
546549

@@ -551,9 +554,9 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
551554
if (port->registered)
552555
xhci_dbc_tty_unregister_device(xhci);
553556

554-
spin_lock(&dbc->lock);
557+
spin_lock_irqsave(&dbc->lock, flags);
555558
xhci_do_dbc_stop(xhci);
556-
spin_unlock(&dbc->lock);
559+
spin_unlock_irqrestore(&dbc->lock, flags);
557560

558561
pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
559562
}
@@ -779,14 +782,15 @@ static void xhci_dbc_handle_events(struct work_struct *work)
779782
int ret;
780783
enum evtreturn evtr;
781784
struct xhci_dbc *dbc;
785+
unsigned long flags;
782786
struct xhci_hcd *xhci;
783787

784788
dbc = container_of(to_delayed_work(work), struct xhci_dbc, event_work);
785789
xhci = dbc->xhci;
786790

787-
spin_lock(&dbc->lock);
791+
spin_lock_irqsave(&dbc->lock, flags);
788792
evtr = xhci_dbc_do_handle_events(dbc);
789-
spin_unlock(&dbc->lock);
793+
spin_unlock_irqrestore(&dbc->lock, flags);
790794

791795
switch (evtr) {
792796
case EVT_GSER:

drivers/usb/host/xhci-dbgtty.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,23 @@ static void dbc_start_rx(struct dbc_port *port)
9292
static void
9393
dbc_read_complete(struct xhci_hcd *xhci, struct dbc_request *req)
9494
{
95+
unsigned long flags;
9596
struct xhci_dbc *dbc = xhci->dbc;
9697
struct dbc_port *port = &dbc->port;
9798

98-
spin_lock(&port->port_lock);
99+
spin_lock_irqsave(&port->port_lock, flags);
99100
list_add_tail(&req->list_pool, &port->read_queue);
100101
tasklet_schedule(&port->push);
101-
spin_unlock(&port->port_lock);
102+
spin_unlock_irqrestore(&port->port_lock, flags);
102103
}
103104

104105
static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req)
105106
{
107+
unsigned long flags;
106108
struct xhci_dbc *dbc = xhci->dbc;
107109
struct dbc_port *port = &dbc->port;
108110

109-
spin_lock(&port->port_lock);
111+
spin_lock_irqsave(&port->port_lock, flags);
110112
list_add(&req->list_pool, &port->write_pool);
111113
switch (req->status) {
112114
case 0:
@@ -119,7 +121,7 @@ static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req)
119121
req->status);
120122
break;
121123
}
122-
spin_unlock(&port->port_lock);
124+
spin_unlock_irqrestore(&port->port_lock, flags);
123125
}
124126

125127
static void xhci_dbc_free_req(struct dbc_ep *dep, struct dbc_request *req)
@@ -327,12 +329,13 @@ static void dbc_rx_push(unsigned long _port)
327329
{
328330
struct dbc_request *req;
329331
struct tty_struct *tty;
332+
unsigned long flags;
330333
bool do_push = false;
331334
bool disconnect = false;
332335
struct dbc_port *port = (void *)_port;
333336
struct list_head *queue = &port->read_queue;
334337

335-
spin_lock_irq(&port->port_lock);
338+
spin_lock_irqsave(&port->port_lock, flags);
336339
tty = port->port.tty;
337340
while (!list_empty(queue)) {
338341
req = list_first_entry(queue, struct dbc_request, list_pool);
@@ -392,16 +395,17 @@ static void dbc_rx_push(unsigned long _port)
392395
if (!disconnect)
393396
dbc_start_rx(port);
394397

395-
spin_unlock_irq(&port->port_lock);
398+
spin_unlock_irqrestore(&port->port_lock, flags);
396399
}
397400

398401
static int dbc_port_activate(struct tty_port *_port, struct tty_struct *tty)
399402
{
403+
unsigned long flags;
400404
struct dbc_port *port = container_of(_port, struct dbc_port, port);
401405

402-
spin_lock_irq(&port->port_lock);
406+
spin_lock_irqsave(&port->port_lock, flags);
403407
dbc_start_rx(port);
404-
spin_unlock_irq(&port->port_lock);
408+
spin_unlock_irqrestore(&port->port_lock, flags);
405409

406410
return 0;
407411
}

drivers/usb/host/xhci-pci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
126126
if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
127127
xhci->quirks |= XHCI_AMD_PLL_FIX;
128128

129+
if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43bb)
130+
xhci->quirks |= XHCI_SUSPEND_DELAY;
131+
129132
if (pdev->vendor == PCI_VENDOR_ID_AMD)
130133
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
131134

drivers/usb/host/xhci-plat.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
360360
{
361361
struct usb_hcd *hcd = dev_get_drvdata(dev);
362362
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
363-
int ret;
364363

365364
/*
366365
* xhci_suspend() needs `do_wakeup` to know whether host is allowed
@@ -370,12 +369,7 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
370369
* reconsider this when xhci_plat_suspend enlarges its scope, e.g.,
371370
* also applies to runtime suspend.
372371
*/
373-
ret = xhci_suspend(xhci, device_may_wakeup(dev));
374-
375-
if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
376-
clk_disable_unprepare(xhci->clk);
377-
378-
return ret;
372+
return xhci_suspend(xhci, device_may_wakeup(dev));
379373
}
380374

381375
static int __maybe_unused xhci_plat_resume(struct device *dev)
@@ -384,9 +378,6 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)
384378
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
385379
int ret;
386380

387-
if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
388-
clk_prepare_enable(xhci->clk);
389-
390381
ret = xhci_priv_resume_quirk(hcd);
391382
if (ret)
392383
return ret;

drivers/usb/host/xhci-rcar.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ static const struct soc_device_attribute rcar_quirks_match[] = {
8383
.soc_id = "r8a7796",
8484
.data = (void *)RCAR_XHCI_FIRMWARE_V3,
8585
},
86+
{
87+
.soc_id = "r8a77965",
88+
.data = (void *)RCAR_XHCI_FIRMWARE_V3,
89+
},
8690
{ /* sentinel */ },
8791
};
8892

drivers/usb/host/xhci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,9 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
877877
clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
878878
del_timer_sync(&xhci->shared_hcd->rh_timer);
879879

880+
if (xhci->quirks & XHCI_SUSPEND_DELAY)
881+
usleep_range(1000, 1500);
882+
880883
spin_lock_irq(&xhci->lock);
881884
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
882885
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);

drivers/usb/host/xhci.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,12 @@ struct xhci_ep_ctx {
718718
/* bits 10:14 are Max Primary Streams */
719719
/* bit 15 is Linear Stream Array */
720720
/* Interval - period between requests to an endpoint - 125u increments. */
721-
#define EP_INTERVAL(p) (((p) & 0xff) << 16)
722-
#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
723-
#define CTX_TO_EP_INTERVAL(p) (((p) >> 16) & 0xff)
724-
#define EP_MAXPSTREAMS_MASK (0x1f << 10)
725-
#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
721+
#define EP_INTERVAL(p) (((p) & 0xff) << 16)
722+
#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
723+
#define CTX_TO_EP_INTERVAL(p) (((p) >> 16) & 0xff)
724+
#define EP_MAXPSTREAMS_MASK (0x1f << 10)
725+
#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
726+
#define CTX_TO_EP_MAXPSTREAMS(p) (((p) & EP_MAXPSTREAMS_MASK) >> 10)
726727
/* Endpoint is set up with a Linear Stream Array (vs. Secondary Stream Array) */
727728
#define EP_HAS_LSA (1 << 15)
728729
/* hosts with LEC=1 use bits 31:24 as ESIT high bits. */
@@ -1825,6 +1826,7 @@ struct xhci_hcd {
18251826
#define XHCI_U2_DISABLE_WAKE (1 << 27)
18261827
#define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)
18271828
#define XHCI_HW_LPM_DISABLE (1 << 29)
1829+
#define XHCI_SUSPEND_DELAY (1 << 30)
18281830

18291831
unsigned int num_active_eps;
18301832
unsigned int limit_active_eps;
@@ -2549,21 +2551,22 @@ static inline const char *xhci_decode_ep_context(u32 info, u32 info2, u64 deq,
25492551
u8 burst;
25502552
u8 cerr;
25512553
u8 mult;
2552-
u8 lsa;
2553-
u8 hid;
2554+
2555+
bool lsa;
2556+
bool hid;
25542557

25552558
esit = CTX_TO_MAX_ESIT_PAYLOAD_HI(info) << 16 |
25562559
CTX_TO_MAX_ESIT_PAYLOAD(tx_info);
25572560

25582561
ep_state = info & EP_STATE_MASK;
2559-
max_pstr = info & EP_MAXPSTREAMS_MASK;
2562+
max_pstr = CTX_TO_EP_MAXPSTREAMS(info);
25602563
interval = CTX_TO_EP_INTERVAL(info);
25612564
mult = CTX_TO_EP_MULT(info) + 1;
2562-
lsa = info & EP_HAS_LSA;
2565+
lsa = !!(info & EP_HAS_LSA);
25632566

25642567
cerr = (info2 & (3 << 1)) >> 1;
25652568
ep_type = CTX_TO_EP_TYPE(info2);
2566-
hid = info2 & (1 << 7);
2569+
hid = !!(info2 & (1 << 7));
25672570
burst = CTX_TO_MAX_BURST(info2);
25682571
maxp = MAX_PACKET_DECODED(info2);
25692572

0 commit comments

Comments
 (0)