Skip to content

Commit

Permalink
Merge tag 'usb-4.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  ...
  • Loading branch information
Linus Torvalds committed Mar 14, 2018
2 parents 6560ca4 + 94e46a4 commit 3032f8c
Show file tree
Hide file tree
Showing 26 changed files with 211 additions and 218 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/usb/dwc2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Required properties:
configured in FS mode;
- "st,stm32f4x9-hsotg": The DWC2 USB HS controller instance in STM32F4x9 SoCs
configured in HS mode;
- "st,stm32f7xx-hsotg": The DWC2 USB HS controller instance in STM32F7xx SoCs
- "st,stm32f7-hsotg": The DWC2 USB HS controller instance in STM32F7 SoCs
configured in HS mode;
- reg : Should contain 1 register range (address and length)
- interrupts : Should contain 1 interrupt
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/usb/renesas_usb3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Required properties:
- compatible: Must contain one of the following:
- "renesas,r8a7795-usb3-peri"
- "renesas,r8a7796-usb3-peri"
- "renesas,r8a77965-usb3-peri"
- "renesas,rcar-gen3-usb3-peri" for a generic R-Car Gen3 compatible
device

Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/usb/renesas_usbhs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Required properties:
- "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
- "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
- "renesas,usbhs-r8a7796" for r8a7796 (R-Car M3-W) compatible device
- "renesas,usbhs-r8a77965" for r8a77965 (R-Car M3-N) compatible device
- "renesas,usbhs-r8a77995" for r8a77995 (R-Car D3) compatible device
- "renesas,usbhs-r7s72100" for r7s72100 (RZ/A1) compatible device
- "renesas,rcar-gen2-usbhs" for R-Car Gen2 or RZ/G1 compatible devices
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/usb/usb-xhci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Required properties:
- "renesas,xhci-r8a7793" for r8a7793 SoC
- "renesas,xhci-r8a7795" for r8a7795 SoC
- "renesas,xhci-r8a7796" for r8a7796 SoC
- "renesas,xhci-r8a77965" for r8a77965 SoC
- "renesas,rcar-gen2-xhci" for a generic R-Car Gen2 or RZ/G1 compatible
device
- "renesas,rcar-gen3-xhci" for a generic R-Car Gen3 compatible device
Expand Down
5 changes: 5 additions & 0 deletions drivers/phy/qualcomm/phy-qcom-ufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,8 @@ int ufs_qcom_phy_power_off(struct phy *generic_phy)
return 0;
}
EXPORT_SYMBOL_GPL(ufs_qcom_phy_power_off);

MODULE_AUTHOR("Yaniv Gardi <ygardi@codeaurora.org>");
MODULE_AUTHOR("Vivek Gautam <vivek.gautam@codeaurora.org>");
MODULE_DESCRIPTION("Universal Flash Storage (UFS) QCOM PHY");
MODULE_LICENSE("GPL v2");
4 changes: 4 additions & 0 deletions drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request,

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

/* Linger a bit, prior to the next control message. */
if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG)
msleep(200);

kfree(dr);

return ret;
Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/core/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },

/* Corsair Strafe RGB */
{ USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT },
{ USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
USB_QUIRK_DELAY_CTRL_MSG },

/* Corsair K70 LUX */
{ USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/dwc2/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static void dwc2_set_stm32f4x9_fsotg_params(struct dwc2_hsotg *hsotg)
p->activate_stm_fs_transceiver = true;
}

static void dwc2_set_stm32f7xx_hsotg_params(struct dwc2_hsotg *hsotg)
static void dwc2_set_stm32f7_hsotg_params(struct dwc2_hsotg *hsotg)
{
struct dwc2_core_params *p = &hsotg->params;

Expand All @@ -164,8 +164,8 @@ const struct of_device_id dwc2_of_match_table[] = {
{ .compatible = "st,stm32f4x9-fsotg",
.data = dwc2_set_stm32f4x9_fsotg_params },
{ .compatible = "st,stm32f4x9-hsotg" },
{ .compatible = "st,stm32f7xx-hsotg",
.data = dwc2_set_stm32f7xx_hsotg_params },
{ .compatible = "st,stm32f7-hsotg",
.data = dwc2_set_stm32f7_hsotg_params },
{},
};
MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
dwc->desired_dr_role = mode;
spin_unlock_irqrestore(&dwc->lock, flags);

queue_work(system_power_efficient_wq, &dwc->drd_work);
queue_work(system_freezable_wq, &dwc->drd_work);
}

u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type)
Expand Down
1 change: 0 additions & 1 deletion drivers/usb/gadget/function/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,6 @@ ffs_fs_kill_sb(struct super_block *sb)
if (sb->s_fs_info) {
ffs_release_dev(sb->s_fs_info);
ffs_data_closed(sb->s_fs_info);
ffs_data_put(sb->s_fs_info);
}
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/host/ohci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ static int ohci_init (struct ohci_hcd *ohci)
struct usb_hcd *hcd = ohci_to_hcd(ohci);

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

if (distrust_firmware)
ohci->flags |= OHCI_QUIRK_HUB_POWER;
Expand Down
20 changes: 12 additions & 8 deletions drivers/usb/host/xhci-dbgcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,14 @@ dbc_ep_do_queue(struct dbc_ep *dep, struct dbc_request *req)
int dbc_ep_queue(struct dbc_ep *dep, struct dbc_request *req,
gfp_t gfp_flags)
{
unsigned long flags;
struct xhci_dbc *dbc = dep->dbc;
int ret = -ESHUTDOWN;

spin_lock(&dbc->lock);
spin_lock_irqsave(&dbc->lock, flags);
if (dbc->state == DS_CONFIGURED)
ret = dbc_ep_do_queue(dep, req);
spin_unlock(&dbc->lock);
spin_unlock_irqrestore(&dbc->lock, flags);

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

Expand Down Expand Up @@ -521,15 +522,16 @@ static void xhci_do_dbc_stop(struct xhci_hcd *xhci)
static int xhci_dbc_start(struct xhci_hcd *xhci)
{
int ret;
unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc;

WARN_ON(!dbc);

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

spin_lock(&dbc->lock);
spin_lock_irqsave(&dbc->lock, flags);
ret = xhci_do_dbc_start(xhci);
spin_unlock(&dbc->lock);
spin_unlock_irqrestore(&dbc->lock, flags);

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

static void xhci_dbc_stop(struct xhci_hcd *xhci)
{
unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc;
struct dbc_port *port = &dbc->port;

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

spin_lock(&dbc->lock);
spin_lock_irqsave(&dbc->lock, flags);
xhci_do_dbc_stop(xhci);
spin_unlock(&dbc->lock);
spin_unlock_irqrestore(&dbc->lock, flags);

pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
}
Expand Down Expand Up @@ -779,14 +782,15 @@ static void xhci_dbc_handle_events(struct work_struct *work)
int ret;
enum evtreturn evtr;
struct xhci_dbc *dbc;
unsigned long flags;
struct xhci_hcd *xhci;

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

spin_lock(&dbc->lock);
spin_lock_irqsave(&dbc->lock, flags);
evtr = xhci_dbc_do_handle_events(dbc);
spin_unlock(&dbc->lock);
spin_unlock_irqrestore(&dbc->lock, flags);

switch (evtr) {
case EVT_GSER:
Expand Down
20 changes: 12 additions & 8 deletions drivers/usb/host/xhci-dbgtty.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,23 @@ static void dbc_start_rx(struct dbc_port *port)
static void
dbc_read_complete(struct xhci_hcd *xhci, struct dbc_request *req)
{
unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc;
struct dbc_port *port = &dbc->port;

spin_lock(&port->port_lock);
spin_lock_irqsave(&port->port_lock, flags);
list_add_tail(&req->list_pool, &port->read_queue);
tasklet_schedule(&port->push);
spin_unlock(&port->port_lock);
spin_unlock_irqrestore(&port->port_lock, flags);
}

static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req)
{
unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc;
struct dbc_port *port = &dbc->port;

spin_lock(&port->port_lock);
spin_lock_irqsave(&port->port_lock, flags);
list_add(&req->list_pool, &port->write_pool);
switch (req->status) {
case 0:
Expand All @@ -119,7 +121,7 @@ static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req)
req->status);
break;
}
spin_unlock(&port->port_lock);
spin_unlock_irqrestore(&port->port_lock, flags);
}

static void xhci_dbc_free_req(struct dbc_ep *dep, struct dbc_request *req)
Expand Down Expand Up @@ -327,12 +329,13 @@ static void dbc_rx_push(unsigned long _port)
{
struct dbc_request *req;
struct tty_struct *tty;
unsigned long flags;
bool do_push = false;
bool disconnect = false;
struct dbc_port *port = (void *)_port;
struct list_head *queue = &port->read_queue;

spin_lock_irq(&port->port_lock);
spin_lock_irqsave(&port->port_lock, flags);
tty = port->port.tty;
while (!list_empty(queue)) {
req = list_first_entry(queue, struct dbc_request, list_pool);
Expand Down Expand Up @@ -392,16 +395,17 @@ static void dbc_rx_push(unsigned long _port)
if (!disconnect)
dbc_start_rx(port);

spin_unlock_irq(&port->port_lock);
spin_unlock_irqrestore(&port->port_lock, flags);
}

static int dbc_port_activate(struct tty_port *_port, struct tty_struct *tty)
{
unsigned long flags;
struct dbc_port *port = container_of(_port, struct dbc_port, port);

spin_lock_irq(&port->port_lock);
spin_lock_irqsave(&port->port_lock, flags);
dbc_start_rx(port);
spin_unlock_irq(&port->port_lock);
spin_unlock_irqrestore(&port->port_lock, flags);

return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/host/xhci-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
xhci->quirks |= XHCI_AMD_PLL_FIX;

if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43bb)
xhci->quirks |= XHCI_SUSPEND_DELAY;

if (pdev->vendor == PCI_VENDOR_ID_AMD)
xhci->quirks |= XHCI_TRUST_TX_LENGTH;

Expand Down
11 changes: 1 addition & 10 deletions drivers/usb/host/xhci-plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
int ret;

/*
* xhci_suspend() needs `do_wakeup` to know whether host is allowed
Expand All @@ -370,12 +369,7 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
* reconsider this when xhci_plat_suspend enlarges its scope, e.g.,
* also applies to runtime suspend.
*/
ret = xhci_suspend(xhci, device_may_wakeup(dev));

if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
clk_disable_unprepare(xhci->clk);

return ret;
return xhci_suspend(xhci, device_may_wakeup(dev));
}

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

if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
clk_prepare_enable(xhci->clk);

ret = xhci_priv_resume_quirk(hcd);
if (ret)
return ret;
Expand Down
4 changes: 4 additions & 0 deletions drivers/usb/host/xhci-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ static const struct soc_device_attribute rcar_quirks_match[] = {
.soc_id = "r8a7796",
.data = (void *)RCAR_XHCI_FIRMWARE_V3,
},
{
.soc_id = "r8a77965",
.data = (void *)RCAR_XHCI_FIRMWARE_V3,
},
{ /* sentinel */ },
};

Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/host/xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
del_timer_sync(&xhci->shared_hcd->rh_timer);

if (xhci->quirks & XHCI_SUSPEND_DELAY)
usleep_range(1000, 1500);

spin_lock_irq(&xhci->lock);
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
Expand Down
23 changes: 13 additions & 10 deletions drivers/usb/host/xhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,12 @@ struct xhci_ep_ctx {
/* bits 10:14 are Max Primary Streams */
/* bit 15 is Linear Stream Array */
/* Interval - period between requests to an endpoint - 125u increments. */
#define EP_INTERVAL(p) (((p) & 0xff) << 16)
#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
#define CTX_TO_EP_INTERVAL(p) (((p) >> 16) & 0xff)
#define EP_MAXPSTREAMS_MASK (0x1f << 10)
#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
#define EP_INTERVAL(p) (((p) & 0xff) << 16)
#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
#define CTX_TO_EP_INTERVAL(p) (((p) >> 16) & 0xff)
#define EP_MAXPSTREAMS_MASK (0x1f << 10)
#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
#define CTX_TO_EP_MAXPSTREAMS(p) (((p) & EP_MAXPSTREAMS_MASK) >> 10)
/* Endpoint is set up with a Linear Stream Array (vs. Secondary Stream Array) */
#define EP_HAS_LSA (1 << 15)
/* hosts with LEC=1 use bits 31:24 as ESIT high bits. */
Expand Down Expand Up @@ -1825,6 +1826,7 @@ struct xhci_hcd {
#define XHCI_U2_DISABLE_WAKE (1 << 27)
#define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)
#define XHCI_HW_LPM_DISABLE (1 << 29)
#define XHCI_SUSPEND_DELAY (1 << 30)

unsigned int num_active_eps;
unsigned int limit_active_eps;
Expand Down Expand Up @@ -2549,21 +2551,22 @@ static inline const char *xhci_decode_ep_context(u32 info, u32 info2, u64 deq,
u8 burst;
u8 cerr;
u8 mult;
u8 lsa;
u8 hid;

bool lsa;
bool hid;

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

ep_state = info & EP_STATE_MASK;
max_pstr = info & EP_MAXPSTREAMS_MASK;
max_pstr = CTX_TO_EP_MAXPSTREAMS(info);
interval = CTX_TO_EP_INTERVAL(info);
mult = CTX_TO_EP_MULT(info) + 1;
lsa = info & EP_HAS_LSA;
lsa = !!(info & EP_HAS_LSA);

cerr = (info2 & (3 << 1)) >> 1;
ep_type = CTX_TO_EP_TYPE(info2);
hid = info2 & (1 << 7);
hid = !!(info2 & (1 << 7));
burst = CTX_TO_MAX_BURST(info2);
maxp = MAX_PACKET_DECODED(info2);

Expand Down
Loading

0 comments on commit 3032f8c

Please sign in to comment.