[USBEHCI]
authorCameron Gutman <aicommander@gmail.com>
Wed, 1 Feb 2012 11:22:43 +0000 (11:22 +0000)
committerCameron Gutman <aicommander@gmail.com>
Wed, 1 Feb 2012 11:22:43 +0000 (11:22 +0000)
- Wait 20 milliseconds after enabling power for the port to stabilize

svn path=/branches/usb-bringup-trunk/; revision=55365

drivers/usb/usbehci_new/hardware.cpp

index 672a228..0ba69d6 100644 (file)
@@ -957,11 +957,30 @@ CUSBHardwareDevice::SetPortFeature(
     {
         if (m_Capabilities.HCSParams.PortPowerControl)
         {
+            ULONG Value;
+            LARGE_INTEGER Timeout;
+
             //
             // enable port power
             //
-            ULONG Value = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId)) | EHCI_PRT_POWER;
+            Value = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId)) | EHCI_PRT_POWER;
             EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC, Value);
+
+            //
+            // delay is 20 ms
+            //
+            Timeout.QuadPart = 20;
+            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;