DM USB: xHCI: fix xhci speed emulation logic

The xHCI speed emulation is not right, which will cause failure
during enumeration of certain USB device. This patch is used to
fix it.

Change-Id: I2d996298983882ed6921a75a10dec9e8684a393e
Tracked-On:
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Xiaoguang Wu
2018-07-11 14:43:23 +08:00
committed by lijinxia
parent d6cc701c89
commit d24213db2d
2 changed files with 55 additions and 5 deletions

View File

@@ -21,6 +21,31 @@ static struct usb_dev_sys_ctx_info g_ctx;
static inline uint8_t usb_dev_get_ep_type(struct usb_dev *udev, int pid,
int epnum);
static int
libusb_speed_to_usb_speed(int libusb_speed)
{
int speed = LIBUSB_SPEED_UNKNOWN;
switch (libusb_speed) {
case LIBUSB_SPEED_LOW:
speed = USB_SPEED_LOW;
break;
case LIBUSB_SPEED_FULL:
speed = USB_SPEED_FULL;
break;
case LIBUSB_SPEED_HIGH:
speed = USB_SPEED_HIGH;
break;
case LIBUSB_SPEED_SUPER:
speed = USB_SPEED_SUPER;
break;
default:
UPRINTF(LWRN, "%s unexpect speed %d\r\n", __func__,
libusb_speed);
}
return speed;
}
static void
usb_dev_comp_req(struct libusb_transfer *libusb_xfer)
{
@@ -852,6 +877,7 @@ usb_dev_info(void *pdata, int type, void *value, int size)
break;
case USB_INFO_SPEED:
sz = sizeof(udev->speed);
udev->speed = libusb_speed_to_usb_speed(udev->speed);
pv = &udev->speed;
break;
case USB_INFO_BUS: