1. 29 9月, 2014 3 次提交
  2. 25 9月, 2014 1 次提交
    • M
      usb: Add LED triggers for USB activity · 0cfbd328
      Michal Sojka 提交于
      With this patch, USB activity can be signaled by blinking a LED. There
      are two triggers, one for activity on USB host and one for USB gadget.
      
      Both triggers should work with all host/device controllers. Tested only
      with musb.
      
      Performace: I measured performance overheads on ARM Cortex-A8 (TI
      AM335x) running on 600 MHz.
      
      Duration of usb_led_activity():
      - with no LED attached to the trigger:        2 ± 1 µs
      - with one GPIO LED attached to the trigger:  2 ± 1 µs or 8 ± 2 µs (two peaks in histogram)
      
      Duration of functions calling usb_led_activity() (with this patch
      applied and no LED attached to the trigger):
      - __usb_hcd_giveback_urb():    10 - 25 µs
      - usb_gadget_giveback_request(): 2 - 6 µs
      Signed-off-by: NMichal Sojka <sojka@merica.cz>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Tested-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0cfbd328
  3. 24 9月, 2014 12 次提交
  4. 11 9月, 2014 1 次提交
  5. 28 8月, 2014 1 次提交
  6. 27 8月, 2014 1 次提交
  7. 20 8月, 2014 2 次提交
  8. 02 8月, 2014 2 次提交
  9. 23 7月, 2014 2 次提交
    • A
      usb: core: allow zero packet flag for interrupt urbs · 9672f0fe
      Amit Virdi 提交于
      Section 4.4.7.2 "Interrupt Transfer Bandwidth Requirements" of the USB3.0 spec
      says:
      	A zero-length data payload is a valid transfer and may be useful for
      	some implementations.
      
      So, extend the logic of allowing URB_ZERO_PACKET to interrupt urbs too.
      Otherwise, the kernel throws warning of BOGUS transfer flags.
      Signed-off-by: NAmit Virdi <amit.virdi@st.com>
      Acked-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9672f0fe
    • J
      USB: core: hcd-pci: free IRQ before disabling PCI device when shutting down · c5946f9d
      Jiang Liu 提交于
      The assigned IRQ should be freed before calling pci_disable_device()
      when shutting down system, otherwise it will cause following warning.
      [  568.879482] ------------[ cut here ]------------
      [  568.884236] WARNING: CPU: 1 PID: 3300 at /home/konrad/ssd/konrad/xtt-i386/bootstrap/linux-usb/fs/proc/generic.c:521 remove_proc_entry+0x165/0x170()
      [  568.897846] remove_proc_entry: removing non-empty directory 'irq/16', leaking at least 'ohci_hcd:usb4'
      [  568.907430] Modules linked in: dm_multipath dm_mod iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi libcrc32c crc32c_generic sg sd_mod crct10dif_generic crc_t10dif crct10dif_common radeon fbcon tileblit ttm font bitblit softcursor ata_generic ahci libahci drm_kms_helper skge r8169 libata mii scsi_mod wmi acpi_cpufreq
      [  568.938539] CPU: 1 PID: 3300 Comm: init Tainted: G        W     3.16.0-rc5upstream-01651-g03b9189 #1
      [  568.947946] Hardware name: ECS A780GM-A Ultra/A780GM-A Ultra, BIOS 080015  04/01/2010
      [  568.956008]  00000209 ed0f1cd0 c1617946 c175403c ed0f1d00 c1090c3f c1754084 ed0f1d2c
      [  568.964068]  00000ce4 c175403c 00000209 c11f22a5 c11f22a5 f755e8c0 ed0f1d78 f755e90d
      [  568.972128]  ed0f1d18 c1090cde 00000009 ed0f1d10 c1754084 ed0f1d2c ed0f1d60 c11f22a5
      [  568.980194] Call Trace:
      [  568.982715]  [<c1617946>] dump_stack+0x48/0x60
      [  568.987294]  [<c1090c3f>] warn_slowpath_common+0x7f/0xa0
      [  569.003887]  [<c1090cde>] warn_slowpath_fmt+0x2e/0x30
      [  569.009092]  [<c11f22a5>] remove_proc_entry+0x165/0x170
      [  569.014476]  [<c10da6ca>] unregister_irq_proc+0xaa/0xc0
      [  569.019858]  [<c10d582f>] free_desc+0x1f/0x60
      [  569.024346]  [<c10d58aa>] irq_free_descs+0x3a/0x80
      [  569.029283]  [<c10d9e9d>] irq_dispose_mapping+0x2d/0x50
      [  569.034666]  [<c1078fd3>] mp_unmap_irq+0x73/0xa0
      [  569.039423]  [<c107196b>] acpi_unregister_gsi_ioapic+0x2b/0x40
      [  569.045431]  [<c107180f>] acpi_unregister_gsi+0xf/0x20
      [  569.050725]  [<c1339cad>] acpi_pci_irq_disable+0x4b/0x50
      [  569.056196]  [<c14daa38>] pcibios_disable_device+0x18/0x20
      [  569.061848]  [<c130123d>] do_pci_disable_device+0x4d/0x60
      [  569.067410]  [<c13012b7>] pci_disable_device+0x47/0xb0
      [  569.077814]  [<c14800b1>] usb_hcd_pci_shutdown+0x31/0x40
      [  569.083285]  [<c1304b19>] pci_device_shutdown+0x19/0x50
      [  569.088667]  [<c13fda64>] device_shutdown+0x14/0x120
      [  569.093777]  [<c10ac29d>] kernel_restart_prepare+0x2d/0x30
      [  569.099429]  [<c10ac41e>] kernel_restart+0xe/0x60
      [  569.109028]  [<c10ac611>] SYSC_reboot+0x191/0x220
      [  569.159269]  [<c10ac6ba>] SyS_reboot+0x1a/0x20
      [  569.163843]  [<c161c718>] sysenter_do_call+0x12/0x16
      [  569.168951] ---[ end trace ccc1ec4471c289c9 ]---
      Tested-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Reviewed-by: NHuang Rui <ray.huang@amd.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c5946f9d
  10. 19 7月, 2014 3 次提交
    • P
      USB: Fix persist resume of some SS USB devices · a40178b2
      Pratyush Anand 提交于
      Problem Summary: Problem has been observed generally with PM states
      where VBUS goes off during suspend. There are some SS USB devices which
      take longer time for link training compared to many others.  Such
      devices fail to reconnect with same old address which was associated
      with it before suspend.
      
      When system resumes, at some point of time (dpm_run_callback->
      usb_dev_resume->usb_resume->usb_resume_both->usb_resume_device->
      usb_port_resume) SW reads hub status. If device is present,
      then it finishes port resume and re-enumerates device with same
      address. If device is not present then, SW thinks that device was
      removed during suspend and therefore does logical disconnection
      and removes all the resource allocated for this device.
      
      Now, if I put sufficient delay just before root hub status read in
      usb_resume_device then, SW sees always that device is present. In normal
      course(without any delay) SW sees that no device is present and then SW
      removes all resource associated with the device at this port.  In the
      latter case, after sometime, device says that hey I am here, now host
      enumerates it, but with new address.
      
      Problem had been reproduced when I connect verbatim USB3.0 hard disc
      with my STiH407 XHCI host running with 3.10 kernel.
      
      I see that similar problem has been reported here.
      https://bugzilla.kernel.org/show_bug.cgi?id=53211
      Reading above it seems that bug was not in 3.6.6 and was present in 3.8
      and again it was not present for some in 3.12.6, while it was present
      for few others. I tested with 3.13-FC19 running at i686 desktop, problem
      was still there. However, I was failed to reproduce it with 3.16-RC4
      running at same i686 machine. I would say it is just a random
      observation. Problem for few devices is always there, as I am unable to
      find a proper fix for the issue.
      
      So, now question is what should be the amount of delay so that host is
      always able to recognize suspended device after resume.
      
      XHCI specs 4.19.4 says that when Link training is successful, port sets
      CSC bit to 1. So if SW reads port status before successful link
      training, then it will not find device to be present.  USB Analyzer log
      with such buggy devices show that in some cases device switch on the
      RX termination after long delay of host enabling the VBUS. In few other
      cases it has been seen that device fails to negotiate link training in
      first attempt. It has been reported till now that few devices take as
      long as 2000 ms to train the link after host enabling its VBUS and
      RX termination. This patch implements a 2000 ms timeout for CSC bit to set
      ie for link training. If in a case link trains before timeout, loop will
      exit earlier.
      
      This patch implements above delay, but only for SS device and when
      persist is enabled.
      
      So, for the good device overhead is almost none. While for the bad
      devices penalty could be the time which it take for link training.
      But, If a device was connected before suspend, and was removed
      while system was asleep, then the penalty would be the timeout ie
      2000 ms.
      
      Results:
      
      Verbatim USB SS hard disk connected with STiH407 USB host running 3.10
      Kernel resumes in 461 msecs without this patch, but hard disk is
      assigned a new device address. Same system resumes in 790 msecs with
      this patch, but with old device address.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NPratyush Anand <pratyush.anand@st.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a40178b2
    • N
      usb-core: Remove Fix mes in file hcd.c · 1c094728
      Nicholas Krause 提交于
      I am removing two fix mes in this file as after dicussing then it  seems
      there is no reason to check against Null for usb_device as it can never
      be NULL and this is check is therefore not needed.
      Signed-off-by: NNicholas Krause <xerofoify@gmail.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c094728
    • O
      usbcore: don't log on consecutive debounce failures of the same port · 5ee0f803
      Oliver Neukum 提交于
      Some laptops have an internal port for a BT device which picks
      up noise when the kill switch is used, but not enough to trigger
      printk_rlimit(). So we shouldn't log consecutive faults of this kind.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ee0f803
  11. 18 7月, 2014 3 次提交
  12. 12 7月, 2014 1 次提交
    • J
      USB: add reset resume quirk for usb3503 · 526a4045
      Joonyoung Shim 提交于
      The usb device will autoresume from choose_wakeup() if it is
      autosuspended with the wrong wakeup setting, but below errors occur
      because usb3503 misc driver will switch to standby mode when suspended.
      
      As add USB_QUIRK_RESET_RESUME, it can stop setting wrong wakeup from
      autosuspend_check().
      
      [    7.734717] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
      [    7.854658] usb 1-3: device descriptor read/64, error -71
      [    8.079657] usb 1-3: device descriptor read/64, error -71
      [    8.294664] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
      [    8.414658] usb 1-3: device descriptor read/64, error -71
      [    8.639657] usb 1-3: device descriptor read/64, error -71
      [    8.854667] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
      [    9.264598] usb 1-3: device not accepting address 3, error -71
      [    9.374655] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
      [    9.784601] usb 1-3: device not accepting address 3, error -71
      [    9.784838] usb usb1-port3: device 1-3 not suspended yet
      Signed-off-by: NJoonyoung Shim <jy0922.shim@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      526a4045
  13. 10 7月, 2014 2 次提交
    • D
      usb: force warm reset to break link re-connect livelock · 3cd12f91
      Dan Williams 提交于
      Resuming a powered down port sometimes results in the port state being
      stuck in the training sequence.
      
       hub 3-0:1.0: debounce: port 1: total 2000ms stable 0ms status 0x2e0
       port1: can't get reconnection after setting port  power on, status -110
       hub 3-0:1.0: port 1 status 0000.02e0 after resume, -19
       usb 3-1: can't resume, status -19
       hub 3-0:1.0: logical disconnect on port 1
      
      In the case above we wait for the port re-connect timeout of 2 seconds
      and observe that the port status is USB_SS_PORT_LS_POLLING (although it
      is likely toggling between this state and USB_SS_PORT_LS_RX_DETECT).
      This is indicative of a case where the device is failing to progress the
      link training state machine.
      
      It is resolved by issuing a warm reset to get the hub and device link
      state machines back in sync.
      
       hub 3-0:1.0: debounce: port 1: total 2000ms stable 0ms status 0x2e0
       usb usb3: port1 usb_port_runtime_resume requires warm reset
       hub 3-0:1.0: port 1 not warm reset yet, waiting 50ms
       usb 3-1: reset SuperSpeed USB device number 2 using xhci_hcd
      
      After a reconnect timeout when we expect the device to be present, force
      a warm reset of the device.  Note that we can not simply look at the
      link status to determine if a warm reset is required as any of the
      training states USB_SS_PORT_LS_POLLING, USB_SS_PORT_LS_RX_DETECT, or
      USB_SS_PORT_LS_COMP_MOD are valid states that do not indicate the need
      for warm reset by themselves.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Kukjin Kim <kgene.kim@samsung.com>
      Cc: Vincent Palatin <vpalatin@chromium.org>
      Cc: Lan Tianyu <tianyu.lan@intel.com>
      Cc: Ksenia Ragiadakou <burzalodowa@gmail.com>
      Cc: Vivek Gautam <gautam.vivek@samsung.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Sunil Joshi <joshi@samsung.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Acked-by: NJulius Werner <jwerner@chromium.org>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3cd12f91
    • P
      usb: allow lpm (en/dis)able only if device is atleast in default state · 51df62ff
      Pratyush Anand 提交于
      When a USB device is disconnected, usb_unbind_interface is called, which
      tries to enable and disable LPM. usb_enable_lpm also try to send a
      control command SET SEL to the device.
      Since device is already disconnected, therefore it does not make sense
      to execute usb_(en/dis)able_lpm.
      This patch returns from usb_(en/dis)able_lpm, if device was not in
      default state atleast.
      Signed-off-by: NPratyush Anand <pratyush.anand@st.com>
      Tested-by: NAymen Bouattay <aymen.bouattay@st.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      51df62ff
  14. 18 6月, 2014 4 次提交
  15. 03 6月, 2014 1 次提交
  16. 28 5月, 2014 1 次提交
    • D
      usb: resume child device when port is powered on · 7027df36
      Dan Williams 提交于
      Unconditionally wake up the child device when the power session is
      recovered.
      
      This addresses the following scenarios:
      
      1/ The device may need a reset on power-session loss, without this
         change port power-on recovery exposes khubd to scenarios that
         usb_port_resume() is set to handle.  Prior to port power control the
         only time a power session would be lost is during dpm_suspend of the
         hub.  In that scenario usb_port_resume() is guaranteed to be called
         prior to khubd running for that port.  With this change we wakeup the
         child device as soon as possible (prior to khubd running again for this
         port).
      
         Although khubd has facilities to wake a child device it will only do
         so if the portstatus / portchange indicates a suspend state.  In the
         case of port power control we are not coming from a hub-port-suspend
         state.  This implementation simply uses pm_request_resume() to wake the
         device and relies on the port_dev->status_lock to prevent any collisions
         between khubd and usb_port_resume().
      
      2/ This mechanism rate limits port power toggling.  The minimum port
         power on/off period is now gated by the child device suspend/resume
         latency.  Empirically this mitigates devices downgrading their connection
         on perceived instability of the host connection.  This ratelimiting is
         really only relevant to port power control testing, but it is a nice
         side effect of closing the above race.  Namely, the race of khubd for
         the given port running while a usb_port_resume() event is pending.
      
      3/ Going forward we are finding that power-session recovery requires
         warm-resets (http://marc.info/?t=138659232900003&r=1&w=2).  This
         mechanism allows for warm-resets to be requested at the same point in
         the resume path for hub dpm_suspend power session losses, or port
         rpm_suspend power session losses.
      
      4/ If the device *was* disconnected the only time we'll know for sure is
         after a failed resume, so it's necessary for usb_port_runtime_resume()
         to expedite a usb_port_resume() to clean up the removed device.  The
         reasoning for this is "least surprise" for the user. Turning on a port
         means that hotplug detection is again enabled for the port, it is
         surprising that devices that were removed while the port was off are not
         disconnected until they are attempted to be used.  As a user "why would
         I try to use a device I removed from the system?"
      
      1, 2, and 4 are not a problem in the system dpm_resume() case because,
      although the power-session is lost, khubd is frozen until after device
      resume.  For the rpm_resume() case pm_request_resume() is used to
      request re-validation of the device, and if it happens to collide with a
      khubd run we rely on the port_dev->status_lock to synchronize those
      operations.
      
      Besides testing, the primary scenario where this mechanism is expected
      to be triggered is when the user changes the port power policy
      (control/pm_qos_no_poweroff, or power/control).   Each time power is
      enabled want to revalidate the child device, where the revalidation is
      handled by usb_port_resume().
      
      Given that this arranges for port_dev->child to be de-referenced in
      usb_port_runtime_resume() we need to make sure not to collide with
      usb_disconnect() that frees the usb_device.  To this end we hold the
      port active with the "child_usage" reference across the disconnect
      event.  Subsequently, the need to access hub->child_usage_bits lead to
      the creation of hub_disconnect_children() to remove any ambiguity of
      which "hub" is being acted on in usb_disconnect() (prompted-by sharp
      eyes from Alan).
      
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      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>
      7027df36