1. 15 2月, 2012 1 次提交
    • S
      USB/xHCI: Support device-initiated USB 3.0 resume. · 4ee823b8
      Sarah Sharp 提交于
      USB 3.0 hubs don't have a port suspend change bit (that bit is now
      reserved).  Instead, when a host-initiated resume finishes, the hub sets
      the port link state change bit.
      
      When a USB 3.0 device initiates remote wakeup, the parent hubs with
      their upstream links in U3 will pass the LFPS up the chain.  The first
      hub that has an upstream link in U0 (which may be the roothub) will
      reflect that LFPS back down the path to the device.
      
      However, the parent hubs in the resumed path will not set their link
      state change bit.  Instead, the device that initiated the resume has to
      send an asynchronous "Function Wake" Device Notification up to the host
      controller.  Therefore, we need a way to notify the USB core of a device
      resume without going through the normal hub URB completion method.
      
      First, make the xHCI roothub act like an external USB 3.0 hub and not
      pass up the port link state change bit when a device-initiated resume
      finishes.  Introduce a new xHCI bit field, port_remote_wakeup, so that
      we can tell the difference between a port coming out of the U3Exit state
      (host-initiated resume) and the RExit state (ending state of
      device-initiated resume).
      
      Since the USB core can't tell whether a port on a hub has resumed by
      looking at the Hub Status buffer, we need to introduce a bitfield,
      wakeup_bits, that indicates which ports have resumed.  When the xHCI
      driver notices a port finishing a device-initiated resume, we call into
      a new USB core function, usb_wakeup_notification(), that will set
      the right bit in wakeup_bits, and kick khubd for that hub.
      
      We also call usb_wakeup_notification() when the Function Wake Device
      Notification is received by the xHCI driver.  This covers the case where
      the link between the roothub and the first-tier hub is in U0, and the
      hub reflects the resume signaling back to the device without giving any
      indication it has done so until the device sends the Function Wake
      notification.
      
      Change the code in khubd that handles the remote wakeup to look at the
      state the USB core thinks the device is in, and handle the remote wakeup
      if the port's wakeup bit is set.
      
      This patch only takes care of the case where the device is attached
      directly to the roothub, or the USB 3.0 hub that is attached to the root
      hub is the device sending the Function Wake Device Notification (e.g.
      because a new USB device was attached).  The other cases will be covered
      in a second patch.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      4ee823b8
  2. 15 11月, 2011 1 次提交
    • A
      USB: Remove the SAW_IRQ hcd flag · 968b822c
      Alan Stern 提交于
      The HCD_FLAG_SAW_IRQ flag was introduced in order to catch IRQ routing
      errors: If an URB was unlinked and the host controller hadn't gotten
      any IRQs, it seemed likely that the IRQs were directed to the wrong
      vector.
      
      This warning hasn't come up in many years, as far as I know; interrupt
      routing now seems to be well under control.  Therefore there's no
      reason to keep the flag around any more.  This patch (as1495) finally
      removes it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      968b822c
  3. 11 10月, 2011 1 次提交
  4. 27 9月, 2011 1 次提交
  5. 14 3月, 2011 4 次提交
    • S
      usb: Make core allocate resources per PCI-device. · c5635437
      Sarah Sharp 提交于
      Introduce the notion of a PCI device that may be associated with more than
      one USB host controller driver (struct usb_hcd).  This patch is the start
      of the work to separate the xHCI host controller into two roothubs: a USB
      3.0 roothub with SuperSpeed-only ports, and a USB 2.0 roothub with
      HS/FS/LS ports.
      
      One usb_hcd structure is designated to be the "primary HCD", and a pointer
      is added to the usb_hcd structure to keep track of that.  A new function
      call, usb_hcd_is_primary_hcd() is added to check whether the USB hcd is
      marked as the primary HCD (or if it is not part of a roothub pair).  To
      allow the USB core and xHCI driver to access either roothub in a pair, a
      "shared_hcd" pointer is added to the usb_hcd structure.
      
      Add a new function, usb_create_shared_hcd(), that does roothub allocation
      for paired roothubs.  It will act just like usb_create_hcd() did if the
      primary_hcd pointer argument is NULL.  If it is passed a non-NULL
      primary_hcd pointer, it sets usb_hcd->shared_hcd and usb_hcd->primary_hcd
      fields.  It will also skip the bandwidth_mutex allocation, and set the
      secondary hcd's bandwidth_mutex pointer to the primary HCD's mutex.
      
      IRQs are only allocated once for the primary roothub.
      
      Introduce a new usb_hcd driver flag that indicates the host controller
      driver wants to create two roothubs.  If the HCD_SHARED flag is set, then
      the USB core PCI probe methods will allocate a second roothub, and make
      sure that second roothub gets freed during rmmod and in initialization
      error paths.
      
      When usb_hc_died() is called with the primary HCD, make sure that any
      roothubs that share that host controller are also marked as being dead.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      c5635437
    • S
      usb: Store bus type in usb_hcd, not in driver flags. · 83de4b2b
      Sarah Sharp 提交于
      The xHCI driver essentially has both a USB 2.0 and a USB 3.0 roothub.  So
      setting the HCD_USB3 bits in the hcd->driver->flags is a bit misleading.
      Add a new field to usb_hcd, bcdUSB.  Store the result of
      hcd->driver->flags & HCD_MASK in it.  Later, when we have the xHCI driver
      register the two roothubs, we'll set the usb_hcd->bcdUSB field to HCD_USB2
      for the USB 2.0 roothub, and HCD_USB3 for the USB 3.0 roothub.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      83de4b2b
    • S
      usb: Change usb_hcd->bandwidth_mutex to a pointer. · d673bfcb
      Sarah Sharp 提交于
      Change the bandwith_mutex in struct usb_hcd to a pointer.  This will allow
      the pointer to be shared across usb_hcds for the upcoming work to split
      the xHCI driver roothub into a USB 2.0/1.1 and a USB 3.0 bus.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      d673bfcb
    • 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
  6. 08 3月, 2011 1 次提交
    • A
      USB: move usbcore away from hcd->state · 9b37596a
      Alan Stern 提交于
      The hcd->state variable is a disaster.  It's not clearly owned by
      either usbcore or the host controller drivers, and they both change it
      from time to time, potentially stepping on each other's toes.  It's
      not protected by any locks.  And there's no mechanism to prevent it
      from going through an invalid transition.
      
      This patch (as1451) takes a first step toward fixing these problems.
      As it turns out, usbcore uses hcd->state for essentially only two
      things: checking whether the controller's root hub is running and
      checking whether the controller has died.  Therefore the patch adds
      two new atomic bitflags to the hcd structure, to store these pieces of
      information.  The new flags are used only by usbcore, and a private
      spinlock prevents invalid combinations (a dead controller's root hub
      cannot be running).
      
      The patch does not change the places where usbcore sets hcd->state,
      since HCDs may depend on them.  Furthermore, there is one place in
      usb_hcd_irq() where usbcore still must use hcd->state: An HCD's
      interrupt handler can implicitly indicate that the controller died by
      setting hcd->state to HC_STATE_HALT.  Nevertheless, the new code is a
      big improvement over the current code.
      
      The patch makes one other change.  The hcd_bus_suspend() and
      hcd_bus_resume() routines now check first whether the host controller
      has died; if it has then they return immediately without calling the
      HCD's bus_suspend or bus_resume methods.
      
      This fixes the major problem reported in Bugzilla #29902: The system
      fails to suspend after a host controller dies during system resume.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NAlex Terekhov <a.terekhov@gmail.com>
      CC: <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9b37596a
  7. 05 2月, 2011 2 次提交
  8. 15 1月, 2011 1 次提交
  9. 11 11月, 2010 1 次提交
  10. 23 10月, 2010 2 次提交
  11. 11 8月, 2010 5 次提交
    • A
      USB: fix race between root-hub wakeup & controller suspend · ff2f0787
      Alan Stern 提交于
      This patch (as1395) adds code to hcd_pci_suspend() for handling wakeup
      races.  This is another general race pattern, similar to the "open
      vs. unregister" race we're all familiar with.  Here, the race is
      between suspending a device and receiving a wakeup request from one of
      the device's suspended children.
      
      In particular, if a root-hub wakeup is requested at about the same
      time as the corresponding USB controller is suspended, and if the
      controller is enabled for wakeup, then the controller should either
      fail to suspend or else wake right back up again.
      
      During system sleep this won't happen very much, especially since host
      controllers generally aren't enabled for wakeup during sleep.  However
      it is definitely an issue for runtime PM.  Something like this will be
      needed to prevent the controller from autosuspending while waiting for
      a root-hub resume to take place.  (That is, in fact, the common case,
      for which there is an extra test.)
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ff2f0787
    • A
      USB: add do_wakeup parameter for PCI HCD suspend · 4147200d
      Alan Stern 提交于
      This patch (as1385) adds a "do_wakeup" parameter to the pci_suspend
      method used by PCI-based host controller drivers.  ehci-hcd in
      particular needs to know whether or not to enable wakeup when
      suspending a controller.  Although that information is currently
      available through device_may_wakeup(), when support is added for
      runtime suspend this will no longer be true.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4147200d
    • A
      USB: convert usb_hcd bitfields into atomic flags · 541c7d43
      Alan Stern 提交于
      This patch (as1393) converts several of the single-bit fields in
      struct usb_hcd to atomic flags.  This is for safety's sake; not all
      CPUs can update bitfield values atomically, and these flags are used
      in multiple contexts.
      
      The flag fields that are set only during registration or removal can
      remain as they are, since non-atomic accesses at those times will not
      cause any problems.
      
      (Strictly speaking, the authorized_default flag should become atomic
      as well.  I didn't bother with it because it gets changed only via
      sysfs.  It can be done later, if anyone wants.)
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      541c7d43
    • A
      USB: EHCI: EHCI 1.1 addendum: Basic LPM feature support · 48f24970
      Alek Du 提交于
      With this patch, the LPM capable EHCI host controller can put device
      into L1 sleep state which is a mode that can enter/exit quickly, and
      reduce power consumption.
      Signed-off-by: NJacob Pan <jacob.jun.pan@intel.com>
      Signed-off-by: NAlek Du <alek.du@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      48f24970
    • A
      USB: don't stop root-hub status polls too soon · 6d88e679
      Alan Stern 提交于
      This patch (as1390) fixes a problem that crops up when a UHCI host
      controller is unbound from uhci-hcd while there are still some active
      URBs.  The URBs have to be unlinked when the root hub is unregistered,
      and uhci-hcd relies upon root-hub status polls as part of its
      unlinking procedure.  But usb_hcd_poll_rh_status() won't make those
      status calls if hcd->rh_registered is clear, and the flag is cleared
      _before_ the unregistration takes place.
      
      Since hcd->rh_registered is used for other things and needs to be
      cleared early, the solution is to add a new flag (rh_pollable) and use
      it instead.  It gets cleared _after_ the root hub is unregistered.
      
      Now that the status polls don't end too soon, we have to make sure
      they also don't occur too late -- after the root hub's usb_device
      structure or the HCD's private structures are deallocated.  Therefore
      the patch adds usb_get_device() and usb_put_device() calls to protect
      the root hub structure, and it adds an extra del_timer_sync() to
      prevent the root-hub timer from causing an unexpected status poll.
      
      This additional complexity would not be needed if the HCD framework
      had provided separate stop() and release() callbacks instead of just
      stop().  This lack could be fixed at some future time (although it
      would require changes to every host controller driver); when that
      happens this patch won't be needed any more.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6d88e679
  12. 21 5月, 2010 5 次提交
    • G
      USB: include/usb/*.h checkpatch cleanup · 0858a3a5
      Greg Kroah-Hartman 提交于
      Lots of minor formatting cleanups in includes/usb/ to make checkpatch
      happier.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0858a3a5
    • S
      USB: Support for allocating USB 3.0 streams. · eab1cafc
      Sarah Sharp 提交于
      Bulk endpoint streams were added in the USB 3.0 specification.  Streams
      allow a device driver to overload a bulk endpoint so that multiple
      transfers can be queued at once.
      
      The device then decides which transfer it wants to work on first, and can
      queue part of a transfer before it switches to a new stream.  All this
      switching is invisible to the device driver, which just gets a completion
      for the URB.  Drivers that use streams must be able to handle URBs
      completing in a different order than they were submitted to the endpoint.
      
      This requires adding new API to set up xHCI data structures to support
      multiple queues ("stream rings") per endpoint.  Drivers will allocate a
      number of stream IDs before enqueueing URBs to the bulk endpoints of the
      device, and free the stream IDs in their disconnect function.  See
      Documentation/usb/bulk-streams.txt for details.
      
      The new mass storage device class, USB Attached SCSI Protocol (UASP), uses
      these streams API.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eab1cafc
    • E
      USB: split hub.h into ch11.h and merge-in hcd.h · d20db4b4
      Eric Lescouet 提交于
      Base on inputs from Alan Stern, split the hub.h header into:
      - new ch11.h header (most of it) containing constants and
        structures from chapter 11 of the USB 2.0 spec.
      - a small remaining part being merged into hcd.h.
      Signed-of-by: NEric Lescouet <eric@lescouet.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d20db4b4
    • E
      USB: make hub.h public (drivers dependency) · d65d7e7e
      Eric Lescouet 提交于
      The usbcore headers: hcd.h and hub.h are shared between usbcore,
      HCDs and a couple of other drivers (e.g. USBIP modules).
      So, it makes sense to move them into a more public location and
      to cleanup dependency of those modules on kernel internal headers.
      This patch moves hub.h from drivers/usb/core into include/linux/usb/
      Signed-of-by: NEric Lescouet <eric@lescouet.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d65d7e7e
    • E
      USB: make hcd.h public (drivers dependency) · 27729aad
      Eric Lescouet 提交于
      The usbcore headers: hcd.h and hub.h are shared between usbcore,
      HCDs and a couple of other drivers (e.g. USBIP modules).
      So, it makes sense to move them into a more public location and
      to cleanup dependency of those modules on kernel internal headers.
      This patch moves hcd.h from drivers/usb/core into include/linux/usb/
      Signed-of-by: NEric Lescouet <eric@lescouet.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      27729aad
  13. 03 3月, 2010 3 次提交
    • H
      USB: Move hcd free_dev call into usb_disconnect to fix oops · f7410ced
      Herbert Xu 提交于
      USB: Move hcd free_dev call into usb_disconnect
      
      I found a way to oops the kernel:
      
      1. Open a USB device through devio.
      2. Remove the hcd module in the host kernel.
      3. Close the devio file descriptor.
      
      The problem is that closing the file descriptor does usb_release_dev
      as it is the last reference.  usb_release_dev then tries to invoke
      the hcd free_dev function (or rather dereferencing the hcd driver
      struct).  This causes an oops as the hcd driver has already been
      unloaded so the struct is gone.
      
      This patch tries to fix this by bringing the free_dev call earlier
      and into usb_disconnect.  I have verified that repeating the
      above steps no longer crashes with this patch applied.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f7410ced
    • A
      USB: convert to the runtime PM framework · 9bbdf1e0
      Alan Stern 提交于
      This patch (as1329) converts the USB stack over to the PM core's
      runtime PM framework.  This involves numerous changes throughout
      usbcore, especially to hub.c and driver.c.  Perhaps the most notable
      change is that CONFIG_USB_SUSPEND now depends on CONFIG_PM_RUNTIME
      instead of CONFIG_PM.
      
      Several fields in the usb_device and usb_interface structures are no
      longer needed.  Some code which used to depend on CONFIG_USB_PM now
      depends on CONFIG_USB_SUSPEND (requiring some rearrangement of header
      files).
      
      The only visible change in behavior should be that following a system
      sleep (resume from RAM or resume from hibernation), autosuspended USB
      devices will be resumed just like everything else.  They won't remain
      suspended.  But if they aren't in use then they will naturally
      autosuspend again in a few seconds.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9bbdf1e0
    • S
      USB: Add call to notify xHC of a device reset. · a5f0efab
      Sarah Sharp 提交于
      Add a new host controller driver method, reset_device(), that the USB core
      will use to notify the host of a successful device reset.  The call may
      fail due to out-of-memory errors; attempt the port reset sequence again if
      that happens.  Update hub_port_init() to allow resetting a configured
      device.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a5f0efab
  14. 16 12月, 2009 1 次提交
  15. 12 12月, 2009 1 次提交
    • S
      USB: Check bandwidth when switching alt settings. · 3f0479e0
      Sarah Sharp 提交于
      Make the USB core check the bandwidth when switching from one
      interface alternate setting to another.  Also check the bandwidth
      when resetting a configuration (so that alt setting 0 is used).  If
      this check fails, the device's state is unchanged.  If the device
      refuses the new alt setting, re-instate the old alt setting in the
      host controller hardware.
      
      If a USB device doesn't have an alternate interface setting 0, install
      the first alt setting in its descriptors when a new configuration is
      requested, or the device is reset.
      
      Add a mutex per root hub to protect bandwidth operations:
      adding/reseting/changing configurations, and changing alternate interface
      settings.  We want to ensure that the xHCI host controller and the USB
      device are set up for the same configurations and alternate settings.
      There are two (possibly three) steps to do this:
      
       1. The host controller needs to check that bandwidth is available for a
          different setting, by issuing and waiting for a configure endpoint
          command.
       2. Once that returns successfully, a control message is sent to the
          device.
       3. If that fails, the host controller must be notified through another
          configure endpoint command.
      
      The mutex is used to make these three operations seem atomic, to prevent
      another driver from using more bandwidth for a different device while
      we're in the middle of these operations.
      
      While we're touching the bandwidth code, rename usb_hcd_check_bandwidth()
      to usb_hcd_alloc_bandwidth().  This function does more than just check
      that the bandwidth change won't exceed the bus bandwidth; it actually
      changes the bandwidth configuration in the xHCI host controller.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3f0479e0
  16. 23 9月, 2009 1 次提交
  17. 13 7月, 2009 1 次提交
    • A
      USB: fix the clear_tt_buffer interface · cb88a1b8
      Alan Stern 提交于
      This patch (as1255) updates the interface for calling
      usb_hub_clear_tt_buffer().  Even the name of the function is changed!
      
      When an async URB (i.e., Control or Bulk) going through a high-speed
      hub to a non-high-speed device is cancelled or fails, the hub's
      Transaction Translator buffer may be left busy still trying to
      complete the transaction.  The buffer has to be cleared; that's what
      usb_hub_clear_tt_buffer() does.
      
      It isn't safe to send any more URBs to the same endpoint until the TT
      buffer is fully clear.  Therefore the HCD needs to be told when the
      Clear-TT-Buffer request has finished.  This patch adds a callback
      method to struct hc_driver for that purpose, and makes the hub driver
      invoke the callback at the proper time.
      
      The patch also changes a couple of names; "hub_tt_kevent" and
      "tt.kevent" now look rather antiquated.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cb88a1b8
  18. 16 6月, 2009 6 次提交
    • S
      USB: Support for bandwidth allocation. · 79abb1ab
      Sarah Sharp 提交于
      Originally, the USB core had no support for allocating bandwidth when a
      particular configuration or alternate setting for an interface was
      selected.  Instead, the device driver's URB submission would fail if
      there was not enough bandwidth for a periodic endpoint.  Drivers could
      work around this, by using the scatter-gather list API to guarantee
      bandwidth.
      
      This patch adds host controller API to allow the USB core to allocate or
      deallocate bandwidth for an endpoint.  Endpoints are added to or dropped
      from a copy of the current schedule by calling add_endpoint() or
      drop_endpoint(), and then the schedule is atomically evaluated with a
      call to check_bandwidth().  This allows all the endpoints for a new
      configuration or alternate setting to be added at the same time that the
      endpoints from the old configuration or alt setting are dropped.
      
      Endpoints must be added to the schedule before any URBs are submitted to
      them.  The HCD must be allowed to reject a new configuration or alt
      setting before the control transfer is sent to the device requesting the
      change.  It may reject the change because there is not enough bandwidth,
      not enough internal resources (such as memory on an embedded host
      controller), or perhaps even for security reasons in a virtualized
      environment.
      
      If the call to check_bandwidth() fails, the USB core must call
      reset_bandwidth().  This causes the schedule to be reverted back to the
      state it was in just after the last successful check_bandwidth() call.
      
      If the call succeeds, the host controller driver (and hardware) will have
      changed its internal state to match the new configuration or alternate
      setting.  The USB core can then issue a control transfer to the device to
      change the configuration or alt setting.  This allows the core to test new
      configurations or alternate settings before unbinding drivers bound to
      interfaces in the old configuration.
      
      WIP:
      
      The USB core must add endpoints from all interfaces in a configuration
      to the schedule, because a driver may claim that interface at any time.
      A slight optimization might be to add the endpoints to the schedule once
      a driver claims that interface.  FIXME
      
      This patch does not cover changing alternate settings, but it does
      handle a configuration change or de-configuration.  FIXME
      
      The code for managing the schedule is currently HCD specific.  A generic
      scheduling algorithm could be added for host controllers without
      built-in scheduling support.  For now, if a host controller does not
      define the check_bandwidth() function, the call to
      usb_hcd_check_bandwidth() will always succeed.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      79abb1ab
    • S
      USB: Support for addressing a USB device under xHCI · c6515272
      Sarah Sharp 提交于
      Add host controller driver API and a slot_id variable to struct
      usb_device.  This allows the xHCI host controller driver to ask the
      hardware to allocate a slot for the device when a struct usb_device is
      allocated.  The slot needs to be allocated at that point because the
      hardware can run out of internal resources, and we want to know that very
      early in the device connection process.  Don't call this new API for root
      hubs, since they aren't real devices.
      
      Add HCD API to let the host controller choose the device address.  This is
      especially important for xHCI hardware running in a virtualized
      environment.  The guests running under the VM don't need to know which
      addresses on the bus are taken, because the hardware picks the address for
      them.  Announce SuperSpeed USB devices after the address has been assigned
      by the hardware.
      
      Don't use the new get descriptor/set address scheme with xHCI.  Unless
      special handling is done in the host controller driver, the xHC can't
      issue control transfers before you set the device address.  Support for
      the older addressing scheme will be added when the xHCI driver supports
      the Block Set Address Request (BSR) flag in the Address Device command.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c6515272
    • S
      USB: Add SuperSpeed to the list of USB device speeds. · 6b403b02
      Sarah Sharp 提交于
      Modify the USB core to handle the new USB 3.0 speed, "SuperSpeed".  This
      is 5.0 Gbps (wire speed).  There are probably more places that check for
      speed that I've missed.
      
      SuperSpeed devices have a 512 byte endpoint 0 max packet size.  This shows
      up as a bMaxPacketSize0 set to 0x09 (see table 9-8 of the USB 3.0 bus
      spec).
      
      xHCI spec says that the xHC can handle intervals up to 2^15 microframes.  That
      might change when real silicon becomes available.
      
      Add FIXME note for SuperSpeed isochronous endpoints.  They can transmit up
      to 16 packets in one "burst" before they wait for an acknowledgment of the
      packets.  They can do up to 3 bursts per microframe (determined by the
      mult value in the endpoint companion descriptor).  The xHCI driver doesn't
      have support for isoc yet, so fix this later.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6b403b02
    • S
      USB: xhci: BIOS handoff and HW initialization. · 66d4eadd
      Sarah Sharp 提交于
      Add PCI initialization code to take control of the xHCI host controller
      away from the BIOS, halt, and reset the host controller.  The xHCI spec
      says that BIOSes must give up the host controller within 5 seconds.
      
      Add some host controller glue functions to handle hardware initialization
      and memory allocation for the host controller.  The current xHCI
      prototypes use PCI interrupts, but the xHCI spec requires MSI-X
      interrupts.  Add code to support MSI-X interrupts, but use the PCI
      interrupts for now.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      66d4eadd
    • A
      USB: new flag for resume-from-hibernation · 6ec4beb5
      Alan Stern 提交于
      This patch (as1237) changes the way the PCI host controller drivers
      avoid retaining bogus hardware states during resume-from-hibernation.
      Previously we had reset the hardware as part of preparing to reinstate
      the memory image.  But we can do better now with the new PM framework,
      since we know exactly which resume operations are from hibernation.
      
      The pci_resume method is changed to accept a flag indicating whether
      the system is resuming from hibernation.  When this flag is set, the
      drivers will reset the hardware to get rid of any existing state.
      
      Similarly, the pci_suspend method is changed to remove the
      pm_message_t argument.  It's no longer needed, since no special action
      has to be taken when preparing to reinstate the memory image.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6ec4beb5
    • A
      USB: move PCI host controllers to new PM framework · abb30641
      Alan Stern 提交于
      This patch (as1236) converts the USB PCI power management routines
      over to the new PM framework.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      abb30641
  19. 18 4月, 2009 1 次提交
    • D
      USB: add reset endpoint operations · 3444b26a
      David Vrabel 提交于
      Wireless USB endpoint state has a sequence number and a current
      window and not just a single toggle bit.  So allow HCDs to provide a
      endpoint_reset method and call this or clear the software toggles as
      required (after a clear halt, set configuration etc.).
      
      usb_settoggle() and friends are then HCD internal and are moved into
      core/hcd.h and all device drivers call usb_reset_endpoint() instead.
      
      If the device endpoint state has been reset (with a clear halt) but
      the host endpoint state has not then subsequent data transfers will
      not complete. The device will only work again after it is reset or
      disconnected.
      Signed-off-by: NDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3444b26a
  20. 18 2月, 2009 1 次提交