Commit f1c1f540243438246aefb703fdcf16957e3a72e1

Authored by Stefan Roese
Committed by Remy Bohmer
1 parent daa2dafb45

USB: Add high-speed (480Mb/s) to all USB related outputs

With this patch the USB related connection speed output ("usb tree" command and
debug output) is now high-speed enabled.

This patch also fixes a compilation warning when debugging is enabled.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

Showing 2 changed files with 24 additions and 7 deletions Side-by-side Diff

... ... @@ -264,6 +264,16 @@
264 264 printf("\n");
265 265 }
266 266  
  267 +static inline char *portspeed(int speed)
  268 +{
  269 + if (speed == USB_SPEED_HIGH)
  270 + return "480 Mb/s";
  271 + else if (speed == USB_SPEED_LOW)
  272 + return "1.5 Mb/s";
  273 + else
  274 + return "12 Mb/s";
  275 +}
  276 +
267 277 /* shows the device tree recursively */
268 278 void usb_show_tree_graph(struct usb_device *dev, char *pre)
269 279 {
... ... @@ -310,7 +320,7 @@
310 320 pre[index] = 0;
311 321 printf(" %s (%s, %dmA)\n", usb_get_class_desc(
312 322 dev->config.if_desc[0].bInterfaceClass),
313   - dev->speed ? "1.5MBit/s" : "12MBit/s",
  323 + portspeed(dev->speed),
314 324 dev->config.MaxPower * 2);
315 325 if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
316 326 printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
... ... @@ -681,7 +681,7 @@
681 681 err = usb_string_sub(dev, 0, 0, tbuf);
682 682 if (err < 0) {
683 683 USB_PRINTF("error getting string descriptor 0 " \
684   - "(error=%x)\n", dev->status);
  684 + "(error=%lx)\n", dev->status);
685 685 return -1;
686 686 } else if (tbuf[0] < 4) {
687 687 USB_PRINTF("string descriptor 0 too short\n");
... ... @@ -1041,6 +1041,16 @@
1041 1041  
1042 1042 #define MAX_TRIES 5
1043 1043  
  1044 +static inline char *portspeed(int portstatus)
  1045 +{
  1046 + if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED))
  1047 + return "480 Mb/s";
  1048 + else if (portstatus & (1 << USB_PORT_FEAT_LOWSPEED))
  1049 + return "1.5 Mb/s";
  1050 + else
  1051 + return "12 Mb/s";
  1052 +}
  1053 +
1044 1054 static int hub_port_reset(struct usb_device *dev, int port,
1045 1055 unsigned short *portstat)
1046 1056 {
... ... @@ -1064,8 +1074,7 @@
1064 1074  
1065 1075 USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
1066 1076 portstatus, portchange,
1067   - portstatus & (1 << USB_PORT_FEAT_LOWSPEED) ? \
1068   - "Low Speed" : "High Speed");
  1077 + portspeed(portstatus));
1069 1078  
1070 1079 USB_HUB_PRINTF("STAT_C_CONNECTION = %d STAT_CONNECTION = %d" \
1071 1080 " USB_PORT_STAT_ENABLE %d\n",
... ... @@ -1111,9 +1120,7 @@
1111 1120 portstatus = le16_to_cpu(portsts.wPortStatus);
1112 1121 portchange = le16_to_cpu(portsts.wPortChange);
1113 1122 USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
1114   - portstatus, portchange,
1115   - portstatus&(1 << USB_PORT_FEAT_LOWSPEED) ? \
1116   - "Low Speed" : "High Speed");
  1123 + portstatus, portchange, portspeed(portstatus));
1117 1124  
1118 1125 /* Clear the connection change status */
1119 1126 usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);