1. 27 9月, 2011 2 次提交
  2. 10 9月, 2011 1 次提交
  3. 10 8月, 2011 2 次提交
    • A
      xHCI: report USB2 port in resuming as suspend · 8a8ff2f9
      Andiry Xu 提交于
      When a USB2 port initiate a remote wakeup, software shall ensure that
      resume is signaled for at least 20ms, and then write '0' to the PLS field.
      According to this, xhci driver do the following things:
      
      1. When receive a remote wakeup event in irq_handler, set the resume_done
         value as jiffies + 20ms, and modify rh_timer to poll root hub status at
         that time;
      2. When receive a GetPortStatus request, if the jiffies is after the
         resume_done value, clear the resume signal and resume_done.
      
      However, if usb_port_resume() is called before the rh_timer triggered, it
      will indicate the port as Suspend Cleared and skip the clear resume signal
      part. The device will fail the usb_get_status request in finish_port_resume(),
      and usbcore will try a reset-resume instead. Device will work OK after
      reset-resume, but resume_done value is not cleared in this case, and
      xhci_bus_suspend() will fail because when it finds a non-zero resume_done
      value, it will regard the port as resuming and return -EBUSY.
      
      This causes issue on some platforms that the system fail to suspend
      after remote wakeup from suspend by USB2 devices connected to xHCI port.
      
      To fix this issue, report the port status as suspend if the resume is
      signaling less that 20ms, and usb_port_resume() will wait 25ms and check
      port status again, so xHCI driver can clear the resume signaling and
      resume_done value.
      
      This should be backported to kernels as old as 2.6.37.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      8a8ff2f9
    • A
      xHCI: fix port U3 status check condition · 5ac04bf1
      Andiry Xu 提交于
      Fix the port U3 status check when Clear PORT_SUSPEND Feature.
      The port status should be masked with PORT_PLS_MASK to check if it's in
      U3 state.
      
      This should be backported to kernels as old as 2.6.37.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      5ac04bf1
  4. 13 5月, 2011 1 次提交
  5. 04 5月, 2011 1 次提交
    • A
      xHCI: Clear PLC in xhci_bus_resume() · 4f0871a6
      Andiry Xu 提交于
      This patch clears PORT_PLC if xhci_bus_resume() resumes a previous suspended
      port, because if a port transition from U3 to U0 state, it will report a
      port link state change, and software should clear the corresponding PLC bit.
      
      It also uses hcd->speed to check if a port is a USB2 protocol port.
      
      The patch fixes the issue that USB keyboard can not wakeup system from
      hibernation.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      4f0871a6
  6. 03 5月, 2011 6 次提交
  7. 14 3月, 2011 12 次提交
    • 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: Make roothub functions deal with device removal. · f9de8151
      Sarah Sharp 提交于
      Return early in the roothub control and status functions if the xHCI host
      controller is not electrically present in the system (register reads
      return all "fs").  This issue only shows up when the xHCI driver registers
      two roothubs and the host controller is removed from the system.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      f9de8151
    • S
      xhci: Return a USB 3.0 hub descriptor for USB3 roothub. · 4bbb0ace
      Sarah Sharp 提交于
      Return the correct xHCI roothub descriptor, based on whether the roothub
      is marked as USB 3.0 or USB 2.0 in usb_hcd->bcdUSB.  Fill in
      DeviceRemovable for the USB 2.0 and USB 3.0 roothub descriptors, using the
      Device Removable bit in the port status and control registers.  xHCI is
      the first host controller to actually properly set these bits (other hosts
      say all devices are removable).
      
      When userspace asks for a USB 2.0-style hub descriptor for the USB 3.0
      roothub, stall the endpoint.  This is what real external USB 3.0 hubs do,
      and we don't want to return a descriptor that userspace didn't ask for.
      
      The USB core is already fixed to always ask for USB 3.0-style hub
      descriptors.  Only usbfs (typically lsusb) will ask for the USB 2.0-style
      hub descriptors.  This has already been fixed in usbutils version 0.91,
      but the kernel needs to deal with older usbutils versions.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      4bbb0ace
    • S
      xhci: Register second xHCI roothub. · f6ff0ac8
      Sarah Sharp 提交于
      This patch changes the xHCI driver to allocate two roothubs.  This touches
      the driver initialization and shutdown paths, roothub emulation code, and
      port status change event handlers.  This is a rather large patch, but it
      can't be broken up, or it would break git-bisect.
      
      Make the xHCI driver register its own PCI probe function.  This will call
      the USB core to create the USB 2.0 roothub, and then create the USB 3.0
      roothub.  This gets the code for registering a shared roothub out of the
      USB core, and allows other HCDs later to decide if and how many shared
      roothubs they want to allocate.
      
      Make sure the xHCI's reset method marks the xHCI host controller's primary
      roothub as the USB 2.0 roothub.  This ensures that the high speed bus will
      be processed first when the PCI device is resumed, and any USB 3.0 devices
      that have migrated over to high speed will migrate back after being reset.
      This ensures that USB persist works with these odd devices.
      
      The reset method will also mark the xHCI USB2 roothub as having an
      integrated TT.  Like EHCI host controllers with a "rate matching hub" the
      xHCI USB 2.0 roothub doesn't have an OHCI or UHCI companion controller.
      It doesn't really have a TT, but we'll lie and say it has an integrated
      TT.  We need to do this because the USB core will reject LS/FS devices
      under a HS hub without a TT.
      
      Other details:
      -------------
      
      The roothub emulation code is changed to return the correct number of
      ports for the two roothubs.  For the USB 3.0 roothub, it only reports the
      USB 3.0 ports.  For the USB 2.0 roothub, it reports all the LS/FS/HS
      ports.  The code to disable a port now checks the speed of the roothub,
      and refuses to disable SuperSpeed ports under the USB 3.0 roothub.
      
      The code for initializing a new device context must be changed to set the
      proper roothub port number.  Since we've split the xHCI host into two
      roothubs, we can't just use the port number in the ancestor hub.  Instead,
      we loop through the array of hardware port status register speeds and find
      the Nth port with a similar speed.
      
      The port status change event handler is updated to figure out whether the
      port that reported the change is a USB 3.0 port, or a non-SuperSpeed port.
      Once it figures out the port speed, it kicks the proper roothub.
      
      The function to find a slot ID based on the port index is updated to take
      into account that the two roothubs will have over-lapping port indexes.
      It checks that the virtual device with a matching port index is the same
      speed as the passed in roothub.
      
      There's also changes to the driver initialization and shutdown paths:
      
       1. Make sure that the xhci_hcd pointer is shared across the two
          usb_hcd structures.  The xhci_hcd pointer is allocated and the
          registers are mapped in when xhci_pci_setup() is called with the
          primary HCD.  When xhci_pci_setup() is called with the non-primary
          HCD, the xhci_hcd pointer is stored.
      
       2. Make sure to set the sg_tablesize for both usb_hcd structures.  Set
          the PCI DMA mask for the non-primary HCD to allow for 64-bit or 32-bit
          DMA.  (The PCI DMA mask is set from the primary HCD further down in
          the xhci_pci_setup() function.)
      
       3. Ensure that the host controller doesn't start kicking khubd in
          response to port status changes before both usb_hcd structures are
          registered.  xhci_run() only starts the xHC running once it has been
          called with the non-primary roothub.  Similarly, the xhci_stop()
          function only halts the host controller when it is called with the
          non-primary HCD.  Then on the second call, it resets and cleans up the
          MSI-X irqs.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      f6ff0ac8
    • S
      xhci: Change xhci_find_slot_id_by_port() API. · 5233630f
      Sarah Sharp 提交于
      xhci_find_slot_id_by_port() tries to map the port index to the slot ID for
      the USB device.  In the future, there will be two xHCI roothubs, and their
      port indices will overlap.  Therefore, xhci_find_slot_id_by_port() will
      need to use information in the roothub's usb_hcd structure to map the port
      index and roothub speed to the right slot ID.
      
      Add a new parameter to xhci_find_slot_id_by_port(), in order to pass in
      the roothub's usb_hcd structure.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      5233630f
    • S
      xhci: Refactor bus suspend state into a struct. · 20b67cf5
      Sarah Sharp 提交于
      There are several variables in the xhci_hcd structure that are related to
      bus suspend and resume state.  There are a couple different port status
      arrays that are accessed by port index.  Move those variables into a
      separate structure, xhci_bus_state.  Stash that structure in xhci_hcd.
      
      When we have two roothhubs that can be suspended and resumed separately,
      we can have two xhci_bus_states, and index into the port arrays in each
      structure with the fake roothub port index (not the real hardware port
      index).
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      20b67cf5
    • S
      xhci: Index with a port array instead of PORTSC addresses. · 5308a91b
      Sarah Sharp 提交于
      In the upcoming patches, the roothub emulation code will need to return
      port status and port change buffers based on whether they are called with
      the xHCI USB 2.0 or USB 3.0 roothub.  To facilitate that, make the roothub
      code index into an array of port addresses with wIndex, rather than
      calculating the address using the offset and the address of the PORTSC
      registers.  Later we can set the port array to be the array of USB 3.0
      port addresses, or the USB 2.0 port addresses, depending on the roothub
      passed in.
      
      Create a temporary (statically sized) port array and fill it in with both
      USB 3.0 and USB 2.0 port addresses.  This is inefficient to do for every
      roothub call, but this is needed for git bisect compatibility.  The
      temporary port array will be deleted in a subsequent patch.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      5308a91b
    • J
      USB 3.0 Hub Changes · dbe79bbe
      John Youn 提交于
      Update the USB core to deal with USB 3.0 hubs.  These hubs have a slightly
      different hub descriptor than USB 2.0 hubs, with a fixed (rather than
      variable length) size.  Change the USB core's hub descriptor to have a
      union for the last fields that differ.  Change the host controller drivers
      that access those last fields (DeviceRemovable and PortPowerCtrlMask) to
      use the union.
      
      Translate the new version of the hub port status field into the old
      version that khubd understands.  (Note: we need to fix it to translate the
      roothub's port status once we stop converting it to USB 2.0 hub status
      internally.)
      
      Add new code to handle link state change status.  Send out new control
      messages that are needed for USB 3.0 hubs, like Set Hub Depth.
      
      This patch is a modified version of the original patch submitted by John
      Youn.  It's updated to reflect the removal of the "bitmap" #define, and
      change the hub descriptor accesses of a couple new host controller
      drivers.
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
      Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Cc: Tony Olech <tony.olech@elandigitalsystems.com>
      Cc: "Robert P. J. Day" <rpjday@crashcourse.ca>
      Cc: Max Vozeler <mvz@vozeler.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: Rodolfo Giometti <giometti@linux.it>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Anton Vorontsov <avorontsov@mvista.com>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Lothar Wassmann <LW@KARO-electronics.de>
      Cc: Olav Kongas <ok@artecdesign.ee>
      Cc: Martin Fuzzey <mfuzzey@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      dbe79bbe
    • S
      xhci: Remove references to HC_STATE_RUNNING. · ad73dff3
      Sarah Sharp 提交于
      The USB core will set hcd->state to HC_STATE_RUNNING before calling
      xhci_run, so there's no point in setting it twice.  The USB core also
      doesn't pay attention to HC_STATE_RUNNING on the resume path anymore; it
      uses HCD_RH_RUNNING(), which looks at hcd->flags & (1U <<
      HCD_FLAG_RH_RUNNING.  Therefore, it's safe to remove the state set in
      xhci_bus_resume().
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      ad73dff3
    • S
      xhci: Rename variables and reduce register reads. · 518e848e
      Sarah Sharp 提交于
      The xhci_bus_suspend() and xhci_bus_resume() functions are a bit hard to
      read, because they have an ambiguously named variable "port".  Rename it
      to "port_index".  Introduce a new temporary variable, "max_ports" that
      holds the maximum number of roothub ports the host controller supports.
      This will reduce the number of register reads, and make it easy to change
      the maximum number of ports when there are two roothubs.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      518e848e
    • S
      xhci: Rework port suspend structures for limited ports. · 1d5810b6
      Sarah Sharp 提交于
      The USB core only allows up to 31 (USB_MAXCHILDREN) ports under a roothub.
      The xHCI driver keeps track of which ports are suspended, which ports have
      a suspend change bit set, and what time the port will be done resuming.
      It keeps track of the first two by setting a bit in a u32 variable,
      suspended_ports or port_c_suspend.  The xHCI driver currently assumes we
      can have up to 256 ports under a roothub, so it allocates an array of 8
      u32 variables for both suspended_ports and port_c_suspend.  It also
      allocates a 256-element array to keep track of when the ports will be done
      resuming.
      
      Since we can only have 31 roothub ports, we only need to use one u32 for
      each of the suspend state and change variables.  We simplify the bit math
      that's trying to index into those arrays and set the correct bit, if we
      assume wIndex never exceeds 30.  (wIndex is zero-based after it's
      decremented from the value passed in from the USB core.)  Finally, we
      change the resume_done array to only hold 31 elements.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      1d5810b6
    • S
      USB: Remove bitmap #define from hcd.h · da13051c
      Sarah Sharp 提交于
      Using a #define to redefine a common variable name is a bad thing,
      especially when the #define is in a header.  include/linux/usb/hcd.h
      redefined bitmap to DeviceRemovable to avoid typing a long field in the
      hub descriptor.  This has unintended side effects for files like
      drivers/usb/core/devio.c that include that file, since another header
      included after hcd.h has different variables named bitmap.
      
      Remove the bitmap #define and replace instances of it in the host
      controller code.  Cleanup the spaces around function calls and square
      brackets while we're at it.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
      Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Cc: Tony Olech <tony.olech@elandigitalsystems.com>
      Cc: "Robert P. J. Day" <rpjday@crashcourse.ca>
      Cc: Max Vozeler <mvz@vozeler.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: Rodolfo Giometti <giometti@linux.it>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Anton Vorontsov <avorontsov@mvista.com>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Lothar Wassmann <LW@KARO-electronics.de>
      Cc: Olav Kongas <ok@artecdesign.ee>
      Cc: Martin Fuzzey <mfuzzey@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      da13051c
  8. 20 11月, 2010 1 次提交
    • S
      xhci: Don't let the USB core disable SuperSpeed ports. · 6dd0a3a7
      Sarah Sharp 提交于
      Disabling SuperSpeed ports is a Very Bad Thing (TM).  It disables
      SuperSpeed terminations, which means that devices will never connect at
      SuperSpeed on that port.  For USB 2.0/1.1 ports, disabling the port meant
      that the USB core could always get a connect status change later.  That's
      not true with USB 3.0 ports.
      
      Do not let the USB core disable SuperSpeed ports.  We can't rely on the
      device speed in the port status registers, since that isn't valid until
      there's a USB device connected to the port.  Instead, we use the port
      speed array that's created from the Extended Capabilities registers.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NDon Zickus <dzickus@redhat.com>
      Cc: stable@kernel.org
      6dd0a3a7
  9. 23 10月, 2010 4 次提交
  10. 21 5月, 2010 3 次提交
  11. 03 3月, 2010 2 次提交
  12. 16 6月, 2009 1 次提交
    • S
      USB: xhci: Root hub support. · 0f2a7930
      Sarah Sharp 提交于
      Add functionality for getting port status and hub descriptor for xHCI root
      hubs.  This is WIP because the USB 3.0 hub descriptor is different from
      the USB 2.0 hub descriptor.  For now, we lie about the root hub descriptor
      because the changes won't effect how the core talks to the root hub.
      Later we will need to add the USB 3.0 hub descriptor for real hubs, and
      this code might change.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0f2a7930