1. 21 Jul, 2015 3 commits
  2. 11 Jun, 2015 1 commit
  3. 15 May, 2015 4 commits
  4. 06 May, 2015 3 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
    • Hans de Goede's avatar
      dm: usb: Do not use bus->seq before device_probe(bus) · 134692af
      Hans de Goede authored
      
      
      Do not use bus->seq before device_probe(bus), as bus->seq is not set until
      after the device_probe() call. This fixes u-boot printing: "USB-1:   " for
      each bus it scans.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarSimon Glass <sjg@chromium.org>
      134692af
  5. 18 Apr, 2015 5 commits
    • Simon Glass's avatar
      dm: usb: sandbox: Reset emulation devices in usb stop() · 095fdef0
      Simon Glass authored
      
      
      These devices must have their addresses removed ready for the next USB
      bus enumeration. Add this logic to usb_stop().
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      095fdef0
    • Simon Glass's avatar
      dm: usb: Allow setting up a USB controller as a device/gadget · fbeceb26
      Simon Glass authored
      
      
      Some controllers support OTG (on-the-go) where they can operate as either
      host or device. The gadget layer in U-Boot supports this.
      
      While this layer does not interact with driver model, we can provide a
      function which sets up the controller in the correct way. This way the code
      at least builds (although it likely will not work).
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      fbeceb26
    • Simon Glass's avatar
      dm: usb: Bind generic USB devices when there is no driver · 449230f0
      Simon Glass authored
      
      
      At present USB devices with no driver model driver cannot be seen in the
      device list, and we fail to set them up correctly. This means they cannot
      be used.
      
      While having real drivers that support driver model for all USB devices
      is the eventual goal, we are not there yet.
      
      As a stop-gap, add a generic USB driver which is bound when we do not have
      a real driver. This allows the device to be set up and shown on the bus.
      It also allows ad-hoc code (such as usb_ether) to find these devices and
      set them up.
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      449230f0
    • Simon Glass's avatar
      dm: usb: Allow USB drivers to be declared and auto-probed · 0566e240
      Simon Glass authored
      
      
      USB devices in U-Boot are currently probed only after all devices have
      been enumerated. Each type of device is probed by custom code, e.g.:
      
      - USB storage
      - Keyboard
      - Ethernet
      
      With driver model this approach doesn't work very well. We could build
      a picture of the bus and then go back and add the devices later, but
      this means that the data structures are incomplete for quite a while.
      It also does not follow the model of being able to bind a device when we
      discover it.
      
      We would prefer to have devices automatically be bound as the device is
      enumerated. This allows us to attach drivers to particular USB classes
      or product/vendor IDs. This is the method used by Linux.
      
      Add the required #defines from Linux, a way of declaring a USB driver and
      the logic to locate the correct driver given the USB device's descriptors.
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      0566e240
    • Simon Glass's avatar
      dm: usb: Add a uclass for USB controllers · de31213f
      Simon Glass authored
      
      
      Add a uclass that can represent a USB controller. For now we do not create
      devices for things attached to the controller. This will be added later.
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      de31213f