Patchwork [U-Boot,v3,4/8] usb: Update device class in usb device's descriptor

login
register
mail settings
Submitter Vivek Gautam
Date April 12, 2013, 11:04 a.m.
Message ID <1365764680-10917-5-git-send-email-gautam.vivek@samsung.com>
Download mbox | patch
Permalink /patch/236035/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Vivek Gautam - April 12, 2013, 11:04 a.m.
Fetch the device class into usb device's dwcriptors,
so that the host controller's driver can use this info
to differentiate between HUB and DEVICE.

Signed-off-by: Amar <amarendra.xt@samsung.com>
---

Changes from v2:
 - none

 common/usb.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Julius Werner - April 19, 2013, 6:39 p.m.
> Fetch the device class into usb device's dwcriptors,
> so that the host controller's driver can use this info
> to differentiate between HUB and DEVICE.
> 
> Signed-off-by: Amar <amarendra.xt@samsung.com>
> 
> ---
> Changes from v2:
>  - none
> 
>  common/usb.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/common/usb.c b/common/usb.c
> index 8407974..3a96a34 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -879,6 +879,11 @@ int usb_new_device(struct usb_device *dev)
>  	}
>  
>  	dev->descriptor.bMaxPacketSize0 = desc->bMaxPacketSize0;
> +	/*
> +	 * Fetch the device class, driver can use this info
> +	 * to differentiate between HUB and DEVICE.
> +	 */
> +	dev->descriptor.bDeviceClass = desc->bDeviceClass;

There is nothing wrong with this, but I also don't think you need it. In those
places where you check for the hub class in your XHCI stack, you actually want
to check whether the device is the root hub... so you should do that
differently to avoid breaking external hubs (e.g. by comparing the device
address). I think we should drop this since there is no real use for it.

>  
>  	/* find the port number we're at */
>  	if (parent) {

Patch

diff --git a/common/usb.c b/common/usb.c
index 8407974..3a96a34 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -879,6 +879,11 @@  int usb_new_device(struct usb_device *dev)
 	}
 
 	dev->descriptor.bMaxPacketSize0 = desc->bMaxPacketSize0;
+	/*
+	 * Fetch the device class, driver can use this info
+	 * to differentiate between HUB and DEVICE.
+	 */
+	dev->descriptor.bDeviceClass = desc->bDeviceClass;
 
 	/* find the port number we're at */
 	if (parent) {