1. 03 5月, 2011 1 次提交
    • M
      xhci: Make xHCI driver endian-safe · 28ccd296
      Matt Evans 提交于
      This patch changes the struct members defining access to xHCI device-visible
      memory to use __le32/__le64 where appropriate, and then adds swaps where
      required.  Checked with sparse that all accesses are correct.
      
      MMIO accesses use readl/writel so already are performed LE, but prototypes
      now reflect this with __le*.
      
      There were a couple of (debug) instances of DMA pointers being truncated to
      32bits which have been fixed too.
      Signed-off-by: NMatt Evans <matt@ozlabs.org>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      28ccd296
  2. 30 4月, 2011 4 次提交
  3. 15 4月, 2011 1 次提交
    • G
      Revert "USB: isp1760-hcd: move imask clear after pending work is done" · 753d8534
      Greg Kroah-Hartman 提交于
      This reverts commit 58085446.
      
      To quote Richard:
      	I don't think this should be mainlined. It was a
      	misunderstanding on my part.  If you see all the other hdc
      	drivers in the same location, they all do the same thing (i.e.
      	clear the interrupt status first, then do the work) that
      	"glitch" I think I saw was actually two back-to-back
      	interrupts.
      
      	Sebastian (the original author of isp1760) explained it to me a
      	few days after my submission.
      
      	sorry for the confusion
      
      Cc: Richard Retanubun <RichardRetanubun@ruggedcom.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      753d8534
  4. 14 4月, 2011 23 次提交
    • G
      USB: ohci: add bus glue for the Atheros AR71XX/AR7240 SoCs · 90e6ca5c
      Gabor Juhos 提交于
      The Atheros AR71XX/AR7240 SoCs have a built-in OHCI controller.
      This patch adds the necessary glue code to make the generic OHCI
      driver usable for them.
      Signed-off-by: NGabor Juhos <juhosg@openwrt.org>
      Signed-off-by: NImre Kaloz <kaloz@openwrt.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      90e6ca5c
    • G
      USB: ehci: add workaround for Synopsys HC bug · 2f7ac6c1
      Gabor Juhos 提交于
      A Synopsys USB core used in various SoCs has a bug which might cause
      that the host controller not issuing ping.
      
      When software uses the Doorbell mechanism to remove queue heads, the
      host controller still has references to the removed queue head even
      after indicating an Interrupt on Async Advance. This happens if the last
      executed queue head's Next Link queue head is removed.
      
      Consequences of the defect:
      The Host controller fetches the removed queue head, using memory that
      would otherwise be deallocated.This results in incorrect transactions on
      both the USB and system memory. This may result in undefined behavior.
      
      Workarounds:
      
      1) If no queue head is active (no Status field's Active bit is set)
      after removing the queue heads, the software can write one of the valid
      queue head addresses to the ASYNCLISTADDR register and deallocate the
      removed queue head's memory after 2 microframes.
      
      If one or more of the queue heads is active (the Active bit is set in
      the Status field) after removing the queue heads, the software can delay
      memory deallocation after time X, where X is the time required for the
      Host Controller to go through all the queue heads once. X varies with
      the number of queue heads and the time required to process periodic
      transactions: if more periodic transactions must be performed, the Host
      Controller has less time to process asynchronous transaction processing.
      
      2) Do not use the Doorbell mechanism to remove the queue heads. Disable
      the Asynchronous Schedule Enable bit instead.
      
      The bug has been discussed on the linux-usb-devel mailing-list
      four years ago, the original thread can be found here:
      http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg45345.html
      
      This patch implements the first workaround as suggested by David Brownell.
      
      The built-in USB host controller of the Atheros AR7130/AR7141/AR7161 SoCs
      requires this to work properly.
      Signed-off-by: NGabor Juhos <juhosg@openwrt.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2f7ac6c1
    • G
      USB: ehci: add bus glue for the Atheros AR71XX/AR724X/AR91XX SoCs · 502fa841
      Gabor Juhos 提交于
      The Atheros AR71XX/AR91XX SoCs have a built-in EHCI controller.
      This patch adds the necessary glue code to make the generic EHCI
      driver usable for them.
      Signed-off-by: NGabor Juhos <juhosg@openwrt.org>
      Signed-off-by: NImre Kaloz <kaloz@openwrt.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      502fa841
    • A
      xHCI: Implement AMD PLL quirk · c41136b0
      Andiry Xu 提交于
      This patch disable the optional PM feature inside the Hudson3 platform under
      the following conditions:
      
      1. If an isochronous device is connected to xHCI port and is active;
      2. Optional PM feature that powers down the internal Bus PLL when the link is
         in low power state is enabled.
      
      The PM feature needs to be disabled to eliminate PLL startup delays when the
      link comes out of low power state. The performance of DMA data transfer could
      be impacted if system delay were encountered and in addition to the PLL start
      up delays. Disabling the PM would leave room for unpredictable system delays
      in order to guarantee uninterrupted data transfer to isochronous audio or
      video stream devices that require time sensitive information. If data in an
      audio/video stream was interrupted then erratic audio or video performance
      may be encountered.
      
      AMD PLL quirk is already implemented in OHCI/EHCI driver. After moving the
      quirk code to pci-quirks.c and export them, xHCI driver can call it directly
      without having the quirk implementation in itself.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      c41136b0
    • S
      xhci: Tell USB core both roothubs lost power. · fedd383e
      Sarah Sharp 提交于
      On a resume, when the power is lost during hibernate, the USB core will
      call hub_reset_resume for the xHCI USB 2.0 roothub, but not for the USB
      3.0 roothub:
      
      [  164.748310] usb usb1: root hub lost power or was reset
      [  164.748353] usb usb2: root hub lost power or was reset
      [  164.748487] usb usb3: root hub lost power or was reset
      [  164.748488] xhci_hcd 0000:01:00.0: Stop HCD
      ...
      [  164.870039] hub 4-0:1.0: hub_resume
      ...
      [  164.870054] hub 3-0:1.0: hub_reset_resume
      
      This causes issues later, because the USB core assumes the USB 3.0 hub
      attached to the USB 3.0 roothub is still active.  It attempts to queue a
      control URB for the external hub, which fails because all the device
      slot contexts were released when the USB 3.0 roothub lost power:
      
      [  164.980044] hub 4-1:1.0: hub_resume
      [  164.980047] xhci_hcd 0000:01:00.0: Get port status returned 0x10101
      [  164.980049] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980053] hub 3-0:1.0: port 1: status 0101 change 0001
      [  164.980056] hub 4-1:1.0: hub_port_status failed (err = -22)
      [  164.980060] xhci_hcd 0000:01:00.0: `MEM_WRITE_DWORD(3'b000, 32'hffffc90008948440, 32'h202e1, 4'hf);
      [  164.980062] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980066] xhci_hcd 0000:01:00.0: clear port connect change, actual port 0 status  = 0x2e1
      [  164.980069] hub 4-1:1.0: hub_port_status failed (err = -22)
      [  164.980072] xhci_hcd 0000:01:00.0: get port status, actual port 1 status  = 0x2a0
      [  164.980074] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980077] xhci_hcd 0000:01:00.0: Get port status returned 0x100
      [  164.980079] hub 4-1:1.0: hub_port_status failed (err = -22)
      [  164.980082] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980085] hub 4-1:1.0: hub_port_status failed (err = -22)
      [  164.980088] hub 4-1:1.0: port 4: status 0000 change 0000
      [  164.980091] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980094] hub 4-1:1.0: activate --> -22
      [  164.980113] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980117] hub 4-1:1.0: hub_port_status failed (err = -22)
      [  164.980119] xHCI xhci_urb_enqueue called with unaddressed device
      [  164.980123] hub 4-1:1.0: can't resume port 4, status -22
      [  164.980126] hub 4-1:1.0: port 4 status ffff.ffff after resume, -22
      [  164.980129] usb 4-1.4: can't resume, status -22
      [  164.980131] hub 4-1:1.0: logical disconnect on port 4
      
      This causes issues when a USB 3.0 hard drive is attached to the external
      USB 3.0 hub when the system is hibernated:
      
      [ 6249.849653] sd 8:0:0:0: [sdb] Unhandled error code
      [ 6249.849659] sd 8:0:0:0: [sdb]  Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
      [ 6249.849663] sd 8:0:0:0: [sdb] CDB: Read(10): 28 00 00 00 2a 08 00 00 02 00
      [ 6249.849671] end_request: I/O error, dev sdb, sector 10760
      
      Make sure to inform the USB core that *both* xHCI roothubs lost power.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      fedd383e
    • D
      USB: xhci - also free streams when resetting devices · 2dea75d9
      Dmitry Torokhov 提交于
      Currently, when resetting a device, xHCI driver disables all but one
      endpoints and frees their rings, but leaves alone any streams that
      might have been allocated. Later, when users try to free allocated
      streams, we oops in xhci_setup_no_streams_ep_input_ctx() because
      ep->ring is NULL.
      
      Let's free not only rings but also stream data as well, so that
      calling free_streams() on a device that was reset will be safe.
      
      This should be queued for stable trees back to 2.6.35.
      Reviewed-by: NMicah Elizabeth Scott <micah@vmware.com>
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      2dea75d9
    • J
      USB: Add initial S5P EHCI driver · 1bcc5aa8
      Joonyoung Shim 提交于
      This patch adds host USB high speed driver for samsung S5P series. This
      is initial driver and we need additional implementation to support some
      functions like power management.
      Signed-off-by: NJingoo Han <jg1.han@samsung.com>
      Signed-off-by: NJoonyoung Shim <jy0922.shim@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1bcc5aa8
    • F
      USB: Mark ehci_adjust_port_wakeup_flags as __maybe_unused · 0b0cd6c8
      Fabio Estevam 提交于
      Mark ehci_adjust_port_wakeup_flags as __maybe_unused to avoid the following
      warning when building the ehci-mxc driver:
      
        CC      drivers/usb/host/ehci-hcd.o
      drivers/usb/host/ehci-hub.c:130: warning: 'ehci_adjust_port_wakeup_flags' defined but not used
      
      Current ehci-mxc driver implementation does not support suspend/resume.
      Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0b0cd6c8
    • M
      usb: u132-hcd: Drop __TIME__ usage · 654d121a
      Michal Marek 提交于
      The kernel already prints its build timestamp during boot, no need to
      repeat it in random drivers and produce different object files each
      time.
      
      Cc: Tony Olech <tony.olech@elandigitalsystems.com>
      Cc: linux-usb@vger.kernel.org
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      654d121a
    • A
      USB: UHCI: don't try to revive a dead controller · 99083f16
      Alan Stern 提交于
      This patch (as1457) abandons the curious strategy of declaring a
      controller dead following hibernation merely in order to reset and
      then revive it.  The core no longer allow dead controllers to spring
      back to life when the system resumes, so there's no reason to declare
      a working controller temporarily dead.  Instead we do an explicit
      reset.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      99083f16
    • A
      USB: UHCI: remove uses of hcd->state · 7d670a2e
      Alan Stern 提交于
      This patch (as1456) removes all uses of hcd->state from the uhci-hcd
      driver, as part of the overall strategy to eliminate hcd->state
      completely.  Now when a controller dies we call usb_hc_died()
      directly, instead of relying on the core interrupt handler to see that
      hcd->state has changed to HC_STATE_HALT and make the call for us.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7d670a2e
    • M
      USB: sl811: add Kconfig option for ISOCHRONOUS mode · ad7c56f0
      Mike Frysinger 提交于
      Some bluetooth dongles want ISO mode, and the limited support that the
      sl811 offers today is sufficient.  So add a Kconfig option for people
      to optionally get access to the partial functionality.
      Signed-off-by: NMike Frysinger <vapier@gentoo.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ad7c56f0
    • S
      xhci: Fix NULL pointer deref in handle_port_status() · 386139d7
      Sarah Sharp 提交于
      When we get a port status change event, we need to figure out what type of
      port it came from: a USB 3.0 port, or a USB 2.0/1.1 port.  We can't know
      which usb_hcd to use until that point, so hcd will be NULL for part of the
      function.  Unfortunately, if any of the sanity checks fail, we'll jump to
      the cleanup label before hcd is set to a valid pointer, and then we'll
      attempt to tell the USB core to kick the hcd, which is NULL.
      
      Skip kicking the roothub if the sanity checks fail.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      386139d7
    • D
      USB: xhci - fix math in xhci_get_endpoint_interval() · dfa49c4a
      Dmitry Torokhov 提交于
      When parsing exponent-expressed intervals we subtract 1 from the
      value and then expect it to match with original + 1, which is
      highly unlikely, and we end with frequent spew:
      
      	usb 3-4: ep 0x83 - rounding interval to 512 microframes
      
      Also, parsing interval for fullspeed isochronous endpoints was
      incorrect - according to USB spec they use exponent-based
      intervals (but xHCI spec claims frame-based intervals). I trust
      USB spec more, especially since USB core agrees with it.
      
      This should be queued for stable kernels back to 2.6.31.
      Reviewed-by: NMicah Elizabeth Scott <micah@vmware.com>
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      dfa49c4a
    • D
      USB: xhci: simplify logic of skipping missed isoc TDs · 926008c9
      Dmitry Torokhov 提交于
      The logic of the handling Missed Service Error Events was pretty
      confusing as we were checking the same condition several times.
      In addition, it caused compiler warning since the compiler could
      not figure out that event_trb is actually unused in case we are
      skipping current TD.
      
      Fix that by rearranging "skip" condition checks, and factor out
      skip_isoc_td() so that it is called explicitly.
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      926008c9
    • D
      USB: xhci - remove excessive 'inline' markings · 575688e1
      Dmitry Torokhov 提交于
      Remove 'inline' markings from file-local functions and let compiler
      do its job and inline what makes sense for given architecture.
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      575688e1
    • D
      USB: xhci: unsigned char never equals -1 · 22e04870
      Dan Carpenter 提交于
      There were some places that compared port_speed == -1 where port_speed
      is a u8.  This doesn't work unless we cast the -1 to u8.  Some places
      did it correctly.
      
      Instead of using -1 directly, I've created a DUPLICATE_ENTRY define
      which does the cast and is more descriptive as well.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      22e04870
    • D
      USB: xhci - fix unsafe macro definitions · 5a6c2f3f
      Dmitry Torokhov 提交于
      Macro arguments used in expressions need to be enclosed in parenthesis
      to avoid unpleasant surprises.
      
      This should be queued for kernels back to 2.6.31
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      5a6c2f3f
    • R
      USB: isp1760-hcd: move imask clear after pending work is done · 58085446
      Richard Retanubun 提交于
      This patch moves the HcInterrupt register write to clear the
      pending interrupt to after the isr work is done, doing this removes
      glitches in the irq line.
      Signed-off-by: NRichard Retanubun <richardretanubun@ruggedcom.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      58085446
    • J
      USB host: Fix lockdep warning in AMD PLL quirk · 9ab7927b
      Joerg Roedel 提交于
      Booting latest kernel on my test machine produces a lockdep
      warning from the usb_amd_find_chipset_info() function:
      
       WARNING: at /data/lemmy/linux.trees.git/kernel/lockdep.c:2465 lockdep_trace_alloc+0x95/0xc2()
       Hardware name: Snook
       Modules linked in:
       Pid: 959, comm: work_for_cpu Not tainted 2.6.39-rc2+ #22
       Call Trace:
        [<ffffffff8103c0d4>] warn_slowpath_common+0x80/0x98
        [<ffffffff812387e6>] ? T.492+0x24/0x26
        [<ffffffff8103c101>] warn_slowpath_null+0x15/0x17
        [<ffffffff81068667>] lockdep_trace_alloc+0x95/0xc2
        [<ffffffff810ed9ac>] slab_pre_alloc_hook+0x18/0x3b
        [<ffffffff810ef227>] kmem_cache_alloc_trace+0x25/0xba
        [<ffffffff812387e6>] T.492+0x24/0x26
        [<ffffffff81238816>] pci_get_subsys+0x2e/0x73
        [<ffffffff8123886c>] pci_get_device+0x11/0x13
        [<ffffffff814082a9>] usb_amd_find_chipset_info+0x3f/0x18a
      ...
      
      It turns out that this function calls pci_get_device under a spin_lock
      with irqs disabled, but the pci_get_device function is only allowed in
      preemptible context.
      
      This patch fixes the warning by making all data-structure
      modifications on temporal storage and commiting this back
      into the visible structure at the end. While at it, this
      patch also moves the pci_dev_put calls out of the spinlocks
      because this function might sleep too.
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9ab7927b
    • Y
      USB: ohci-au1xxx: fix warning "__BIG_ENDIAN" is not defined · 0fdf65c3
      Yoichi Yuasa 提交于
      In file included from drivers/usb/host/ohci-hcd.c:1028:0:
      drivers/usb/host/ohci-au1xxx.c:36:7: warning: "__BIG_ENDIAN" is not defined
      Signed-off-by: NYoichi Yuasa <yuasa@linux-mips.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0fdf65c3
    • A
      USB: EHCI: unlink unused QHs when the controller is stopped · 94ae4976
      Alan Stern 提交于
      This patch (as1458) fixes a problem affecting ultra-reliable systems:
      When hardware failover of an EHCI controller occurs, the data
      structures do not get released correctly.  This is because the routine
      responsible for removing unused QHs from the async schedule assumes
      the controller is running properly (the frame counter is used in
      determining how long the QH has been idle) -- but when a failover
      causes the controller to be electronically disconnected from the PCI
      bus, obviously it stops running.
      
      The solution is simple: Allow scan_async() to remove a QH from the
      async schedule if it has been idle for long enough _or_ if the
      controller is stopped.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-Tested-by: NDan Duval <dan.duval@stratus.com>
      CC: <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      94ae4976
    • R
      usb: fix ips1760-hcd printk format warning · d06847fe
      Randy Dunlap 提交于
      Fix printk format build warning and grammar typo on same line.
      
      drivers/usb/host/isp1760-hcd.c:300: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'size_t'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d06847fe
  5. 31 3月, 2011 1 次提交
  6. 29 3月, 2011 1 次提交
  7. 24 3月, 2011 1 次提交
    • A
      ehci-hcd: Bug fix: don't set a QH's Halt bit · b5a3b3d9
      Alan Stern 提交于
      This patch (as1453) fixes a long-standing bug in the ehci-hcd driver.
      
      There is no need to set the Halt bit in the overlay region for an
      unlinked or blocked QH.  Contrary to what the comment says, setting
      the Halt bit does not cause the QH to be patched later; that decision
      (made in qh_refresh()) depends only on whether the QH is currently
      pointing to a valid qTD.  Likewise, setting the Halt bit does not
      prevent completions from activating the QH while it is "stopped"; they
      are prevented by the fact that qh_completions() temporarily changes
      qh->qh_state to QH_STATE_COMPLETING.
      
      On the other hand, there are circumstances in which the QH will be
      reactivated _without_ being patched; this happens after an URB beyond
      the head of the queue is unlinked.  Setting the Halt bit will then
      cause the hardware to see the QH with both the Active and Halt bits
      set, an invalid combination that will prevent the queue from
      advancing and may even crash some controllers.
      
      Apparently the only reason this hasn't been reported before is that
      unlinking URBs from the middle of a running queue is quite uncommon.
      However Test 17, recently added to the usbtest driver, does exactly
      this, and it confirms the presence of the bug.
      
      In short, there is no reason to set the Halt bit for an unlinked or
      blocked QH, and there is a very good reason not to set it.  Therefore
      the code that sets it is removed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NAndiry Xu <andiry.xu@amd.com>
      CC: David Brownell <david-b@pacbell.net>
      CC: <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b5a3b3d9
  8. 23 3月, 2011 2 次提交
  9. 14 3月, 2011 6 次提交
    • S
      xhci: Clean up cycle bit math used during stalls. · ba0a4d9a
      Sarah Sharp 提交于
      Use XOR to invert the cycle bit, instead of a more complicated
      calculation.  Eliminate a check for the link TRB type in find_trb_seg().
      We know that there will always be a link TRB at the end of a segment, so
      xhci_segment->trbs[TRBS_PER_SEGMENT - 1] will always have a link TRB type.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NTakashi Iwai <tiwai@suse.de>
      ba0a4d9a
    • S
      xhci: Fix cycle bit calculation during stall handling. · 01a1fdb9
      Sarah Sharp 提交于
      When an endpoint stalls, we need to update the xHCI host's internal
      dequeue pointer to move it past the stalled transfer.  This includes
      updating the cycle bit (TRB ownership bit) if we have moved the dequeue
      pointer past a link TRB with the toggle cycle bit set.
      
      When we're trying to find the new dequeue segment, find_trb_seg() is
      supposed to keep track of whether we've passed any link TRBs with the
      toggle cycle bit set.  However, this while loop's body
      
      	while (cur_seg->trbs > trb ||
      			&cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {
      
      Will never get executed if the ring only contains one segment.
      find_trb_seg() will return immediately, without updating the new cycle
      bit.  Since find_trb_seg() has no idea where in the segment the TD that
      stalled was, make the caller, xhci_find_new_dequeue_state(), check for
      this special case and update the cycle bit accordingly.
      
      This patch should be queued to kernels all the way back to 2.6.31.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NTakashi Iwai <tiwai@suse.de>
      Cc: stable@kernel.org
      01a1fdb9
    • S
      xhci: Update internal dequeue pointers after stalls. · bf161e85
      Sarah Sharp 提交于
      When an endpoint stalls, the xHCI driver must move the endpoint ring's
      dequeue pointer past the stalled transfer.  To do that, the driver issues
      a Set TR Dequeue Pointer command, which will complete some time later.
      
      Takashi was having issues with USB 1.1 audio devices that stalled, and his
      analysis of the code was that the old code would not update the xHCI
      driver's ring dequeue pointer after the command completes.  However, the
      dequeue pointer is set in xhci_find_new_dequeue_state(), just before the
      set command is issued to the hardware.
      
      Setting the dequeue pointer before the Set TR Dequeue Pointer command
      completes is a dangerous thing to do, since the xHCI hardware can fail the
      command.  Instead, store the new dequeue pointer in the xhci_virt_ep
      structure, and update the ring's dequeue pointer when the Set TR dequeue
      pointer command completes.
      
      While we're at it, make sure we can't queue another Set TR Dequeue Command
      while the first one is still being processed.  This just won't work with
      the internal xHCI state code.  I'm still not sure if this is the right
      thing to do, since we might have a case where a driver queues multiple
      URBs to a control ring, one of the URBs Stalls, and then the driver tries
      to cancel the second URB.  There may be a race condition there where the
      xHCI driver might try to issue multiple Set TR Dequeue Pointer commands,
      but I would have to think very hard about how the Stop Endpoint and
      cancellation code works.  Keep the fix simple until when/if we run into
      that case.
      
      This patch should be queued to kernels all the way back to 2.6.31.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NTakashi Iwai <tiwai@suse.de>
      Cc: stable@kernel.org
      bf161e85
    • S
      USB: Remove bogus USB_PORT_STAT_SUPER_SPEED symbol. · 131dec34
      Sarah Sharp 提交于
      USB_PORT_STAT_SUPER_SPEED is a made up symbol that the USB core used to
      track whether USB ports had a SuperSpeed device attached.  This is a
      linux-internal symbol that was used when SuperSpeed and non-SuperSpeed
      devices would show up under the same xHCI roothub.  This particular
      port status is never returned by external USB 3.0 hubs.  (Instead they
      have a USB_PORT_STAT_SPEED_5GBPS that uses a completely different speed
      mask.)
      
      Now that the xHCI driver registers two roothubs, USB 3.0 devices will only
      show up under USB 3.0 hubs.  Rip out USB_PORT_STAT_SUPER_SPEED and replace
      it with calls to hub_is_superspeed().
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      131dec34
    • S
      xhci: Return canceled URBs immediately when host is halted. · c6cc27c7
      Sarah Sharp 提交于
      When the xHCI host controller is halted, it won't respond to commands
      placed on the command ring.  So if an URB is cancelled after the first
      roothub is deallocated, it will try to place a stop endpoint command on
      the command ring, which will fail.  The command watchdog timer will fire
      after five seconds, and the host controller will be marked as dying, and
      all URBs will be completed.
      
      Add a flag to the xHCI's internal state variable for when the host
      controller is halted.  Immediately return the canceled URB if the host
      controller is halted.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      c6cc27c7
    • S
      xhci: Fixes for suspend/resume of shared HCDs. · b3209379
      Sarah Sharp 提交于
      Make sure the HCD_FLAG_HW_ACCESSIBLE flag is mirrored by both roothubs,
      since it refers to whether the shared hardware is accessible.  Make sure
      each bus is marked as suspended by setting usb_hcd->state to
      HC_STATE_SUSPENDED when the PCI host controller is resumed.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      b3209379