1. 22 Jul, 2014 35 commits
  2. 21 Jul, 2014 1 commit
  3. 18 Jul, 2014 4 commits
    • Alan Stern's avatar
      USB: OHCI: add check for stopped frame counter · 499b3803
      Alan Stern authored
      This patch adds an extra check to ohci-hcd's I/O watchdog routine.  If
      the controller stops updating the frame counter, we will assume it is
      dead.  But there has to be an exception: Some controllers stop the
      frame counter when no ports are connected.  Check to make sure there
      is at least one active port before deciding the controller is dead.
      
      (This test may appear racy, but it isn't.  Enabling a newly connected
      port takes several milliseconds, during which time the frame counter
      must advance.)
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarDennis New <dennisn@dennisn.linuxd.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      499b3803
    • Alan Stern's avatar
      USB: OHCI: add I/O watchdog for orphan TDs · 81e38333
      Alan Stern authored
      Some OHCI controllers have a bug: They fail to add completed TDs to
      the done queue.  Examining this queue is the only method ohci-hcd has
      for telling when a transfer is complete; failure to add a TD can
      result in an URB that never completes and cannot be unlinked.
      
      This patch adds a watchdog routine to ohci-hcd.  The routine
      periodically scans the active ED and TD lists, looking for TDs which
      are finished but not on the done queue.  When one is found, and it is
      certain that the controller hardware will never add the TD to the done
      queue, the watchdog routine manually puts the TD on the done list so
      that it can be handled normally.
      
      The watchdog routine also checks for a condition indicating the
      controller has died.  If the done queue is non-empty but the
      HccaDoneHead pointer hasn't been updated for a few hundred
      milliseconds, we assume the controller will never update it and
      therefore is dead.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81e38333
    • Alan Stern's avatar
      USB: OHCI: make URB completions single-threaded · cdb4dd15
      Alan Stern authored
      URBs for a particular endpoint should complete sequentially.  That is,
      we shouldn't call the completion handler for one URB until the handler
      for the previous URB has returned.
      
      When the OHCI watchdog routine is added, there will be two paths for
      completing URBs: interrupt handler and watchdog routine.  Their
      activities have to be synchronized so that completions don't occur in
      multiple threads concurrently.
      
      For that purpose, this patch creates an ohci_work() routine which will
      be responsible for calling process_done_list() and finish_unlinks(),
      the two routines that detect when an URB is complete.  Everything will
      funnel through ohci_work(), and it will be careful not to run in more
      than one thread at a time.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cdb4dd15
    • Alan Stern's avatar
      USB: OHCI: redesign the TD done list · c6fcb85e
      Alan Stern authored
      This patch changes the way ohci-hcd handles the TD done list.  In
      addition to relying on the TD pointers stored by the controller
      hardware, we need to handle TDs that the hardware has forgotten about.
      
      This means the list has to exist even while the dl_done_list() routine
      isn't running.  That function essentially gets split in two:
      update_done_list() reads the TD pointers stored by the hardware and
      adds the TDs to the done list, and process_done_list() scans through
      the list to handle URB completions.  When we detect a TD that the
      hardware forgot about, we will be able to add it to the done list
      manually and then process it normally.
      
      Since the list is really a queue, and because there can be a lot of
      TDs, keep the existing singly linked implementation.  To insure that
      URBs are given back in order of submission, whenever a TD is added to
      the done list, all the preceding TDs for the same endpoint must be
      added as well (going back to the first one that isn't already on the
      done list).
      
      The done list manipulations must all be protected by the private
      lock.  The scope of the lock is expanded in preparation for the
      watchdog routine to be added in a later patch.
      
      We have to be more careful about giving back unlinked URBs.  Since TDs
      may be added to the done list by the watchdog routine and not in
      response to a controller interrupt, we have to check explicitly to
      make sure all the URB's TDs that were added to the done list have been
      processed before giving back the URB.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c6fcb85e