diff mbox

[U-Boot,v2] usb: dfu: make nand upload working

Message ID 1383805781-23146-1-git-send-email-voice.shen@atmel.com
State Accepted
Delegated to: Marek Vasut
Headers show

Commit Message

Bo Shen Nov. 7, 2013, 6:29 a.m. UTC
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>
---
Changes in v2:
  - Move code to nand part, or else it will break mmc

 drivers/dfu/dfu_nand.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Heiko Schocher Nov. 8, 2013, 12:14 p.m. UTC | #1
Hello Bo,

Am 07.11.2013 07:29, schrieb Bo Shen:
> 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>
> ---
> Changes in v2:
>    - Move code to nand part, or else it will break mmc
>
>   drivers/dfu/dfu_nand.c |    1 +
>   1 file changed, 1 insertion(+)

Thanks! Tested on the rut board.

Tested-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Lukasz Majewski Nov. 8, 2013, 3:41 p.m. UTC | #2
Hi Bo,

> 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>

I would kindly ask some users of NAND part of the DFU (Tom, Heiko) to
test if this change doesn't break anything.


> ---
> Changes in v2:
>   - Move code to nand part, or else it will break mmc
> 
>  drivers/dfu/dfu_nand.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
> index 1c2e03b..cf082e2 100644
> --- a/drivers/dfu/dfu_nand.c
> +++ b/drivers/dfu/dfu_nand.c
> @@ -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:

Best regards,
Lukasz
Marek Vasut Nov. 8, 2013, 7:45 p.m. UTC | #3
Dear Bo Shen,

> 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>
> ---
> Changes in v2:
>   - Move code to nand part, or else it will break mmc
> 
>  drivers/dfu/dfu_nand.c |    1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

Best regards,
Marek Vasut
Heiko Schocher Nov. 11, 2013, 6:46 a.m. UTC | #4
Hello Lukasz,

Am 08.11.2013 16:41, schrieb Lukasz Majewski:
> Hi Bo,
>
>> 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>
>
> I would kindly ask some users of NAND part of the DFU (Tom, Heiko) to
> test if this change doesn't break anything.

I sent a tested-by for this patch, see:

http://lists.denx.de/pipermail/u-boot/2013-November/166552.html

without this patch nand upload didn;t worked on the rut board, with
this patch it worked :-)

bye,
Heiko
Bo Shen Nov. 11, 2013, 8:17 a.m. UTC | #5
Hi Heiko,

On 11/11/2013 02:46 PM, Heiko Schocher wrote:
> Hello Lukasz,
>
> Am 08.11.2013 16:41, schrieb Lukasz Majewski:
>> Hi Bo,
>>
>>> 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>
>>
>> I would kindly ask some users of NAND part of the DFU (Tom, Heiko) to
>> test if this change doesn't break anything.
>
> I sent a tested-by for this patch, see:
>
> http://lists.denx.de/pipermail/u-boot/2013-November/166552.html
>
> without this patch nand upload didn;t worked on the rut board, with
> this patch it worked :-)

Thanks for testing it.

> bye,
> Heiko

Best Regards,
Bo Shen
Marek Vasut Nov. 11, 2013, 1:29 p.m. UTC | #6
Dear Bo Shen,

> Hi Heiko,
> 
> On 11/11/2013 02:46 PM, Heiko Schocher wrote:
> > Hello Lukasz,
> > 
> > Am 08.11.2013 16:41, schrieb Lukasz Majewski:
> >> Hi Bo,
> >> 
> >>> 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>
> >> 
> >> I would kindly ask some users of NAND part of the DFU (Tom, Heiko) to
> >> test if this change doesn't break anything.
> > 
> > I sent a tested-by for this patch, see:
> > 
> > http://lists.denx.de/pipermail/u-boot/2013-November/166552.html
> > 
> > without this patch nand upload didn;t worked on the rut board, with
> > this patch it worked :-)
> 
> Thanks for testing it.

Thanks guys, PR is already on it's way to mainline.

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 1c2e03b..cf082e2 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -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: