]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Ehci: don't clear port status bits during init
authorFeng Tian <feng.tian@intel.com>
Wed, 30 Nov 2016 05:14:23 +0000 (13:14 +0800)
committerFeng Tian <feng.tian@intel.com>
Fri, 2 Dec 2016 00:58:23 +0000 (08:58 +0800)
Port status bits are clear in original code, so no enumeration
takes place.
Changing this to prevent the status bits from being cleared
allows enumeration to proceed normally.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Mike Turner <Michael.Turner@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mike Turner <Michael.Turner@microsoft.com>
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c
MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c

index 88a66aee71028ced1cf80bc1eac4d8a20e59c1c9..3a6ed02be77c72cbbd0202871c50e1e22b5abfc9 100644 (file)
@@ -591,6 +591,7 @@ EhcInitHC (
 {\r
   EFI_STATUS              Status;\r
   UINT32                  Index;\r
+  UINT32                  RegVal;\r
 \r
   // This ASSERT crashes the BeagleBoard. There is some issue in the USB stack.\r
   // This ASSERT needs to be removed so the BeagleBoard will boot. When we fix\r
@@ -626,7 +627,14 @@ EhcInitHC (
   //\r
   if (Ehc->HcStructParams & HCSP_PPC) {\r
     for (Index = 0; Index < (UINT8) (Ehc->HcStructParams & HCSP_NPORTS); Index++) {\r
-      EhcSetOpRegBit (Ehc, (UINT32) (EHC_PORT_STAT_OFFSET + (4 * Index)), PORTSC_POWER);\r
+      //\r
+      // Do not clear port status bits on initialization.  Otherwise devices will\r
+      // not enumerate properly at startup.\r
+      //\r
+      RegVal  = EhcReadOpReg(Ehc, (UINT32)(EHC_PORT_STAT_OFFSET + (4 * Index)));\r
+      RegVal &= ~PORTSC_CHANGE_MASK;\r
+      RegVal |= PORTSC_POWER;\r
+      EhcWriteOpReg (Ehc, (UINT32) (EHC_PORT_STAT_OFFSET + (4 * Index)), RegVal);\r
     }\r
   }\r
 \r
index 09769eaf243aa23d3fa7f616328f7ca7985ef268..31647ff0525cb546a6dc9a880edc031e70254e54 100644 (file)
@@ -2,7 +2,7 @@
 PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid\r
 which is used to enable recovery function from USB Drivers.\r
 \r
-Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
   \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -411,12 +411,20 @@ EhcPowerOnAllPorts (
   IN PEI_USB2_HC_DEV          *Ehc\r
   )\r
 {\r
-  UINT8 PortNumber;\r
-  UINT8 Index;\r
-\r
+  UINT8     PortNumber;\r
+  UINT8     Index;\r
+  UINT32    RegVal;\r
+  \r
   PortNumber = (UINT8)(Ehc->HcStructParams & HCSP_NPORTS);\r
   for (Index = 0; Index < PortNumber; Index++) {\r
-    EhcSetOpRegBit (Ehc, EHC_PORT_STAT_OFFSET + 4 * Index, PORTSC_POWER);\r
+    //\r
+    // Do not clear port status bits on initialization.  Otherwise devices will\r
+    // not enumerate properly at startup.\r
+    //\r
+    RegVal  = EhcReadOpReg(Ehc, EHC_PORT_STAT_OFFSET + 4 * Index);\r
+    RegVal &= ~PORTSC_CHANGE_MASK;\r
+    RegVal |= PORTSC_POWER;\r
+    EhcWriteOpReg (Ehc, EHC_PORT_STAT_OFFSET + 4 * Index, RegVal);\r
   }\r
 }\r
 \r