summaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
Diffstat (limited to 'payloads')
-rw-r--r--payloads/libpayload/drivers/usb/usb.c14
-rw-r--r--payloads/libpayload/drivers/usb/xhci_devconf.c2
-rw-r--r--payloads/libpayload/include/usb/usb.h1
3 files changed, 16 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index e87e397061..bfb697d619 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -275,6 +275,20 @@ usb_decode_mps0(usb_speed speed, u8 bMaxPacketSize0)
}
}
+int speed_to_default_mps(usb_speed speed)
+{
+ switch (speed) {
+ case LOW_SPEED:
+ return 8;
+ case FULL_SPEED:
+ case HIGH_SPEED:
+ return 64;
+ case SUPER_SPEED:
+ default:
+ return 512;
+ }
+}
+
/* Normalize bInterval to log2 of microframes */
static int
usb_decode_interval(usb_speed speed, const endpoint_type type, const unsigned char bInterval)
diff --git a/payloads/libpayload/drivers/usb/xhci_devconf.c b/payloads/libpayload/drivers/usb/xhci_devconf.c
index ead130e7d1..48d928c380 100644
--- a/payloads/libpayload/drivers/usb/xhci_devconf.c
+++ b/payloads/libpayload/drivers/usb/xhci_devconf.c
@@ -185,7 +185,7 @@ xhci_set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
ic->dev.ep0->tr_dq_high = 0;
EC_SET(TYPE, ic->dev.ep0, EP_CONTROL);
EC_SET(AVRTRB, ic->dev.ep0, 8);
- EC_SET(MPS, ic->dev.ep0, 8);
+ EC_SET(MPS, ic->dev.ep0, speed_to_default_mps(speed));
EC_SET(CERR, ic->dev.ep0, 3);
EC_SET(DCS, ic->dev.ep0, 1);
diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h
index cf52a4aece..e93a11e616 100644
--- a/payloads/libpayload/include/usb/usb.h
+++ b/payloads/libpayload/include/usb/usb.h
@@ -263,6 +263,7 @@ void usb_poll (void);
usbdev_t *init_device_entry (hci_t *controller, int num);
int usb_decode_mps0 (usb_speed speed, u8 bMaxPacketSize0);
+int speed_to_default_mps(usb_speed speed);
int set_feature (usbdev_t *dev, int endp, int feature, int rtype);
int get_status (usbdev_t *dev, int endp, int rtype, int len, void *data);
int get_descriptor (usbdev_t *dev, int rtype, int descType, int descIdx,