USB change speed
USB changes the speed according to the port status
Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
diff --git a/common/usb.c b/common/usb.c
index 3138452..3350127 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1061,10 +1061,12 @@
}
portstatus = le16_to_cpu(portsts.wPortStatus);
portchange = le16_to_cpu(portsts.wPortChange);
+
USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
portstatus, portchange,
- portstatus&(1<<USB_PORT_FEAT_LOWSPEED) ? \
+ portstatus & (1 << USB_PORT_FEAT_LOWSPEED) ? \
"Low Speed" : "High Speed");
+
USB_HUB_PRINTF("STAT_C_CONNECTION = %d STAT_CONNECTION = %d" \
" USB_PORT_STAT_ENABLE %d\n",
(portchange & USB_PORT_STAT_C_CONNECTION) ? 1 : 0,
@@ -1136,7 +1138,13 @@
/* Allocate a new device struct for it */
usb = usb_alloc_new_device();
- usb->speed = (portstatus & USB_PORT_STAT_LOW_SPEED) ? 1 : 0;
+
+ if (portstatus & USB_PORT_STAT_HIGH_SPEED)
+ usb->speed = USB_SPEED_HIGH;
+ else if (portstatus & USB_PORT_STAT_LOW_SPEED)
+ usb->speed = USB_SPEED_LOW;
+ else
+ usb->speed = USB_SPEED_FULL;
dev->children[port] = usb;
usb->parent = dev;