Author: cgutman
Date: Thu Jan 26 04:35:04 2012
New Revision: 55196

URL: http://svn.reactos.org/svn/reactos?rev=55196&view=rev
Log:
[USBOHCI]
- Wait the required time for the port to be ready after powering it up

Modified:
    branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp

Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp?rev=55196&r1=55195&r2=55196&view=diff
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] 
(original)
+++ branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] 
Thu Jan 26 04:35:04 2012
@@ -1266,10 +1266,39 @@
     }
     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)


Reply via email to