u-boot/cmd
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
..
aes.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ambapp.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
armflash.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
bdinfo.c microblaze: Do not print eth device when DM_ETH is enabled 2016-01-27 15:55:49 +01:00
bedbug.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
blob.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
bmp.c cmd: Fix control bmp_display() 2016-02-06 13:53:09 +01:00
boot.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
bootldr.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
bootm.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
bootmenu.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
bootstage.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
cache.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
cbfs.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
clk.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
console.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
cplbinfo.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
cpu.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
cramfs.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
dataflash_mmc_mux.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
date.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
dcr.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
demo.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
dfu.c dfu: usb: f_dfu: Set deferred call for dfu_flush() function 2016-02-24 19:12:32 +01:00
diag.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
disk.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
display.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
dtt.c bug.h: move BUILD_BUG_* defines to include/linux/bug.h 2016-01-25 10:39:59 -05:00
echo.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
eeprom.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
efi.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
elf.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ethsw.c Merge branch 'master' of git://git.denx.de/u-boot-net 2016-01-28 18:42:10 -05:00
exit.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ext2.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ext4.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fastboot.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fat.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fdc.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fdt.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fitupd.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
flash.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fpga.c fpga: Fix compilation warnings 2016-01-27 15:55:54 +01:00
fpgad.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fs_uuid.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fs.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
fuse.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
gettime.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
gpio.c gpio: Correct handling of 'gpio status' 2016-02-15 20:58:25 +00:00
gpt.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
hash.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
help.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
host.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
i2c.c i2c: spd: Extend SPD memory types 2016-02-22 16:21:12 +01:00
ide.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
immap.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ini.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
io.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
iotrace.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
irq.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
itest.c itest: allow map_physmem to return 0 in limited cases 2016-02-09 15:41:19 -07:00
jffs2.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
Kconfig Move all command code into its own directory 2016-01-25 10:39:43 -05:00
ldrinfo.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
led.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
license.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
load.c Remove unused CONFIG_CMD_HWFLOW option and associated dead code. 2016-02-08 10:22:44 -05:00
log.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
lzmadec.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mac.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
Makefile Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
md5sum.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mdio.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mem.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mfsl.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mii.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
misc.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mmc_spi.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mmc.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mp.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
mtdparts.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
nand.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
net.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
nvedit.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
onenand.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
otp.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
part.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
pci.c Implement "pci enum" command for CONFIG_DM_PCI 2016-01-28 21:01:23 -07:00
pcmcia.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
pmic.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
portio.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
pxe.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
read.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
reginfo.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
regulator.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
reiser.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
remoteproc.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
sata.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
scsi.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
setexpr.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
sf.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
sha1sum.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
softswitch.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
sound.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
source.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
spi.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
spibootldr.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
spl.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
strings.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
terminal.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
test.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
thordown.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
time.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
tpm_test.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
tpm.c tpm: Fix fault in case CONFIG_DM_TPM is set without any TPM 2016-01-28 21:01:22 -07:00
trace.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
tsi148.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ubi.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ubifs.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
universe.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
unzip.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
usb_mass_storage.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
usb.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
version.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
ximg.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
yaffs2.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
zfs.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00
zip.c Remove the cmd_ prefix from command files 2016-01-25 10:39:43 -05:00