1. 17 May, 2016 1 commit
  2. 22 Mar, 2016 1 commit
  3. 20 Mar, 2016 1 commit
    • Stefan Roese's avatar
      usb: Change power-on / scanning timeout handling · c998da0d
      Stefan Roese authored
      This patch changes the USB port scanning procedure and timeout
      handling in the following ways:
      
      a)
      The power-on delay in usb_hub_power_on() is now reduced to a value of
      max(100ms, "hub->desc.bPwrOn2PwrGood * 2"). The code does not wait
      using mdelay, instead usb_hub_power_on() will wait before querying
      the device in the scanning loop later. The total timeout for this
      hub, which is 1 second + "hub->desc.bPwrOn2PwrGood * 2" is calculated
      and will be used in the following per-port scanning loop as the timeout
      to detect active USB devices on this hub.
      
      b)
      Don't delay the minimum delay (for power to stabilize) in
      usb_hub_power_on(). Instead skip querying these devices in the scannig
      loop until the delay time is reached.
      
      c)
      The ports are now scanned in a quasi parallel way. The current code did
      wait for each (unconnected) port to reach its timeout and only then
      continue with the next port. This patch now changes this to scan all
      ports of all USB hubs quasi simultaneously. For this, all ports are added
      to a scanning list. This list is scanned until all ports are ready
      by either a) reaching the connection timeout (calculated earlier), or
      by b) detecting a USB device. This results in a faster USB scan time as
      the recursive scanning of USB hubs connected to the hub that's currently
      being scanned will start earlier.
      
      One small functional change to the original code is, that ports with
      overcurrent detection will now get rescanned multiple times
      (PORT_OVERCURRENT_MAX_SCAN_COUNT).
      
      Without this patch:
      starting USB...
      USB0:   USB EHCI 1.00
      scanning bus 0 for devices... 9 USB Device(s) found
      
      time: 20.163 seconds
      
      With this patch:
      starting USB...
      USB0:   USB EHCI 1.00
      scanning bus 0 for devices... 9 USB Device(s) found
      
      time: 1.822 seconds
      
      So ~18.3 seconds of USB scanning time reduction.
      Signed-off-by: default avatarStefan Roese <sr@denx.de>
      Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
      Tested-by: default avatarStephen Warren <swarren@nvidia.com>
      c998da0d
  4. 14 Mar, 2016 1 commit
  5. 07 Jan, 2016 1 commit
  6. 31 Dec, 2015 2 commits
  7. 20 Nov, 2015 3 commits
  8. 23 Oct, 2015 1 commit
  9. 05 Aug, 2015 1 commit
  10. 21 Jul, 2015 6 commits
  11. 19 Jun, 2015 1 commit
    • Hans de Goede's avatar
      usb.h: Always declare usb function prototypes · b335fe68
      Hans de Goede authored
      There is no harm in declaring the function prototypes even if nothing
      implements them, and when CONFIG_DM_USB=y the various usb functions are
      available regardless of any controller drivers being enabled.
      
      This fixes compile warnings due to missing prototypes on ARCHs where
      the ARCH Kconfig always enables CONFIG_DM_USB and various usb drivers.
      
      One could argue that in the case of no controllers CONFIG_DM_USB should not
      be set, but this problem is typically seen during bringup of boards which
      do actually have usb controllers.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      b335fe68
  12. 15 May, 2015 3 commits
  13. 06 May, 2015 2 commits
    • Hans de Goede's avatar
      dm: usb: Copy over usb_device values from usb_scan_device() to final usb_device · 7f1a0753
      Hans de Goede authored
      Currently we copy over a number of usb_device values stored in the on stack
      struct usb_device probed in usb_scan_device() to the final driver-model managed
      struct usb_device in usb_child_pre_probe() through usb_device_platdata, and
      then call usb_select_config() to fill in the rest.
      
      There are 3 problems with this approach:
      
      1) It does not fill in enough fields before calling usb_select_config(),
      specifically it does not fill in ep0's maxpacketsize causing a div by zero
      exception in the ehci driver.
      
      2) It unnecessarily redoes a number of usb requests making usb probing slower
      
      3) Calling usb_select_config() a second time fails on some usb-1 devices
      plugged into usb-2 hubs, causing u-boot to not recognize these devices.
      
      This commit fixes these issues by removing (*) the usb_select_config() call
      from usb_child_pre_probe(), and instead of copying over things field by field
      through usb_device_platdata, store a pointer to the in stack usb_device
      (which is still valid when usb_child_pre_probe() gets called) and copy
      over the entire struct.
      
      *) Except for devices which are explictly instantiated through device-tree
      rather then discovered through usb_scan_device() such as emulated usb devices
      in the sandbox.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarSimon Glass <sjg@chromium.org>
      7f1a0753
    • Hans de Goede's avatar
      dm: usb: Make usb_get_bus easier to use for callers · f78a5c07
      Hans de Goede authored
      Make usb_get_bus easier to use for callers, by directly returning the bus
      rather then returning it via a pass-by-ref argument.
      
      This also removes the error checking from the current callers, as
      we already have an assert() for bus not being NULL in usb_get_bus().
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarSimon Glass <sjg@chromium.org>
      f78a5c07
  14. 18 Apr, 2015 5 commits
  15. 14 Apr, 2015 1 commit
  16. 18 Jan, 2015 4 commits
    • Hans de Goede's avatar
      musb-new: Add interrupt queue support · 904f2a83
      Hans de Goede authored
      Add interrupt queue support, so that a usb keyboard can be used without
      causing huge latencies.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      904f2a83
    • Hans de Goede's avatar
      musb-new: Fix reset sequence when in host mode · 90cdc103
      Hans de Goede authored
      This commit fixes a number of issues with the reset sequence of musb-new
      in host mode:
      
      1) Our usb device probe relies on a second device reset being done after the
      first descriptors read. Factor the musb reset code into a usb_reset_root_port
      function (and add this as an empty define for other controllers), and call
      this when a device has no parent.
      
      2) Just like with normal usb controllers there needs to be a delay after
      reset, for normal usb controllers, this is handled in hub_port_reset, add a
      delay to usb_reset_root_port.
      
      3) Sync the musb reset sequence with the upstream kernel, clear all bits of
      power except bits 4-7, and increase the time reset is asserted to 50 ms.
      
      With these fixes an usb keyboard I have now always enumerates properly, where
      as earlier it would only enumerare properly once every 5 tries.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      90cdc103
    • Hans de Goede's avatar
      musb-new: Add sunxi musb controller support · 28a15ef7
      Hans de Goede authored
      This is based on Jussi Kivilinna's work for the linux-sunxi-3.4 kernel to use
      the kernels musb driver instead of Allwinners own custom driver.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      28a15ef7
    • Hans de Goede's avatar
      usb: Add an interval parameter to create_int_queue · 8bb6c1d1
      Hans de Goede authored
      Currently create_int_queue is only implemented by the ehci code, and that
      does not honor interrupt intervals, but other drivers which might also want
      to implement create_int_queue may honor intervals, so add an interval param.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      8bb6c1d1
  17. 07 Nov, 2014 1 commit
  18. 04 Nov, 2014 1 commit
  19. 22 Oct, 2014 1 commit
  20. 06 Oct, 2014 1 commit
  21. 05 May, 2014 1 commit
    • Mateusz Zalega's avatar
      usb: dfu: fix boards wo USB cable detection · 75504e95
      Mateusz Zalega authored
      Former usb_cable_connected() patch broke compilation of boards which do
      not support this feature.
      
      I've renamed usb_cable_connected() to g_dnl_usb_cable_connected() and added
      its default implementation to gadget downloader driver code. There's
      only one driver of this kind and it's unlikely there'll be another, so
      there's no point in keeping it in /common.
      
      Previously this function was declared in usb.h. I've moved it, since
      it's more appropriate to keep it in g_dnl.h - usb.h seems to be intended
      for USB host implementation.
      
      Existing code, confronted with default -EOPNOTSUPP return value,
      continues as if the cable was connected.
      
      CONFIG_USB_CABLE_CHECK was removed.
      
      Change-Id: Ib9198621adee2811b391c64512f14646cefd0369
      Signed-off-by: default avatarMateusz Zalega <m.zalega@samsung.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      75504e95
  22. 08 Nov, 2013 1 commit