Skip to contentSkip to conversation

usb: create common header virtual root hub descriptors

PATCH New Stephen Warren 2 participants 4 messages Feb 13, 2014 – Feb 14, 2014

Subsystems (8)
USB PowerPC MIPS Arm Samsung Exynos +4 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: create common header virtual root hub descriptors

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.

---
 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
arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c +1 -98
index fd0ec65..a3dac70 100644
@@ -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 */
-	' ',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	'R',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	'o',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	'o',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	't',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	' ',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	'H',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	'u',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-	'b',			/*  __u8  Unicode */
-	0,				/*  __u8  Unicode */
-};
+#include <usbroothubdes.h>
 
 /* Hub class-specific descriptor is constructed dynamically */
 
arch/powerpc/cpu/mpc5xxx/usb_ohci.c +1 -98

105 lines not on this page · raw message

arch/powerpc/cpu/ppc4xx/usb_ohci.c +1 -98

105 lines not on this page · raw message

arch/sparc/cpu/leon3/usb_uhci.c +3 -104

113 lines not on this page · raw message

board/mpl/common/usb_uhci.c +3 -112

121 lines not on this page · raw message

drivers/usb/host/isp116x-hcd.c +1 -99

106 lines not on this page · raw message

drivers/usb/host/ohci-hcd.c +1 -97

104 lines not on this page · raw message

drivers/usb/host/ohci-s3c24xx.c +1 -94

101 lines not on this page · raw message

drivers/usb/host/r8a66597-hcd.c +1 -103

110 lines not on this page · raw message

drivers/usb/musb/musb_hcd.c +1 -92

100 lines not on this page · raw message

include/usbroothubdes.h new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 usb: create common header virtual root hub descriptors

Quoted 7 lines · 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:

Quoted 6 lines

- 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

#2 lore raw

PATCH 1/1 usb: create common header virtual root hub descriptors

Quoted 8 lines · Marek Vasut
Quoted 7 lines · 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:

Quoted 8 lines
Quoted 6 lines

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

#3 lore raw

PATCH 1/1 usb: create common header virtual root hub descriptors

Quoted 18 lines · Stephen Warren
Quoted 8 lines · Marek Vasut
Quoted 7 lines · 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:

Quoted 8 lines
Quoted 6 lines

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

Quoted 8 lines

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