[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250429090046.1512000-3-sai.krishna.musham@amd.com>
Date: Tue, 29 Apr 2025 14:30:46 +0530
From: Sai Krishna Musham <sai.krishna.musham@....com>
To: <bhelgaas@...gle.com>, <lpieralisi@...nel.org>, <kw@...ux.com>,
<manivannan.sadhasivam@...aro.org>, <robh@...nel.org>, <krzk+dt@...nel.org>,
<conor+dt@...nel.org>, <cassel@...nel.org>
CC: <linux-pci@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <michal.simek@....com>,
<bharat.kumar.gogada@....com>, <thippeswamy.havalige@....com>,
<sai.krishna.musham@....com>
Subject: [PATCH v2 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
Add GPIO based PERST# signal handling for AMD Versal Gen 2 MDB
PCIe Root Port.
Signed-off-by: Sai Krishna Musham <sai.krishna.musham@....com>
---
Changes in v2:
- Change delay to PCIE_T_PVPERL_MS
---
drivers/pci/controller/dwc/pcie-amd-mdb.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c b/drivers/pci/controller/dwc/pcie-amd-mdb.c
index 4eb2a4e8189d..763265e86db5 100644
--- a/drivers/pci/controller/dwc/pcie-amd-mdb.c
+++ b/drivers/pci/controller/dwc/pcie-amd-mdb.c
@@ -18,6 +18,7 @@
#include <linux/resource.h>
#include <linux/types.h>
+#include "../../pci.h"
#include "pcie-designware.h"
#define AMD_MDB_TLP_IR_STATUS_MISC 0x4C0
@@ -408,6 +409,7 @@ static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
struct dw_pcie *pci = &pcie->pci;
struct dw_pcie_rp *pp = &pci->pp;
struct device *dev = &pdev->dev;
+ struct gpio_desc *reset_gpio;
int err;
pcie->slcr = devm_platform_ioremap_resource_byname(pdev, "slcr");
@@ -426,6 +428,20 @@ static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
pp->ops = &amd_mdb_pcie_host_ops;
+ /* Request the GPIO for PCIe reset signal and assert */
+ reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(reset_gpio),
+ "Failed to request reset GPIO\n");
+
+ if (reset_gpio) {
+ mdelay(PCIE_T_PVPERL_MS);
+
+ /* Deassert the reset signal */
+ gpiod_set_value_cansleep(reset_gpio, 0);
+ mdelay(PCIE_T_RRS_READY_MS);
+ }
+
err = dw_pcie_host_init(pp);
if (err) {
dev_err(dev, "Failed to initialize host, err=%d\n", err);
--
2.44.1
Powered by blists - more mailing lists