1. 01 Mar, 2016 1 commit
    • Sam Protsenko's avatar
      usb: gadget: composite: Correct recovery path for register · 8038f6d2
      Sam Protsenko authored
      
      
      In case when usb_composite_register() failed once (for whatever reason),
      it will fail further even if all conditions are correct. Example:
      
          => fastboot 2
          Invalid Controller Index
          couldn't find an available UDC
          g_dnl_register: failed!, error: -19
          exit not allowed from main input shell.
      
          => fastboot 0
          g_dnl_register: failed!, error: -22
          exit not allowed from main input shell.
      
      Despite that 0 is correct index for USB controller, "fastboot 0" command
      will fail, because "composite" structure wasn't cleared properly on
      previous fail (on "fastboot 2" command).
      
      This patch fixes that erroneous behavior, allowing us to use composite
      even after previous failure.
      Signed-off-by: default avatarSam Protsenko <semen.protsenko@linaro.org>
      8038f6d2
  2. 26 Feb, 2016 1 commit
    • Marek Vasut's avatar
      usb: ehci: Fix warning on aarch64 · abd702f4
      Marek Vasut authored
      
      
      Fix the following warning on aarch64 introduced by using p2v/v2p
      functions in the code:
      
      In file included from ./arch/arm/include/asm/byteorder.h:29:0,
                       from include/compiler.h:125,
                       from include/image.h:19,
                       from include/common.h:88,
                       from drivers/usb/host/ehci-hcd.c:10:
      drivers/usb/host/ehci-hcd.c: In function ‘ehci_td_buffer’:
      drivers/usb/host/ehci-hcd.c:250:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         td->qt_buffer[idx] = cpu_to_hc32(virt_to_phys((void *)addr));
                                                       ^
      include/linux/byteorder/little_endian.h:34:51: note: in definition of macro ‘__cpu_to_le32’
       #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                                         ^
      drivers/usb/host/ehci-hcd.c:250:24: note: in expansion of macro ‘cpu_to_hc32’
         td->qt_buffer[idx] = cpu_to_hc32(virt_to_phys((void *)addr));
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Tom Rini <trini@konsulko.com>
      abd702f4
  3. 24 Feb, 2016 7 commits
    • Steve Rae's avatar
      fastboot: update error and warning messages · a18c2706
      Steve Rae authored
      
      
      Fix the formatting in error messages, and demote one error message
      to a warning, as it is only informational.
      Signed-off-by: default avatarSteve Rae <srae@broadcom.com>
      a18c2706
    • Stephen Warren's avatar
      usb: eth: fix memalign() parameter order · 53419bac
      Stephen Warren authored
      The alignment and size were swapped, leading to malloc heap corruption.
      
      On my system, this sometimes caused U-Boot to crash during or after
      certain USB Ethernet operations.
      
      Fixes: c8c2797c
      
       ("dm: usb: eth: Support driver model with USB Ethernet")
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      53419bac
    • Lukasz Majewski's avatar
      dfu: usb: f_dfu: Set deferred call for dfu_flush() function · fc18f8d1
      Lukasz Majewski authored
      
      
      This patch fixes situation when one would like to write large file into
      medium with the file system (fat, ext4, etc).
      This change sets file size limitation to the DFU internal buffer size.
      
      Since u-boot is not supporting interrupts and seek on file systems, it
      becomes challenging to store large file appropriately.
      
      To reproduce this error - create large file (around 26 MiB) and sent it
      to the target board.
      
      Lets examine the flow of USB transactions:
      
      0. DFU uses EP0 with 64B MPS [Max Packet Size]
      
      1. Send file - OUT (PC->target) - dat_26MiB.img is sent with 4096 B transactions
      
      2. Get status - OUT (PC->target) - wait for DFU_STATE_dfuDNLOAD_IDLE (0x05) sent
      				   from target board - IN transaction
      				   (target->PC)
      
      3. The whole file content is sent to target - OUT (PC->target) with ZLP [Zero
      					      Length Packet]
      
      Now the interesting part starts:
      
      4. OUT (PC->target) Setup transaction (request to share DFU state)
      
      5. IN (target->PC) - reply the current DFU state
      	- In the UDC driver the req->completion (with dfu_flush) is called
      	  after successful IN transfer.
      	- The dfu_flush() (called from req->completion callback) saves the
      	  whole file at once (u-boot doesn't support seek on fs).
      	  Such operation takes considerable time. When the file
      	  is large - e.g. 26MiB - this time may be more than 5 seconds.
      
      6. OUT (PC->target) - ZLP, is send in the same time when dfu_flush()
       writes data to eMMC memory.
       The dfu-util application has hard coded timeout on USB transaction
       completion set to 5 seconds (it uses libusb calls).
      
      When the file to store is large (e.g. 26 MiB) the time needed to write it
      may excess the dfu-util timeout and following error message will be displayed:
      "unable to read DFU status" on the HOST PC console.
      
      This change is supposed to leverage DFU's part responsible for storing files
      on file systems. Other DFU operations - i.e. raw/partition write to NAND and
      eMMC should work as before.
      
      The only functional change is the error reporting. When dfu_flush() fails
      the u-boot prompt will exit with error information and dfu-util application
      exits afterwards as well.
      
      Test HW:
      - Odroid XU3 (Exynos5433) - test with large file
      - Trats (Exynos4210) - test for regression - eMMC, raw,
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Reported-by: default avatarAlex Gdalevich <agdalevich@axion-biosystems.com>
      Tested-by: default avatarStephen Warren <swarren@nvidia.com>
      Tested-by: default avatarHeiko Schocher <hs@denx.de>
      fc18f8d1
    • Marek Vasut's avatar
      usb: ehci: Be explicit about the BE IO accessors · e88a1b75
      Marek Vasut authored
      
      
      Add explicit cpu_to_be32()/be32_to_cpu() conversion to BE EHCI I/O
      accessors to align them with their LE counterpart. No functional
      change.
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      e88a1b75
    • Marek Vasut's avatar
      usb: ehci: Clear USBMODE_BE on LE MMIO · 7ab0d355
      Marek Vasut authored
      
      
      If the USB EHCI is configured for little endian MMIO, make sure to
      clear the USBMODE_BE flag from the USBMODE register.
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      7ab0d355
    • Marek Vasut's avatar
      usb: ehci: Implement V2P mapping · cf7c93cd
      Marek Vasut authored
      
      
      Certain processor architectures, like MIPS, require that the USB
      structures and transfer buffers are passed with their PA to the
      USB controller. If VA is passed, the USB will not work. Add the
      necessary virt_to_phys() calls into the USB EHCI code to make it
      work.
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      cf7c93cd
    • Marek Vasut's avatar
      usb: ehci: Use map_physmem in ehci-generic · 643cacb6
      Marek Vasut authored
      
      
      Some architectures, like MIPS, require remapping of the registers.
      Add the map_physmem() call to handle it.
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      643cacb6
  4. 23 Feb, 2016 1 commit
  5. 18 Feb, 2016 3 commits
  6. 14 Feb, 2016 1 commit
  7. 06 Feb, 2016 1 commit
  8. 04 Feb, 2016 1 commit
  9. 25 Jan, 2016 5 commits
  10. 24 Jan, 2016 1 commit
  11. 23 Jan, 2016 8 commits
    • Ted Chen's avatar
      usb: eth: add Realtek RTL8152B/RTL8153 DRIVER · 9dc8ba19
      Ted Chen authored
      This patch adds driver support for the Realtek RTL8152B/RTL8153 USB
      network adapters.
      
      Signed-off-by: Ted Chen <tedchen at realtek.com>
      [swarren, fixed a few compiler warnings]
      [swarren, with permission, converted license header to SPDX]
      [swarren, removed printf() spew during probe()]
      Signed-off-by: Stephen Warren <swarren at nvidia.com>
      9dc8ba19
    • Stefan Brüns's avatar
      usb: dwc2: Do not mix data toggle for IN and OUT endpoints, check bounds · 25612f23
      Stefan Brüns authored
      USB protocol allows for 16 IN and 16 OUT endpoints (USB 2.0 Spec,
      8.3.2.2 Endpoint Field). A function may have an EP 1 for both IN and OUT,
      so these two should be kept separate. As EPs are either BULK or INTERRUPT
      (or ISO), it is fine to have one array per direction for all transfer
      types (also see e236519b
      
      ).
      
      USB device address is 7 bits, so a bus may have more than 16 devices.
      Check the device number, as the DWC2 driver only supports BULK/ISO for
      the first 16 devices.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      25612f23
    • Stefan Brüns's avatar
      usb: dwc2: Add SPLIT INTERRUPT transaction support · d2ff51b3
      Stefan Brüns authored
      
      
      CSPLITs for INTERRUPT transactions have to be scheduled in each microframe
      following the SSPLIT. INTERRUPT transfers are executed in the next even/
      odd microframe depending on the HCCHAR_ODDFRM flag.
      
      As there are no handshakes for INTERRUPT SSPLITs the SSPLIT may have
      failed (transport error) without the error being detected by the host
      driver. If the last CSPLIT is not received within 4 microframes after the
      SSPLIT there was a transaction error and the complete transaction has
      to be restarted.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      d2ff51b3
    • Stefan Brüns's avatar
      usb: dwc2: Implement SPLIT transaction support · b54e4470
      Stefan Brüns authored
      
      
      In contrast to non-SPLIT transfers each transaction has to be submitted
      as an individual chunk.
      The transaction state machine proceeds from SSPLIT to CSPLIT if the ACK
      flag is set. CSPLIT has to be repeated while NYET is set.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      b54e4470
    • Stefan Brüns's avatar
      usb: dwc2: add helper function for setting SPLIT HC registers · 890f0ee4
      Stefan Brüns authored
      
      
      The split register setting is used for both SSPLIT and CSPLIT transactions,
      the bit for CSPLIT has to be set seperately.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      890f0ee4
    • Stefan Brüns's avatar
      usb: dwc2: split transfer core from outer loop · daed3059
      Stefan Brüns authored
      
      
      Split the movement of data between CPU and Host Controller from the
      status handling and tracking of transfer progress.
      This will also simplify adding of SPLIT transaction support.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      daed3059
    • Stefan Brüns's avatar
      usb: dwc2: Simplify wait_for_chhltd(), remove ignore_ack · 03460cdc
      Stefan Brüns authored
      
      
      A transfer is completed if the XFERCOMP flag is set, irrespective of the
      ACK flag. BULK OUT transfers to some HS devices complete without having
      the ACK flag set, which signal the devices has responded with an NYET
      to the transfer (PING protocol).
      The new behaviour matches the Linux kernel minus any PING protocol.
      
      Also see 5966defabdcc (usb: dwc2: fix bulk transfers)
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      03460cdc
    • Stefan Brüns's avatar
      usb: dwc2: Fix out-of-bounds access, fix chunk size · 56a7bbd7
      Stefan Brüns authored
      
      
      Fix two errors in transfer len calculation, move loop invariant code out
      of loop.
      
      If xfer_len is equal to CONFIG_DWC2_MAX_TRANSFER_SIZE (or slightly
      smaller), the xfer_len will be to large, e.g.:
        xfer_len = MAX_TRANSFER_SIZE = 65535
        max packet size = 512
          => num_packets = 128
          => IN xfer_len = 65536
      
      For OUT transactions larger than (65536 - mps) bytes, the xfer_len
      determination is quite awkward, it is only correct due to:
      - max_packet_size for control/bulk/interrupt is required to be
        power-of-two.
      - (CONFIG_DWC2_MAX_TRANSFER_SIZE + 1) % max-packet-size is zero
        for all allowed (2^3 ... 2^9) packet sizes
      
      As the max xfer len is loop invariant, it can be moved out of the loop.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      56a7bbd7
  12. 19 Jan, 2016 1 commit
  13. 16 Jan, 2016 3 commits
  14. 15 Jan, 2016 1 commit
  15. 14 Jan, 2016 1 commit
    • Stephen Warren's avatar
      ums: support multiple LUNs at once · 02585eb3
      Stephen Warren authored
      
      
      Extend the ums command to accept a list of block devices. Each of these
      will be exported as a separate LUN. An example use-case would be:
      
      ums 0 mmc 0,0.1,0.2
      
      ... which would export LUNs for eMMC 0's user data, boot0, and boot1 HW
      partitions. This is useful since it allows the host access to everything
      on the eMMC without having to somehow stop the ums command from executing
      and restart it with different parameters.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      02585eb3
  16. 12 Jan, 2016 4 commits