[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH 02/10] usb: Add necessary recovery intervals
! The USB specification requires a 10 ms recovery interval after the
reset signal has been deasserted. We should grant that.
! Furthermore, it requires a 2 ms recovery interval after a SetAddress()
request.
Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
ehci/ehci.c | 3 +++
usb/usb.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/ehci/ehci.c b/ehci/ehci.c
index 7f3838c..addec00 100644
--- a/ehci/ehci.c
+++ b/ehci/ehci.c
@@ -274,6 +274,9 @@ void ehci_rh_port_up(struct cdi_usb_hub *hub, int index)
hc->regs->portsc[index] = portsc & ~EHCI_PSC_RES;
CDI_CONDITION_WAIT(!(hc->regs->portsc[index] & EHCI_PSC_RES), 50);
+ // Recovery interval
+ cdi_sleep_ms(10);
+
portsc = hc->regs->portsc[index];
if (portsc & EHCI_PSC_RES) {
// Disable port, route on to companion controller
diff --git a/usb/usb.c b/usb/usb.c
index 62ef989..3141176 100644
--- a/usb/usb.c
+++ b/usb/usb.c
@@ -191,6 +191,9 @@ static usb_device_t *enumerate(usb_hub_t *hub, int hub_port,
return NULL;
}
+ // SetAddress() recovery interval
+ cdi_sleep_ms(2);
+
dev->id = new_id;
res = control_transfer(dev, &dev->eps[0][0], &(struct cdi_usb_setup_packet){
@@ -859,6 +862,9 @@ static void hub_port_up(struct cdi_usb_hub *cdi_hub, int index)
CDI_CONDITION_WAIT(hub_get_port_status(hub, index) & (1 << C_PORT_RESET),
100);
+
+ // Recovery interval
+ cdi_sleep_ms(10);
}
--
2.6.4