Patchwork [U-Boot,01/10] usb: Remove obsolete header file

login
register
mail settings
Submitter Pantelis Antoniou
Date Nov. 29, 2012, 7:33 a.m.
Message ID <1354174439-5589-2-git-send-email-panto@antoniou-consulting.com>
Download mbox | patch
Permalink /patch/202408/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Łukasz Majewski - Nov. 28, 2012, 2:40 p.m.
Hi Pantelis,

> usbdescriptors.h conflicts with linux/usb/ch9.h
> Remove it.

After applying this patch, I cannot build trats target anymore.

If I remember correctly both files (usbdescriptors.h and
linux/usb/ch9.h) are necessary.

The usbdescriptors.h declares e.g.: struct usb_device_descriptor


Moreover after quick check, (I've applied all patches excluding the
patch 01/10) the dfu is _NOT_ working properly anymore.

It writes u-boot.bin, but in a way that the board is bricked after
flashing.



Regards,
Lukasz

BTW: 
1. What is your target device? What is the output of dfu mmc 0 list
command on your device?

On trats it is:
DFU alt settings list:
dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
dev: eMMC alt: 1 name: uImage layout: FAT

2. Please look into the TRATS board (especially the CONFIG_DFU_ALT
constant) for reference.

3. What is yours dfu-util version? (Mine is 0.1+svnexported)

> 
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
>  drivers/usb/gadget/f_dfu.c | 1 -
>  include/g_dnl.h            | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index 3ec4c65..10547e3 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -25,7 +25,6 @@
>  #include <malloc.h>
>  
>  #include <linux/usb/ch9.h>
> -#include <usbdescriptors.h>
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 0ec7440..f47395f 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -22,7 +22,6 @@
>  #define __G_DOWNLOAD_H_
>  
>  #include <linux/usb/ch9.h>
> -#include <usbdescriptors.h>
>  #include <linux/usb/gadget.h>
>  
>  int g_dnl_register(const char *s);
Tom Rini - Nov. 28, 2012, 3:42 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/28/12 09:40, Lukasz Majewski wrote:
> Hi Pantelis,
> 
>> usbdescriptors.h conflicts with linux/usb/ch9.h Remove it.
> 
> After applying this patch, I cannot build trats target anymore.

Had you also merged u-boot-usb?  Locally, trats builds now (which is
why this is merged to masgter) but wasn't after the u-boot-usb merge.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQtjDuAAoJENk4IS6UOR1WiooP/3FZJupcB4F64VKFWN2QjO3Y
MN3SnN7NFxL5/DqiZ/kg7YAz5f3Z7eKvGRuTZGfM5nyCgqDFm0IWlzzrHkHUK6ow
Jlj3Gy0X1iQoDGCC5tCNHR84pka9f0NQ6PQrQbR7fSBGRw5iw/sFANiwWfY50FJz
49Z3rJMLbh0ocwepVHmKmXBlnv++kUxpFd7nMi8gIon70A0a/1X/y1/NIN/fZEE/
e40DHSSgocmrGfJjNb49/UNjhDMqyG9I4yvf7/7QTONkV8taaAHurprzcD/aGRpI
zHlxsfVRlZ5TftfEqIyIK3fGHlW4qdCMqjzjiTxjANImlCgeUK3JHdSbafUA9j94
9fDBwE5OZp5v32npxv8d4a9/0JPjMQSAYVq3Lmb64MyWppFkgOKFtr4StbLg9+NE
K443RM/NYhvX+bkIuDytc9OxbxKkfVvalCJow+2LosxJO9GovwZfD5BrOX7zul3j
EwhzgiFV88Vpzn3SiyGtuhauFugkadrX+3hgC6Mmh1DMYG1MxSK/Ombw7G/nKdzx
SUGRL9ij3eEU60QbZFb241TouQ3PZeB1v2P6b6er5veIbS6iUZjd6GdeRNRyWri2
Q9S+h6tHx0CSVSaRudHrAnhdtmbbCGvgzsPY7fHzMzu5hiV7Ng12Sg0Mr1TiDazu
4rd57SIVSIFLBmdNUnK3
=3b1u
-----END PGP SIGNATURE-----
Łukasz Majewski - Nov. 28, 2012, 3:45 p.m.
Hi Tom,

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 11/28/12 09:40, Lukasz Majewski wrote:
> > Hi Pantelis,
> > 
> >> usbdescriptors.h conflicts with linux/usb/ch9.h Remove it.
> > 
> > After applying this patch, I cannot build trats target anymore.
> 
> Had you also merged u-boot-usb?  Locally, trats builds now (which is
> why this is merged to masgter) but wasn't after the u-boot-usb merge.
> 

Good point, I've rebased on master. 
I will do the same with u-boot-usb
Łukasz Majewski - Nov. 28, 2012, 4:01 p.m.
Hi Tom,

> Hi Pantelis,
> 
> > usbdescriptors.h conflicts with linux/usb/ch9.h
> > Remove it.
> 
After rebasing on u-boot-usb/next below comment apply:

After applying this patch, I cannot build trats target anymore.
 

With u-boot-usb/master I can compile the u-boot for trats board with no
warnings and errors.

Unfortunately after flashing with dfu, the u-boot is _NOT_ working
properly anymore.
It seems, that some parts of the binary weren't correct.

> It writes u-boot.bin, but in a way that the board is bricked after
> flashing.

I need some time to perform the thorough review of core DFU patches
(patches 7/10, 09/10, 10/10).



> BTW: 
> 1. What is your target device? What is the output of dfu mmc 0 list
> command on your device?
> 
> On trats it is:
> DFU alt settings list:
> dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
> dev: eMMC alt: 1 name: uImage layout: FAT
> 
> 2. Please look into the TRATS board (especially the CONFIG_DFU_ALT
> constant) for reference.
> 
> 3. What is yours dfu-util version? (Mine is 0.1+svnexported)
> 
> > 
> > Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> > ---
> >  drivers/usb/gadget/f_dfu.c | 1 -
> >  include/g_dnl.h            | 1 -
> >  2 files changed, 2 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> > index 3ec4c65..10547e3 100644
> > --- a/drivers/usb/gadget/f_dfu.c
> > +++ b/drivers/usb/gadget/f_dfu.c
> > @@ -25,7 +25,6 @@
> >  #include <malloc.h>
> >  
> >  #include <linux/usb/ch9.h>
> > -#include <usbdescriptors.h>
> >  #include <linux/usb/gadget.h>
> >  #include <linux/usb/composite.h>
> >  
> > diff --git a/include/g_dnl.h b/include/g_dnl.h
> > index 0ec7440..f47395f 100644
> > --- a/include/g_dnl.h
> > +++ b/include/g_dnl.h
> > @@ -22,7 +22,6 @@
> >  #define __G_DOWNLOAD_H_
> >  
> >  #include <linux/usb/ch9.h>
> > -#include <usbdescriptors.h>
> >  #include <linux/usb/gadget.h>
> >  
> >  int g_dnl_register(const char *s);
> 
> 
>
Pantelis Antoniou - Nov. 28, 2012, 5:13 p.m.
Hi Lukasz,

On Nov 28, 2012, at 6:01 PM, Lukasz Majewski wrote:

> Hi Tom,
> 
>> Hi Pantelis,
>> 
>>> usbdescriptors.h conflicts with linux/usb/ch9.h
>>> Remove it.
>> 
> After rebasing on u-boot-usb/next below comment apply:
> 
> After applying this patch, I cannot build trats target anymore.
> 
> 
> With u-boot-usb/master I can compile the u-boot for trats board with no
> warnings and errors.
> 
> Unfortunately after flashing with dfu, the u-boot is _NOT_ working
> properly anymore.
> It seems, that some parts of the binary weren't correct.
> 

Are you writing to a file in a filesystem? I.e. FAT?

I'm in the middle of doing more extensive tests, but file write to an
FS might have problems. I am using the raw mmc interface.

There could be something there that it's missed. I'm in the middle of
doing more extensive tests.


>> It writes u-boot.bin, but in a way that the board is bricked after
>> flashing.
> 
> I need some time to perform the thorough review of core DFU patches
> (patches 7/10, 09/10, 10/10).
> 

OK.

> 
> 
>> BTW: 
>> 1. What is your target device? What is the output of dfu mmc 0 list
>> command on your device?
>> 

I'm on am335x_evm target, actual board is a beaglebone.


>> On trats it is:
>> DFU alt settings list:
>> dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
>> dev: eMMC alt: 1 name: uImage layout: FAT
>> 

# setenv dfu_alt_info 'test part 0 3'
# mmc part
U-Boot# mmc part

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              112392          7a348599-01     0c Boot
  2     112455          7501331         7a348599-02     83
  3     7613786         12966           7a348599-03     83
# dfu mmc 0 list
DFU alt settings list:
dev: eMMC alt: 0 name: test layout: RAW_ADDR

Are you downloading u-boot.bin to the raw nand?
I.e. there's no boot partition?

All my tests have been downloading a small ext3 image to the mmc.
I'm in the middle of doing more extensive tests but those takes a huge
amount of time... :(

>> 2. Please look into the TRATS board (especially the CONFIG_DFU_ALT
>> constant) for reference.
>> 

Already looked there.

>> 3. What is yours dfu-util version? (Mine is 0.1+svnexported)
>> 

Compiled from source git://gitorious.org/dfu-util/dfu-util.git
Current master.

Regards

-- Pantelis


>>> 
>>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>>> ---
>>> drivers/usb/gadget/f_dfu.c | 1 -
>>> include/g_dnl.h            | 1 -
>>> 2 files changed, 2 deletions(-)
>>> 
>>> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
>>> index 3ec4c65..10547e3 100644
>>> --- a/drivers/usb/gadget/f_dfu.c
>>> +++ b/drivers/usb/gadget/f_dfu.c
>>> @@ -25,7 +25,6 @@
>>> #include <malloc.h>
>>> 
>>> #include <linux/usb/ch9.h>
>>> -#include <usbdescriptors.h>
>>> #include <linux/usb/gadget.h>
>>> #include <linux/usb/composite.h>
>>> 
>>> diff --git a/include/g_dnl.h b/include/g_dnl.h
>>> index 0ec7440..f47395f 100644
>>> --- a/include/g_dnl.h
>>> +++ b/include/g_dnl.h
>>> @@ -22,7 +22,6 @@
>>> #define __G_DOWNLOAD_H_
>>> 
>>> #include <linux/usb/ch9.h>
>>> -#include <usbdescriptors.h>
>>> #include <linux/usb/gadget.h>
>>> 
>>> int g_dnl_register(const char *s);
>> 
>> 
>> 
> 
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group
Łukasz Majewski - Nov. 28, 2012, 5:46 p.m.
Hi Pantelis,

> Hi Lukasz,
> 
> On Nov 28, 2012, at 6:01 PM, Lukasz Majewski wrote:
> 
> > Hi Tom,
> > 
> >> Hi Pantelis,
> >> 
> >>> usbdescriptors.h conflicts with linux/usb/ch9.h
> >>> Remove it.
> >> 
> > After rebasing on u-boot-usb/next below comment apply:
> > 
> > After applying this patch, I cannot build trats target anymore.
> > 
> > 
> > With u-boot-usb/master I can compile the u-boot for trats board
> > with no warnings and errors.
> > 
> > Unfortunately after flashing with dfu, the u-boot is _NOT_ working
> > properly anymore.
> > It seems, that some parts of the binary weren't correct.
> > 
> 
> Are you writing to a file in a filesystem? I.e. FAT?
> 
> I'm in the middle of doing more extensive tests, but file write to an
> FS might have problems. I am using the raw mmc interface.
> 

I've written u-boot to RAW eMMC (based on the LBA addressing). Moreover
I was also able to write data to FAT and EXT4 fs (which uses standard
fat/ext4 load commands).

> There could be something there that it's missed. I'm in the middle of
> doing more extensive tests.
> 
> 
> >> It writes u-boot.bin, but in a way that the board is bricked after
> >> flashing.
> > 
> > I need some time to perform the thorough review of core DFU patches
> > (patches 7/10, 09/10, 10/10).
> > 
> 
> OK.
> 
> > 
> > 
> >> BTW: 
> >> 1. What is your target device? What is the output of dfu mmc 0 list
> >> command on your device?
> >> 
> 
> I'm on am335x_evm target, actual board is a beaglebone.
> 
> 
> >> On trats it is:
> >> DFU alt settings list:
> >> dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
> >> dev: eMMC alt: 1 name: uImage layout: FAT
> >> 
> 
> # setenv dfu_alt_info 'test part 0 3'
> # mmc part
> U-Boot# mmc part
> 
> Partition Map for MMC device 0  --   Partition Type: DOS
> 
> Part    Start Sector    Num Sectors     UUID            Type
>   1     63              112392          7a348599-01     0c Boot
>   2     112455          7501331         7a348599-02     83
>   3     7613786         12966           7a348599-03     83
> # dfu mmc 0 list
> DFU alt settings list:
> dev: eMMC alt: 0 name: test layout: RAW_ADDR
> 
Off topic: 
It would be nice to have all partitions listed with dfu mmc 0
list :-) and then have access to it via dfu-util tool (as a separate
alt settings). But this is a task for the future :-).


> Are you downloading u-boot.bin to the raw nand?
> I.e. there's no boot partition?

Yes, there isn't any partition for u-boot. I write to raw eMMC address.

> 
> All my tests have been downloading a small ext3 image to the mmc.
> I'm in the middle of doing more extensive tests but those takes a huge
> amount of time... :(

This is because of very low DFU transmission speed (It uses only EP0
with EPS=64B , so it is meant to transfer really small files).

Updating rootfs via DFU would take much time. It is OK, to transfer
u-boot, uImage, some log data.

> 
> >> 2. Please look into the TRATS board (especially the CONFIG_DFU_ALT
> >> constant) for reference.
> >> 
> 
> Already looked there.
> 
> >> 3. What is yours dfu-util version? (Mine is 0.1+svnexported)
> >> 
> 
> Compiled from source git://gitorious.org/dfu-util/dfu-util.git
> Current master.
> 
> Regards
> 
> -- Pantelis
> 
> 
> >>> 
> >>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> >>> ---
> >>> drivers/usb/gadget/f_dfu.c | 1 -
> >>> include/g_dnl.h            | 1 -
> >>> 2 files changed, 2 deletions(-)
> >>> 
> >>> diff --git a/drivers/usb/gadget/f_dfu.c
> >>> b/drivers/usb/gadget/f_dfu.c index 3ec4c65..10547e3 100644
> >>> --- a/drivers/usb/gadget/f_dfu.c
> >>> +++ b/drivers/usb/gadget/f_dfu.c
> >>> @@ -25,7 +25,6 @@
> >>> #include <malloc.h>
> >>> 
> >>> #include <linux/usb/ch9.h>
> >>> -#include <usbdescriptors.h>
> >>> #include <linux/usb/gadget.h>
> >>> #include <linux/usb/composite.h>
> >>> 
> >>> diff --git a/include/g_dnl.h b/include/g_dnl.h
> >>> index 0ec7440..f47395f 100644
> >>> --- a/include/g_dnl.h
> >>> +++ b/include/g_dnl.h
> >>> @@ -22,7 +22,6 @@
> >>> #define __G_DOWNLOAD_H_
> >>> 
> >>> #include <linux/usb/ch9.h>
> >>> -#include <usbdescriptors.h>
> >>> #include <linux/usb/gadget.h>
> >>> 
> >>> int g_dnl_register(const char *s);
> >> 
> >> 
> >> 
> > 
> > 
> > 
> > -- 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > Samsung Poland R&D Center | Linux Platform Group
>
Pantelis Antoniou - Nov. 28, 2012, 5:54 p.m.
Hi Lukasz,

On Nov 28, 2012, at 7:46 PM, Lukasz Majewski wrote:

> Hi Pantelis,
> 
>> Hi Lukasz,
>> 
>> On Nov 28, 2012, at 6:01 PM, Lukasz Majewski wrote:
>> 
>>> Hi Tom,
>>> 
>>>> Hi Pantelis,
>>>> 
>>>>> usbdescriptors.h conflicts with linux/usb/ch9.h
>>>>> Remove it.
>>>> 
>>> After rebasing on u-boot-usb/next below comment apply:
>>> 
>>> After applying this patch, I cannot build trats target anymore.
>>> 
>>> 
>>> With u-boot-usb/master I can compile the u-boot for trats board
>>> with no warnings and errors.
>>> 
>>> Unfortunately after flashing with dfu, the u-boot is _NOT_ working
>>> properly anymore.
>>> It seems, that some parts of the binary weren't correct.
>>> 
>> 
>> Are you writing to a file in a filesystem? I.e. FAT?
>> 
>> I'm in the middle of doing more extensive tests, but file write to an
>> FS might have problems. I am using the raw mmc interface.
>> 
> 
> I've written u-boot to RAW eMMC (based on the LBA addressing). Moreover
> I was also able to write data to FAT and EXT4 fs (which uses standard
> fat/ext4 load commands).
> 

I see. Note that ext4 writes won't work; there is no offset to the
write file command. You will have to have use a large enough buffer
to handle the file's worst case.

>> There could be something there that it's missed. I'm in the middle of
>> doing more extensive tests.
>> 
>> 
>>>> It writes u-boot.bin, but in a way that the board is bricked after
>>>> flashing.
>>> 
>>> I need some time to perform the thorough review of core DFU patches
>>> (patches 7/10, 09/10, 10/10).
>>> 
>> 
>> OK.
>> 
>>> 
>>> 
>>>> BTW: 
>>>> 1. What is your target device? What is the output of dfu mmc 0 list
>>>> command on your device?
>>>> 
>> 
>> I'm on am335x_evm target, actual board is a beaglebone.
>> 
>> 
>>>> On trats it is:
>>>> DFU alt settings list:
>>>> dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
>>>> dev: eMMC alt: 1 name: uImage layout: FAT
>>>> 
>> 
>> # setenv dfu_alt_info 'test part 0 3'
>> # mmc part
>> U-Boot# mmc part
>> 
>> Partition Map for MMC device 0  --   Partition Type: DOS
>> 
>> Part    Start Sector    Num Sectors     UUID            Type
>>  1     63              112392          7a348599-01     0c Boot
>>  2     112455          7501331         7a348599-02     83
>>  3     7613786         12966           7a348599-03     83
>> # dfu mmc 0 list
>> DFU alt settings list:
>> dev: eMMC alt: 0 name: test layout: RAW_ADDR
>> 
> Off topic: 
> It would be nice to have all partitions listed with dfu mmc 0
> list :-) and then have access to it via dfu-util tool (as a separate
> alt settings). But this is a task for the future :-).
> 
> 
>> Are you downloading u-boot.bin to the raw nand?
>> I.e. there's no boot partition?
> 
> Yes, there isn't any partition for u-boot. I write to raw eMMC address.
> 
>> 
>> All my tests have been downloading a small ext3 image to the mmc.
>> I'm in the middle of doing more extensive tests but those takes a huge
>> amount of time... :(
> 
> This is because of very low DFU transmission speed (It uses only EP0
> with EPS=64B , so it is meant to transfer really small files).
> 
> Updating rootfs via DFU would take much time. It is OK, to transfer
> u-boot, uImage, some log data.
> 

We have customers that do want to use DFU for all of their initial programming.

The limitations are known, but the fact is that they find it very convenient
for their use. And it's not like you're limited by the USB interface, most of
the time is spent writing to the medium.

BTW, I've just confirmed that larger transfers get corrupted... :(
Working on a fix now...

>> 
>>>> 2. Please look into the TRATS board (especially the CONFIG_DFU_ALT
>>>> constant) for reference.
>>>> 
>> 
>> Already looked there.
>> 
>>>> 3. What is yours dfu-util version? (Mine is 0.1+svnexported)
>>>> 
>> 
>> Compiled from source git://gitorious.org/dfu-util/dfu-util.git
>> Current master.
>> 
>> Regards
>> 
>> -- Pantelis
>> 
>> 
>>>>> 
>>>>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>>>>> ---
>>>>> drivers/usb/gadget/f_dfu.c | 1 -
>>>>> include/g_dnl.h            | 1 -
>>>>> 2 files changed, 2 deletions(-)
>>>>> 
>>>>> diff --git a/drivers/usb/gadget/f_dfu.c
>>>>> b/drivers/usb/gadget/f_dfu.c index 3ec4c65..10547e3 100644
>>>>> --- a/drivers/usb/gadget/f_dfu.c
>>>>> +++ b/drivers/usb/gadget/f_dfu.c
>>>>> @@ -25,7 +25,6 @@
>>>>> #include <malloc.h>
>>>>> 
>>>>> #include <linux/usb/ch9.h>
>>>>> -#include <usbdescriptors.h>
>>>>> #include <linux/usb/gadget.h>
>>>>> #include <linux/usb/composite.h>
>>>>> 
>>>>> diff --git a/include/g_dnl.h b/include/g_dnl.h
>>>>> index 0ec7440..f47395f 100644
>>>>> --- a/include/g_dnl.h
>>>>> +++ b/include/g_dnl.h
>>>>> @@ -22,7 +22,6 @@
>>>>> #define __G_DOWNLOAD_H_
>>>>> 
>>>>> #include <linux/usb/ch9.h>
>>>>> -#include <usbdescriptors.h>
>>>>> #include <linux/usb/gadget.h>
>>>>> 
>>>>> int g_dnl_register(const char *s);
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Best regards,
>>> 
>>> Lukasz Majewski
>>> 
>>> Samsung Poland R&D Center | Linux Platform Group
>> 
> 
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group
Pantelis Antoniou - Nov. 29, 2012, 7:33 a.m.
usbdescriptors.h conflicts with linux/usb/ch9.h
Remove it.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 drivers/usb/gadget/f_dfu.c | 1 -
 include/g_dnl.h            | 1 -
 2 files changed, 2 deletions(-)
Pantelis Antoniou - Nov. 29, 2012, 8:07 a.m.
Hi Lukasz,

I did found out the problem with large transfers, and there is a patch that
fixes it.

I'm pretty sure that the transfers are correct. Perhaps some other problem
with your board?

Can you use the updated patch series and try with that, with debugging
enabled?

Regards

-- Pantelis
Łukasz Majewski - Nov. 29, 2012, 8:13 a.m.
Hi Pantelis,

> Hi Lukasz,
> 
> On Nov 28, 2012, at 7:46 PM, Lukasz Majewski wrote:
> 
> > Hi Pantelis,
> > 
> >> Hi Lukasz,
> >> 
> >> On Nov 28, 2012, at 6:01 PM, Lukasz Majewski wrote:
> >> 
> >>> Hi Tom,
> >>> 
> >>>> Hi Pantelis,
> >>>> 
> >>>>> usbdescriptors.h conflicts with linux/usb/ch9.h
> >>>>> Remove it.
> >>>> 
> >>> After rebasing on u-boot-usb/next below comment apply:
> >>> 
> >>> After applying this patch, I cannot build trats target anymore.
> >>> 
> >>> 
> >>> With u-boot-usb/master I can compile the u-boot for trats board
> >>> with no warnings and errors.
> >>> 
> >>> Unfortunately after flashing with dfu, the u-boot is _NOT_ working
> >>> properly anymore.
> >>> It seems, that some parts of the binary weren't correct.
> >>> 
> >> 
> >> Are you writing to a file in a filesystem? I.e. FAT?
> >> 
> >> I'm in the middle of doing more extensive tests, but file write to
> >> an FS might have problems. I am using the raw mmc interface.
> >> 
> > 
> > I've written u-boot to RAW eMMC (based on the LBA addressing).
> > Moreover I was also able to write data to FAT and EXT4 fs (which
> > uses standard fat/ext4 load commands).
> > 
> 
> I see. Note that ext4 writes won't work; there is no offset to the
> write file command. You will have to have use a large enough buffer
> to handle the file's worst case.

The 4 MiB buffer size was my wrong simplification. It shall be done as
you proposed (with transfered data chopped to smaller chunks).

The ext4write command will write data from DRAM buffer (e.g.
0x44000000) to partition formatted with ext4 fs. (one just needs to
remember that file size is given with hex number).
I've posted some fixes for ext4 recently to ML.

> 
> >> There could be something there that it's missed. I'm in the middle
> >> of doing more extensive tests.
> >> 
> >> 
> >>>> It writes u-boot.bin, but in a way that the board is bricked
> >>>> after flashing.
> >>> 
> >>> I need some time to perform the thorough review of core DFU
> >>> patches (patches 7/10, 09/10, 10/10).
> >>> 
> >> 
> >> OK.
> >> 
> >>> 
> >>> 
> >>>> BTW: 
> >>>> 1. What is your target device? What is the output of dfu mmc 0
> >>>> list command on your device?
> >>>> 
> >> 
> >> I'm on am335x_evm target, actual board is a beaglebone.
> >> 
> >> 
> >>>> On trats it is:
> >>>> DFU alt settings list:
> >>>> dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
> >>>> dev: eMMC alt: 1 name: uImage layout: FAT
> >>>> 
> >> 
> >> # setenv dfu_alt_info 'test part 0 3'
> >> # mmc part
> >> U-Boot# mmc part
> >> 
> >> Partition Map for MMC device 0  --   Partition Type: DOS
> >> 
> >> Part    Start Sector    Num Sectors     UUID            Type
> >>  1     63              112392          7a348599-01     0c Boot
> >>  2     112455          7501331         7a348599-02     83
> >>  3     7613786         12966           7a348599-03     83
> >> # dfu mmc 0 list
> >> DFU alt settings list:
> >> dev: eMMC alt: 0 name: test layout: RAW_ADDR
> >> 
> > Off topic: 
> > It would be nice to have all partitions listed with dfu mmc 0
> > list :-) and then have access to it via dfu-util tool (as a separate
> > alt settings). But this is a task for the future :-).
> > 
> > 
> >> Are you downloading u-boot.bin to the raw nand?
> >> I.e. there's no boot partition?
> > 
> > Yes, there isn't any partition for u-boot. I write to raw eMMC
> > address.
> > 
> >> 
> >> All my tests have been downloading a small ext3 image to the mmc.
> >> I'm in the middle of doing more extensive tests but those takes a
> >> huge amount of time... :(
> > 
> > This is because of very low DFU transmission speed (It uses only EP0
> > with EPS=64B , so it is meant to transfer really small files).
> > 
> > Updating rootfs via DFU would take much time. It is OK, to transfer
> > u-boot, uImage, some log data.
> > 
> 
> We have customers that do want to use DFU for all of their initial
> programming.

Ok, I see.

> 
> The limitations are known, but the fact is that they find it very
> convenient for their use. And it's not like you're limited by the USB
> interface, most of the time is spent writing to the medium.

So in my opinion there would be nice to have some kind of caching of
received data before writing to memory.

Then we could write memory asynchronously, when we "collect" e.g. 1 MiB
data in a buffer (and in meantime collect next data).


> 
> BTW, I've just confirmed that larger transfers get corrupted... :(
> Working on a fix now...

Ok.

> 
> >> 
> >>>> 2. Please look into the TRATS board (especially the
> >>>> CONFIG_DFU_ALT constant) for reference.
> >>>> 
> >> 
> >> Already looked there.
> >> 
> >>>> 3. What is yours dfu-util version? (Mine is 0.1+svnexported)
> >>>> 
> >> 
> >> Compiled from source git://gitorious.org/dfu-util/dfu-util.git
> >> Current master.
> >> 
> >> Regards
> >> 
> >> -- Pantelis
> >> 
> >> 
> >>>>> 
> >>>>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> >>>>> ---
> >>>>> drivers/usb/gadget/f_dfu.c | 1 -
> >>>>> include/g_dnl.h            | 1 -
> >>>>> 2 files changed, 2 deletions(-)
> >>>>> 
> >>>>> diff --git a/drivers/usb/gadget/f_dfu.c
> >>>>> b/drivers/usb/gadget/f_dfu.c index 3ec4c65..10547e3 100644
> >>>>> --- a/drivers/usb/gadget/f_dfu.c
> >>>>> +++ b/drivers/usb/gadget/f_dfu.c
> >>>>> @@ -25,7 +25,6 @@
> >>>>> #include <malloc.h>
> >>>>> 
> >>>>> #include <linux/usb/ch9.h>
> >>>>> -#include <usbdescriptors.h>
> >>>>> #include <linux/usb/gadget.h>
> >>>>> #include <linux/usb/composite.h>
> >>>>> 
> >>>>> diff --git a/include/g_dnl.h b/include/g_dnl.h
> >>>>> index 0ec7440..f47395f 100644
> >>>>> --- a/include/g_dnl.h
> >>>>> +++ b/include/g_dnl.h
> >>>>> @@ -22,7 +22,6 @@
> >>>>> #define __G_DOWNLOAD_H_
> >>>>> 
> >>>>> #include <linux/usb/ch9.h>
> >>>>> -#include <usbdescriptors.h>
> >>>>> #include <linux/usb/gadget.h>
> >>>>> 
> >>>>> int g_dnl_register(const char *s);
> >>>> 
> >>>> 
> >>>> 
> >>> 
> >>> 
> >>> 
> >>> -- 
> >>> Best regards,
> >>> 
> >>> Lukasz Majewski
> >>> 
> >>> Samsung Poland R&D Center | Linux Platform Group
> >> 
> > 
> > 
> > 
> > -- 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > Samsung Poland R&D Center | Linux Platform Group
>
Pantelis Antoniou - Nov. 29, 2012, 8:19 a.m.
Hi Lukasz,

On Nov 29, 2012, at 10:13 AM, Lukasz Majewski wrote:

> Hi Pantelis,
> 
>> Hi Lukasz,
>> 
>> On Nov 28, 2012, at 7:46 PM, Lukasz Majewski wrote:
>> 
>>> Hi Pantelis,
>>> 
>>>> Hi Lukasz,
>>>> 
>>>> On Nov 28, 2012, at 6:01 PM, Lukasz Majewski wrote:
>>>> 
>>>>> Hi Tom,
>>>>> 
>>>>>> Hi Pantelis,
>>>>>> 
>>>>>>> usbdescriptors.h conflicts with linux/usb/ch9.h
>>>>>>> Remove it.
>>>>>> 
>>>>> After rebasing on u-boot-usb/next below comment apply:
>>>>> 
>>>>> After applying this patch, I cannot build trats target anymore.
>>>>> 
>>>>> 
>>>>> With u-boot-usb/master I can compile the u-boot for trats board
>>>>> with no warnings and errors.
>>>>> 
>>>>> Unfortunately after flashing with dfu, the u-boot is _NOT_ working
>>>>> properly anymore.
>>>>> It seems, that some parts of the binary weren't correct.
>>>>> 
>>>> 
>>>> Are you writing to a file in a filesystem? I.e. FAT?
>>>> 
>>>> I'm in the middle of doing more extensive tests, but file write to
>>>> an FS might have problems. I am using the raw mmc interface.
>>>> 
>>> 
>>> I've written u-boot to RAW eMMC (based on the LBA addressing).
>>> Moreover I was also able to write data to FAT and EXT4 fs (which
>>> uses standard fat/ext4 load commands).
>>> 
>> 
>> I see. Note that ext4 writes won't work; there is no offset to the
>> write file command. You will have to have use a large enough buffer
>> to handle the file's worst case.
> 
> The 4 MiB buffer size was my wrong simplification. It shall be done as
> you proposed (with transfered data chopped to smaller chunks).
> 
> The ext4write command will write data from DRAM buffer (e.g.
> 0x44000000) to partition formatted with ext4 fs. (one just needs to
> remember that file size is given with hex number).
> I've posted some fixes for ext4 recently to ML.
> 

Nice. There is a big fat warning when you try to write an ext4 file at
an offset other than 0; it should be easy to fix.

>> 
>>>> There could be something there that it's missed. I'm in the middle
>>>> of doing more extensive tests.
>>>> 
>>>> 
>>>>>> It writes u-boot.bin, but in a way that the board is bricked
>>>>>> after flashing.
>>>>> 
>>>>> I need some time to perform the thorough review of core DFU
>>>>> patches (patches 7/10, 09/10, 10/10).
>>>>> 
>>>> 
>>>> OK.
>>>> 
>>>>> 
>>>>> 
>>>>>> BTW: 
>>>>>> 1. What is your target device? What is the output of dfu mmc 0
>>>>>> list command on your device?
>>>>>> 
>>>> 
>>>> I'm on am335x_evm target, actual board is a beaglebone.
>>>> 
>>>> 
>>>>>> On trats it is:
>>>>>> DFU alt settings list:
>>>>>> dev: eMMC alt: 0 name: u-boot layout: RAW_ADDR
>>>>>> dev: eMMC alt: 1 name: uImage layout: FAT
>>>>>> 
>>>> 
>>>> # setenv dfu_alt_info 'test part 0 3'
>>>> # mmc part
>>>> U-Boot# mmc part
>>>> 
>>>> Partition Map for MMC device 0  --   Partition Type: DOS
>>>> 
>>>> Part    Start Sector    Num Sectors     UUID            Type
>>>> 1     63              112392          7a348599-01     0c Boot
>>>> 2     112455          7501331         7a348599-02     83
>>>> 3     7613786         12966           7a348599-03     83
>>>> # dfu mmc 0 list
>>>> DFU alt settings list:
>>>> dev: eMMC alt: 0 name: test layout: RAW_ADDR
>>>> 
>>> Off topic: 
>>> It would be nice to have all partitions listed with dfu mmc 0
>>> list :-) and then have access to it via dfu-util tool (as a separate
>>> alt settings). But this is a task for the future :-).
>>> 
>>> 
>>>> Are you downloading u-boot.bin to the raw nand?
>>>> I.e. there's no boot partition?
>>> 
>>> Yes, there isn't any partition for u-boot. I write to raw eMMC
>>> address.
>>> 
>>>> 
>>>> All my tests have been downloading a small ext3 image to the mmc.
>>>> I'm in the middle of doing more extensive tests but those takes a
>>>> huge amount of time... :(
>>> 
>>> This is because of very low DFU transmission speed (It uses only EP0
>>> with EPS=64B , so it is meant to transfer really small files).
>>> 
>>> Updating rootfs via DFU would take much time. It is OK, to transfer
>>> u-boot, uImage, some log data.
>>> 
>> 
>> We have customers that do want to use DFU for all of their initial
>> programming.
> 
> Ok, I see.
> 
>> 
>> The limitations are known, but the fact is that they find it very
>> convenient for their use. And it's not like you're limited by the USB
>> interface, most of the time is spent writing to the medium.
> 
> So in my opinion there would be nice to have some kind of caching of
> received data before writing to memory.
> 
> Then we could write memory asynchronously, when we "collect" e.g. 1 MiB
> data in a buffer (and in meantime collect next data).
> 

I doubt that would work in a u-boot environment. There are no threads
and I'm pretty sure most mass memory interfaces are PIO.

I'm completely up to date on latest u-boot happenings, maybe this has changed.

Regards

-- Pantelis

> 
>> 
>> BTW, I've just confirmed that larger transfers get corrupted... :(
>> Working on a fix now...
> 
> Ok.
> 
>> 
>>>> 
>>>>>> 2. Please look into the TRATS board (especially the
>>>>>> CONFIG_DFU_ALT constant) for reference.
>>>>>> 
>>>> 
>>>> Already looked there.
>>>> 
>>>>>> 3. What is yours dfu-util version? (Mine is 0.1+svnexported)
>>>>>> 
>>>> 
>>>> Compiled from source git://gitorious.org/dfu-util/dfu-util.git
>>>> Current master.
>>>> 
>>>> Regards
>>>> 
>>>> -- Pantelis
>>>> 
>>>> 
>>>>>>> 
>>>>>>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>>>>>>> ---
>>>>>>> drivers/usb/gadget/f_dfu.c | 1 -
>>>>>>> include/g_dnl.h            | 1 -
>>>>>>> 2 files changed, 2 deletions(-)
>>>>>>> 
>>>>>>> diff --git a/drivers/usb/gadget/f_dfu.c
>>>>>>> b/drivers/usb/gadget/f_dfu.c index 3ec4c65..10547e3 100644
>>>>>>> --- a/drivers/usb/gadget/f_dfu.c
>>>>>>> +++ b/drivers/usb/gadget/f_dfu.c
>>>>>>> @@ -25,7 +25,6 @@
>>>>>>> #include <malloc.h>
>>>>>>> 
>>>>>>> #include <linux/usb/ch9.h>
>>>>>>> -#include <usbdescriptors.h>
>>>>>>> #include <linux/usb/gadget.h>
>>>>>>> #include <linux/usb/composite.h>
>>>>>>> 
>>>>>>> diff --git a/include/g_dnl.h b/include/g_dnl.h
>>>>>>> index 0ec7440..f47395f 100644
>>>>>>> --- a/include/g_dnl.h
>>>>>>> +++ b/include/g_dnl.h
>>>>>>> @@ -22,7 +22,6 @@
>>>>>>> #define __G_DOWNLOAD_H_
>>>>>>> 
>>>>>>> #include <linux/usb/ch9.h>
>>>>>>> -#include <usbdescriptors.h>
>>>>>>> #include <linux/usb/gadget.h>
>>>>>>> 
>>>>>>> int g_dnl_register(const char *s);
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Best regards,
>>>>> 
>>>>> Lukasz Majewski
>>>>> 
>>>>> Samsung Poland R&D Center | Linux Platform Group
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Best regards,
>>> 
>>> Lukasz Majewski
>>> 
>>> Samsung Poland R&D Center | Linux Platform Group
>> 
> 
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung Poland R&D Center | Linux Platform Group

Patch

diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 3ec4c65..10547e3 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -25,7 +25,6 @@ 
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
-#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 
diff --git a/include/g_dnl.h b/include/g_dnl.h
index 0ec7440..f47395f 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -22,7 +22,6 @@ 
 #define __G_DOWNLOAD_H_
 
 #include <linux/usb/ch9.h>
-#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 int g_dnl_register(const char *s);