usb: dfu: make nand upload working
authorBo Shen <voice.shen@atmel.com>
Thu, 7 Nov 2013 06:29:41 +0000 (14:29 +0800)
committerMarek Vasut <marex@denx.de>
Fri, 8 Nov 2013 19:46:20 +0000 (20:46 +0100)
Nowhere pass a value to len, which always 0, make no transfer which
cause uploading failed.

This patch make nand upload working. However it needs enough malloc
buffer to store read data, that means the buffer at least equal to
the upload partition size, or else it doesn't work.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
drivers/dfu/dfu_nand.c

index edbf5a97b9001a84cd93570884f6aee5372cdc96..2d07097e850af70544d95f5481d6d5af9ef26f5c 100644 (file)
@@ -121,6 +121,7 @@ static int dfu_read_medium_nand(struct dfu_entity *dfu, u64 offset, void *buf,
 
        switch (dfu->layout) {
        case DFU_RAW_ADDR:
+               *len = dfu->data.nand.size;
                ret = nand_block_read(dfu, offset, buf, len);
                break;
        default: