Skip to content
Snippets Groups Projects
  1. Oct 03, 2017
  2. Oct 02, 2017
  3. Oct 01, 2017
    • Tom Rini's avatar
      Merge git://git.denx.de/u-boot-usb · 4d1c166f
      Tom Rini authored
      4d1c166f
    • Tom Rini's avatar
      Merge git://git.denx.de/u-boot-rockchip · 16d4ff76
      Tom Rini authored
      16d4ff76
    • Masahiro Yamada's avatar
      usb: dwc3: add UniPhier specific glue layer · dc04b35e
      Masahiro Yamada authored
      
      Add UniPhier platform specific glue layer to support USB3 Host mode
      on Synopsys DWC3 IP.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      dc04b35e
    • Bin Meng's avatar
      usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk() · 72ac8f3f
      Bin Meng authored
      
      The stored 'blk' value is overwritten to 'size / 512' before it can
      be used in usb_stor_set_max_xfer_blk(). This is not what we want.
      In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
      should simply assign 'size' to the upper limit.
      
      Reported-by: Coverity (CID: 167250)
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      72ac8f3f
    • Bin Meng's avatar
      usb: xhci: Set 'Average TRB Length' to 8 for control endpoints · fae35857
      Bin Meng authored
      
      Update the codes to conform with xHCI spec chapter 6.2.3.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      fae35857
    • Bin Meng's avatar
      usb: xhci: Set 'Error Count' to 0 for isoch endpoints · ab2b727d
      Bin Meng authored
      
      Per xHCI spec, 'Error Count' should be set to 0 for isoch endpoints.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      ab2b727d
    • Bin Meng's avatar
      usb: xhci: Program max burst size for endpoint · fa483b2c
      Bin Meng authored
      
      The 'Max Burst Size' indicates to the xHC the maximum number of
      consecutive USB transactions that should be executed per scheduling
      opportunity. This is a “zero-based” value, where 0 to 15 represents
      burst sizes of 1 to 16, but at present this is always set to zero.
      Let's program the required value according to real needs.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      fa483b2c
    • Bin Meng's avatar
      usb: xhci: Honor endpoint's interval · f51966bf
      Bin Meng authored
      
      USB endpoint reports the period between consecutive requests to send
      or receive data as bInverval in its endpoint descriptor. So far this
      is ignored by xHCI driver and the 'Interval' field in xHC's endpoint
      context is always programmed to zero which means 1ms for low speed
      or full speed , or 125us for high speed or super speed. We should
      honor the interval by getting it from endpoint descriptor.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      f51966bf
    • Bin Meng's avatar
      usb: hub: Clear BH reset status change for a 3.0 hub · 061895fb
      Bin Meng authored
      
      USB 3.0 hubs report bit[5] in the port status change response as BH
      reset. The hub shall set the C_BH_PORT_RESET field for this port.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      061895fb
    • Bin Meng's avatar
      usb: hub: Clear port reset before usb_hub_port_connect_change() · b9020352
      Bin Meng authored
      
      During usb_hub_port_connect_change(), a port reset set feature
      request is issued to the port, and later a port reset clear feature
      is done to the same port before the function returns. However at
      the end of usb_scan_port(), we attempt to clear port reset again
      on a cached port status change variable, which should not be done.
      
      Adjust the call to clear port reset to right before the call to
      usb_hub_port_connect_change().
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      b9020352
    • Bin Meng's avatar
      usb: xhci: Fix max packet size for full speed device endpoint 0 · b5aa857b
      Bin Meng authored
      
      In xhci_check_maxpacket(), the control endpoint 0 max packet size
      is wrongly taken from the interface's endpoint descriptor. However
      the default endpoint 0 does not come with an endpoint descriptor
      hence is not included in the interface structure. Change to use
      epmaxpacketin[0] instead.
      
      The other bug in this routine is that when setting max packet size
      to the xHC endpoint 0 context, it does not clear its previous value
      at all before programming a new one.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      b5aa857b
    • Bin Meng's avatar
      usb: Read device descriptor after device is addressed for xHCI · 932bb668
      Bin Meng authored
      
      For xHCI it is not possible to read a device descriptor before it
      has been assigned an address. That's why usb_setup_descriptor()
      was called with 'do_read' being false. But we really need try to
      read the device descriptor before starting any real communication
      with the default control endpoint.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      932bb668
    • Bin Meng's avatar
      usb: Only get 64 bytes device descriptor for full speed devices · c008faa7
      Bin Meng authored
      
      Full speed device endpoint 0 can have 8/16/32/64 bMaxPacketSize0.
      Other speed devices report fixed value per USB spec. So it only
      makes sense if we send a get device descriptor with 64 bytes to
      full speed devices.
      
      While we are here, update the comment block to be within 80 cols.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      c008faa7
    • Bin Meng's avatar
      usb: xhci: Add interrupt transfer support · 1897d601
      Bin Meng authored
      
      xHCI uses normal TRBs for both bulk and interrupt. This adds the
      missing interrupt transfer support to xHCI so that devices like
      USB keyboard that uses interrupt transfer can work.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      1897d601
    • Bin Meng's avatar
      usb: Handle audio extension endpoint descriptor in usb_parse_config() · 2f0eb2ac
      Bin Meng authored
      
      Normal endpoint descriptor size is 7, but for audio extension it is
      9. Handle that correctly when parsing endpoint descriptor.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      2f0eb2ac
    • Bin Meng's avatar
      usb: xhci: Don't assume LS/FS devices are always behind a HS hub · 8a0e6d83
      Bin Meng authored
      
      At present xHCI driver assumes LS/FS devices are attached directly
      to a HS hub. If they are connected to a LS/FS hub, the driver will
      fail to perform the USB enumeration process on such devices.
      
      This is fixed by looking from the device itself all the way up to
      the HS hub where the TT that serves the device is located.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      8a0e6d83
    • Bin Meng's avatar
      test: dm: usb: Update test cases for USB · f4d4f7d4
      Bin Meng authored
      
      Now that we have changed to remove all devices under the root hub in
      usb_stop(), and corrected the USB emulator select logic, it makes no
      sense to do various tests based on 'usb tree' output since the order
      of devices is no longer fixed. Remove these USB test cases related
      to 'usb tree'.
      
      For the USB remove test, ideally we should remove an emulator device
      node from the device tree, but this is so far not working. Change to
      test the 'usb stop' only.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      f4d4f7d4
    • Bin Meng's avatar
      dm: usb: emul: Drop usb_emul_reset() · ad56e4b6
      Bin Meng authored
      
      With the root hub unbinding in usb_stop(), there is no need to do
      a Sandbox-specific reset operation. usb_emul_reset() is no longer
      used anywhere, drop it.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      ad56e4b6
    • Bin Meng's avatar
      dm: usb: Remove no longer needed blk_unbind_all() · ad0a9378
      Bin Meng authored
      
      With the root hub unbinding in usb_stop(), there is no need to do
      a blk uclass specific unbind operation.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      ad0a9378
    • Bin Meng's avatar
      dm: usb: Fix broken usb_stop() · d4efefe3
      Bin Meng authored
      
      At present we only do device_remove() during usb stop. The DM API
      device_remove() only marks the device state as inactivated, but
      still keeps its USB topology (eg: parent, children, etc) in the DM
      device structure. There is no issue if we only start USB subsystem
      once and never stop it. But a big issue occurs when we do 'usb stop'
      and 'usb start' multiple times.
      
      Strange things may be observed with current implementation, like:
      - the enumeration may report only 1 mass storage device is detected,
        but the total number of USB devices is correct.
      - USB keyboard does not work anymore after a bunch of 'usb reset'
        even if 'usb tree' shows it is correctly identified.
      - read/write flash drive via 'fatload usb' may complain "Bad device"
      
      In fact, every time when USB host controller starts the enumeration
      process, it takes random time for each USB port to show up online,
      hence each USB device may appear in a different order from previous
      enumeration, and gets assigned to a totally different USB address.
      As a result, we end up using a stale USB topology in the DM device
      structure which still reflects the previous enumeration result, and
      it may create an exact same DM device name like generic_bus_0_dev_7
      that is already in the DM device structure. And since the DM device
      structure is there, there is no device_bind() call to bind driver to
      the device during current enumeration process, eventually creating
      an inconsistent software representation of the hardware topology, a
      non-working USB subsystem.
      
      The fix is to clear the unused USB topology in the usb_stop(), by
      calling device_unbind() on each controller's root hub device, and
      the unbinding will unbind all of its children automatically.
      
      For Sandbox, we need scan the device tree each time when we start
      the USB stack, in order to re-create the emulated USB devices and
      bind drivers for them before we actually do the driver probe.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      d4efefe3
    • Bin Meng's avatar
      usb: emul: hub: Report the actual device speed of the emulation device · d7771f0c
      Bin Meng authored
      
      At present the usb hub emulator always reports its downstream port
      speed as full speed. Actually it is high speed for sandbox-flash,
      and low speed for sandbox-keyb. We can determine the device speed
      by checking its device descriptor bcdUSB field, and do the proper
      hub port status report based on that.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      d7771f0c
    • Bin Meng's avatar
      usb: emul: Expose find_descriptor() as a public API · 848436a4
      Bin Meng authored
      
      This can be useful outside of the sandbox usb emulation uclass
      driver. Expose it as a public API with a proper prefix (usb_emul_).
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      848436a4
    • Bin Meng's avatar
      usb: sandbox: Fix emulator device select logic in usb_emul_find_devnum() · 84aa8536
      Bin Meng authored
      
      Current emulator select logic in usb_emul_find_devnum() is to test
      the USB address. The USB address of the device being enumerated is
      initialized to zero at the beginning of the enumeration process in
      usb_setup_device(). At this point, the saved USB address in the
      platform data has not been assigned to any valid USB address either.
      This means: the logic will select an emulator device according to
      its sequence of declaring order in the device tree. Take test.dts
      for example, flash-stick@0 will be selected before flash-stick@1.
      But unfortunately such logic is wrong.
      
      In fact USB devices show up in a random order during the enumeration
      which means usb_emul_find_devnum() may be called on port 3 for keyb@3
      before on port 0 for flash-stick@0.
      
      To fix this, we introduce a new emulator uclass specific platdata
      to store the USB device's port number on its parent hub, and update
      the logic to test the port number instead.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      84aa8536
    • Bin Meng's avatar
      usb: sandbox: Initialize root hub's device speed to high speed · 813f74ea
      Bin Meng authored
      
      At present 'usb tree' shows that the root hub on the Sandbox USB
      controller is at full speed. But its device descriptor says it's
      USB 2.0, so let's report it as a high speed device.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      813f74ea
    • Bin Meng's avatar
      usb: Fix comments of usb_emul_find_for_dev() · 8d36c687
      Bin Meng authored
      
      There is no such a parameter called 'bus'.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      8d36c687
    • Bin Meng's avatar
      usb: emul: Remove maxpacketsize in usb_emul_setup_device() · 98b639fc
      Bin Meng authored
      
      This parameter is never used.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      98b639fc
Loading