Author: cgutman
Date: Wed Feb 1 12:16:47 2012
New Revision: 55367
URL:
http://svn.reactos.org/svn/reactos?rev=55367&view=rev
Log:
[USBEHCI][USBOHCI]
- Wait 100 milliseconds for the port power and insertion to stabilize
- Wait for the 10 millisecond "recovery" period after reset
Modified:
branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp
branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1]
(original)
+++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Wed Feb
1 12:16:47 2012
@@ -799,8 +799,25 @@
} while (TRUE);
//
+ // delay is 10 ms
+ //
+ Timeout.QuadPart = 10;
+ DPRINT1("Waiting %d milliseconds for port to recover after reset\n",
Timeout.LowPart);
+
+ //
+ // convert to 100 ns units (absolute)
+ //
+ Timeout.QuadPart *= -10000;
+
+ //
+ // perform the wait
+ //
+ KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
+
+ //
// check slow speed line after reset
//
+ PortStatus = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex));
if (PortStatus & EHCI_PRT_SLOWSPEEDLINE)
{
DPRINT1("Non HighSpeed device. Releasing Ownership\n");
@@ -916,9 +933,30 @@
if (Status == C_PORT_CONNECTION)
{
+ LARGE_INTEGER Timeout;
+
+ //
+ // reset status change bits
+ //
Value = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId));
Value |= EHCI_PRT_CONNECTSTATUSCHANGE | EHCI_PRT_ENABLEDSTATUSCHANGE;
EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId), Value);
+
+ //
+ // delay is 100 ms
+ //
+ Timeout.QuadPart = 100;
+ DPRINT1("Waiting %d milliseconds for port to stabilize after
connection\n", Timeout.LowPart);
+
+ //
+ // convert to 100 ns units (absolute)
+ //
+ Timeout.QuadPart *= -10000;
+
+ //
+ // perform the wait
+ //
+ KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
}
return STATUS_SUCCESS;
Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- 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] Wed Feb 1
12:16:47 2012
@@ -1191,9 +1191,33 @@
if (Status == C_PORT_CONNECTION || Status == C_PORT_ENABLE)
{
//
- // clear bits
+ // clear change bits
//
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)),
OHCI_RH_PORTSTATUS_CSC | OHCI_RH_PORTSTATUS_PESC);
+
+ //
+ // wait for port to stabilize
+ //
+ if (Status == C_PORT_CONNECTION)
+ {
+ LARGE_INTEGER Timeout;
+
+ //
+ // delay is 100 ms
+ //
+ Timeout.QuadPart = 100;
+ DPRINT1("Waiting %d milliseconds for port to stabilize after
connection\n", Timeout.LowPart);
+
+ //
+ // convert to 100 ns units (absolute)
+ //
+ Timeout.QuadPart *= -10000;
+
+ //
+ // perform the wait
+ //
+ KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
+ }
}
//
@@ -1275,6 +1299,8 @@
}
else if (Feature == PORT_RESET)
{
+ LARGE_INTEGER Timeout;
+
//
// assert
//
@@ -1307,6 +1333,22 @@
}while(TRUE);
//
+ // delay is 10 ms
+ //
+ Timeout.QuadPart = 10;
+ DPRINT1("Waiting %d milliseconds for port to recover after reset\n",
Timeout.LowPart);
+
+ //
+ // convert to 100 ns units (absolute)
+ //
+ Timeout.QuadPart *= -10000;
+
+ //
+ // perform the wait
+ //
+ KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
+
+ //
// trigger the status change interrupt
//
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_ENABLE_OFFSET),
OHCI_ROOT_HUB_STATUS_CHANGE);