[U-Boot] [PATCH] usb: create common header virtual root hub descriptors

2014-02-12 Thread Stephen Warren
Many USB host controller drivers contain almost identical copies of the
same virtual root hub descriptors. Put these into a common file to avoid
duplication.

Note that there were some very minor differences between the descriptors
in the various files, such as:

- USB 1.0 vs. USB 1.1
- Manufacturer/Device ID
- Max packet size
- String content

I assume these aren't relevant.

Signed-off-by: Stephen Warren 
---
 arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |  99 +---
 arch/powerpc/cpu/mpc5xxx/usb_ohci.c   |  99 +---
 arch/powerpc/cpu/ppc4xx/usb_ohci.c|  99 +---
 arch/sparc/cpu/leon3/usb_uhci.c   | 107 +
 board/mpl/common/usb_uhci.c   | 115 +--
 drivers/usb/host/isp116x-hcd.c| 100 +---
 drivers/usb/host/ohci-hcd.c   |  98 +--
 drivers/usb/host/ohci-s3c24xx.c   |  95 +--
 drivers/usb/host/r8a66597-hcd.c   | 104 +
 drivers/usb/musb/musb_hcd.c   |  93 +--
 include/usbroothubdes.h   | 129 ++
 11 files changed, 143 insertions(+), 995 deletions(-)
 create mode 100644 include/usbroothubdes.h

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c 
b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
index fd0ec65..a3dac70 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
@@ -839,104 +839,7 @@ static int dl_done_list (ohci_t *ohci, td_t *td_list)
  * Virtual Root Hub
  *-*/
 
-/* Device descriptor */
-static __u8 root_hub_dev_des[] =
-{
-   0x12,   /*  __u8  bLength; */
-   0x01,   /*  __u8  bDescriptorType; Device */
-   0x10,   /*  __u16 bcdUSB; v1.1 */
-   0x01,
-   0x09,   /*  __u8  bDeviceClass; HUB_CLASSCODE */
-   0x00,   /*  __u8  bDeviceSubClass; */
-   0x00,   /*  __u8  bDeviceProtocol; */
-   0x08,   /*  __u8  bMaxPacketSize0; 8 Bytes */
-   0x00,   /*  __u16 idVendor; */
-   0x00,
-   0x00,   /*  __u16 idProduct; */
-   0x00,
-   0x00,   /*  __u16 bcdDevice; */
-   0x00,
-   0x00,   /*  __u8  iManufacturer; */
-   0x01,   /*  __u8  iProduct; */
-   0x00,   /*  __u8  iSerialNumber; */
-   0x01/*  __u8  bNumConfigurations; */
-};
-
-
-/* Configuration descriptor */
-static __u8 root_hub_config_des[] =
-{
-   0x09,   /*  __u8  bLength; */
-   0x02,   /*  __u8  bDescriptorType; Configuration */
-   0x19,   /*  __u16 wTotalLength; */
-   0x00,
-   0x01,   /*  __u8  bNumInterfaces; */
-   0x01,   /*  __u8  bConfigurationValue; */
-   0x00,   /*  __u8  iConfiguration; */
-   0x40,   /*  __u8  bmAttributes;
-Bit 7: Bus-powered, 6: Self-powered, 5 Remote-wakwup, 4..0: 
resvd */
-   0x00,   /*  __u8  MaxPower; */
-
-   /* interface */
-   0x09,   /*  __u8  if_bLength; */
-   0x04,   /*  __u8  if_bDescriptorType; Interface */
-   0x00,   /*  __u8  if_bInterfaceNumber; */
-   0x00,   /*  __u8  if_bAlternateSetting; */
-   0x01,   /*  __u8  if_bNumEndpoints; */
-   0x09,   /*  __u8  if_bInterfaceClass; HUB_CLASSCODE */
-   0x00,   /*  __u8  if_bInterfaceSubClass; */
-   0x00,   /*  __u8  if_bInterfaceProtocol; */
-   0x00,   /*  __u8  if_iInterface; */
-
-   /* endpoint */
-   0x07,   /*  __u8  ep_bLength; */
-   0x05,   /*  __u8  ep_bDescriptorType; Endpoint */
-   0x81,   /*  __u8  ep_bEndpointAddress; IN Endpoint 1 */
-   0x03,   /*  __u8  ep_bmAttributes; Interrupt */
-   0x02,   /*  __u16 ep_wMaxPacketSize; ((MAX_ROOT_PORTS + 1) / 8 */
-   0x00,
-   0xff/*  __u8  ep_bInterval; 255 ms */
-};
-
-static unsigned char root_hub_str_index0[] =
-{
-   0x04,   /*  __u8  bLength; */
-   0x03,   /*  __u8  bDescriptorType; String-descriptor */
-   0x09,   /*  __u8  lang ID */
-   0x04,   /*  __u8  lang ID */
-};
-
-static unsigned char root_hub_str_index1[] =
-{
-   28, /*  __u8  bLength; */
-   0x03,   /*  __u8  bDescriptorType; String-descriptor */
-   'O',/*  __u8  Unicode */
-   0,  /*  __u8  Unicode */
-   'H',/*  __u8  Unicode */
-   0,  /*  __u8  Unicode */
-   'C',/*  __u8  Unicode */
-   0,  /*  __u8  Unicode */
-   'I',/*  __u8  Unicode */
-   0,  /*  __u8  Unicode 

Re: [U-Boot] [PATCH] usb: create common header virtual root hub descriptors

2014-02-13 Thread Marek Vasut
On Thursday, February 13, 2014 at 06:42:18 AM, Stephen Warren wrote:
> Many USB host controller drivers contain almost identical copies of the
> same virtual root hub descriptors. Put these into a common file to avoid
> duplication.
> 
> Note that there were some very minor differences between the descriptors
> in the various files, such as:
> 
> - USB 1.0 vs. USB 1.1
> - Manufacturer/Device ID
> - Max packet size
> - String content
> 
> I assume these aren't relevant.

Please CC the driver authors so we can be sure.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: create common header virtual root hub descriptors

2014-02-13 Thread Stephen Warren
On 02/13/2014 01:44 PM, Marek Vasut wrote:
> On Thursday, February 13, 2014 at 06:42:18 AM, Stephen Warren wrote:
>> Many USB host controller drivers contain almost identical copies of the
>> same virtual root hub descriptors. Put these into a common file to avoid
>> duplication.
>>
>> Note that there were some very minor differences between the descriptors
>> in the various files, such as:
>>
>> - USB 1.0 vs. USB 1.1
>> - Manufacturer/Device ID
>> - Max packet size
>> - String content
>>
>> I assume these aren't relevant.
> 
> Please CC the driver authors so we can be sure.

OK, I've done so. It's pretty unclear who the relevant driver authors or
maintainers are for most of the files, so I cast a wide net from git
log, doc/git-mailrc, and (c) messages in the file. I don't expect the
message to make it to the list because of the Cc count. I doubt many
people will respond.

I hoped this would be the kind of call you could make yourself as the
USB stack maintainer.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: create common header virtual root hub descriptors

2014-02-14 Thread Marek Vasut
On Friday, February 14, 2014 at 05:16:58 AM, Stephen Warren wrote:
> On 02/13/2014 01:44 PM, Marek Vasut wrote:
> > On Thursday, February 13, 2014 at 06:42:18 AM, Stephen Warren wrote:
> >> Many USB host controller drivers contain almost identical copies of the
> >> same virtual root hub descriptors. Put these into a common file to avoid
> >> duplication.
> >> 
> >> Note that there were some very minor differences between the descriptors
> >> in the various files, such as:
> >> 
> >> - USB 1.0 vs. USB 1.1
> >> - Manufacturer/Device ID
> >> - Max packet size
> >> - String content
> >> 
> >> I assume these aren't relevant.
> > 
> > Please CC the driver authors so we can be sure.
> 
> OK, I've done so. It's pretty unclear who the relevant driver authors or
> maintainers are for most of the files, so I cast a wide net from git
> log, doc/git-mailrc, and (c) messages in the file. I don't expect the
> message to make it to the list because of the Cc count. I doubt many
> people will respond.
> 
> I hoped this would be the kind of call you could make yourself as the
> USB stack maintainer.

Sorry, I cannot. I have no clue about _all_ the hardware out there. That's why 
I 
want opinion of the hardware maintainers.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot