1. 31 Mar, 2015 1 commit
  2. 09 Mar, 2015 1 commit
    • Przemyslaw Marczak's avatar
      dfu: mmc: file buffer: remove static allocation · 41ac233c
      Przemyslaw Marczak authored
      For writing files, DFU implementation requires the file buffer
      with the len at least of file size. For big files it requires
      the same big buffer.
      
      Previously the file buffer was allocated as a static variable,
      so it was a part of U-Boot .bss section. For 32MiB len of buffer
      we have 32MiB of additional space, required for this section.
      
      The .bss needs to be cleared after the relocation.
      This introduces an additional boot delay at every start, but usually
      the dfu feature is not required at the standard boot, so the buffer
      should be allocated only if required.
      
      This patch removes the static allocation of this buffer,
      and alloc it with memalign after first call of function:
      - dfu_fill_entity_mmc()
      and the buffer is freed on dfu_free_entity() call.
      
      This was tested on Trats2.
      A quick test with trace. Boot time from start to main_loop() entry:
      - ~888ms - before this change (arch memset enabled for .bss clear)
      - ~464ms - after this change
      Signed-off-by: default avatarPrzemyslaw Marczak <p.marczak@samsung.com>
      Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Stephen Warren <swarren@nvidia.com>
      Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Marek Vasut <marek.vasut@gmail.com>
      41ac233c
  3. 25 Feb, 2015 1 commit
  4. 18 Dec, 2014 3 commits
  5. 23 Nov, 2014 1 commit
  6. 14 Nov, 2014 1 commit
  7. 22 Oct, 2014 1 commit
  8. 24 Sep, 2014 1 commit
  9. 02 Sep, 2014 1 commit
    • Lukasz Majewski's avatar
      dfu: Provide means to find difference between dfu-util -e and -R · 1cc03c5c
      Lukasz Majewski authored
      This commit provides distinction between DFU device detach and reset.
      The -R behavior is preserved with proper handling of the dfu-util's -e
      switch, which detach the DFU device.
      
      By running dfu-util -e; one can force device to finish the execution of
      dfu command on target and execute some other scripted commands.
      
      Moreover, some naming has been changed - the dfu_reset() method now is known
      as dfu_detach(). New name better reflects the purpose of the code.
      
      It was also necessary to increase the number of usb_gadget_handle_interrupts()
      calls since we also must wait for detection of the USB reset event.
      
      Example usage:
      1. -e (detach) switch
       dfu-util -a0 -D file1.bin;dfu-util -a3 -D uImage;dfu-util -e
      
       access to u-boot prompt.
      
      2. -R (reset) switch
       dfu-util -a0 -D file1.bin;dfu-util -R -a3 -D uImage
      
       target board reset
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
      Tested-by: default avatarStephen Warren <swarren@nvidia.com>
      1cc03c5c
  10. 09 Aug, 2014 7 commits
    • Stephen Warren's avatar
      dfu: fix readback buffer overflow test · 67ab0a5e
      Stephen Warren authored
      The buffer is too small if it's < size to read, not if it's <= the size.
      This fixes the 1MB test case on Tegra, which has a 1MB buffer.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      67ab0a5e
    • Stephen Warren's avatar
      dfu: add SF backend · 6f12ebf6
      Stephen Warren authored
      This allows SPI Flash to be programmed using DFU.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      6f12ebf6
    • Stephen Warren's avatar
      dfu: add free_entity() to struct dfu_entity · cb7bd2e0
      Stephen Warren authored
      This allows the backend to free any resources allocated during the
      relevant dfu_fill_entity_*() call. This will soon be used by the
      SF backend.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      cb7bd2e0
    • Stephen Warren's avatar
      dfu: allow backend to specify a maximum buffer size · 7ac1b410
      Stephen Warren authored
      CONFIG_SYS_DFU_DATA_BUF_SIZE may be large to allow for FAT/ext layouts
      to transfer large files. However, this means that individual write
      operations will take a long time. Allow backends to specify a maximum
      buffer size, so that each write operation is limited to a smaller data
      block. This prevents the DFU protocol from timing out when e.g. writing
      to SPI flash. I would guess that NAND might benefit from setting this
      value too, but I can't test that.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      7ac1b410
    • Stephen Warren's avatar
      dfu: defer parsing of device string to IO backend · dd64827e
      Stephen Warren authored
      Devices are not all identified by a single integer. To support
      this, defer the parsing of the device string to the IO backed, so that
      it can apply the appropriate rules.
      
      SPI devices are specified as controller:chip_select. SPI/SF support will
      be added soon.
      
      MMC devices can also be specified as controller[.hwpart][:partition] in
      many commands, although we don't support that syntax in DFU.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      dd64827e
    • Stephen Warren's avatar
      dfu: add write error handling · 3ee9593f
      Stephen Warren authored
      Fix calls to dfu_write() and dfu_flush() to detect errors in the I/O
      itself. This could happen due to problems with the storage medium, or
      simply when trying to write a FAT/ext file that is larger than the buffer
      dfu_mmc.c maintains for this purpose.
      
      Signal the error by switching the DFU state/status. This will be picked
      up by the DFU client when it sends the next DFU request. Note that errors
      can't simply be returned from e.g. dnload_request_complete(), since that
      function has no way to pass errors back to the DFU client; a call to
      dnload_request_complete() simply means that a USB OUT completed.
      
      This error state/status needs to be cleared when the next DFU client
      connects. While there is a DFU_CLRSTATUS request, no DFU client seems to
      send this. Hence, clear this when selecting the USB alternate setting on
      the USB interface.
      
      Finally, dfu.c relies on a call to dfu_flush() to clear up the internal
      state of the write transaction. Now that errors in dfu_write() are
      detected, dfu_flush() may no longer be called for every transaction.
      Separate out the cleanup code into a new function, and call it whenever
      dfu_write() fails, as well as from any call to dfu_flush().
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      3ee9593f
    • Stephen Warren's avatar
      dfu: fix some issues with reads/uploads · 0e285b50
      Stephen Warren authored
      DFU read support appears to rely upon dfu->read_medium() updating the
      passed-by-reference len parameter to indicate the remaining size
      available for reading.
      
      dfu_read_medium_mmc() never does this, and the implementation of
      dfu_read_medium_nand() will only work if called just once; it hard-codes
      the value to the total size of the NAND device irrespective of read
      offset.
      
      I believe that overloading dfu->read_medium() is confusing. As such,
      this patch introduces a new function dfu->get_medium_size() which can
      be used to explicitly find out the medium size, and nothing else.
      dfu_read() is modified to use this function to set the initial value for
      dfu->r_left, rather than attempting to use the side-effects of
      dfu->read_medium() for this purpose.
      
      Due to this change, dfu_read() must initially set dfu->b_left to 0, since
      no data has been read.
      
      dfu_read_buffer_fill() must also be modified not to adjust dfu->r_left
      when simply copying data from dfu->i_buf_start to the upload request
      buffer. r_left represents the amount of data left to be read from HW.
      That value is not affected by the memcpy(), but only by calls to
      dfu->read_medium().
      
      After this change, I can read from either a 4MB or 1.5MB chunk of a 4MB
      eMMC boot partion with CONFIG_SYS_DFU_DATA_BUF_SIZE==1MB. Without this
      change, attempting to do that would result in DFU read returning no data
      at all due to r_left never being set.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      0e285b50
  11. 11 Jun, 2014 1 commit
    • Lukasz Majewski's avatar
      dfu: Disable default calculation of CRC32 · 3d83e675
      Lukasz Majewski authored
      Patch (SHA1: bd694244)
      dfu: Introduction of the "dfu_hash_algo" env variable for checksum method
      setting
      
      already introduced more generic handling of the crc32 calculation.
      Up till now the CRC32 of received data was calculated unconditionally.
      This patch changes this and from now - by default the crc32 is NOT
      calculated anymore.
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Cc: Marek Vasut <marex@denx.de>
      3d83e675
  12. 01 Jun, 2014 1 commit
    • Lukasz Majewski's avatar
      dfu: Introduction of the "dfu_hash_algo" env variable for checksum method setting · bd694244
      Lukasz Majewski authored
      Up till now the CRC32 of received data was calculated unconditionally.
      The standard crc32 implementation causes long delay when large images
      were uploaded.
      
      The "dfu_hash_algo" environment variable gives the opportunity to
      disable on demand the hash (crc32) calculation.
      It can be done without the need to recompile the u-boot binary.
      
      By default the crc32 is calculated, which means that legacy behavior
      has been preserved.
      
      Tests results:
      400 MiB ums.img file
      With 		crc32 calculation: 65 sec [avg 6.29 MB/s]
      Without 		crc32 calculation: 25 sec [avg 16.17 MB/s]
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Cc: Marek Vasut <marex@denx.de>
      bd694244
  13. 14 May, 2014 2 commits
    • Lukasz Majewski's avatar
      dfu: mmc: Provide support for eMMC boot partition access · c8151b4a
      Lukasz Majewski authored
      Before this patch it was only possible to access the default eMMC HW
      partition. By partition selection I mean the access to eMMC via the
      ext_csd[179] register programming.
      
      It sometimes happens that it is necessary to write to other partitions.
      This patch adds extra attribute to "raw" sub type of the dfu_alt_info
      environment variable (e.g. boot-mmc.bin raw 0x0 0x200 mmcpart 1;)
      
      It saves the original boot value and restores it after storing the file.
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      c8151b4a
    • Przemyslaw Marczak's avatar
      drivers:dfu: dfu_flush(): add raw data flush to complete dfu write · 1aa4bdc8
      Przemyslaw Marczak authored
      Before dfu write and flush operations separation,
      dfu write data was flushed by host download request
      with len of zero size.
      
      Since above change manually calling dfu write with zero
      size has non sense (e.g. in THOR). This should be done by
      flush operation.
      So now dfu_write_buffer_drain() is called in dfu_flush().
      If there is any raw data to flush (like it can be in thor)
      then it will be physically written to medium.
      Signed-off-by: default avatarPrzemyslaw Marczak <p.marczak@samsung.com>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Heiko Schocher <hs@denx.de>
      Cc: Marek Vasut <marex@denx.de>
      1aa4bdc8
  14. 08 May, 2014 1 commit
  15. 05 May, 2014 2 commits
  16. 30 Apr, 2014 1 commit
  17. 24 Mar, 2014 1 commit
  18. 23 Mar, 2014 3 commits
    • Łukasz Majewski's avatar
      dfu: mmc: Replace calls to u-boot commands with native mmc API · 7d0b605a
      Łukasz Majewski authored
      For some time we have been using the run_command() with properly crafted
      string. Such approach turned to be unreliable and error prone.
      
      Switch to "native" mmc subsystem API would allow better type checking and
      shall improve speed.
      
      Also, it seems that this API is changing less often than u-boot commands.
      The approach similar to env operations on the eMMC has been reused.
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      7d0b605a
    • Heiko Schocher's avatar
      usb: dfu: introduce dfuMANIFEST state · 001a8319
      Heiko Schocher authored
      on nand flash using ubi, after the download of the new image into
      the flash, the "rest" of the nand sectors get erased while flushing
      the medium. With current u-boot version dfu-util may show:
      
      Starting download: [##################################################] finished!
      state(7) = dfuMANIFEST, status(0) = No error condition is present
      unable to read DFU status
      
      as get_status is not answered while erasing sectors, if erasing
      needs some time.
      
      So do the following changes to prevent this:
      
      - introduce dfuManifest state
        According to dfu specification
        ( http://www.usb.org/developers/devclass_docs/usbdfu10.pdf ) section 7:
        "the device enters the dfuMANIFEST-SYNC state and awaits the solicitation
         of the status report by the host. Upon receipt of the anticipated
         DFU_GETSTATUS, the device enters the dfuMANIFEST state, where it
         completes its reprogramming operations."
      
      - when stepping into dfuManifest state, sending a PollTimeout
        DFU_MANIFEST_POLL_TIMEOUT in ms, to the host, so the host
        (dfu-util) waits the PollTimeout before sending a get_status again.
      Signed-off-by: default avatarHeiko Schocher <hs@denx.de>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Kyungmin Park <kyungmin.park@samsung.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
      001a8319
    • Heiko Schocher's avatar
      usb, dfu: extract flush code into seperate function · a2199afe
      Heiko Schocher authored
      move the flushing code into an extra function dfu_flush(),
      so it can be used from other code.
      Signed-off-by: default avatarHeiko Schocher <hs@denx.de>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Kyungmin Park <kyungmin.park@samsung.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
      a2199afe
  19. 13 Mar, 2014 1 commit
  20. 20 Feb, 2014 1 commit
  21. 18 Dec, 2013 1 commit
  22. 08 Nov, 2013 3 commits
  23. 31 Oct, 2013 1 commit
  24. 20 Oct, 2013 3 commits