1. 16 Oct, 2013 8 commits
    • Xenia Ragiadakou's avatar
      xhci: remove unused argument from xhci_giveback_urb_in_irq() · 07a37e9e
      Xenia Ragiadakou authored
      This patch removes the "adjective" argument from xhci_giveback_urb_in_irq(),
      since it is not used in the function anymore.
      Signed-off-by: default avatarXenia Ragiadakou <burzalodowa@gmail.com>
      Acked-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      07a37e9e
    • xiao jin's avatar
      xhci: correct the usage of USB_CTRL_SET_TIMEOUT · d194c031
      xiao jin authored
      The usage of USB_CTRL_SET_TIMEOUT in xhci is incorrect.
      The definition of USB_CTRL_SET_TIMEOUT is 5000ms. The
      input timeout to wait_for_completion_interruptible_timeout
      is jiffies. That makes the timeout be longer than what
      we want, such as 50s in some platform.
      
      The patch is to use XHCI_CMD_DEFAULT_TIMEOUT instead of
      USB_CTRL_SET_TIMEOUT as command completion event timeout.
      Signed-off-by: default avatarxiao jin <jin.xiao@intel.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      d194c031
    • Sachin Kamat's avatar
      usb: xhci: Staticize xhci_del_comp_mod_timer · 5f20cf12
      Sachin Kamat authored
      'xhci_del_comp_mod_timer' is local to this file.
      Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      5f20cf12
    • Sarah Sharp's avatar
      usb: Push USB2 LPM disable on disconnect into USB core. · f468f7b9
      Sarah Sharp authored
      The USB core currently handles enabling and disabling optional USB power
      management features during device transitions (device suspend/resume,
      driver bind/unbind, device reset, and device disconnect).  Those
      optional power features include Latency Tolerance Messaging (LTM),
      USB 3.0 Link PM, and USB 2.0 Link PM.
      
      The USB core currently enables LPM on device enumeration and disables
      USB 2.0 Link PM when the device is reset.  However, the xHCI driver
      disables LPM when the device is disconnected and the device context is
      freed.  Push the call up into the USB core, in order to be consistent
      with the core handling all power management enabling and disabling.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      f468f7b9
    • Mathias Nyman's avatar
      xhci: Enable LPM support only for hardwired or BESL devices · 890dae88
      Mathias Nyman authored
      Some usb3 devices falsely claim they support usb2 hardware Link PM
      when connected to a usb2 port. We only trust hardwired devices
      or devices with the later BESL LPM support to be LPM enabled as default.
      
      [Note: Sarah re-worked the original patch to move the code into the USB
      core, and updated it to check whether the USB device supports BESL,
      instead of checking if the xHCI port it's connected to supports BESL
      encoding.]
      
      This patch should be backported to kernels as old as 3.11, that
      contain the commit a558ccdc "usb: xhci:
      add USB2 Link power management BESL support".  Without this fix, some
      USB 3.0 devices will not enumerate or work properly under USB 2.0 ports
      on Haswell-ULT systems.
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      890dae88
    • Sarah Sharp's avatar
      usb: Don't enable USB 2.0 Link PM by default. · de68bab4
      Sarah Sharp authored
      How it's supposed to work:
      --------------------------
      
      USB 2.0 Link PM is a lower power state that some newer USB 2.0 devices
      support.  USB 3.0 devices certified by the USB-IF are required to
      support it if they are plugged into a USB 2.0 only port, or a USB 2.0
      cable is used.  USB 2.0 Link PM requires both a USB device and a host
      controller that supports USB 2.0 hardware-enabled LPM.
      
      USB 2.0 Link PM is designed to be enabled once by software, and the host
      hardware handles transitions to the L1 state automatically.  The premise
      of USB 2.0 Link PM is to be able to put the device into a lower power
      link state when the bus is idle or the device NAKs USB IN transfers for
      a specified amount of time.
      
      ...but hardware is broken:
      --------------------------
      
      It turns out many USB 3.0 devices claim to support USB 2.0 Link PM (by
      setting the LPM bit in their USB 2.0 BOS descriptor), but they don't
      actually implement it correctly.  This manifests as the USB device
      refusing to respond to transfers when it is plugged into a USB 2.0 only
      port under the Haswell-ULT/Lynx Point LP xHCI host.
      
      These devices pass the xHCI driver's simple test to enable USB 2.0 Link
      PM, wait for the port to enter L1, and then bring it back into L0.  They
      only start to break when L1 entry is interleaved with transfers.
      
      Some devices then fail to respond to the next control transfer (usually
      a Set Configuration).  This results in devices never enumerating.
      
      Other mass storage devices (such as a later model Western Digital My
      Passport USB 3.0 hard drive) respond fine to going into L1 between
      control transfers.  They ACK the entry, come out of L1 when the host
      needs to send a control transfer, and respond properly to those control
      transfers.  However, when the first READ10 SCSI command is sent, the
      device NAKs the data phase while it's reading from the spinning disk.
      Eventually, the host requests to put the link into L1, and the device
      ACKs that request.  Then it never responds to the data phase of the
      READ10 command.  This results in not being able to read from the drive.
      
      Some mass storage devices (like the Corsair Survivor USB 3.0 flash
      drive) are well behaved.  They ACK the entry into L1 during control
      transfers, and when SCSI commands start coming in, they NAK the requests
      to go into L1, because they need to be at full power.
      
      Not all USB 3.0 devices advertise USB 2.0 link PM support.  My Point
      Grey USB 3.0 webcam advertises itself as a USB 2.1 device, but doesn't
      have a USB 2.0 BOS descriptor, so we don't enable USB 2.0 Link PM.  I
      suspect that means the device isn't certified.
      
      What do we do about it?
      -----------------------
      
      There's really no good way for the kernel to test these devices.
      Therefore, the kernel needs to disable USB 2.0 Link PM by default, and
      distros will have to enable it by writing 1 to the sysfs file
      /sys/bus/usb/devices/../power/usb2_hardware_lpm.  Rip out the xHCI Link
      PM test, since it's not sufficient to detect these buggy devices, and
      don't automatically enable LPM after the device is addressed.
      
      This patch should be backported to kernels as old as 3.11, that
      contain the commit a558ccdc "usb: xhci:
      add USB2 Link power management BESL support".  Without this fix, some
      USB 3.0 devices will not enumerate or work properly under USB 2.0 ports
      on Haswell-ULT systems.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      de68bab4
    • Sarah Sharp's avatar
      xhci: Set L1 device slot on USB2 LPM enable/disable. · 58e21f73
      Sarah Sharp authored
      To enable USB 2.0 Link Power Management (LPM), the xHCI host controller
      needs the device slot ID to generate the device address used in L1 entry
      tokens.  That information is set in the L1 device slot ID field of the
      USB 2.0 LPM registers.
      
      Currently, the L1 device slot ID is overwritten when the xHCI driver
      initiates the software test of USB 2.0 Link PM in
      xhci_usb2_software_lpm_test.  It is never cleared when USB 2.0 Link PM
      is disabled for the device.  That should be harmless, because the
      Hardware LPM Enable (HLE) bit is cleared when USB 2.0 Link PM is
      disabled, so the host should not pay attention to the slot ID.
      
      This patch should have no effect on host behavior, but since
      xhci_usb2_software_lpm_test is going away in an upcoming bug fix patch,
      we need to move that code to the function that enables and disables USB
      2.0 Link PM.
      
      This patch should be backported to kernels as old as 3.11, that contain
      the commit a558ccdc "usb: xhci: add USB2
      Link power management BESL support".  The upcoming bug fix patch is also
      marked for that stable kernel.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      58e21f73
    • Sarah Sharp's avatar
      usb: Disable USB 2.0 Link PM before device reset. · dcc01c08
      Sarah Sharp authored
      Before the USB core resets a device, we need to disable the L1 timeout
      for the roothub, if USB 2.0 Link PM is enabled.  Otherwise the port may
      transition into L1 in between descriptor fetches, before we know if the
      USB device descriptors changed.  LPM will be re-enabled after the
      full device descriptors are fetched, and we can confirm the device still
      supports USB 2.0 LPM after the reset.
      
      We don't need to wait for the USB device to exit L1 before resetting the
      device, since the xHCI roothub port diagrams show a transition to the
      Reset state from any of the Ux states (see Figure 34 in the 2012-08-14
      xHCI specification update).
      
      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 commit to enable USB 2.0
      hardware-driven Link Power Management.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      dcc01c08
  2. 14 Oct, 2013 11 commits
    • Jingoo Han's avatar
      USB: ohci-exynos: Remove non-DT support · c00809d3
      Jingoo Han authored
      The non-DT for EXYNOS SoCs is not supported from v3.11.
      Thus, there is no need to support non-DT for Exynos OHCI driver.
      
      The 'include/linux/platform_data/usb-ohci-exynos.h' file has been
      used for non-DT support. Thus, the 'usb-ohci-exynos.h' file can
      be removed.
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c00809d3
    • Michael Opdenacker's avatar
      usb/hcd: remove unnecessary local_irq_save · 88ed9fd5
      Michael Opdenacker authored
      Remove the use of local_irq_save() and IRQF_DISABLED, no longer needed since
      interrupt handlers are always run with interrupts disabled on the
      current CPU.
      
      Tested successfully with 3.12.0-rc4 on my PC. Didn't find
      any issue because of this change.
      Signed-off-by: default avatarMichael Opdenacker <michael.opdenacker@free-electrons.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88ed9fd5
    • Alan Stern's avatar
      USB: EHCI: start new isochronous streams ASAP · a393a807
      Alan Stern authored
      This patch changes the initial delay before the startup of a newly
      scheduled isochronous stream.  Currently the stream doesn't start
      for at least 5 ms (40 microframes).  This value is just an estimate;
      it has no real justification.
      
      Instead, we can start the stream as soon as possible after the
      scheduling computations are complete.  Essentially this requires
      nothing more than reading the frame counter after the stream is
      scheduled, instead of before.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a393a807
    • Alan Stern's avatar
      USB: EHCI: create per-TT bandwidth tables · b35c5009
      Alan Stern authored
      This patch continues the scheduling changes in ehci-hcd by adding a
      table to store the bandwidth allocation below each TT.  This will
      speed up the scheduling code, as it will no longer need to read
      through the entire schedule to compute the bandwidth currently in use.
      
      Properly speaking, the FS/LS budget calculations should be done in
      terms of full-speed bytes per microframe, as described in the USB-2
      spec.  However the driver currently uses microseconds per microframe,
      and the scheduling code isn't robust enough at this point to change
      over.  For the time being, we leave the calculations as they are.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b35c5009
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle OHCI controller suspend" · ca1ad0ff
      Greg Kroah-Hartman authored
      This reverts commit 476e4bf9.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      ca1ad0ff
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle ohci-at91 suspend" · 118cb990
      Greg Kroah-Hartman authored
      This reverts commit 056ca85d.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      118cb990
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle ohci-s3c2410 suspend" · ba8d400e
      Greg Kroah-Hartman authored
      This reverts commit 19d33943.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      ba8d400e
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle ohci-da8xx suspend" · 5d931288
      Greg Kroah-Hartman authored
      This reverts commit 86a63f10.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      5d931288
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle ohci-ep93xx suspend" · 848b5b5e
      Greg Kroah-Hartman authored
      This reverts commit 018258b4.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      848b5b5e
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle ohci-exynos suspend" · 066ba8e0
      Greg Kroah-Hartman authored
      This reverts commit fea0896f.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      066ba8e0
    • Greg Kroah-Hartman's avatar
      Revert "USB: OHCI: Properly handle ohci-spear suspend" · 3de80bfc
      Greg Kroah-Hartman authored
      This reverts commit 36a87587.
      
      Manjunath is no longer at Linaro, the email address bounces.  Given
      that, and the fact that others have reported problems with these
      patches, I'm reverting them until someone from Linaro who can SUPPORT
      THEM submits them.
      
      I will no longer accept patches from linaro.com developers unless a
      senior Linaro developer has signed off on them, which did not happen
      with this patch set.
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
      Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      3de80bfc
  3. 12 Oct, 2013 7 commits
  4. 11 Oct, 2013 14 commits
    • Matthias Beyer's avatar
      drivers: usb: core: hcd.c: converted busmap from struct to bitmap · 059239ad
      Matthias Beyer authored
      The DECLARE_BITMAP macro should be used for declaring this bitmap.
      This commit converts the busmap from a struct to a simple (static)
      bitmap, using the DECLARE_BITMAP macro from linux/types.h.
      
      Please review, as I'm new to kernel development, I don't know if this
      has any hidden side effects!
      
      Suggested by joe@perches.com
      Signed-off-by: default avatarMatthias Beyer <mail@beyermatthias.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      059239ad
    • Jingoo Han's avatar
      USB: host: Rename ehci-s5p to ehci-exynos · 29824c16
      Jingoo Han authored
      Currently, Samsung is using 'EXYNOS' as the name of Samsung SoCs.
      Thus, ehci-exynos is preferred than ehci-s5p.
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      29824c16
    • Jingoo Han's avatar
      USB: ehci-s5p: Remove non-DT support · 57ae1605
      Jingoo Han authored
      The non-DT for EXYNOS SoCs is not supported from v3.11.
      Thus, there is no need to support non-DT for Exynos EHCI driver.
      
      The 'include/linux/platform_data/usb-ehci-s5p.h' file has been
      used for non-DT support. Thus, the 'usb-ehci-s5p.h' file can
      be removed.
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      57ae1605
    • Jingoo Han's avatar
      ARM: SAMSUNG: Remove unused s5p_device_ehci · a4b3f029
      Jingoo Han authored
      Since commit ca914350 "ARM: EXYNOS: Remove unused board files",
      s5p_device_ehci is not used anymore. Thus, s5p_device_ehci can
      be removed. Also, unnecessary S5P_DEV_USB_EHCI option is removed.
      Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
      Reviewed-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4b3f029
    • Alan Stern's avatar
      USB: add a private-data pointer to struct usb_tt · 7c4bb942
      Alan Stern authored
      For improved scheduling of transfers through a Transaction Translator,
      ehci-hcd will need to store a bunch of information associated with the
      FS/LS bus on the downstream side of the TT.  This patch adds a pointer
      for such HCD-private data to the usb_tt structure.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c4bb942
    • Alan Stern's avatar
      USB: EHCI: use a bandwidth-allocation table · d0ce5c6b
      Alan Stern authored
      This patch significantly changes the scheduling code in ehci-hcd.
      Instead of calculating the current bandwidth utilization by trudging
      through the schedule and adding up the times used by the existing
      transfers, we will now maintain a table holding the time used for each
      of 64 microframes.  This will drastically speed up the bandwidth
      computations.
      
      In addition, it eliminates a theoretical bug.  An isochronous endpoint
      may have bandwidth reserved even at times when it has no transfers
      listed in the schedule.  The table will keep track of the reserved
      bandwidth, whereas adding up entries in the schedule would miss it.
      
      As a corollary, we can keep bandwidth reserved for endpoints even
      when they aren't in active use.  Eventually the bandwidth will be
      reserved when a new alternate setting is installed; for now the
      endpoint's reservation takes place when its first URB is submitted.
      
      A drawback of this approach is that transfers with an interval larger
      than 64 microframes will have to be charged for bandwidth as though
      the interval was 64.  In practice this shouldn't matter much;
      transfers with longer intervals tend to be rather short anyway (things
      like hubs or HID devices).
      
      Another minor drawback is that we will keep track of two different
      period and phase values: the actual ones and the ones used for
      bandwidth allocation (which are limited to 64).  This adds only a
      small amount of overhead: 3 bytes for each endpoint.
      
      The patch also adds a new debugfs file named "bandwidth" to display
      the information stored in the new table.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0ce5c6b
    • Alan Stern's avatar
      USB: EHCI: create a "periodic schedule info" struct · ffa0248e
      Alan Stern authored
      This patch begins the process of unifying the scheduling parameters
      that ehci-hcd uses for interrupt and isochronous transfers.  It
      creates an ehci_per_sched structure, which will be stored in both
      ehci_qh and ehci_iso_stream structures, and will contain the common
      scheduling information needed for both.
      
      Initially we merely create the new structure and move some existing
      fields into it.  Later patches will add more fields and utilize these
      structures in improved scheduling algorithms.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffa0248e
    • Alan Stern's avatar
      USB: EHCI: use consistent NO_FRAME value · 91a99b5e
      Alan Stern authored
      ehci-hcd is inconsistent in the sentinel values it uses to indicate
      that no frame number has been assigned for a periodic transfer.  Some
      places it uses NO_FRAME (defined as 65535), other places it uses -1,
      and elsewhere it uses 9999.
      
      This patch defines a value for NO_FRAME which can fit in a 16-bit
      signed integer, and changes the code to use it everywhere.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      91a99b5e
    • Alan Stern's avatar
      USB: EHCI: change toggle only upon successful reset · 27c4a31d
      Alan Stern authored
      ehci-hcd uses a value of 0 in an endpoint's toggle flag to indicate
      that the endpoint has been reset (and therefore the Data Toggle bit
      needs to be cleared in the endpoint's QH overlay region).
      
      The toggle flag should be set to 0 only when ehci_endpoint_reset()
      succeeds.  This patch moves the usb_settoggle() call into the
      appropriate branch of the "if" statement.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27c4a31d
    • Alan Stern's avatar
      USB: EHCI: No SSPLIT allowed in uframe 7 · 8c05dc59
      Alan Stern authored
      The scheduling code in ehci-hcd contains an error.  For full-speed
      isochronous-OUT transfers, the EHCI spec forbids scheduling
      Start-Split transactions in H-microframe 7, but the driver allows it
      anyway.  This patch adds a check to prevent it.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c05dc59
    • Alan Stern's avatar
      USB: EHCI: compute full-speed bandwidth usage correctly · 2b90f01b
      Alan Stern authored
      Although the bandwidth statistics maintained by ehci-hcd show up only
      in the /sys/kernel/debug/usb/devices file, they ought to be calculated
      correctly.  The calculation for full-speed isochronous endpoints is
      wrong; it mistakenly yields bytes per microframe instead of bytes per
      frame.  The "interval" value, which is in frames, should not be
      converted to microframes.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b90f01b
    • Alan Stern's avatar
      USB: EHCI: check the right uframes for CSPLIT · e24371a6
      Alan Stern authored
      The check_intr_schedule() routine in ehci-hcd looks at the wrong
      microframes when checking to see if a full-speed or low-speed
      interrupt endpoint will fit in the periodic schedule.  If the
      Start-Split transaction is scheduled for microframe N then the
      Complete-Split transactions get scheduled for microframes N+2, N+3, and
      N+4.  However the code considers N+1, N+2, and N+3 instead.
      
      This patch fixes the limits on the "for" loop and also improves the
      use of whitespace.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e24371a6
    • Alan Stern's avatar
      USB: NS_TO_US should round up · 63fb3a28
      Alan Stern authored
      Host controller drivers use the NS_TO_US macro to convert transaction
      times, which are computed in nanoseconds, to microseconds for
      scheduling.  Periodic scheduling requires worst-case estimates, but
      the macro does its conversion using round-to-nearest.  This patch
      changes it to use round-up, giving a correct worst-case value.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63fb3a28
    • Hans de Goede's avatar
      usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done · 6ec4147e
      Hans de Goede authored
      usb_wait_anchor_empty_timeout() should wait till the completion handler
      has run. Both the zd1211rw driver and the uas driver (in its task mgmt) depend
      on the completion handler having completed when usb_wait_anchor_empty_timeout()
      returns, as they read state set by the completion handler after an
      usb_wait_anchor_empty_timeout() call.
      
      But __usb_hcd_giveback_urb() calls usb_unanchor_urb before calling the
      completion handler. This is necessary as the completion handler may
      re-submit and re-anchor the urb. But this introduces a race where the state
      these drivers want to read has not been set yet by the completion handler
      (this race is easily triggered with the uas task mgmt code).
      
      I've considered adding an anchor_count to struct urb, which would be
      incremented on anchor and decremented on unanchor, and then only actually
      do the anchor / unanchor on 0 -> 1 and 1 -> 0 transtions, combined with
      moving the unanchor call in hcd_giveback_urb to after calling the completion
      handler. But this will only work if urb's are only re-anchored to the same
      anchor as they were anchored to before the completion handler ran.
      
      And at least one driver re-anchors to another anchor from the completion
      handler (rtlwifi).
      
      So I have come up with this patch instead, which adds the ability to
      suspend wakeups of usb_wait_anchor_empty_timeout() waiters to the usb_anchor
      functionality, and uses this in __usb_hcd_giveback_urb() to delay wake-ups
      until the completion handler has run.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarOliver Neukum <oliver@neukum.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ec4147e