Author: cgutman
Date: Sat Feb 25 02:20:15 2012
New Revision: 55848
URL:
http://svn.reactos.org/svn/reactos?rev=55848&view=rev
Log:
[USBOHCI]
- Implement per-port power control
Modified:
trunk/reactos/drivers/usb/usbohci/hardware.cpp
trunk/reactos/drivers/usb/usbohci/hardware.h
Modified: trunk/reactos/drivers/usb/usbohci/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/hardwa…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/hardware.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/hardware.cpp [iso-8859-1] Sat Feb 25 02:20:15 2012
@@ -517,7 +517,7 @@
NTSTATUS
CUSBHardwareDevice::StartController(void)
{
- ULONG Control, Descriptor, FrameInterval, Periodic;
+ ULONG Control, Descriptor, FrameInterval, Periodic, Port;
//
// lets write physical address of dummy control endpoint descriptor
@@ -530,7 +530,7 @@
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_BULK_HEAD_ED_OFFSET),
m_BulkEndpointDescriptor->PhysicalAddress.LowPart);
//
- // read descriptor
+ // read descriptor A
//
Descriptor = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base +
OHCI_RH_DESCRIPTOR_A_OFFSET));
@@ -552,18 +552,34 @@
Descriptor &= ~OHCI_RH_NO_POWER_SWITCHING;
//
- // control each port power independently (disabled until it's supported
correctly)
- //
-#if 0
+ // control each port power independently
+ //
Descriptor |= OHCI_RH_POWER_SWITCHING_MODE;
-#else
- Descriptor &= ~OHCI_RH_POWER_SWITCHING_MODE;
-#endif
//
// write the configuration back
//
+ DPRINT1("Descriptor A: %x\n", Descriptor);
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_DESCRIPTOR_A_OFFSET),
Descriptor);
+
+ //
+ // read descriptor B
+ //
+ Descriptor = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base +
OHCI_RH_DESCRIPTOR_B_OFFSET));
+
+ //
+ // set power power control for each port to use PPS
+ //
+ for (Port = 1; Port <= m_NumberOfPorts; Port++)
+ {
+ Descriptor |= (1 << (16 + Port));
+ }
+
+ //
+ // write the configuration back
+ //
+ DPRINT1("Descriptor B: %x\n", Descriptor);
+ WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_DESCRIPTOR_B_OFFSET),
Descriptor);
//
// get frame interval
@@ -634,11 +650,6 @@
ASSERT((Control & OHCI_HC_FUNCTIONAL_STATE_MASK) ==
OHCI_HC_FUNCTIONAL_STATE_OPERATIONAL);
ASSERT((Control & OHCI_ENABLE_LIST) == OHCI_ENABLE_LIST);
DPRINT1("Control %x\n", Control);
-
- //
- // enable power on all ports
- //
- WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_STATUS_OFFSET),
OHCI_RH_LOCAL_POWER_STATUS_CHANGE);
//
// done
Modified: trunk/reactos/drivers/usb/usbohci/hardware.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/hardwa…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/hardware.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/hardware.h [iso-8859-1] Sat Feb 25 02:20:15 2012
@@ -113,7 +113,7 @@
// Root Hub Descriptor B register (section 7.4.2)
//
-#define OHCI_RH_DESCRIPTOR_B 0x4c
+#define OHCI_RH_DESCRIPTOR_B_OFFSET 0x4c
//
// Root Hub status register (section 7.4.3)