[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250226220653.GA561472@bhelgaas>
Date: Wed, 26 Feb 2025 16:06:53 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Sai Krishna Musham <sai.krishna.musham@....com>
Cc: bhelgaas@...gle.com, lpieralisi@...nel.org, kw@...ux.com,
manivannan.sadhasivam@...aro.org, robh@...nel.org,
krzk+dt@...nel.org, conor+dt@...nel.org, linux-pci@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
michal.simek@....com, bharat.kumar.gogada@....com,
thippeswamy.havalige@....com
Subject: Re: [PATCH v2 2/2] PCI: xilinx-cpm: Add support for PCIe RP PERST#
signal
On Wed, Feb 26, 2025 at 06:13:58PM +0530, Sai Krishna Musham wrote:
> Add GPIO-based control for the PCIe Root Port PERST# signal.
>
> According to section 2.2 of the PCIe Electromechanical Specification
> (Revision 6.0), PERST# signal has to be deasserted after a delay of
> 100 ms (TPVPERL) to ensure proper reset sequencing during PCIe
> initialization.
>
> Adapt to use the GPIO framework and make reset optional to keep DTB
> backward compatibility.
>
> Signed-off-by: Sai Krishna Musham <sai.krishna.musham@....com>
> ---
> This patch depends on the following patch series.
> https://lore.kernel.org/all/20250217072713.635643-3-thippeswamy.havalige@amd.com/
>
> Changes for v2:
> - Make the request GPIO optional.
> - Correct the reset sequence as per PERST#
> - Update commit message
> ---
> drivers/pci/controller/pcie-xilinx-cpm.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c
> index 81e8bfae53d0..aa0c61d30049 100644
> --- a/drivers/pci/controller/pcie-xilinx-cpm.c
> +++ b/drivers/pci/controller/pcie-xilinx-cpm.c
> @@ -6,6 +6,8 @@
> */
>
> #include <linux/bitfield.h>
> +#include <linux/delay.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/interrupt.h>
> #include <linux/irq.h>
> #include <linux/irqchip.h>
> @@ -568,8 +570,29 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct pci_host_bridge *bridge;
> struct resource_entry *bus;
> + struct gpio_desc *reset_gpio;
> int err;
>
> + /* Request the GPIO for PCIe reset signal */
> + reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> + if (IS_ERR(reset_gpio)) {
> + dev_err(dev, "Failed to request reset GPIO\n");
> + return PTR_ERR(reset_gpio);
> + }
> +
> + /* Assert the reset signal */
> + gpiod_set_value(reset_gpio, 1);
> +
> + /*
> + * As per section 2.2 of the PCI Express Card Electromechanical
> + * Specification (Revision 6.0), the deassertion of the PERST# signal
> + * should be delayed by 100 ms (TPVPERL).
> + */
> + msleep(100);
Use PCIE_T_PVPERL_MS. The comment at that #define is probably enough.
> + /* Deassert the reset signal */
> + gpiod_set_value(reset_gpio, 0);
> +
> bridge = devm_pci_alloc_host_bridge(dev, sizeof(*port));
> if (!bridge)
> return -ENODEV;
> --
> 2.44.1
>
Powered by blists - more mailing lists