1. 10 10月, 2013 2 次提交
    • O
      xhci: quirk for extra long delay for S4 · 455f5892
      Oliver Neukum 提交于
      It has been reported that this chipset really cannot
      sleep without this extraordinary delay.
      
      This patch should be backported, in order to ensure this host functions
      under stable kernels.  The last quirk for Fresco Logic hosts (commit
      bba18e33 "xhci: Extend Fresco Logic MSI
      quirk.") was backported to stable kernels as old as 2.6.36.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      455f5892
    • S
      xhci: Don't enable/disable RWE on bus suspend/resume. · f217c980
      Sarah Sharp 提交于
      The RWE bit of the USB 2.0 PORTPMSC register is supposed to enable
      remote wakeup for devices in the lower power link state L1.  It has
      nothing to do with the device suspend remote wakeup from L2.  The RWE
      bit is designed to be set once (when USB 2.0 LPM is enabled for the
      port) and cleared only when USB 2.0 LPM is disabled for the port.
      
      The xHCI bus suspend method was setting the RWE bit erroneously, and the
      bus resume method was clearing it.  The xHCI 1.0 specification with
      errata up to Aug 12, 2012 says in section 4.23.5.1.1.1 "Hardware
      Controlled LPM":
      
      "While Hardware USB2 LPM is enabled, software shall not modify the
      HIRDBESL or RWE fields of the USB2 PORTPMSC register..."
      
      If we have previously enabled USB 2.0 LPM for a device, that means when
      the USB 2.0 bus is resumed, we violate the xHCI specification by
      clearing RWE.  It also means that after a bus resume, the host would
      think remote wakeup is disabled from L1 for ports with USB 2.0 Link PM
      enabled, which is not what we want.
      
      This patch should be backported to kernels as old as 3.2, that
      contain the commit 65580b43 "xHCI: set
      USB2 hardware LPM".  That was the first kernel that supported USB 2.0
      Link PM.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      f217c980
  2. 27 9月, 2013 2 次提交
  3. 26 9月, 2013 4 次提交
    • A
      USB: fix PM config symbol in uhci-hcd, ehci-hcd, and xhci-hcd · f875fdbf
      Alan Stern 提交于
      Since uhci-hcd, ehci-hcd, and xhci-hcd support runtime PM, the .pm
      field in their pci_driver structures should be protected by CONFIG_PM
      rather than CONFIG_PM_SLEEP.  The corresponding change has already
      been made for ohci-hcd.
      
      Without this change, controllers won't do runtime suspend if system
      suspend or hibernation isn't enabled.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f875fdbf
    • A
      USB: OHCI: accept very late isochronous URBs · a8693424
      Alan Stern 提交于
      Commit 24f53137 (USB: EHCI: accept very late isochronous URBs)
      changed the isochronous API provided by ehci-hcd.  URBs submitted too
      late, so that the time slots for all their packets have already
      expired, are no longer rejected outright.  Instead the submission is
      accepted, and the URB completes normally with a -EXDEV error for each
      packet.  This is what client drivers expect.
      
      This patch implements the same policy in ohci-hcd.  The change is more
      complicated than it was in ehci-hcd, because ohci-hcd doesn't scan for
      isochronous completions in the same way as ehci-hcd does.  Rather, it
      depends on the hardware adding completed TDs to a "done queue".  Some
      OHCI controller don't handle this properly when a TD's time slot has
      already expired, so we have to avoid adding such TDs to the schedule
      in the first place.  As a result, if the URB was submitted too late
      then none of its TDs will get put on the schedule, so none of them
      will end up on the done queue, so the driver will never realize that
      the URB should be completed.
      
      To solve this problem, the patch adds one to urb_priv->td_cnt for such
      URBs, making it larger than urb_priv->length (td_cnt already gets set
      to the number of TD's that had to be skipped because their slots have
      expired).  Each time an URB is given back, the finish_urb() routine
      looks to see if urb_priv->td_cnt for the next URB on the same endpoint
      is marked in this way.  If so, it gives back the next URB right away.
      
      This should be applied to all kernels containing commit 815fa7b9
      (USB: OHCI: fix logic for scheduling isochronous URBs).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8693424
    • A
      USB: UHCI: accept very late isochronous URBs · bef073b0
      Alan Stern 提交于
      Commit 24f53137 (USB: EHCI: accept very late isochronous URBs)
      changed the isochronous API provided by ehci-hcd.  URBs submitted too
      late, so that the time slots for all their packets have already
      expired, are no longer rejected outright.  Instead the submission is
      accepted, and the URB completes normally with a -EXDEV error for each
      packet.  This is what client drivers expect.
      
      This patch implements the same policy in uhci-hcd.  It should be
      applied to all kernels containing commit c44b2250 (UHCI: implement
      new semantics for URB_ISO_ASAP).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bef073b0
    • A
      USB: iMX21: accept very late isochronous URBs · 8937669f
      Alan Stern 提交于
      Commit 24f53137 (USB: EHCI: accept very late isochronous URBs)
      changed the isochronous API provided by ehci-hcd.  URBs submitted too
      late, so that the time slots for all their packets have already
      expired, are no longer rejected outright.  Instead the submission is
      accepted, and the URB completes normally with a -EXDEV error for each
      packet.  This is what client drivers expect.
      
      The same policy should be implemented in imx21-hcd, but I don't know
      enough about the hardware to do it.  As a second-best substitute, this
      patch treats very late isochronous submissions as though the
      URB_ISO_ASAP flag were set.  I don't have any way to test this change,
      unfortunately.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Sascha Hauer <kernel@pengutronix.de>
      CC: Martin Fuzzey <mfuzzey@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8937669f
  4. 24 9月, 2013 4 次提交
    • F
      xhci: Fix race between ep halt and URB cancellation · 526867c3
      Florian Wolter 提交于
      The halted state of a endpoint cannot be cleared over CLEAR_HALT from a
      user process, because the stopped_td variable was overwritten in the
      handle_stopped_endpoint() function. So the xhci_endpoint_reset() function will
      refuse the reset and communication with device can not run over this endpoint.
      https://bugzilla.kernel.org/show_bug.cgi?id=60699Signed-off-by: NFlorian Wolter <wolly84@web.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      526867c3
    • S
      usb: Fix xHCI host issues on remote wakeup. · 8b3d4570
      Sarah Sharp 提交于
      When a device signals remote wakeup on a roothub, and the suspend change
      bit is set, the host controller driver must not give control back to the
      USB core until the port goes back into the active state.
      
      EHCI accomplishes this by waiting in the get port status function until
      the PORT_RESUME bit is cleared:
      
                              /* stop resume signaling */
                              temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME);
                              ehci_writel(ehci, temp, status_reg);
                              clear_bit(wIndex, &ehci->resuming_ports);
                              retval = ehci_handshake(ehci, status_reg,
                                              PORT_RESUME, 0, 2000 /* 2msec */);
      
      Similarly, the xHCI host should wait until the port goes into U0, before
      passing control up to the USB core.  When the port transitions from the
      RExit state to U0, the xHCI driver will get a port status change event.
      We need to wait for that event before passing control up to the USB
      core.
      
      After the port transitions to the active state, the USB core should time
      a recovery interval before it talks to the device.  The length of that
      recovery interval is TRSMRCY, 10 ms, mentioned in the USB 2.0 spec,
      section 7.1.7.7.  The previous xHCI code (which did not wait for the
      port to go into U0) would cause the USB core to violate that recovery
      interval.
      
      This bug caused numerous USB device disconnects on remote wakeup under
      ChromeOS and a Lynx Point LP xHCI host that takes up to 20 ms to move
      from RExit to U0.  ChromeOS is very aggressive about power savings, and
      sets the autosuspend_delay to 100 ms, and disables USB persist.
      
      I attempted to replicate this bug with Ubuntu 12.04, but could not.  I
      used Ubuntu 12.04 on the same platform, with the same BIOS that the bug
      was triggered on ChromeOS with.  I also changed the USB sysfs settings
      as described above, but still could not reproduce the bug under Ubuntu.
      It may be that ChromeOS userspace triggers this bug through additional
      settings.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      8b3d4570
    • M
      xhci: Ensure a command structure points to the correct trb on the command ring · ec7e43e2
      Mathias Nyman 提交于
      If a command on the command ring needs to be cancelled before it is handled
      it can be turned to a no-op operation when the ring is stopped.
      We want to store the command ring enqueue pointer in the command structure
      when the command in enqueued for the cancellation case.
      
      Some commands used to store the command ring dequeue pointers instead of enqueue
      (these often worked because enqueue happends to equal dequeue quite often)
      
      Other commands correctly used the enqueue pointer but did not check if it pointed
      to a valid trb or a link trb, this caused for example stop endpoint command to timeout in
      xhci_stop_device() in about 2% of suspend/resume cases.
      
      This should also solve some weird behavior happening in command cancellation cases.
      
      This patch is based on a patch submitted by Sarah Sharp to linux-usb, but
      then forgotten:
          http://marc.info/?l=linux-usb&m=136269803207465&w=2
      
      This patch should be backported to kernels as old as 3.7, that contain
      the commit b92cc66c "xHCI: add aborting
      command ring function"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      ec7e43e2
    • M
      xhci: Fix oops happening after address device timeout · 284d2055
      Mathias Nyman 提交于
      When a command times out, the command ring is first aborted,
      and then stopped. If the command ring is empty when it is stopped
      the stop event will point to next command which is not yet set.
      xHCI tries to handle this next event often causing an oops.
      
      Don't handle command completion events on stopped cmd ring if ring is
      empty.
      
      This patch should be backported to kernels as old as 3.7, that contain
      the commit b92cc66c "xHCI: add aborting
      command ring function"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Reported-by: NGiovanni <giovanni.nervi@yahoo.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      284d2055
  5. 18 9月, 2013 2 次提交
  6. 13 9月, 2013 1 次提交
  7. 31 8月, 2013 5 次提交
  8. 29 8月, 2013 1 次提交
    • S
      xhci: Fix warning introduced by disabling runtime PM. · e7ecf069
      Sarah Sharp 提交于
      The 0day build server caught a new build warning that is triggered when
      CONFIG_USB_DEFAULT_PERSIST is turned on:
      
      tree:   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git for-usb-next
      head:   0730d52a
      commit: c8476fb8 [1/3] usb: xhci: Disable runtime PM suspend for quirky controllers
      config: i386-randconfig-r6-0826 (attached as .config)
      
      All warnings:
      
         drivers/usb/host/xhci.c: In function 'xhci_free_dev':
      >> drivers/usb/host/xhci.c:3560:17: warning: unused variable 'dev' [-Wunused-variable]
           struct device *dev = hcd->self.controller;
                          ^
         drivers/usb/host/xhci.c: In function 'xhci_alloc_dev':
      >> drivers/usb/host/xhci.c:3648:17: warning: unused variable 'dev' [-Wunused-variable]
           struct device *dev = hcd->self.controller;
                          ^
      
      vim +/dev +3560 drivers/usb/host/xhci.c
      
        3554   * disabled.  Free any HC data structures associated with that device.
        3555   */
        3556  void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
        3557  {
        3558          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
        3559          struct xhci_virt_device *virt_dev;
      > 3560          struct device *dev = hcd->self.controller;
        3561          unsigned long flags;
        3562          u32 state;
        3563          int i, ret;
        3564
        3565  #ifndef CONFIG_USB_DEFAULT_PERSIST
        3566          /*
        3567           * We called pm_runtime_get_noresume when the device was attached.
        3568           * Decrement the counter here to allow controller to runtime suspend
        3569           * if no devices remain.
        3570           */
        3571          if (xhci->quirks & XHCI_RESET_ON_RESUME)
        3572                  pm_runtime_put_noidle(dev);
        3573  #endif
        3574
      ...
        3641  /*
        3642   * Returns 0 if the xHC ran out of device slots, the Enable Slot command
        3643   * timed out, or allocating memory failed.  Returns 1 on success.
        3644   */
        3645  int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
        3646  {
        3647          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
      > 3648          struct device *dev = hcd->self.controller;
        3649          unsigned long flags;
        3650          int timeleft;
        3651          int ret;
      
      Fix this.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Shawn Nematbakhsh <shawnn@chromium.org>
      e7ecf069
  9. 28 8月, 2013 2 次提交
  10. 27 8月, 2013 4 次提交
  11. 24 8月, 2013 3 次提交
  12. 16 8月, 2013 1 次提交
    • S
      xhci-plat: Don't enable legacy PCI interrupts. · 52fb6125
      Sarah Sharp 提交于
      The xHCI platform driver calls into usb_add_hcd to register the irq for
      its platform device.  It does not want the xHCI generic driver to
      register an interrupt for it at all.  The original code did that by
      setting the XHCI_BROKEN_MSI quirk, which tells the xHCI driver to not
      enable MSI or MSI-X for a PCI host.
      
      Unfortunately, if CONFIG_PCI is enabled, and CONFIG_USB_DW3 is enabled,
      the xHCI generic driver will attempt to register a legacy PCI interrupt
      for the xHCI platform device in xhci_try_enable_msi().  This will result
      in a bogus irq being registered, since the underlying device is a
      platform_device, not a pci_device, and thus the pci_device->irq pointer
      will be bogus.
      
      Add a new quirk, XHCI_PLAT, so that the xHCI generic driver can
      distinguish between a PCI device that can't handle MSI or MSI-X, and a
      platform device that should not have its interrupts touched at all.
      This quirk may be useful in the future, in case other corner cases like
      this arise.
      
      This patch should be backported to kernels as old as 3.9, that
      contain the commit 00eed9c8 "USB: xhci:
      correctly enable interrupts".
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Reported-by: NYu Y Wang <yu.y.wang@intel.com>
      Tested-by: NYu Y Wang <yu.y.wang@intel.com>
      Reviewed-by: NFelipe Balbi <balbi@ti.com>
      Cc: stable@vger.kernel.org
      52fb6125
  13. 15 8月, 2013 1 次提交
  14. 14 8月, 2013 8 次提交
    • X
      xhci: fix dma mask setup in xhci.c · c10cf118
      Xenia Ragiadakou 提交于
      The function dma_set_mask() tests internally whether the dma_mask pointer
      for the device is initialized and fails if the dma_mask pointer is NULL.
      On pci platforms, the device dma_mask pointer is initialized, when pci
      devices are enumerated, to point to the pci_dev->dma_mask which is 0xffffffff.
      However, for non-pci platforms, the dma_mask pointer may not be initialized
      and in that case dma_set_mask() will fail.
      
      This patch initializes the dma_mask and the coherent_dma_mask to 32bits
      in xhci_plat_probe(), before the call to usb_create_hcd() that sets the
      "uses_dma" flag for the usb bus and the call to usb_add_hcd() that creates
      coherent dma pools for the usb hcd.
      
      Moreover, a call to dma_set_mask() does not set the device coherent_dma_mask.
      Since the xhci-hcd driver calls dma_alloc_coherent() and dma_pool_alloc()
      to allocate consistent DMA memory blocks, the coherent DMA address mask
      has to be set explicitly.
      
      This patch sets the coherent_dma_mask to 64bits in xhci_gen_setup() when
      the xHC is capable for 64-bit DMA addressing.
      
      If dma_set_mask() succeeds, for a given bitmask, it is guaranteed that
      the given bitmask is also supported for consistent DMA mappings.
      
      Other changes introduced in this patch are:
      
      - The return value of dma_set_mask() is checked to ensure that the required
        dma bitmask conforms with the host system's addressing capabilities.
      
      - The dma_mask setup code for the non-primary hcd was removed since both
        primary and non-primary hcd refer to the same generic device whose
        dma_mask and coherent_dma_mask are already set during the setup of
        the primary hcd.
      
      - The code for reading the HCCPARAMS register to find out the addressing
        capabilities of xHC was removed since its value is already cached in
        xhci->hccparams.
      
      - hcd->self.controller was replaced with the dev variable since it is
        already available.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      c10cf118
    • X
      xhci: trace debug statements related to ring expansion · 68ffb011
      Xenia Ragiadakou 提交于
      This patch defines a new trace event, which is called xhci_dbg_ring_expansion
      and belongs to the event class xhci_log_msg, and adds tracepoints that trace
      the debug messages associated with the expansion of endpoint ring when there
      is not enough space allocated to hold all pending TRBs.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      68ffb011
    • X
      xhci: trace debug messages related to driver initialization and unload · d195fcff
      Xenia Ragiadakou 提交于
      This patch defines a new trace event, which is called xhci_dbg_init
      and belongs to the event class xhci_log_msg, and adds tracepoints that
      trace the debug statements in the functions used to start and stop the
      xhci-hcd driver.
      
      Also, it removes an unnecessary cast of variable val to unsigned int
      in xhci_mem_init(), since val is already declared as unsigned int.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      d195fcff
    • X
      xhci: trace debug statements for urb cancellation · aa50b290
      Xenia Ragiadakou 提交于
      This patch defines a new trace event, which is called xhci_dbg_cancel_urb
      and belongs to the event class xhci_log_msg, and adds tracepoints that
      trace the debug messages related to the removal of a cancelled URB from
      the endpoint's transfer ring.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      aa50b290
    • X
      xhci: add xhci_cmd_completion trace event · 63a23b9a
      Xenia Ragiadakou 提交于
      This patch creates a new event class, called xhci_log_event,
      and defines the xhci_cmd_completion trace event used for
      tracing the commands issued to xHC that generate a completion
      event in the event ring.
      
      This info can be used, later, to print, in a human readable
      way, the completion status and flags as well as the command's
      type and fields using the trace-cmd tool and the appropriate
      plugin.
      
      Also, a tracepoint is added in handle_cmd_completion().
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      63a23b9a
    • X
      xhci: add xhci_address_ctx trace event · 1d27fabe
      Xenia Ragiadakou 提交于
      This patch defines a new event class, called xhci_log_ctx,
      that records in the ring buffer the context data, the
      context type (input or output), the context dma and virtual
      addresses, the context endpoint entries, the slot ID and
      whether the xHC uses 64 byte context data structures.
      
      This information can be used, later, to parse and display
      the context data fields with the appropriate plugin using
      the trace-cmd tool.
      
      Also, this patch defines a trace event, called xhci_address_ctx,
      to trace the contexts related to the Address Device command and
      adds the associated tracepoints in xhci_address_device().
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      1d27fabe
    • X
      xhci: add trace for debug messages related to endpoint reset · a0254324
      Xenia Ragiadakou 提交于
      This patch defines a new trace event, which is called xhci_dbg_reset_ep
      and belongs in the event class xhci_log_msg, and adds tracepoints that
      trace the debug messages associated with resetting an endpoint after
      the reception of a STALL packet.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      a0254324
    • X
      xhci: add trace for debug messages related to quirks · 4bdfe4c3
      Xenia Ragiadakou 提交于
      This patch defines a new trace event, which is called xhci_dbg_quirks
      and belongs in the event class xhci_log_msg, and adds tracepoints that
      trace the debug messages associated with xHCs' quirks.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      4bdfe4c3