From: Cameron Gutman Date: Thu, 26 Jan 2012 04:35:04 +0000 (+0000) Subject: [USBOHCI] X-Git-Tag: backups/usb-bringup-trunk@60667~138 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=b4c6fa3b4c2383d19c4241e713561b01f38ddd2f [USBOHCI] - Wait the required time for the port to be ready after powering it up svn path=/branches/usb-bringup-trunk/; revision=55196 --- diff --git a/drivers/usb/usbohci/hardware.cpp b/drivers/usb/usbohci/hardware.cpp index 00fa24c2dbe..cc35707a2a4 100644 --- a/drivers/usb/usbohci/hardware.cpp +++ b/drivers/usb/usbohci/hardware.cpp @@ -1266,10 +1266,39 @@ CUSBHardwareDevice::SetPortFeature( } else if (Feature == PORT_POWER) { + LARGE_INTEGER Timeout; + // // enable power // WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)), OHCI_RH_PORTSTATUS_PPS); + + // + // read descriptor A for the delay data + // + Value = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_DESCRIPTOR_A_OFFSET)); + + // + // compute the delay + // + Timeout.QuadPart = OHCI_RH_GET_POWER_ON_TO_POWER_GOOD_TIME(Value); + + // + // delay is multiplied by 2 ms + // + Timeout.QuadPart *= 2; + DPRINT1("Waiting %d milliseconds for port power up\n", Timeout.LowPart); + + // + // convert to 100 ns units (absolute) + // + Timeout.QuadPart *= -10000; + + // + // perform the wait + // + KeDelayExecutionThread(KernelMode, FALSE, &Timeout); + return STATUS_SUCCESS; } else if (Feature == PORT_SUSPEND)