diff mbox

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

Message ID 525E55A9.9020005@atmel.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Bo Shen Oct. 16, 2013, 9 a.m. UTC
Hi Lukasz Majewski,

On 10/14/2013 15:25, Bo Shen wrote:
> Hi Lukasz Majewski,
>
> On 10/13/2013 05:19, Lukasz Majewski wrote:
>> On Sat, 12 Oct 2013 15:47:14 +0800
>> Bo Shen <voice.shen@atmel.com> wrote:
>>
>>> If won't pass value to dfu->r_left, it always 0, make no transfer,
>>> the dfu-util on host side report failed. So, before starting transfer,
>>> pass the value, then nand uploading can work.
>>>
>>> Signed-off-by: Bo Shen <voice.shen@atmel.com>
>>>
>>> ---
>>>   drivers/dfu/dfu.c |    1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
>>> index 56b21c7..3c3ad1b 100644
>>> --- a/drivers/dfu/dfu.c
>>> +++ b/drivers/dfu/dfu.c
>>> @@ -274,6 +274,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf,
>>> int size, int blk_seq_num) if (dfu->i_buf_start == NULL)
>>>               return -ENOMEM;
>>>
>>> +        dfu->r_left = dfu->data.nand.size;
>>
>> Please do not add nand related code to "generic" DFU code. This can
>> damage DFU operation with other memories (like eMMC).
>>
>> Such code shall be added to dfu_nand.c file.
>
> Thanks for point out this.
> I will check it.

After read more deeply into dfu core code, even we move this patch to 
nand related code as following.
I think this only a workaround for NAND uploading, because it the same 
as mmc uploading, need the dfu buffer size equal or larger than the 
upload file size or partition size.
So, does this acceptable? If acceptable, I will send v2.

---8>---
         default:
---<8---

Best Regards,
Bo Shen

Comments

Bo Shen Nov. 1, 2013, 1:20 a.m. UTC | #1
Hi Lukasz,

On 10/16/2013 17:00, Bo Shen wrote:
> Hi Lukasz Majewski,
>
> On 10/14/2013 15:25, Bo Shen wrote:
>> Hi Lukasz Majewski,
>>
>> On 10/13/2013 05:19, Lukasz Majewski wrote:
>>> On Sat, 12 Oct 2013 15:47:14 +0800
>>> Bo Shen <voice.shen@atmel.com> wrote:
>>>
>>>> If won't pass value to dfu->r_left, it always 0, make no transfer,
>>>> the dfu-util on host side report failed. So, before starting transfer,
>>>> pass the value, then nand uploading can work.
>>>>
>>>> Signed-off-by: Bo Shen <voice.shen@atmel.com>
>>>>
>>>> ---
>>>>   drivers/dfu/dfu.c |    1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
>>>> index 56b21c7..3c3ad1b 100644
>>>> --- a/drivers/dfu/dfu.c
>>>> +++ b/drivers/dfu/dfu.c
>>>> @@ -274,6 +274,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf,
>>>> int size, int blk_seq_num) if (dfu->i_buf_start == NULL)
>>>>               return -ENOMEM;
>>>>
>>>> +        dfu->r_left = dfu->data.nand.size;
>>>
>>> Please do not add nand related code to "generic" DFU code. This can
>>> damage DFU operation with other memories (like eMMC).
>>>
>>> Such code shall be added to dfu_nand.c file.
>>
>> Thanks for point out this.
>> I will check it.
>
> After read more deeply into dfu core code, even we move this patch to
> nand related code as following.
> I think this only a workaround for NAND uploading, because it the same
> as mmc uploading, need the dfu buffer size equal or larger than the
> upload file size or partition size.
> So, does this acceptable? If acceptable, I will send v2.

Would it possible to check this for NAND uploading?

> ---8>---
> --- 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:
> ---<8---
>
> Best Regards,
> Bo Shen

Best Regards,
Bo Shen
diff mbox

Patch

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