1. 17 7月, 2012 14 次提交
    • A
      USB: EHCI: use hrtimer for controller death · bf6387bc
      Alan Stern 提交于
      This patch (as1578) adds an hrtimer event to handle the death of an
      EHCI controller.  When a controller dies, it doesn't necessarily stop
      running right away.  The new event polls at 1-ms intervals to see when
      all activity has safely stopped.  This replaces a busy-wait polling
      loop in the current code.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bf6387bc
    • A
      USB: EHCI: use hrtimer for interrupt QH unlink · df202255
      Alan Stern 提交于
      This patch (as1577) adds hrtimer support for unlinking interrupt QHs
      in ehci-hcd.  The current code relies on a fixed delay of either 2 or
      55 us, which is not always adequate and in any case is totally bogus.
      Thanks to internal caching, the EHCI hardware may continue to access
      an interrupt QH for more than a millisecond after it has been unlinked.
      
      In fact, the EHCI spec doesn't say how long to wait before using an
      unlinked interrupt QH.  The patch sets the delay to 9 microframes
      minimum, which ought to be adequate.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df202255
    • A
      USB: EHCI: use hrtimer for async schedule · 31446610
      Alan Stern 提交于
      This patch (as1576) adds hrtimer support for managing ehci-hcd's
      async schedule.  Just as with the earlier change to the periodic
      schedule management, two new hrtimer events take care of everything.
      
      One event polls at 1-ms intervals to see when the Asynchronous
      Schedule Status (ASS) flag matches the Asynchronous Schedule Enable
      (ASE) value; the schedule's state must not be changed until it does.
      The other event delays for 15 ms after the async schedule becomes
      empty before turning it off.
      
      The new events replace a busy-wait poll and a kernel timer usage.
      They also replace the rather illogical method currently used for
      indicating the async schedule should be turned off: attempting to
      unlink the dedicated QH at the head of the async list.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31446610
    • A
      USB: EHCI: remove PS3 status polling · 9671cd7a
      Alan Stern 提交于
      This patch (as1575) removes special code added for status polling of
      the EHCI controller in PS3 systems.  While the controller is running,
      the polling is now carried out by an hrtimer handler.  When the
      controller is suspending or stopping, we use the same polling routine
      as the old code -- but in neither case do we need to conclude that the
      controller has died if the polling goes on for too long.
      
      As a result the entire handshake_on_error_set_halt() routine is now
      unused, so it is removed from the driver.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9671cd7a
    • A
      USB: EHCI: return void instead of 0 · b015cb79
      Alan Stern 提交于
      This patch (as1574) changes the return type of multiple functions in
      ehci-sched.c from int to void.  The values they return are now always
      0, so there's no reason for them to return any value at all.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b015cb79
    • A
      USB: EHCI: use hrtimer for the periodic schedule · 3ca9aeba
      Alan Stern 提交于
      This patch (as1573) adds hrtimer support for managing ehci-hcd's
      periodic schedule.  There are two issues to deal with.
      
      First, the schedule's state (on or off) must not be changed until the
      hardware status has caught up with the current command.  This is
      handled by an hrtimer event that polls at 1-ms intervals to see when
      the Periodic Schedule Status (PSS) flag matches the Periodic Schedule
      Enable (PSE) value.
      
      Second, the schedule should not be turned off as soon as it becomes
      empty.  Turning the schedule on and off takes time, so we want to wait
      until the schedule has been empty for a suitable period before turning
      it off.  This is handled by an hrtimer event that gets set to expire
      10 ms after the periodic schedule becomes empty.
      
      The existing code polls (for up to 1125 us and with interrupts
      disabled!) to check the status, and doesn't implement a delay before
      turning off the schedule.  Furthermore, if the polling fails then the
      driver decides that the controller has died.  This has caused problems
      for several people; some controllers can take 10 ms or more to turn
      off their periodic schedules.
      
      This patch fixes these issues.  It also makes the "broken_periodic"
      workaround unnecessary; there is no longer any danger of turning off
      the periodic schedule after it has been on for less than 1 ms.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ca9aeba
    • A
      USB: EHCI: introduce high-res timer · d58b4bcc
      Alan Stern 提交于
      This patch (as1572) begins the conversion of ehci-hcd over to using
      high-resolution timers rather than old-fashioned low-resolution kernel
      timers.  This reduces overhead caused by timer roundoff on systems
      where HZ is smaller than 1000.  Also, the new timer framework
      introduced here is much more logical and easily extended than the
      ad-hoc approach ehci-hcd currently uses for timers.
      
      An hrtimer structure is added to ehci_hcd, along with a bitflag array
      and an array of ktime_t values, to keep track of which timing events
      are pending and what their expiration times are.
      
      Only the infrastructure for the timing operations is added in this
      patch.  Later patches will add routines for handling each of the
      various timing events the driver needs.  In some cases the new hrtimer
      handlers will replace the existing handlers for ehci-hcd's kernel
      timers; as this happens the old timers will be removed.  In other
      cases the new timing events will replace busy-wait loops.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d58b4bcc
    • A
      USB: EHCI: add new root-hub state: STOPPING · c0c53dbc
      Alan Stern 提交于
      This patch (as1571) adds a new state for ehci-hcd's root hubs:
      EHCI_RH_STOPPING.  This value is used at times when the root hub is
      being stopped and we don't know whether or not the hardware has
      finished all its DMA yet.
      
      Although the purpose may not be apparent, this distinction will come
      in useful later on.  Future patches will avoid actions that depend on
      the root hub being operational (like turning on the async or periodic
      schedules) when they see the state is EHCI_RH_STOPPING.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c0c53dbc
    • A
      USB: EHCI: add pointer to end of async-unlink list · 2f5bb665
      Alan Stern 提交于
      This patch (as1570) adds a pointer for the end of ehci-hcd's
      async-unlink list.  The list (which is actually a queue) is singly
      linked, so having a pointer to its end makes adding new entries easier
      -- there's no longer any need to scan through the whole list.
      
      In principle it could be changed to a standard doubly-linked list.  It
      turns out that doing so actually makes the code less clear, so I'm
      leaving it as is.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2f5bb665
    • A
      USB: EHCI: rename "reclaim" · 99ac5b1e
      Alan Stern 提交于
      This patch (as1569) renames the ehci->reclaim list in ehci-hcd.  The
      word "reclaim" is used in the EHCI specification to mean something
      quite different, and "unlink_next" is more descriptive of the list's
      purpose anyway.
      
      Similarly, the "reclaim" field in the ehci_stats structure is renamed
      "iaa", which is more meaningful (to experts, anyway) and is a better
      match for the "lost_iaa" field.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99ac5b1e
    • A
      USB: EHCI: add symbolic constants for QHs · 4c53de72
      Alan Stern 提交于
      This patch (as1568) introduces symbolic constants for some of the
      less-frequently used bitfields in the QH structure.  This makes the
      code a little easier to read and understand.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c53de72
    • A
      USB: EHCI: don't refcount QHs · c83e1a9f
      Alan Stern 提交于
      This patch (as1567) removes ehci-hcd's reference counting of QH
      structures.  It's not necessary to refcount these things because they
      always get deallocated at exactly one spot in ehci_endpoint_disable()
      (except for two special QHs, ehci->async and ehci->dummy) and are
      never used again.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c83e1a9f
    • A
      USB: EHCI: remove unneeded suspend/resume code · 15be105b
      Alan Stern 提交于
      This patch (as1566) removes the code in ehci-hcd's resume routines
      which tries to restart or cancel any transfers left active while the
      root hub or controller was asleep.  This code isn't necessary, because
      all URBs are terminated before the root hub is suspended.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15be105b
    • A
      USB: EHCI: initialize data before resetting hardware · 631fe9d9
      Alan Stern 提交于
      Currently, EHCI initialization turns off the controller (in case it
      was left running by the firmware) before setting up the ehci_hcd data
      structure.  This patch (as1565) reverses that order.
      
      Although it doesn't matter now, it will matter later on when future
      additions to ehci_halt() will want to acquire a spinlock that gets
      initialized by ehci_init().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      631fe9d9
  2. 10 7月, 2012 1 次提交
    • A
      EHCI: centralize controller initialization · 1a49e2ac
      Alan Stern 提交于
      This patch (as1564c) converts the EHCI platform drivers to use the
      central ehci_setup() routine for generic controller initialization
      rather than each having its own idiosyncratic approach.
      
      The major point of difficulty lies in ehci-pci's many vendor- and
      device-specific workarounds.  Some of them have to be applied before
      calling ehci_setup() and some after, which necessitates a fair amount
      of code motion.  The other platform drivers require much smaller
      changes.
      
      One point not addressed by the patch is whether ports should be
      powered on or off following initialization.  The different drivers
      appear to handle this pretty much at random.  In fact it shouldn't
      matter, because the hub driver turns on power to all ports when it
      binds to the root hub.  Straightening that out will be left for
      another day.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1a49e2ac
  3. 09 7月, 2012 2 次提交
    • A
      EHCI: centralize controller suspend/resume · c5cf9212
      Alan Stern 提交于
      This patch (as1563) removes a lot of duplicated code by moving the
      EHCI controller suspend/resume routines into the core driver, where
      the various platform drivers can invoke them as needed.
      
      Not only does this simplify these platform drivers, this also makes it
      easier for other platform drivers to add suspend/resume support in the
      future.
      
      Note: The patch does not touch the ehci-fsl.c file, because its
      approach to suspend and resume is so different from all the others.
      It will have to be handled specially by its maintainer.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c5cf9212
    • R
      mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix issues. · c05995c3
      Russ Dill 提交于
      'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue' (1fcb57d0) fixes
      an issue where the ULPI PHYs were not held in reset while initializing
      the EHCI controller. However, it also changes behavior in
      omap-usb-host.c omap_usbhs_init by releasing reset while the
      configuration in that function was done.
      
      This change caused a regression on BB-xM where USB would not function
      if 'usb start' had been run from u-boot before booting. A change was
      made to release reset a little bit earlier which fixed the issue on
      BB-xM and did not cause any regressions on 3430 sdp, the board for
      which the fix was originally made.
      
      This new fix, 'USB: EHCI: OMAP: Finish ehci omap phy reset cycle
      before adding hcd.', (3aa2ae74) caused a regression on OMAP5.
      
      The original fix to hold the EHCI controller in reset during
      initialization was correct, however it appears that changing
      omap_usbhs_init to not hold the PHYs in reset during it's
      configuration was incorrect. This patch first reverts both fixes, and
      then changes ehci_hcd_omap_probe in ehci-omap.c to hold the PHYs in
      reset as the original patch had done. It also is sure to incorporate
      the _cansleep change that has been made in the meantime.
      
      I've tested this on Beagleboard xM, I'd really like to get an ack from
      the 3430 sdp and OMAP5 guys before getting this merged.
      
      v3 - Brown paper bag its too early in the morning actually run
           git commit amend fix
      v2 - Put cansleep gpiolib call outside of spinlock
      Acked-by: NMantesh Sarashetti <mantesh@ti.com>
      Tested-by: NMantesh Sarashetti <mantesh@ti.com>
      Acked-by: NKeshava Munegowda <keshava_mgowda@ti.com>
      Tested-by: NKeshava Munegowda <keshava_mgowda@ti.com>
      Signed-off-by: NRuss Dill <Russ.Dill@gmail.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      c05995c3
  4. 07 7月, 2012 4 次提交
  5. 03 7月, 2012 2 次提交
    • S
      xhci: Fix hang on back-to-back Set TR Deq Ptr commands. · 0d9f78a9
      Sarah Sharp 提交于
      The Microsoft LifeChat 3000 USB headset was causing a very reproducible
      hang whenever it was plugged in.  At first, I thought the host
      controller was producing bad transfer events, because the log was filled
      with errors like:
      
      xhci_hcd 0000:00:14.0: ERROR Transfer event TRB DMA ptr not part of current TD
      
      However, it turned out to be an xHCI driver bug in the ring expansion
      patches.  The bug is triggered When there are two ring segments, and a
      TD that ends just before a link TRB, like so:
      
       ______________                     _____________
      |              |              ---> | setup TRB B |
       ______________               |     _____________
      |              |              |    |  data TRB B |
       ______________               |     _____________
      | setup TRB A  | <-- deq      |    |  data TRB B |
       ______________               |     _____________
      | data TRB A   |              |    |             | <-- enq, deq''
       ______________               |     _____________
      | status TRB A |              |    |             |
       ______________               |     _____________
      |  link TRB    |---------------    |  link TRB   |
       _____________  <--- deq'           _____________
      
      TD A (the first control transfer) stalls on the data phase.  That halts
      the ring.  The xHCI driver moves the hardware dequeue pointer to the
      first TRB after the stalled transfer, which happens to be the link TRB.
      
      Once the Set TR dequeue pointer command completes, the function
      update_ring_for_set_deq_completion runs.  That function is supposed to
      update the xHCI driver's dequeue pointer to match the internal hardware
      dequeue pointer.  On the first call this would work fine, and the
      software dequeue pointer would move to deq'.
      
      However, if the transfer immediately after that stalled (TD B in this
      case), another Set TR Dequeue command would be issued.  That would move
      the hardware dequeue pointer to deq''.  Once that command completed,
      update_ring_for_set_deq_completion would run again.
      
      The original code would unconditionally increment the software dequeue
      pointer, which moved the pointer off the ring segment into la-la-land.
      The while loop would happy increment the dequeue pointer (possibly
      wrapping it) until it matched the hardware pointer value.
      
      The while loop would also access all the memory in between the first
      ring segment and the second ring segment to determine if it was a link
      TRB.  This could cause general protection faults, although it was
      unlikely because the ring segments came from a DMA pool, and would often
      have consecutive memory addresses.
      
      If nothing in that space looked like a link TRB, the deq_seg pointer for
      the ring would remain on the first segment.  Thus, the deq_seg and the
      software dequeue pointer would get out of sync.
      
      When the next transfer event came in after the stalled transfer, the
      xHCI driver code would attempt to convert the software dequeue pointer
      into a DMA address in order to compare the DMA address for the completed
      transfer.  Since the deq_seg and the dequeue pointer were out of sync,
      xhci_trb_virt_to_dma would return NULL.
      
      The transfer event would get ignored, the transfer would eventually
      timeout, and we would mistakenly convert the finished transfer to no-op
      TRBs.  Some kernel driver (maybe xHCI?) would then get stuck in an
      infinite loop in interrupt context, and the whole machine would hang.
      
      This patch should be backported to kernels as old as 3.4, that contain
      the commit b008df60 "xHCI: count free
      TRBs on transfer ring"
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      Cc: stable@vger.kernel.org
      0d9f78a9
    • S
      usb: Add support for root hub port status CAS · 8bea2bd3
      Stanislaw Ledwon 提交于
      The host controller port status register supports CAS (Cold Attach
      Status) bit. This bit could be set when USB3.0 device is connected
      when system is in Sx state. When the system wakes to S0 this port
      status with CAS bit is reported and this port can't be used by any
      device.
      
      When CAS bit is set the port should be reset by warm reset. This
      was not supported by xhci driver.
      
      The issue was found when pendrive was connected to suspended
      platform. The link state of "Compliance Mode" was reported together
      with CAS bit. This link state was also not supported by xhci and
      core/hub.c.
      
      The CAS bit is defined only for xhci root hub port and it is
      not supported on regular hubs. The link status is used to force
      warm reset on port. Make the USB core issue a warm reset when port
      is in ether the 'inactive' or 'compliance mode'. Change the xHCI driver
      to report 'compliance mode' when the CAS is set. This force warm reset
      on the root hub port.
      
      This patch should be backported to stable kernels as old as 3.2, that
      contain the commit 10d674a8 "USB: When
      hot reset for USB3 fails, try warm reset."
      Signed-off-by: NStanislaw Ledwon <staszek.ledwon@linux.intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAndiry Xu <andiry.xu@amd.com>
      Cc: stable@vger.kernel.org
      8bea2bd3
  6. 02 7月, 2012 1 次提交
  7. 27 6月, 2012 3 次提交
  8. 25 6月, 2012 2 次提交
  9. 21 6月, 2012 1 次提交
  10. 16 6月, 2012 1 次提交
  11. 15 6月, 2012 1 次提交
  12. 14 6月, 2012 8 次提交