1. 16 Jul, 2012 23 commits
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for unlinking empty async QHs · 32830f20
      Alan Stern authored
      This patch (as1583) changes ehci-hcd to use an hrtimer event for
      unlinking empty (unused) async QHs instead of using a kernel timer.
      
      The check for empty QHs is moved to a new routine, where it doesn't
      require going through an entire scan of both the async and periodic
      schedules.  And it can unlink multiple QHs at once, unlike the current
      code.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32830f20
    • Alan Stern's avatar
      USB: EHCI: unlink multiple async QHs together · 3c273a05
      Alan Stern authored
      This patch (as1582) changes ehci-hcd's strategy for unlinking async
      QHs.  Currently the driver never unlinks more than one QH at a time.
      This can be inefficient and cause unnecessary delays, since a QH
      cannot be reused while it is waiting to be unlinked.
      
      The new strategy unlinks all the waiting QHs at once.  In practice the
      improvement won't be very big, because it's somewhat uncommon to have
      two or more QHs waiting to be unlinked at any time.  But it does
      happen, and in any case, doing things this way makes more sense IMO.
      
      The change requires the async unlinking code to be refactored
      slightly.  Now in addition to the routines for starting and ending an
      unlink, there are new routines for unlinking a single QH and starting
      an IAA cycle.  This approach is needed because there are two separate
      paths for unlinking async QHs:
      
      	When a transfer error occurs or an URB is cancelled, the QH
      	must be unlinked right away;
      
      	When a QH has been idle sufficiently long, it is unlinked
      	to avoid consuming DMA bandwidth uselessly.
      
      In the first case we want the unlink to proceed as quickly as
      possible, whereas in the second case we can afford to batch several
      QHs together and unlink them all at once.  Hence the division of
      labor.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c273a05
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for the IAA watchdog · 9d938747
      Alan Stern authored
      This patch (as1581) replaces the iaa_watchdog kernel timer used by
      ehci-hcd with an hrtimer event, in keeping with the general conversion
      to high-res timers.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d938747
    • Alan Stern's avatar
      USB: EHCI: don't refcount iso_stream structures · 8c5bf7be
      Alan Stern authored
      This patch (as1580) makes ehci_iso_stream structures behave more like
      QHs, in that they will remain allocated until their isochronous
      endpoint is disabled.  This will come in useful in the future, when
      periodic bandwidth gets allocated as an altsetting is installed rather
      than on-the-fly.
      
      For now, the change to the ehci_iso_stream lifetimes means that each
      structure is always deallocated at exactly one spot in
      ehci_endpoint_disable() and never used again.  As a result, it is no
      longer necessary to use reference counting on these things, and the
      patch removes it.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c5bf7be
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for (s)iTD deallocation · 55934eb3
      Alan Stern authored
      This patch (as1579) adds an hrtimer event to handle deallocation of
      iTDs and siTDs in ehci-hcd.
      
      Because of the frame-oriented approach used by the EHCI periodic
      schedule, the hardware can continue to access the Transfer Descriptor
      for isochronous (or split-isochronous) transactions for up to a
      millisecond after the transaction completes.  The iTD (or siTD) must
      not be reused before then.
      
      The strategy currently used involves putting completed iTDs on a list
      of cached entries and every so often returning them to the endpoint's
      free list.  The new strategy reduces overhead by putting completed
      iTDs back on the free list immediately, although they are not reused
      until it is safe to do so.
      
      When the isochronous endpoint stops (its queue becomes empty), the
      iTDs on its free list get moved to a global list, from which they will
      be deallocated after a minimum of 2 ms.  This delay is what the new
      hrtimer event is for.
      
      Overall this may not be a tremendous improvement over the current
      code, but to me it seems a lot more clear and logical.  In addition,
      it removes the need for each iTD to keep a reference to the
      ehci_iso_stream it belongs to, since the iTD never needs to be moved
      back to the stream's free list from the global list.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55934eb3
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for controller death · bf6387bc
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bf6387bc
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for interrupt QH unlink · df202255
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df202255
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for async schedule · 31446610
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31446610
    • Alan Stern's avatar
      USB: EHCI: remove PS3 status polling · 9671cd7a
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9671cd7a
    • Alan Stern's avatar
      USB: EHCI: return void instead of 0 · b015cb79
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b015cb79
    • Alan Stern's avatar
      USB: EHCI: use hrtimer for the periodic schedule · 3ca9aeba
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ca9aeba
    • Alan Stern's avatar
      USB: EHCI: introduce high-res timer · d58b4bcc
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d58b4bcc
    • Alan Stern's avatar
      USB: EHCI: add new root-hub state: STOPPING · c0c53dbc
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c0c53dbc
    • Alan Stern's avatar
      USB: EHCI: add pointer to end of async-unlink list · 2f5bb665
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2f5bb665
    • Alan Stern's avatar
      USB: EHCI: rename "reclaim" · 99ac5b1e
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99ac5b1e
    • Alan Stern's avatar
      USB: EHCI: add symbolic constants for QHs · 4c53de72
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c53de72
    • Alan Stern's avatar
      USB: EHCI: don't refcount QHs · c83e1a9f
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c83e1a9f
    • Alan Stern's avatar
      USB: EHCI: remove unneeded suspend/resume code · 15be105b
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15be105b
    • Alan Stern's avatar
      USB: EHCI: initialize data before resetting hardware · 631fe9d9
      Alan Stern authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      631fe9d9
    • Namjae Jeon's avatar
      usb: storage: update usb devices for write cache quirk in quirk list. · 1f9be64a
      Namjae Jeon authored
      Update information of Seagate Portable HDD and WD My Passport HDD in
      quirk list.
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarPankaj Kumar <pankaj.km@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f9be64a
    • Namjae Jeon's avatar
      usb: storage: add support for write cache quirk · e1bc9e50
      Namjae Jeon authored
      Add support for write cache quirk on usb hdd. scsi driver will be set to wce
      by detecting write cache quirk in quirk list when plugging usb hdd.
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarPankaj Kumar <pankaj.km@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1bc9e50
    • Namjae Jeon's avatar
      scsi: set to WCE if usb cache quirk is present. · 7620c687
      Namjae Jeon authored
      Make use of USB quirk method to identify such HDD while reading
      the cache status in sd_probe(). If cache quirk is present for
      the HDD, lets assume that cache is enabled and make WCE bit
      equal to 1.
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarPankaj Kumar <pankaj.km@samsung.com>
      Signed-off-by: default avatarAmit Sahrawat <a.sahrawat@samsung.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7620c687
    • Greg Kroah-Hartman's avatar
      Merge 3.5-rc7 into usb-next · b903bd69
      Greg Kroah-Hartman authored
      This resolves the merge issue with the drivers/usb/host/ehci-omap.c
      file.
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b903bd69
  2. 14 Jul, 2012 11 commits
  3. 13 Jul, 2012 6 commits