public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nhi Pham" <nhi@os.amperecomputing.com>
To: devel@edk2.groups.io
Cc: patches@amperecomputing.com, quic_llindhol@quicinc.com,
	ardb+tianocore@kernel.org,
	Vu Nguyen <vunguyen@os.amperecomputing.com>,
	Nhi Pham <nhi@os.amperecomputing.com>
Subject: [edk2-platforms][PATCH v2 3/9] JadePkg: PCIe: Add delay after releasing PERST
Date: Wed, 29 Mar 2023 11:32:40 +0700	[thread overview]
Message-ID: <20230329043246.495600-4-nhi@os.amperecomputing.com> (raw)
In-Reply-To: <20230329043246.495600-1-nhi@os.amperecomputing.com>

From: Vu Nguyen <vunguyen@os.amperecomputing.com>

According to PCIe specification, following exit from a Conventional Reset,
some devices may require additional time before they are able to respond
to Requests they receive, so this patch adds a delay after releasing the
PERST signal.

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
---
 .../Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c
index f49764097219..5041eb726288 100644
--- a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c
+++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c
@@ -2,7 +2,7 @@
   Pcie board specific driver to handle asserting PERST signal to Endpoint
   card. PERST asserting is via group of GPIO pins to CPLD as Platform Specification.
 
-  Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.<BR>
+  Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -20,6 +20,8 @@
 #define RCB_MAX_PERST_GROUPVAL          46
 #define DEFAULT_SEGMENT_NUMBER          0x0F
 
+#define PCIE_PERST_DELAY  (100 * 1000)               // 100ms
+
 VOID
 BoardPcieReleaseAllPerst (
   IN UINT8 SocketId
@@ -32,6 +34,8 @@ BoardPcieReleaseAllPerst (
   for (GpioIndex = 0; GpioIndex < 6; GpioIndex++) {
     GpioModeConfig (GpioPin + GpioIndex, GpioConfigOutHigh);
   }
+
+  MicroSecondDelay (PCIE_PERST_DELAY);
 }
 
 /**
@@ -81,7 +85,7 @@ BoardPcieAssertPerst (
     }
 
     // Keep reset as low as 100 ms as specification
-    MicroSecondDelay (100 * 1000);
+    MicroSecondDelay (PCIE_PERST_DELAY);
   } else {
     BoardPcieReleaseAllPerst (RootComplex->Socket);
   }
-- 
2.25.1


  parent reply	other threads:[~2023-03-29  4:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  4:32 [edk2-platforms][PATCH v2 0/9] Support Ampere Altra Max processor Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 1/9] AmpereAltraPkg: Correct PCIe Devmap Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 2/9] AmpereAltraPkg: Correct PCIe memory attribute Nhi Pham
2023-03-29  4:32 ` Nhi Pham [this message]
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 4/9] AmpereAltraPkg: Update Ampere specific platform PCIe core Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 5/9] AmpereAltraPkg: Update Ampere Core/Cluster profile Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 6/9] Ampere: PCIe: Add PHY preset NVParams for Ampere Altra Max Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 7/9] Ampere: PCIe: Add support " Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 8/9] AmpereAltraPkg: Support get SubNUMA node region for Ampere silicons Nhi Pham
2023-03-29  4:32 ` [edk2-platforms][PATCH v2 9/9] JadePkg: ACPI: Support ACPI tables for Ampere Altra Max Nhi Pham
2023-03-29 16:07 ` [edk2-platforms][PATCH v2 0/9] Support Ampere Altra Max processor Leif Lindholm
2023-03-29 16:24   ` Nhi Pham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230329043246.495600-4-nhi@os.amperecomputing.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox