1. 28 5月, 2014 7 次提交
    • D
      usb: sysfs link peer ports · b7e38eac
      Dan Williams 提交于
      The usb topology after this change will have symlinks between usb3 ports
      and their usb2 peers, for example:
      
      usb2/2-1/2-1:1.0/2-1-port1/peer => ../../../../usb3/3-1/3-1:1.0/3-1-port1
      usb2/2-1/2-1:1.0/2-1-port2/peer => ../../../../usb3/3-1/3-1:1.0/3-1-port2
      usb2/2-1/2-1:1.0/2-1-port3/peer => ../../../../usb3/3-1/3-1:1.0/3-1-port3
      usb2/2-1/2-1:1.0/2-1-port4/peer => ../../../../usb3/3-1/3-1:1.0/3-1-port4
      usb2/2-0:1.0/usb2-port1/peer    => ../../../usb3/3-0:1.0/usb3-port1
      usb2/2-0:1.0/usb2-port2/peer    => ../../../usb3/3-0:1.0/usb3-port2
      usb2/2-0:1.0/usb2-port3/peer    => ../../../usb3/3-0:1.0/usb3-port3
      usb2/2-0:1.0/usb2-port4/peer    => ../../../usb3/3-0:1.0/usb3-port4
      
      usb3/3-1/3-1:1.0/usb3-1-port1/peer => ../../../../usb2/2-1/2-1:1.0/2-1-port1
      usb3/3-1/3-1:1.0/usb3-1-port2/peer => ../../../../usb2/2-1/2-1:1.0/2-1-port2
      usb3/3-1/3-1:1.0/usb3-1-port3/peer => ../../../../usb2/2-1/2-1:1.0/2-1-port3
      usb3/3-1/3-1:1.0/usb3-1-port4/peer => ../../../../usb2/2-1/2-1:1.0/2-1-port4
      usb3/3-0:1.0/usb3-port1/peer       => ../../../usb2/2-0:1.0/usb2-port1
      usb3/3-0:1.0/usb3-port2/peer       => ../../../usb2/2-0:1.0/usb2-port2
      usb3/3-0:1.0/usb3-port3/peer       => ../../../usb2/2-0:1.0/usb2-port3
      usb3/3-0:1.0/usb3-port4/peer       => ../../../usb2/2-0:1.0/usb2-port4
      
      Introduce link_peers_report() to notify on all link_peers() failure
      cases.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7e38eac
    • D
      usb: find internal hub tier mismatch via acpi · 3bfd659b
      Dan Williams 提交于
      ACPI identifies peer ports by setting their 'group_token' and
      'group_position' _PLD data to the same value.  If a platform has tier
      mismatch [1] , ACPI can override the default (USB3 defined) peer port
      association for internal hubs.  External hubs follow the default peer
      association scheme.
      
      Location data is cached as an opaque cookie in usb_port_location data.
      
      Note that we only consider the group_token and group_position attributes
      from the _PLD data as ACPI specifies that group_token is a unique
      identifier.
      
      When we find port location data for a port then we assume that the
      firmware will also describe its peer port.  This allows the
      implementation to only ever set the peer once.  This leads to a question
      about what happens when a pm runtime event occurs while the peer
      associations are still resolving.  Since we only ever set the peer
      information once, a USB3 port needs to be prevented from suspending
      while its ->peer pointer is NULL (implemented in a subsequent patch).
      
      There is always the possibility that firmware mis-identifies the ports,
      but there is not much the kernel can do in that case.
      
      [1]: xhci 1.1 appendix D figure 131
      [2]: acpi 5 section 6.1.8
      
      [alan]: don't do default peering when acpi data present
      Suggested-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3bfd659b
    • D
      usb: assign usb3 external hub port peers · 8b1ba80c
      Dan Williams 提交于
      Given that root hub port peers are already established, external hub peer
      ports can be determined by traversing the device topology:
      
      1/ ascend to the parent hub and find the upstream port_dev
      
      2/ walk ->peer to find the peer port
      
      3/ descend to the peer hub via ->child
      
      4/ find the port with the matching port id
      
      Note that this assumes the port labeling scheme required by the
      specification [1].
      
      [1]: usb3 3.1 section 10.3.3
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b1ba80c
    • D
      usb: assign default peer ports for root hubs · d8521afe
      Dan Williams 提交于
      Assume that the peer of a superspeed port is the port with the same id
      on the shared_hcd root hub.  This identification scheme is required of
      external hubs by the USB3 spec [1].  However, for root hubs, tier mismatch
      may be in effect [2].  Tier mismatch can only be enumerated via platform
      firmware.  For now, simply perform the nominal association.
      
      A new lock 'usb_port_peer_mutex' is introduced to synchronize port
      device add/remove with peer lookups.  It protects peering against
      changes to hcd->shared_hcd, hcd->self.root_hub, hdev->maxchild, and
      port_dev->child pointers.
      
      [1]: usb 3.1 section 10.3.3
      [2]: xhci 1.1 appendix D
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      [alan: usb_port_peer_mutex locking scheme]
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8521afe
    • D
      usb: rename usb_port device objects · d99f6b41
      Dan Williams 提交于
      The current port name "portX" is ambiguous.  Before adding more port
      messages rename ports to "<hub-device-name>-portX"
      
      This is an ABI change, but the suspicion is that it will go unnoticed as
      the port power control implementation has been broken since its
      introduction.  If however, someone was relying on the old name we can
      add sysfs links from the old name to the new name.
      
      Additionally, it unifies/simplifies port dev_printk messages and modifies
      instances of:
      	dev_XXX(hub->intfdev, ..."port %d"...
      	dev_XXX(&hdev->dev, ..."port%d"...
      into:
      	dev_XXX(&port_dev->dev, ...
      
      Now that the names are unique usb_port devices it would be nice if they
      could be included in /sys/bus/usb.  However, it turns out that this
      breaks 'lsusb -t'.  For now, create a dummy port driver so that print
      messages are prefixed "usb 1-1-port3" rather than the
      subsystem-ambiguous " 1-1-port3".
      
      Finally, it corrects an odd usage of sscanf("port%d") in usb-acpi.c.
      Suggested-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d99f6b41
    • D
      usb: disable port power control if not supported in wHubCharacteristics · 9262c19d
      Dan Williams 提交于
      A hub indicates whether it supports per-port power control via the
      wHubCharacteristics field in its descriptor.  If it is not supported
      a hub will still emulate ClearPortPower(PORT_POWER) requests by
      stopping the link state machine.  However, since this does not save
      power do not bother suspending.
      
      This also consolidates support checks into a
      hub_is_port_power_switchable() helper.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9262c19d
    • A
      USB: mutual exclusion for resetting a hub and power-managing a port · 600856c2
      Alan Stern 提交于
      The USB core doesn't properly handle mutual exclusion between
      resetting a hub and changing the power states of the hub's ports.  We
      need to avoid sending port-power requests to the hub while it is being
      reset, because such requests cannot succeed.
      
      This patch fixes the problem by keeping track of when a reset is in
      progress.  At such times, attempts to suspend (power-off) a port will
      fail immediately with -EBUSY, and calls to usb_port_runtime_resume()
      will update the power_is_on flag and return immediately.  When the
      reset is complete, hub_activate() will automatically restore each port
      to the proper power state.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      600856c2
  2. 26 8月, 2013 1 次提交
  3. 16 8月, 2013 1 次提交
    • S
      usb: Don't fail port power resume on device disconnect. · d49dad3e
      Sarah Sharp 提交于
      Userspace can tell the kernel to power off any USB port, including ones
      that are visible and connectible to users.  When an attached USB device
      goes into suspend, the port will be powered off if the
      pm_qos_no_port_poweroff file for its port is set to 0, the device does
      not have remote wakeup enabled, and the device is marked as persistent.
      
      If the user disconnects the USB device while the port is powered off,
      the current code does not handle that properly.  If you disconnect a
      device, and then run `lsusb -v -s` for the device, the device disconnect
      does not get handled by the USB core.  The runtime resume of the port
      fails, because hub_port_debounce_be_connected() returns -ETIMEDOUT.
      
      This means the port resume fails and khubd doesn't handle the USB device
      disconnect.  This leaves the device listed in lsusb, and the port's
      runtime_status will be permanently marked as "error".
      
      Fix this by ignoring the return value of hub_port_debounce_be_connected.
      Users can disconnect USB devices while the ports are powered off, and we
      must be able to handle that.
      
      This patch should be backported to kernels as old as 3.9, that
      contain the commit ad493e5e "usb: add
      usb port auto power off mechanism"
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Lan Tianyu <tianyu.lan@intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      d49dad3e
  4. 19 6月, 2013 1 次提交
  5. 04 6月, 2013 1 次提交
  6. 02 4月, 2013 1 次提交
  7. 29 3月, 2013 1 次提交
    • A
      USB: remove CONFIG_USB_SUSPEND option · 84ebc102
      Alan Stern 提交于
      This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially
      replacing it everywhere with CONFIG_PM_RUNTIME (except for one place
      in hub.c, where it is replaced with CONFIG_PM because the code needs
      to be used in both runtime and system PM).  The net result is code
      shrinkage and simplification.
      
      There's very little point in keeping CONFIG_USB_SUSPEND because almost
      everybody enables it.  The few that don't will find that the usbcore
      module has gotten somewhat bigger and they will have to take active
      measures if they want to prevent hubs from being runtime suspended.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Peter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84ebc102
  8. 29 1月, 2013 1 次提交
  9. 26 1月, 2013 5 次提交
  10. 21 1月, 2013 2 次提交
    • L
      usb: Add "portX/connect_type" attribute to expose usb port's connect type · cef7468c
      Lan Tianyu 提交于
      Some platforms provide usb port connect types through ACPI. This
      patch is to add this new attribute to expose these information
      to user space.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cef7468c
    • L
      usb: fix compilation error and warning of driver/usb/core/port.c on arm and blackfin · 9f7344fb
      Lan Tianyu 提交于
      This patch is to fix compilation error and warning on the arm and blackfin.
      Add linux/slab.h head file to driver/usb/core/port.c. These are reported
      from 0-DAY kernel build testing backend.
      
      head:   6e30d7cb
      commit: 6e30d7cb [26/26] usb: Add driver/usb/core/(port.c,hub.h) files
      config: make ARCH=arm at91_dt_defconfig
      
      All error/warnings:
      
         drivers/usb/core/port.c: In function 'usb_port_device_release':
      >> drivers/usb/core/port.c:25:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
         drivers/usb/core/port.c: In function 'usb_hub_create_port_device':
      >> drivers/usb/core/port.c:38:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
      >> drivers/usb/core/port.c:38:40: error: 'GFP_KERNEL' undeclared (first use in this function)
         drivers/usb/core/port.c:38:40: note: each undeclared identifier is reported only once for each function it appears in
         cc1: some warnings being treated as errors
      
      head:   6e30d7cb
      commit: 6e30d7cb [26/26] usb: Add driver/usb/core/(port.c,hub.h) files
      config: make ARCH=blackfin BF526-EZBRD_defconfig
      
      All warnings:
      
         drivers/usb/core/port.c: In function 'usb_port_device_release':
         drivers/usb/core/port.c:25:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
         drivers/usb/core/port.c: In function 'usb_hub_create_port_device':
         drivers/usb/core/port.c:38:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
      >> drivers/usb/core/port.c:38:11: warning: assignment makes pointer from integer without a cast [enabled by default]
         cc1: some warnings being treated as errors
      Reported-by: NFengguang Wu <wfg@linux.intel.com>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f7344fb
  11. 19 1月, 2013 1 次提交