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>
This commit is contained in:
parent
daa2dafb45
commit
f1c1f54024
|
@ -264,6 +264,16 @@ void usb_display_config(struct usb_device *dev)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline char *portspeed(int speed)
|
||||||
|
{
|
||||||
|
if (speed == USB_SPEED_HIGH)
|
||||||
|
return "480 Mb/s";
|
||||||
|
else if (speed == USB_SPEED_LOW)
|
||||||
|
return "1.5 Mb/s";
|
||||||
|
else
|
||||||
|
return "12 Mb/s";
|
||||||
|
}
|
||||||
|
|
||||||
/* shows the device tree recursively */
|
/* shows the device tree recursively */
|
||||||
void usb_show_tree_graph(struct usb_device *dev, char *pre)
|
void usb_show_tree_graph(struct usb_device *dev, char *pre)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +320,7 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre)
|
||||||
pre[index] = 0;
|
pre[index] = 0;
|
||||||
printf(" %s (%s, %dmA)\n", usb_get_class_desc(
|
printf(" %s (%s, %dmA)\n", usb_get_class_desc(
|
||||||
dev->config.if_desc[0].bInterfaceClass),
|
dev->config.if_desc[0].bInterfaceClass),
|
||||||
dev->speed ? "1.5MBit/s" : "12MBit/s",
|
portspeed(dev->speed),
|
||||||
dev->config.MaxPower * 2);
|
dev->config.MaxPower * 2);
|
||||||
if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
|
if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
|
||||||
printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
|
printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
|
||||||
|
|
19
common/usb.c
19
common/usb.c
|
@ -681,7 +681,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
|
||||||
err = usb_string_sub(dev, 0, 0, tbuf);
|
err = usb_string_sub(dev, 0, 0, tbuf);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
USB_PRINTF("error getting string descriptor 0 " \
|
USB_PRINTF("error getting string descriptor 0 " \
|
||||||
"(error=%x)\n", dev->status);
|
"(error=%lx)\n", dev->status);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (tbuf[0] < 4) {
|
} else if (tbuf[0] < 4) {
|
||||||
USB_PRINTF("string descriptor 0 too short\n");
|
USB_PRINTF("string descriptor 0 too short\n");
|
||||||
|
@ -1041,6 +1041,16 @@ struct usb_hub_device *usb_hub_allocate(void)
|
||||||
|
|
||||||
#define MAX_TRIES 5
|
#define MAX_TRIES 5
|
||||||
|
|
||||||
|
static inline char *portspeed(int portstatus)
|
||||||
|
{
|
||||||
|
if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED))
|
||||||
|
return "480 Mb/s";
|
||||||
|
else if (portstatus & (1 << USB_PORT_FEAT_LOWSPEED))
|
||||||
|
return "1.5 Mb/s";
|
||||||
|
else
|
||||||
|
return "12 Mb/s";
|
||||||
|
}
|
||||||
|
|
||||||
static int hub_port_reset(struct usb_device *dev, int port,
|
static int hub_port_reset(struct usb_device *dev, int port,
|
||||||
unsigned short *portstat)
|
unsigned short *portstat)
|
||||||
{
|
{
|
||||||
|
@ -1064,8 +1074,7 @@ static int hub_port_reset(struct usb_device *dev, int port,
|
||||||
|
|
||||||
USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
|
USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
|
||||||
portstatus, portchange,
|
portstatus, portchange,
|
||||||
portstatus & (1 << USB_PORT_FEAT_LOWSPEED) ? \
|
portspeed(portstatus));
|
||||||
"Low Speed" : "High Speed");
|
|
||||||
|
|
||||||
USB_HUB_PRINTF("STAT_C_CONNECTION = %d STAT_CONNECTION = %d" \
|
USB_HUB_PRINTF("STAT_C_CONNECTION = %d STAT_CONNECTION = %d" \
|
||||||
" USB_PORT_STAT_ENABLE %d\n",
|
" USB_PORT_STAT_ENABLE %d\n",
|
||||||
|
@ -1111,9 +1120,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
|
||||||
portstatus = le16_to_cpu(portsts.wPortStatus);
|
portstatus = le16_to_cpu(portsts.wPortStatus);
|
||||||
portchange = le16_to_cpu(portsts.wPortChange);
|
portchange = le16_to_cpu(portsts.wPortChange);
|
||||||
USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
|
USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
|
||||||
portstatus, portchange,
|
portstatus, portchange, portspeed(portstatus));
|
||||||
portstatus&(1 << USB_PORT_FEAT_LOWSPEED) ? \
|
|
||||||
"Low Speed" : "High Speed");
|
|
||||||
|
|
||||||
/* Clear the connection change status */
|
/* Clear the connection change status */
|
||||||
usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);
|
usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);
|
||||||
|
|
Loading…
Reference in New Issue