EricR Lai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35023 )
Change subject: libpayload/usb: add USB 3.1 GEN2 support ......................................................................
libpayload/usb: add USB 3.1 GEN2 support
USB 3.1 GEN2 report speed type 4, add into speed enum.
BUG=b:139787920 BRANCH=N/A TEST=Build libpayload and depthcharge on sarien and boot with USB GEN2 HUB with USB disk.
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: Ia0ef12b2f0d91bf0d0db766bbc9019de1614a4f4 --- M payloads/libpayload/drivers/usb/usb.c M payloads/libpayload/drivers/usb/usbhub.c M payloads/libpayload/drivers/usb/xhci_devconf.c M payloads/libpayload/include/usb/usb.h 4 files changed, 9 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/23/35023/1
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c index 9c9854d..51b84f1 100644 --- a/payloads/libpayload/drivers/usb/usb.c +++ b/payloads/libpayload/drivers/usb/usb.c @@ -265,6 +265,7 @@ } return bMaxPacketSize0; case SUPER_SPEED: + case SUPER_SPEED_PLUS: if (bMaxPacketSize0 != 9) { usb_debug("Invalid MPS0: 0x%02x\n", bMaxPacketSize0); bMaxPacketSize0 = 9; @@ -284,6 +285,7 @@ case HIGH_SPEED: return 64; case SUPER_SPEED: + case SUPER_SPEED_PLUS: default: return 512; } @@ -319,6 +321,7 @@ return LOG2(bInterval); } case SUPER_SPEED: + case SUPER_SPEED_PLUS: switch (type) { case ISOCHRONOUS: case INTERRUPT: return bInterval - 1; diff --git a/payloads/libpayload/drivers/usb/usbhub.c b/payloads/libpayload/drivers/usb/usbhub.c index 340e47a..0482da8 100644 --- a/payloads/libpayload/drivers/usb/usbhub.c +++ b/payloads/libpayload/drivers/usb/usbhub.c @@ -98,6 +98,8 @@ /* SuperSpeed hubs can only have SuperSpeed devices. */ if (dev->speed == SUPER_SPEED) return SUPER_SPEED; + if (dev->speed == SUPER_SPEED_PLUS) + return SUPER_SPEED_PLUS;
/*[bit] 10 9 (USB 2.0 port status word) * 0 0 full speed @@ -176,7 +178,7 @@ void usb_hub_init(usbdev_t *const dev) { - int type = dev->speed == SUPER_SPEED ? 0x2a : 0x29; /* similar enough */ + int type = dev->speed > SUPER_SPEED ? 0x2a : 0x29; /* similar enough */ hub_descriptor_t desc; /* won't fit the whole thing, we don't care */ if (get_descriptor(dev, gen_bmRequestType(device_to_host, class_type, dev_recp), type, 0, &desc, sizeof(desc)) != sizeof(desc)) { @@ -185,7 +187,7 @@ return; }
- if (dev->speed == SUPER_SPEED) + if (dev->speed > SUPER_SPEED) usb_hub_set_hub_depth(dev); if (generic_hub_init(dev, desc.bNbrPorts, &usb_hub_ops) < 0) return; diff --git a/payloads/libpayload/drivers/usb/xhci_devconf.c b/payloads/libpayload/drivers/usb/xhci_devconf.c index 99e3037..b53c8ef 100644 --- a/payloads/libpayload/drivers/usb/xhci_devconf.c +++ b/payloads/libpayload/drivers/usb/xhci_devconf.c @@ -267,7 +267,7 @@ static int xhci_finish_hub_config(usbdev_t *const dev, inputctx_t *const ic) { - int type = dev->speed == SUPER_SPEED ? 0x2a : 0x29; /* similar enough */ + int type = dev->speed > SUPER_SPEED ? 0x2a : 0x29; /* similar enough */ hub_descriptor_t desc;
if (get_descriptor(dev, gen_bmRequestType(device_to_host, class_type, diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h index db7ec57..ee767ad 100644 --- a/payloads/libpayload/include/usb/usb.h +++ b/payloads/libpayload/include/usb/usb.h @@ -210,6 +210,7 @@ LOW_SPEED = 1, HIGH_SPEED = 2, SUPER_SPEED = 3, + SUPER_SPEED_PLUS = 4, } usb_speed;
struct usbdev {