Skip to content

Commit

Permalink
Merge tag 'usb-3.18-rc7' 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 some USB driver fixes and new device ids for 3.18-rc7.

  Full details are in the shortlog, and all of these have been in the
  linux-next tree for a while"

* tag 'usb-3.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000
  usb: xhci: rework root port wake bits if controller isn't allowed to wakeup
  USB: xhci: Reset a halted endpoint immediately when we encounter a stall.
  Revert "xhci: clear root port wake on bits if controller isn't wake-up capable"
  USB: xhci: don't start a halted endpoint before its new dequeue is set
  USB: uas: Add no-uas quirk for Hitachi usb-3 enclosures 4971:1012
  USB: ssu100: fix overrun-error reporting
  USB: keyspan: fix overrun-error reporting
  USB: keyspan: fix tty line-status reporting
  usb: serial: ftdi_sio: add PIDs for Matrix Orbital products
  usb: dwc3: ep0: fix for dead code
  USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick
  • Loading branch information
torvalds committed Nov 28, 2014
2 parents cba3b00 + 263e80b commit 4742eb3
Show file tree
Hide file tree
Showing 14 changed files with 224 additions and 144 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/core/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Creative SB Audigy 2 NX */
{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },

/* Microsoft Wireless Laser Mouse 6000 Receiver */
{ USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME },

/* Microsoft LifeCam-VX700 v2.0 */
{ USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },

Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,

trb = dwc->ep0_trb;

r = next_request(&ep0->request_list);
if (!r)
return;

status = DWC3_TRB_SIZE_TRBSTS(trb->size);
if (status == DWC3_TRBSTS_SETUP_PENDING) {
dwc3_trace(trace_dwc3_ep0, "Setup Pending received");
Expand All @@ -801,10 +805,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
return;
}

r = next_request(&ep0->request_list);
if (!r)
return;

ur = &r->request;

length = trb->size & DWC3_TRB_SIZE_MASK;
Expand Down
5 changes: 1 addition & 4 deletions drivers/usb/host/xhci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


#include <linux/slab.h>
#include <linux/device.h>
#include <asm/unaligned.h>

#include "xhci.h"
Expand Down Expand Up @@ -1149,9 +1148,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
* including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME
* is enabled, so also enable remote wake here.
*/
if (hcd->self.root_hub->do_remote_wakeup
&& device_may_wakeup(hcd->self.controller)) {

if (hcd->self.root_hub->do_remote_wakeup) {
if (t1 & PORT_CONNECT) {
t2 |= PORT_WKOC_E | PORT_WKDISC_E;
t2 &= ~PORT_WKCONN_E;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/xhci-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
pdev->no_d3cold = true;

return xhci_suspend(xhci);
return xhci_suspend(xhci, do_wakeup);
}

static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
Expand Down
10 changes: 9 additions & 1 deletion drivers/usb/host/xhci-plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,15 @@ static int xhci_plat_suspend(struct device *dev)
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct xhci_hcd *xhci = hcd_to_xhci(hcd);

return xhci_suspend(xhci);
/*
* xhci_suspend() needs `do_wakeup` to know whether host is allowed
* to do wakeup during suspend. Since xhci_plat_suspend is currently
* only designed for system suspend, device_may_wakeup() is enough
* to dertermine whether host is allowed to do wakeup. Need to
* reconsider this when xhci_plat_suspend enlarges its scope, e.g.,
* also applies to runtime suspend.
*/
return xhci_suspend(xhci, device_may_wakeup(dev));
}

static int xhci_plat_resume(struct device *dev)
Expand Down
43 changes: 11 additions & 32 deletions drivers/usb/host/xhci-ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,9 +1067,8 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
false);
xhci_ring_cmd_db(xhci);
} else {
/* Clear our internal halted state and restart the ring(s) */
/* Clear our internal halted state */
xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED;
ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
}
}

Expand Down Expand Up @@ -1823,22 +1822,13 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
ep->stopped_td = td;
return 0;
} else {
if (trb_comp_code == COMP_STALL) {
/* The transfer is completed from the driver's
* perspective, but we need to issue a set dequeue
* command for this stalled endpoint to move the dequeue
* pointer past the TD. We can't do that here because
* the halt condition must be cleared first. Let the
* USB class driver clear the stall later.
*/
ep->stopped_td = td;
ep->stopped_stream = ep_ring->stream_id;
} else if (xhci_requires_manual_halt_cleanup(xhci,
ep_ctx, trb_comp_code)) {
/* Other types of errors halt the endpoint, but the
* class driver doesn't call usb_reset_endpoint() unless
* the error is -EPIPE. Clear the halted status in the
* xHCI hardware manually.
if (trb_comp_code == COMP_STALL ||
xhci_requires_manual_halt_cleanup(xhci, ep_ctx,
trb_comp_code)) {
/* Issue a reset endpoint command to clear the host side
* halt, followed by a set dequeue command to move the
* dequeue pointer past the TD.
* The class driver clears the device side halt later.
*/
xhci_cleanup_halted_endpoint(xhci,
slot_id, ep_index, ep_ring->stream_id,
Expand Down Expand Up @@ -1958,9 +1948,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
else
td->urb->actual_length = 0;

xhci_cleanup_halted_endpoint(xhci,
slot_id, ep_index, 0, td, event_trb);
return finish_td(xhci, td, event_trb, event, ep, status, true);
return finish_td(xhci, td, event_trb, event, ep, status, false);
}
/*
* Did we transfer any data, despite the errors that might have
Expand Down Expand Up @@ -2519,17 +2507,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
if (ret) {
urb = td->urb;
urb_priv = urb->hcpriv;
/* Leave the TD around for the reset endpoint function
* to use(but only if it's not a control endpoint,
* since we already queued the Set TR dequeue pointer
* command for stalled control endpoints).
*/
if (usb_endpoint_xfer_control(&urb->ep->desc) ||
(trb_comp_code != COMP_STALL &&
trb_comp_code != COMP_BABBLE))
xhci_urb_free_priv(xhci, urb_priv);
else
kfree(urb_priv);

xhci_urb_free_priv(xhci, urb_priv);

usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb);
if ((urb->actual_length != urb->transfer_buffer_length &&
Expand Down
107 changes: 56 additions & 51 deletions drivers/usb/host/xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#define DRIVER_AUTHOR "Sarah Sharp"
#define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"

#define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)

/* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */
static int link_quirk;
module_param(link_quirk, int, S_IRUGO | S_IWUSR);
Expand Down Expand Up @@ -851,13 +853,47 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci)
xhci_set_cmd_ring_deq(xhci);
}

static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
{
int port_index;
__le32 __iomem **port_array;
unsigned long flags;
u32 t1, t2;

spin_lock_irqsave(&xhci->lock, flags);

/* disble usb3 ports Wake bits*/
port_index = xhci->num_usb3_ports;
port_array = xhci->usb3_ports;
while (port_index--) {
t1 = readl(port_array[port_index]);
t1 = xhci_port_state_to_neutral(t1);
t2 = t1 & ~PORT_WAKE_BITS;
if (t1 != t2)
writel(t2, port_array[port_index]);
}

/* disble usb2 ports Wake bits*/
port_index = xhci->num_usb2_ports;
port_array = xhci->usb2_ports;
while (port_index--) {
t1 = readl(port_array[port_index]);
t1 = xhci_port_state_to_neutral(t1);
t2 = t1 & ~PORT_WAKE_BITS;
if (t1 != t2)
writel(t2, port_array[port_index]);
}

spin_unlock_irqrestore(&xhci->lock, flags);
}

/*
* Stop HC (not bus-specific)
*
* This is called when the machine transition into S3/S4 mode.
*
*/
int xhci_suspend(struct xhci_hcd *xhci)
int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
{
int rc = 0;
unsigned int delay = XHCI_MAX_HALT_USEC;
Expand All @@ -868,6 +904,10 @@ int xhci_suspend(struct xhci_hcd *xhci)
xhci->shared_hcd->state != HC_STATE_SUSPENDED)
return -EINVAL;

/* Clear root port wake on bits if wakeup not allowed. */
if (!do_wakeup)
xhci_disable_port_wake_on_bits(xhci);

/* Don't poll the roothubs on bus suspend. */
xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
Expand Down Expand Up @@ -2912,68 +2952,33 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
}
}

/* Deal with stalled endpoints. The core should have sent the control message
* to clear the halt condition. However, we need to make the xHCI hardware
* reset its sequence number, since a device will expect a sequence number of
* zero after the halt condition is cleared.
/* Called when clearing halted device. The core should have sent the control
* message to clear the device halt condition. The host side of the halt should
* already be cleared with a reset endpoint command issued when the STALL tx
* event was received.
*
* Context: in_interrupt
*/

void xhci_endpoint_reset(struct usb_hcd *hcd,
struct usb_host_endpoint *ep)
{
struct xhci_hcd *xhci;
struct usb_device *udev;
unsigned int ep_index;
unsigned long flags;
int ret;
struct xhci_virt_ep *virt_ep;
struct xhci_command *command;

xhci = hcd_to_xhci(hcd);
udev = (struct usb_device *) ep->hcpriv;
/* Called with a root hub endpoint (or an endpoint that wasn't added
* with xhci_add_endpoint()
*/
if (!ep->hcpriv)
return;
ep_index = xhci_get_endpoint_index(&ep->desc);
virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index];
if (!virt_ep->stopped_td) {
xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
"Endpoint 0x%x not halted, refusing to reset.",
ep->desc.bEndpointAddress);
return;
}
if (usb_endpoint_xfer_control(&ep->desc)) {
xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
"Control endpoint stall already handled.");
return;
}

command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC);
if (!command)
return;

xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
"Queueing reset endpoint command");
spin_lock_irqsave(&xhci->lock, flags);
ret = xhci_queue_reset_ep(xhci, command, udev->slot_id, ep_index);
/*
* Can't change the ring dequeue pointer until it's transitioned to the
* stopped state, which is only upon a successful reset endpoint
* command. Better hope that last command worked!
* We might need to implement the config ep cmd in xhci 4.8.1 note:
* The Reset Endpoint Command may only be issued to endpoints in the
* Halted state. If software wishes reset the Data Toggle or Sequence
* Number of an endpoint that isn't in the Halted state, then software
* may issue a Configure Endpoint Command with the Drop and Add bits set
* for the target endpoint. that is in the Stopped state.
*/
if (!ret) {
xhci_cleanup_stalled_ring(xhci, udev, ep_index);
kfree(virt_ep->stopped_td);
xhci_ring_cmd_db(xhci);
}
virt_ep->stopped_td = NULL;
virt_ep->stopped_stream = 0;
spin_unlock_irqrestore(&xhci->lock, flags);

if (ret)
xhci_warn(xhci, "FIXME allocate a new ring segment\n");
/* For now just print debug to follow the situation */
xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n",
ep->desc.bEndpointAddress);
}

static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/xhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks);
void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *));

#ifdef CONFIG_PM
int xhci_suspend(struct xhci_hcd *xhci);
int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
#else
#define xhci_suspend NULL
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/serial/cp210x.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
{ USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
{ USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
{ USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */
{ USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
{ USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
{ USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
Expand Down
33 changes: 33 additions & 0 deletions drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,39 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) },
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
Expand Down
Loading

0 comments on commit 4742eb3

Please sign in to comment.