summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb/usb.c
diff options
context:
space:
mode:
authorEric Lai <ericr_lai@compal.corp-partner.google.com>2019-08-22 12:41:12 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-08-27 07:21:00 +0000
commitda10b9224aaa0c41571b5c0c7017b75d4343ebe4 (patch)
tree5a4fabc348f14f2424da214cf0e747d36ac7bb04 /payloads/libpayload/drivers/usb/usb.c
parent1458777c3ba714b9f62799f8cf4bbbf2e82b9d75 (diff)
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. Check ultra speed device in cbmem log. Signed-off-by: Eric Lai <ericr_lai@compal.corp-partner.google.com> Change-Id: Ia0ef12b2f0d91bf0d0db766bbc9019de1614a4f4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/35023 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'payloads/libpayload/drivers/usb/usb.c')
-rw-r--r--payloads/libpayload/drivers/usb/usb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index 9c9854da76..4004def9d9 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -265,6 +265,8 @@ usb_decode_mps0(usb_speed speed, u8 bMaxPacketSize0)
}
return bMaxPacketSize0;
case SUPER_SPEED:
+ /* Intentional fallthrough */
+ case SUPER_SPEED_PLUS:
if (bMaxPacketSize0 != 9) {
usb_debug("Invalid MPS0: 0x%02x\n", bMaxPacketSize0);
bMaxPacketSize0 = 9;
@@ -284,6 +286,8 @@ int speed_to_default_mps(usb_speed speed)
case HIGH_SPEED:
return 64;
case SUPER_SPEED:
+ /* Intentional fallthrough */
+ case SUPER_SPEED_PLUS:
default:
return 512;
}
@@ -319,6 +323,8 @@ usb_decode_interval(usb_speed speed, const endpoint_type type, const unsigned ch
return LOG2(bInterval);
}
case SUPER_SPEED:
+ /* Intentional fallthrough */
+ case SUPER_SPEED_PLUS:
switch (type) {
case ISOCHRONOUS: case INTERRUPT:
return bInterval - 1;
@@ -657,7 +663,7 @@ usb_detach_device(hci_t *controller, int devno)
int
usb_attach_device(hci_t *controller, int hubaddress, int port, usb_speed speed)
{
- static const char* speeds[] = { "full", "low", "high", "super" };
+ static const char *speeds[] = { "full", "low", "high", "super", "ultra" };
usb_debug ("%sspeed device\n", (speed < sizeof(speeds) / sizeof(char*))
? speeds[speed] : "invalid value - no");
int newdev = set_address (controller, speed, port, hubaddress);
@@ -693,6 +699,14 @@ usb_generic_init (usbdev_t *dev)
}
/*
+ * returns the speed is above SUPER_SPEED or not
+ */
+_Bool is_usb_speed_ss(usb_speed speed)
+{
+ return (speed == SUPER_SPEED || speed == SUPER_SPEED_PLUS);
+}
+
+/*
* returns the address of the closest USB2.0 hub, which is responsible for
* split transactions, along with the number of the used downstream port
*/