Skip to contentSkip to conversation

USB change speed

PATCH New Michael Trimarchi 2 participants 2 messages Dec 18, 2008 – Jan 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB change speed

USB changes the speed according to the port status

---

common/usb.c +10 -2
index 3138452..0c11746 100644
@@ -1061,10 +1061,12 @@ static int hub_port_reset(struct usb_device *dev, int port,
 		}
 		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 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
 
 	/* 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;
#1 lore raw

PATCH 1/1 USB change speed

Hello Michael,

2008/12/18 Michael Trimarchi <[email protected]>:

Quoted 3 lines

USB changes the speed according to the port status

I applied this series to the u-boot-usb 'testing' branch. When it compiles properly and no regressions are being detected, I move it to the 'next' branch for the next U-boot release.

Thanks.

Remy

Quoted 36 lines

---

common/usb.c +10 -2
index 3138452..0c11746 100644
@@ -1061,10 +1061,12 @@ static int hub_port_reset(struct usb_device *dev, int port,
               }
               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 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
 
       /* 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;