* [PATCH v3 0/2] Add support for AMD Versal Gen 2 MDB PCIe RP PERST#
@ 2025-06-18 8:09 Sai Krishna Musham
2025-06-18 8:09 ` [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling Sai Krishna Musham
2025-06-18 8:09 ` [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling Sai Krishna Musham
0 siblings, 2 replies; 8+ messages in thread
From: Sai Krishna Musham @ 2025-06-18 8:09 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kw, mani, robh, krzk+dt, conor+dt, cassel
Cc: linux-pci, devicetree, linux-kernel, michal.simek,
bharat.kumar.gogada, thippeswamy.havalige, sai.krishna.musham
Add reset-gpios property to PCI bridge node
Add support for PCIe Root Port PERST# signal handling
Sai Krishna Musham (2):
dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST#
handling
PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
.../bindings/pci/amd,versal2-mdb-host.yaml | 26 +++++++++++
drivers/pci/controller/dwc/pcie-amd-mdb.c | 45 ++++++++++++++++++-
2 files changed, 70 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling
2025-06-18 8:09 [PATCH v3 0/2] Add support for AMD Versal Gen 2 MDB PCIe RP PERST# Sai Krishna Musham
@ 2025-06-18 8:09 ` Sai Krishna Musham
2025-06-23 7:51 ` Krishna Chaitanya Chundru
2025-06-18 8:09 ` [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling Sai Krishna Musham
1 sibling, 1 reply; 8+ messages in thread
From: Sai Krishna Musham @ 2025-06-18 8:09 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kw, mani, robh, krzk+dt, conor+dt, cassel
Cc: linux-pci, devicetree, linux-kernel, michal.simek,
bharat.kumar.gogada, thippeswamy.havalige, sai.krishna.musham
Add support for the `reset-gpios` property in the PCIe Root Port (RP)
child node to handle the PERST# signal via GPIO. Update the example
to reflect this addition.
Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
---
Changes in v3:
- Move reset-gpios to PCI bridge node.
Changes in v2:
- Update commit message
---
.../bindings/pci/amd,versal2-mdb-host.yaml | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
index 43dc2585c237..3ffe4512650d 100644
--- a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
+++ b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
@@ -71,6 +71,21 @@ properties:
- "#address-cells"
- "#interrupt-cells"
+patternProperties:
+ '^pcie@[0-2],0$':
+ type: object
+ $ref: /schemas/pci/pci-pci-bridge.yaml#
+
+ properties:
+ reg:
+ maxItems: 1
+
+ reset-gpios:
+ description: GPIO controlled connection to PERST# signal
+ maxItems: 1
+
+ unevaluatedProperties: false
+
required:
- reg
- reg-names
@@ -87,6 +102,7 @@ examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/gpio/gpio.h>
soc {
#address-cells = <2>;
@@ -112,6 +128,16 @@ examples:
#size-cells = <2>;
#interrupt-cells = <1>;
device_type = "pci";
+
+ pcie@0,0 {
+ device_type = "pci";
+ reg = <0x0 0x0 0x0 0x0 0x0>;
+ reset-gpios = <&tca6416_u37 7 GPIO_ACTIVE_LOW>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ ranges;
+ };
+
pcie_intc_0: interrupt-controller {
#address-cells = <0>;
#interrupt-cells = <1>;
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
2025-06-18 8:09 [PATCH v3 0/2] Add support for AMD Versal Gen 2 MDB PCIe RP PERST# Sai Krishna Musham
2025-06-18 8:09 ` [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling Sai Krishna Musham
@ 2025-06-18 8:09 ` Sai Krishna Musham
2025-06-24 2:29 ` kernel test robot
2025-06-24 16:00 ` Bjorn Helgaas
1 sibling, 2 replies; 8+ messages in thread
From: Sai Krishna Musham @ 2025-06-18 8:09 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kw, mani, robh, krzk+dt, conor+dt, cassel
Cc: linux-pci, devicetree, linux-kernel, michal.simek,
bharat.kumar.gogada, thippeswamy.havalige, sai.krishna.musham
Add GPIO based PERST# signal handling for AMD Versal Gen 2 MDB
PCIe Root Port.
Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
---
Changes in v3:
- Implement amd_mdb_parse_pcie_port to parse bridge node for reset-gpios property.
Changes in v2:
- Change delay to PCIE_T_PVPERL_MS
---
drivers/pci/controller/dwc/pcie-amd-mdb.c | 45 ++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c b/drivers/pci/controller/dwc/pcie-amd-mdb.c
index 4eb2a4e8189d..b4c5b71900a5 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
@@ -63,6 +64,7 @@ struct amd_mdb_pcie {
void __iomem *slcr;
struct irq_domain *intx_domain;
struct irq_domain *mdb_domain;
+ struct gpio_desc *perst_gpio;
int intx_irq;
};
@@ -284,7 +286,7 @@ static int amd_mdb_pcie_init_irq_domains(struct amd_mdb_pcie *pcie,
struct device_node *pcie_intc_node;
int err;
- pcie_intc_node = of_get_next_child(node, NULL);
+ pcie_intc_node = of_get_child_by_name(node, "interrupt-controller");
if (!pcie_intc_node) {
dev_err(dev, "No PCIe Intc node found\n");
return -ENODEV;
@@ -402,6 +404,34 @@ static int amd_mdb_setup_irq(struct amd_mdb_pcie *pcie,
return 0;
}
+static int amd_mdb_parse_pcie_port(struct amd_mdb_pcie *pcie)
+{
+ struct device *dev = pcie->pci.dev;
+ struct device_node *pcie_port_node;
+
+ pcie_port_node = of_get_next_child_with_prefix(dev->of_node, NULL, "pcie");
+ if (!pcie_port_node) {
+ dev_err(dev, "No PCIe Bridge node found\n");
+ return -ENODEV;
+ }
+
+ /* Request the GPIO for PCIe reset signal and assert */
+ pcie->perst_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(pcie_port_node),
+ "reset", GPIOD_OUT_HIGH, NULL);
+ if (IS_ERR(pcie->perst_gpio)) {
+ if (PTR_ERR(pcie->perst_gpio) != -ENOENT) {
+ of_node_put(pcie_port_node);
+ return dev_err_probe(dev, PTR_ERR(pcie->perst_gpio),
+ "Failed to request reset GPIO\n");
+ }
+ pcie->perst_gpio = NULL;
+ }
+
+ of_node_put(pcie_port_node);
+
+ return 0;
+}
+
static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
struct platform_device *pdev)
{
@@ -426,6 +456,14 @@ static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
pp->ops = &amd_mdb_pcie_host_ops;
+ if (pcie->perst_gpio) {
+ mdelay(PCIE_T_PVPERL_MS);
+
+ /* Deassert the reset signal */
+ gpiod_set_value_cansleep(pcie->perst_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);
@@ -444,6 +482,7 @@ static int amd_mdb_pcie_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct amd_mdb_pcie *pcie;
struct dw_pcie *pci;
+ int ret;
pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
if (!pcie)
@@ -454,6 +493,10 @@ static int amd_mdb_pcie_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pcie);
+ ret = amd_mdb_parse_pcie_port(pcie);
+ if (ret)
+ return ret;
+
return amd_mdb_add_pcie_port(pcie, pdev);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling
2025-06-18 8:09 ` [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling Sai Krishna Musham
@ 2025-06-23 7:51 ` Krishna Chaitanya Chundru
2025-06-25 4:15 ` Musham, Sai Krishna
0 siblings, 1 reply; 8+ messages in thread
From: Krishna Chaitanya Chundru @ 2025-06-23 7:51 UTC (permalink / raw)
To: Sai Krishna Musham, bhelgaas, lpieralisi, kw, mani, robh, krzk+dt,
conor+dt, cassel
Cc: linux-pci, devicetree, linux-kernel, michal.simek,
bharat.kumar.gogada, thippeswamy.havalige
On 6/18/2025 1:39 PM, Sai Krishna Musham wrote:
> Add support for the `reset-gpios` property in the PCIe Root Port (RP)
> child node to handle the PERST# signal via GPIO. Update the example
> to reflect this addition.
>
> Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
> ---
> Changes in v3:
> - Move reset-gpios to PCI bridge node.
>
> Changes in v2:
> - Update commit message
> ---
> .../bindings/pci/amd,versal2-mdb-host.yaml | 26 +++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> index 43dc2585c237..3ffe4512650d 100644
> --- a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> +++ b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> @@ -71,6 +71,21 @@ properties:
> - "#address-cells"
> - "#interrupt-cells"
>
> +patternProperties:
> + '^pcie@[0-2],0$':
> + type: object
> + $ref: /schemas/pci/pci-pci-bridge.yaml#
> +
> + properties:
> + reg:
> + maxItems: 1
> +
> + reset-gpios:
> + description: GPIO controlled connection to PERST# signal
> + maxItems: 1
> +
This is already part of pci-bus-common.yaml in dtschema no need to
define it again here.
- Krishna Chaitanya.
> + unevaluatedProperties: false
> +
> required:
> - reg
> - reg-names
> @@ -87,6 +102,7 @@ examples:
> - |
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/gpio/gpio.h>
>
> soc {
> #address-cells = <2>;
> @@ -112,6 +128,16 @@ examples:
> #size-cells = <2>;
> #interrupt-cells = <1>;
> device_type = "pci";
> +
> + pcie@0,0 {
> + device_type = "pci";
> + reg = <0x0 0x0 0x0 0x0 0x0>;
> + reset-gpios = <&tca6416_u37 7 GPIO_ACTIVE_LOW>;
> + #address-cells = <3>;
> + #size-cells = <2>;
> + ranges;
> + };
> +
> pcie_intc_0: interrupt-controller {
> #address-cells = <0>;
> #interrupt-cells = <1>;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
2025-06-18 8:09 ` [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling Sai Krishna Musham
@ 2025-06-24 2:29 ` kernel test robot
2025-06-24 16:00 ` Bjorn Helgaas
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-06-24 2:29 UTC (permalink / raw)
To: Sai Krishna Musham, bhelgaas, lpieralisi, kw, mani, robh, krzk+dt,
conor+dt, cassel
Cc: oe-kbuild-all, linux-pci, devicetree, linux-kernel, michal.simek,
bharat.kumar.gogada, thippeswamy.havalige, sai.krishna.musham
Hi Sai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus linus/master v6.16-rc3 next-20250623]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sai-Krishna-Musham/dt-bindings-PCI-amd-mdb-Add-reset-gpios-property-for-PCIe-RP-PERST-handling/20250618-161100
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20250618080931.2472366-3-sai.krishna.musham%40amd.com
patch subject: [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
config: csky-randconfig-002-20250621 (https://download.01.org/0day-ci/archive/20250624/202506241020.rPD1a2Vr-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250624/202506241020.rPD1a2Vr-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506241020.rPD1a2Vr-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> Warning: drivers/pci/controller/dwc/pcie-amd-mdb.c:68 struct member 'perst_gpio' not described in 'amd_mdb_pcie'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
2025-06-18 8:09 ` [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling Sai Krishna Musham
2025-06-24 2:29 ` kernel test robot
@ 2025-06-24 16:00 ` Bjorn Helgaas
2025-06-25 4:27 ` Musham, Sai Krishna
1 sibling, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2025-06-24 16:00 UTC (permalink / raw)
To: Sai Krishna Musham
Cc: bhelgaas, lpieralisi, kw, mani, robh, krzk+dt, conor+dt, cassel,
linux-pci, devicetree, linux-kernel, michal.simek,
bharat.kumar.gogada, thippeswamy.havalige
On Wed, Jun 18, 2025 at 01:39:31PM +0530, Sai Krishna Musham wrote:
> Add GPIO based PERST# signal handling for AMD Versal Gen 2 MDB
> PCIe Root Port.
>
> Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
> ---
> Changes in v3:
> - Implement amd_mdb_parse_pcie_port to parse bridge node for reset-gpios property.
>
> Changes in v2:
> - Change delay to PCIE_T_PVPERL_MS
v3 https://lore.kernel.org/r/20250618080931.2472366-1-sai.krishna.musham@amd.com/
v2 https://lore.kernel.org/r/20250429090046.1512000-1-sai.krishna.musham@amd.com/
v1 https://lore.kernel.org/r/20250326041507.98232-1-sai.krishna.musham@amd.com/
> ---
> drivers/pci/controller/dwc/pcie-amd-mdb.c | 45 ++++++++++++++++++++++-
> 1 file changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c b/drivers/pci/controller/dwc/pcie-amd-mdb.c
> index 4eb2a4e8189d..b4c5b71900a5 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
> @@ -63,6 +64,7 @@ struct amd_mdb_pcie {
> void __iomem *slcr;
> struct irq_domain *intx_domain;
> struct irq_domain *mdb_domain;
> + struct gpio_desc *perst_gpio;
> int intx_irq;
> };
>
> @@ -284,7 +286,7 @@ static int amd_mdb_pcie_init_irq_domains(struct amd_mdb_pcie *pcie,
> struct device_node *pcie_intc_node;
> int err;
>
> - pcie_intc_node = of_get_next_child(node, NULL);
> + pcie_intc_node = of_get_child_by_name(node, "interrupt-controller");
Is this change logically part of the PERST# support? If not, this
could be a separate patch.
> if (!pcie_intc_node) {
> dev_err(dev, "No PCIe Intc node found\n");
> return -ENODEV;
> @@ -402,6 +404,34 @@ static int amd_mdb_setup_irq(struct amd_mdb_pcie *pcie,
> return 0;
> }
>
> +static int amd_mdb_parse_pcie_port(struct amd_mdb_pcie *pcie)
> +{
> + struct device *dev = pcie->pci.dev;
> + struct device_node *pcie_port_node;
> +
> + pcie_port_node = of_get_next_child_with_prefix(dev->of_node, NULL, "pcie");
> + if (!pcie_port_node) {
> + dev_err(dev, "No PCIe Bridge node found\n");
> + return -ENODEV;
> + }
> +
> + /* Request the GPIO for PCIe reset signal and assert */
> + pcie->perst_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(pcie_port_node),
> + "reset", GPIOD_OUT_HIGH, NULL);
> + if (IS_ERR(pcie->perst_gpio)) {
> + if (PTR_ERR(pcie->perst_gpio) != -ENOENT) {
> + of_node_put(pcie_port_node);
> + return dev_err_probe(dev, PTR_ERR(pcie->perst_gpio),
> + "Failed to request reset GPIO\n");
> + }
> + pcie->perst_gpio = NULL;
> + }
> +
> + of_node_put(pcie_port_node);
> +
> + return 0;
> +}
> +
> static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
> struct platform_device *pdev)
> {
> @@ -426,6 +456,14 @@ static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
>
> pp->ops = &amd_mdb_pcie_host_ops;
>
> + if (pcie->perst_gpio) {
> + mdelay(PCIE_T_PVPERL_MS);
> +
> + /* Deassert the reset signal */
> + gpiod_set_value_cansleep(pcie->perst_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);
> @@ -444,6 +482,7 @@ static int amd_mdb_pcie_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct amd_mdb_pcie *pcie;
> struct dw_pcie *pci;
> + int ret;
>
> pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
> if (!pcie)
> @@ -454,6 +493,10 @@ static int amd_mdb_pcie_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, pcie);
>
> + ret = amd_mdb_parse_pcie_port(pcie);
> + if (ret)
> + return ret;
> +
> return amd_mdb_add_pcie_port(pcie, pdev);
> }
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling
2025-06-23 7:51 ` Krishna Chaitanya Chundru
@ 2025-06-25 4:15 ` Musham, Sai Krishna
0 siblings, 0 replies; 8+ messages in thread
From: Musham, Sai Krishna @ 2025-06-25 4:15 UTC (permalink / raw)
To: Krishna Chaitanya Chundru, bhelgaas@google.com,
lpieralisi@kernel.org, kw@linux.com, mani@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
cassel@kernel.org
Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Simek, Michal, Gogada, Bharat Kumar,
Havalige, Thippeswamy
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Krishna Chaitanya,
> -----Original Message-----
> From: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
> Sent: Monday, June 23, 2025 1:22 PM
> To: Musham, Sai Krishna <sai.krishna.musham@amd.com>;
> bhelgaas@google.com; lpieralisi@kernel.org; kw@linux.com; mani@kernel.org;
> robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org; cassel@kernel.org
> Cc: linux-pci@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>; Gogada, Bharat
> Kumar <bharat.kumar.gogada@amd.com>; Havalige, Thippeswamy
> <thippeswamy.havalige@amd.com>
> Subject: Re: [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property
> for PCIe RP PERST# handling
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On 6/18/2025 1:39 PM, Sai Krishna Musham wrote:
> > Add support for the `reset-gpios` property in the PCIe Root Port (RP)
> > child node to handle the PERST# signal via GPIO. Update the example
> > to reflect this addition.
> >
> > Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
> > ---
> > Changes in v3:
> > - Move reset-gpios to PCI bridge node.
> >
> > Changes in v2:
> > - Update commit message
> > ---
> > .../bindings/pci/amd,versal2-mdb-host.yaml | 26 +++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> > index 43dc2585c237..3ffe4512650d 100644
> > --- a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> > +++ b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
> > @@ -71,6 +71,21 @@ properties:
> > - "#address-cells"
> > - "#interrupt-cells"
> >
> > +patternProperties:
> > + '^pcie@[0-2],0$':
> > + type: object
> > + $ref: /schemas/pci/pci-pci-bridge.yaml#
> > +
> > + properties:
> > + reg:
> > + maxItems: 1
> > +
> > + reset-gpios:
> > + description: GPIO controlled connection to PERST# signal
> > + maxItems: 1
> > +
> This is already part of pci-bus-common.yaml in dtschema no need to
> define it again here.
>
Thanks for the review. Sure, I will remove it.
> - Krishna Chaitanya.
>
> > + unevaluatedProperties: false
> > +
> > required:
> > - reg
> > - reg-names
> > @@ -87,6 +102,7 @@ examples:
> > - |
> > #include <dt-bindings/interrupt-controller/arm-gic.h>
> > #include <dt-bindings/interrupt-controller/irq.h>
> > + #include <dt-bindings/gpio/gpio.h>
> >
> > soc {
> > #address-cells = <2>;
> > @@ -112,6 +128,16 @@ examples:
> > #size-cells = <2>;
> > #interrupt-cells = <1>;
> > device_type = "pci";
> > +
> > + pcie@0,0 {
> > + device_type = "pci";
> > + reg = <0x0 0x0 0x0 0x0 0x0>;
> > + reset-gpios = <&tca6416_u37 7 GPIO_ACTIVE_LOW>;
> > + #address-cells = <3>;
> > + #size-cells = <2>;
> > + ranges;
> > + };
> > +
> > pcie_intc_0: interrupt-controller {
> > #address-cells = <0>;
> > #interrupt-cells = <1>;
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling
2025-06-24 16:00 ` Bjorn Helgaas
@ 2025-06-25 4:27 ` Musham, Sai Krishna
0 siblings, 0 replies; 8+ messages in thread
From: Musham, Sai Krishna @ 2025-06-25 4:27 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com,
mani@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, cassel@kernel.org, linux-pci@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Simek, Michal, Gogada, Bharat Kumar, Havalige, Thippeswamy
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Bjorn,
> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: Tuesday, June 24, 2025 9:31 PM
> To: Musham, Sai Krishna <sai.krishna.musham@amd.com>
> Cc: bhelgaas@google.com; lpieralisi@kernel.org; kw@linux.com; mani@kernel.org;
> robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org; cassel@kernel.org;
> linux-pci@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>; Gogada, Bharat
> Kumar <bharat.kumar.gogada@amd.com>; Havalige, Thippeswamy
> <thippeswamy.havalige@amd.com>
> Subject: Re: [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST#
> signal handling
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Wed, Jun 18, 2025 at 01:39:31PM +0530, Sai Krishna Musham wrote:
> > Add GPIO based PERST# signal handling for AMD Versal Gen 2 MDB
> > PCIe Root Port.
> >
> > Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
> > ---
> > Changes in v3:
> > - Implement amd_mdb_parse_pcie_port to parse bridge node for reset-gpios
> property.
> >
> > Changes in v2:
> > - Change delay to PCIE_T_PVPERL_MS
>
> v3 https://lore.kernel.org/r/20250618080931.2472366-1-
> sai.krishna.musham@amd.com/
> v2 https://lore.kernel.org/r/20250429090046.1512000-1-
> sai.krishna.musham@amd.com/
> v1 https://lore.kernel.org/r/20250326041507.98232-1-
> sai.krishna.musham@amd.com/
>
Sure, I will add the lore links. Thanks
> > ---
> > drivers/pci/controller/dwc/pcie-amd-mdb.c | 45 ++++++++++++++++++++++-
> > 1 file changed, 44 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c
> b/drivers/pci/controller/dwc/pcie-amd-mdb.c
> > index 4eb2a4e8189d..b4c5b71900a5 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
> > @@ -63,6 +64,7 @@ struct amd_mdb_pcie {
> > void __iomem *slcr;
> > struct irq_domain *intx_domain;
> > struct irq_domain *mdb_domain;
> > + struct gpio_desc *perst_gpio;
> > int intx_irq;
> > };
> >
> > @@ -284,7 +286,7 @@ static int amd_mdb_pcie_init_irq_domains(struct
> amd_mdb_pcie *pcie,
> > struct device_node *pcie_intc_node;
> > int err;
> >
> > - pcie_intc_node = of_get_next_child(node, NULL);
> > + pcie_intc_node = of_get_child_by_name(node, "interrupt-controller");
>
> Is this change logically part of the PERST# support? If not, this
> could be a separate patch.
>
Yes, this change is logically part of the PERST# support patch.
Previously, the interrupt-controller node was the only child under the PCIe node,
so we used of_get_next_child() to retrieve it. With this patch, a new PCIe bridge
node has been added as a child node, which could lead to ambiguity or incorrect
parsing.
To ensure we explicitly retrieve the correct node and avoid potential issues, I replaced
of_get_next_child() with of_get_child_by_name() to directly access the 'interrupt-controller'
node.
> > if (!pcie_intc_node) {
> > dev_err(dev, "No PCIe Intc node found\n");
> > return -ENODEV;
> > @@ -402,6 +404,34 @@ static int amd_mdb_setup_irq(struct amd_mdb_pcie
> *pcie,
> > return 0;
> > }
> >
> > +static int amd_mdb_parse_pcie_port(struct amd_mdb_pcie *pcie)
> > +{
> > + struct device *dev = pcie->pci.dev;
> > + struct device_node *pcie_port_node;
> > +
> > + pcie_port_node = of_get_next_child_with_prefix(dev->of_node, NULL, "pcie");
> > + if (!pcie_port_node) {
> > + dev_err(dev, "No PCIe Bridge node found\n");
> > + return -ENODEV;
> > + }
> > +
> > + /* Request the GPIO for PCIe reset signal and assert */
> > + pcie->perst_gpio = devm_fwnode_gpiod_get(dev,
> of_fwnode_handle(pcie_port_node),
> > + "reset", GPIOD_OUT_HIGH, NULL);
> > + if (IS_ERR(pcie->perst_gpio)) {
> > + if (PTR_ERR(pcie->perst_gpio) != -ENOENT) {
> > + of_node_put(pcie_port_node);
> > + return dev_err_probe(dev, PTR_ERR(pcie->perst_gpio),
> > + "Failed to request reset GPIO\n");
> > + }
> > + pcie->perst_gpio = NULL;
> > + }
> > +
> > + of_node_put(pcie_port_node);
> > +
> > + return 0;
> > +}
> > +
> > static int amd_mdb_add_pcie_port(struct amd_mdb_pcie *pcie,
> > struct platform_device *pdev)
> > {
> > @@ -426,6 +456,14 @@ static int amd_mdb_add_pcie_port(struct
> amd_mdb_pcie *pcie,
> >
> > pp->ops = &amd_mdb_pcie_host_ops;
> >
> > + if (pcie->perst_gpio) {
> > + mdelay(PCIE_T_PVPERL_MS);
> > +
> > + /* Deassert the reset signal */
> > + gpiod_set_value_cansleep(pcie->perst_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);
> > @@ -444,6 +482,7 @@ static int amd_mdb_pcie_probe(struct platform_device
> *pdev)
> > struct device *dev = &pdev->dev;
> > struct amd_mdb_pcie *pcie;
> > struct dw_pcie *pci;
> > + int ret;
> >
> > pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
> > if (!pcie)
> > @@ -454,6 +493,10 @@ static int amd_mdb_pcie_probe(struct platform_device
> *pdev)
> >
> > platform_set_drvdata(pdev, pcie);
> >
> > + ret = amd_mdb_parse_pcie_port(pcie);
> > + if (ret)
> > + return ret;
> > +
> > return amd_mdb_add_pcie_port(pcie, pdev);
> > }
> >
> > --
> > 2.43.0
> >
Thanks,
Sai krishna
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-25 4:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18 8:09 [PATCH v3 0/2] Add support for AMD Versal Gen 2 MDB PCIe RP PERST# Sai Krishna Musham
2025-06-18 8:09 ` [PATCH v3 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property for PCIe RP PERST# handling Sai Krishna Musham
2025-06-23 7:51 ` Krishna Chaitanya Chundru
2025-06-25 4:15 ` Musham, Sai Krishna
2025-06-18 8:09 ` [PATCH v3 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal handling Sai Krishna Musham
2025-06-24 2:29 ` kernel test robot
2025-06-24 16:00 ` Bjorn Helgaas
2025-06-25 4:27 ` Musham, Sai Krishna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).