From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9275881C83 for ; Tue, 29 Nov 2016 21:15:56 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 29 Nov 2016 21:15:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,720,1473145200"; d="scan'208";a="37074178" Received: from shwdeftian.ccr.corp.intel.com ([10.239.158.36]) by orsmga005.jf.intel.com with ESMTP; 29 Nov 2016 21:15:54 -0800 From: Feng Tian To: edk2-devel@lists.01.org Cc: Star Zeng , Mike Turner Date: Wed, 30 Nov 2016 13:15:46 +0800 Message-Id: <2693f04758f5aa5ae2819aaba72c42dae1d5552a.1480482893.git.feng.tian@intel.com> X-Mailer: git-send-email 2.7.1.windows.2 Subject: [patch] MdeModulePkg/Ehci: don't clear port status bits during init X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 05:15:56 -0000 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 Cc: Mike Turner Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Mike Turner Signed-off-by: Feng Tian --- MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c | 10 +++++++++- MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c index 88a66ae..3a6ed02 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c @@ -591,6 +591,7 @@ EhcInitHC ( { EFI_STATUS Status; UINT32 Index; + UINT32 RegVal; // This ASSERT crashes the BeagleBoard. There is some issue in the USB stack. // This ASSERT needs to be removed so the BeagleBoard will boot. When we fix @@ -626,7 +627,14 @@ EhcInitHC ( // if (Ehc->HcStructParams & HCSP_PPC) { for (Index = 0; Index < (UINT8) (Ehc->HcStructParams & HCSP_NPORTS); Index++) { - EhcSetOpRegBit (Ehc, (UINT32) (EHC_PORT_STAT_OFFSET + (4 * Index)), PORTSC_POWER); + // + // Do not clear port status bits on initialization. Otherwise devices will + // not enumerate properly at startup. + // + RegVal = EhcReadOpReg(Ehc, (UINT32)(EHC_PORT_STAT_OFFSET + (4 * Index))); + RegVal &= ~PORTSC_CHANGE_MASK; + RegVal |= PORTSC_POWER; + EhcWriteOpReg (Ehc, (UINT32) (EHC_PORT_STAT_OFFSET + (4 * Index)), RegVal); } } diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c index 09769ea..31647ff 100644 --- a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c +++ b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.c @@ -2,7 +2,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid which is used to enable recovery function from USB Drivers. -Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -411,12 +411,20 @@ EhcPowerOnAllPorts ( IN PEI_USB2_HC_DEV *Ehc ) { - UINT8 PortNumber; - UINT8 Index; - + UINT8 PortNumber; + UINT8 Index; + UINT32 RegVal; + PortNumber = (UINT8)(Ehc->HcStructParams & HCSP_NPORTS); for (Index = 0; Index < PortNumber; Index++) { - EhcSetOpRegBit (Ehc, EHC_PORT_STAT_OFFSET + 4 * Index, PORTSC_POWER); + // + // Do not clear port status bits on initialization. Otherwise devices will + // not enumerate properly at startup. + // + RegVal = EhcReadOpReg(Ehc, EHC_PORT_STAT_OFFSET + 4 * Index); + RegVal &= ~PORTSC_CHANGE_MASK; + RegVal |= PORTSC_POWER; + EhcWriteOpReg (Ehc, EHC_PORT_STAT_OFFSET + 4 * Index, RegVal); } } -- 2.7.1.windows.2