public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add support for AMD Versal2 MDB PCIe RP PERST#
@ 2025-03-26  4:15 Sai Krishna Musham
  2025-03-26  4:15 ` [PATCH 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle " Sai Krishna Musham
  2025-03-26  4:15 ` [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal Sai Krishna Musham
  0 siblings, 2 replies; 6+ messages in thread
From: Sai Krishna Musham @ 2025-03-26  4:15 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, 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 PCIe Root Port PERST# signal

Add `reset-gpios` property to AMD Versal2 MDB controller binding.

Sai Krishna Musham (2):
  dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle PCIe RP
    PERST#
  PCI: amd-mdb: Add support for PCIe RP PERST# signal

 .../bindings/pci/amd,versal2-mdb-host.yaml    |  2 ++
 drivers/pci/controller/dwc/pcie-amd-mdb.c     | 20 +++++++++++++++++++
 2 files changed, 22 insertions(+)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle PCIe RP PERST#
  2025-03-26  4:15 [PATCH 0/2] Add support for AMD Versal2 MDB PCIe RP PERST# Sai Krishna Musham
@ 2025-03-26  4:15 ` Sai Krishna Musham
  2025-03-26  8:22   ` Krzysztof Kozlowski
  2025-03-26  4:15 ` [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal Sai Krishna Musham
  1 sibling, 1 reply; 6+ messages in thread
From: Sai Krishna Musham @ 2025-03-26  4:15 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, 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 enable TCA6416 I2C GPIO expander based
handling of the PCIe PERST# signal.

Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
---
 Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml | 2 ++
 1 file changed, 2 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..e6117d326279 100644
--- a/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
+++ b/Documentation/devicetree/bindings/pci/amd,versal2-mdb-host.yaml
@@ -87,6 +87,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 +113,7 @@ examples:
             #size-cells = <2>;
             #interrupt-cells = <1>;
             device_type = "pci";
+            reset-gpios = <&tca6416_u37 7 GPIO_ACTIVE_LOW>;
             pcie_intc_0: interrupt-controller {
                 #address-cells = <0>;
                 #interrupt-cells = <1>;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal
  2025-03-26  4:15 [PATCH 0/2] Add support for AMD Versal2 MDB PCIe RP PERST# Sai Krishna Musham
  2025-03-26  4:15 ` [PATCH 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle " Sai Krishna Musham
@ 2025-03-26  4:15 ` Sai Krishna Musham
  2025-03-26  8:22   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 6+ messages in thread
From: Sai Krishna Musham @ 2025-03-26  4:15 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt, cassel
  Cc: linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada, thippeswamy.havalige, sai.krishna.musham

Add PERST# signal handling via I2C GPIO expander for AMD Versal2
MDB PCIe Root Port.

Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
---
 drivers/pci/controller/dwc/pcie-amd-mdb.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c b/drivers/pci/controller/dwc/pcie-amd-mdb.c
index 4eb2a4e8189d..4eea53e9e197 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,24 @@ 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)) {
+		if (PTR_ERR(reset_gpio) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		dev_err(dev, "Failed to request reset GPIO\n");
+		return PTR_ERR(reset_gpio);
+	}
+
+	if (reset_gpio) {
+		/* Controller specific delay */
+		udelay(50);
+
+		/* 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.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle PCIe RP PERST#
  2025-03-26  4:15 ` [PATCH 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle " Sai Krishna Musham
@ 2025-03-26  8:22   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-26  8:22 UTC (permalink / raw)
  To: Sai Krishna Musham
  Cc: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt, cassel, linux-pci, devicetree, linux-kernel,
	michal.simek, bharat.kumar.gogada, thippeswamy.havalige

On Wed, Mar 26, 2025 at 09:45:06AM +0530, Sai Krishna Musham wrote:
> Add `reset-gpios` property to enable TCA6416 I2C GPIO expander based
> handling of the PCIe PERST# signal.

Hm? Where? You just updated example, did not add anything to the
binding. Assuming that is what you wanted, then fix subject and commit
msg to say that you make example complete.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal
  2025-03-26  4:15 ` [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal Sai Krishna Musham
@ 2025-03-26  8:22   ` Krzysztof Kozlowski
  2025-04-04  7:07     ` Musham, Sai Krishna
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-26  8:22 UTC (permalink / raw)
  To: Sai Krishna Musham
  Cc: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt, cassel, linux-pci, devicetree, linux-kernel,
	michal.simek, bharat.kumar.gogada, thippeswamy.havalige

On Wed, Mar 26, 2025 at 09:45:07AM +0530, Sai Krishna Musham wrote:
> Add PERST# signal handling via I2C GPIO expander for AMD Versal2
> MDB PCIe Root Port.
> 
> Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
> ---
>  drivers/pci/controller/dwc/pcie-amd-mdb.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c b/drivers/pci/controller/dwc/pcie-amd-mdb.c
> index 4eb2a4e8189d..4eea53e9e197 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,24 @@ 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)) {
> +		if (PTR_ERR(reset_gpio) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +		dev_err(dev, "Failed to request reset GPIO\n");

Do not open-code dev_err_probe.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal
  2025-03-26  8:22   ` Krzysztof Kozlowski
@ 2025-04-04  7:07     ` Musham, Sai Krishna
  0 siblings, 0 replies; 6+ messages in thread
From: Musham, Sai Krishna @ 2025-04-04  7:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com,
	manivannan.sadhasivam@linaro.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 Krzysztof,

> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: Wednesday, March 26, 2025 1:53 PM
> To: Musham, Sai Krishna <sai.krishna.musham@amd.com>
> Cc: bhelgaas@google.com; lpieralisi@kernel.org; kw@linux.com;
> manivannan.sadhasivam@linaro.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 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Wed, Mar 26, 2025 at 09:45:07AM +0530, Sai Krishna Musham wrote:
> > Add PERST# signal handling via I2C GPIO expander for AMD Versal2 MDB
> > PCIe Root Port.
> >
> > Signed-off-by: Sai Krishna Musham <sai.krishna.musham@amd.com>
> > ---
> >  drivers/pci/controller/dwc/pcie-amd-mdb.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-amd-mdb.c
> > b/drivers/pci/controller/dwc/pcie-amd-mdb.c
> > index 4eb2a4e8189d..4eea53e9e197 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,24 @@ 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)) {
> > +             if (PTR_ERR(reset_gpio) == -EPROBE_DEFER)
> > +                     return -EPROBE_DEFER;
> > +             dev_err(dev, "Failed to request reset GPIO\n");
>
> Do not open-code dev_err_probe.
>

Thank you for reviewing. Sure, I will use dev_err_probe in next patch.

> Best regards,
> Krzysztof

Regards,
Sai Krishna


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-04  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26  4:15 [PATCH 0/2] Add support for AMD Versal2 MDB PCIe RP PERST# Sai Krishna Musham
2025-03-26  4:15 ` [PATCH 1/2] dt-bindings: PCI: amd-mdb: Add reset-gpios property to handle " Sai Krishna Musham
2025-03-26  8:22   ` Krzysztof Kozlowski
2025-03-26  4:15 ` [PATCH 2/2] PCI: amd-mdb: Add support for PCIe RP PERST# signal Sai Krishna Musham
2025-03-26  8:22   ` Krzysztof Kozlowski
2025-04-04  7:07     ` 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