u-boot/drivers
Lukasz Majewski fc18f8d170 dfu: usb: f_dfu: Set deferred call for dfu_flush() function
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: Lukasz Majewski <l.majewski@samsung.com>
Reported-by: Alex Gdalevich <agdalevich@axion-biosystems.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Heiko Schocher <hs@denx.de>
2016-02-24 19:12:32 +01:00
..
adc sandbox: add ADC driver 2015-11-02 10:38:00 +09:00
bios_emulator dm: pci: Convert bios_emu to use the driver model PCI API 2016-01-24 12:07:19 +08:00
block Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
bootcount bootcount: Correct #endif comment to match, other aesthetics 2016-01-08 10:15:43 -05:00
clk clk: uniphier: add Media I/O clock driver for UniPhier SoCs 2016-02-14 16:36:13 +09:00
core dm: Remove device_probe_child() 2016-01-28 21:01:23 -07:00
cpu x86: Move MP initialization codes into a common place 2015-07-14 18:03:16 -06:00
crypto imx: Refactoring CAAM Job Ring structure and Secure Memory for imx7 2016-02-21 11:20:54 +01:00
ddr Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
demo drivers: hierarchize drivers Kconfig menu 2015-08-12 20:47:44 -04:00
dfu mmc: store hwpart in the block device 2016-01-13 21:05:19 -05:00
dma drivers: dma: ti-edma3: convert driver to adopt driver model 2016-02-23 16:14:46 +05:30
fpga Revert "arm: socfpga: set the fpga global bit to disable HPS to FPGA signals" 2016-02-04 12:43:21 +01:00
gpio tegra: gpio: Show the GPIO value for outputs 2016-02-16 09:17:50 -07:00
hwmon mailaddr: Update mail address 2016-01-27 15:32:05 +01:00
i2c mvtwsi: Fix breakage introduced by "Fix mvtwsi not working on sun6i and newer sunxi SoCs" 2016-01-26 17:58:02 +01:00
input tegra: keyboard: Fix the init order 2016-02-16 09:17:49 -07:00
led dm: led: Tidy up SPL options for the led and led-gpio 2015-09-02 21:28:22 -06:00
memory Various Makefiles: Add SPDX-License-Identifier tags 2015-11-10 09:19:52 -05:00
misc superio: Add SMSC SIO1007 driver 2016-02-21 13:42:52 +08:00
mmc mmc: Kconfig: Add Arasan SDHCI entry 2016-02-22 16:21:02 +01:00
mtd sf: spi_flash: use dma to copy data from mmap region if platform supports 2016-02-23 16:14:46 +05:30
net net: phy: realtek: Use generic genphy_parse_link() for RTL8211E 2016-02-22 16:37:50 +01:00
pch x86: pch9: Implement get_io_base op 2016-02-05 12:47:21 +08:00
pci Merge git://git.denx.de/u-boot-dm 2016-01-29 13:47:38 -05:00
pcmcia powerpc: mpc824x: remove MPC824X cpu support 2015-01-05 12:08:55 -05:00
pinctrl pinctrl: imx: Support i.MX7D 2016-02-21 11:25:29 +01:00
power sunxi: power: add support for sy8106a driver 2016-02-23 20:50:07 +01:00
pwm tegra: video: Move LCD driver to use the DM PWM driver 2016-02-16 09:17:53 -07:00
qe driver/qe: use strncpy instead of strcpy 2015-08-03 12:06:36 -07:00
ram ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM 2015-08-18 13:46:02 -04:00
remoteproc drivers: remoteproc: rproc-uclass: Fix check for NULL pointers 2015-12-05 18:22:32 -05:00
rtc rtc: Add MCP79411 support to DS1307 rtc driver 2015-11-04 15:19:12 -08:00
serial dm: ns16550: Add support for reg-offset property 2016-02-22 16:21:10 +01:00
soc Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
sound of: clean up OF_CONTROL ifdef conditionals 2015-08-18 13:46:05 -04:00
spi spi: spi-uclass: Set slave wordlen with SPI_DEFAULT_WORDLEN 2016-02-23 16:14:46 +05:30
thermal imx: mx7: fix the temperature checking for Rev1.1 2016-01-07 17:53:11 +01:00
timer timer: sandbox: work without device tree 2016-01-20 19:06:23 -07:00
tpm tpm: st33zp24: Add tpm st33zp24 spi support 2016-01-28 21:01:22 -07:00
twserial
usb dfu: usb: f_dfu: Set deferred call for dfu_flush() function 2016-02-24 19:12:32 +01:00
video video: Add S3C24xx framebuffer support 2016-02-22 18:07:17 +01:00
watchdog imx_watchdog: always set minimal timeout in reset_cpu 2016-01-07 17:54:53 +01:00
Kconfig dm: pwm: Add a PWM uclass 2016-01-21 20:42:36 -07:00
Makefile drivers: ddr: Add DDR2 SDRAM controller driver for Microchip PIC32. 2016-02-01 22:14:01 +01:00