[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsNbau03d5J0sLy/@lizhi-Precision-Tower-5810>
Date: Mon, 19 Aug 2024 10:49:14 -0400
From: Frank Li <Frank.li@....com>
To: Stefan Eichenberger <eichest@...il.com>
Cc: hongxing.zhu@....com, l.stach@...gutronix.de, lpieralisi@...nel.org,
kw@...ux.com, robh@...nel.org, bhelgaas@...gle.com,
shawnguo@...nel.org, s.hauer@...gutronix.de, kernel@...gutronix.de,
festevam@...il.com, francesco.dolcini@...adex.com,
linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
imx@...ts.linux.dev, linux-kernel@...r.kernel.org,
Stefan Eichenberger <stefan.eichenberger@...adex.com>
Subject: Re: [PATCH v1 1/3] PCI: imx6: Add a function to deassert the reset
gpio
On Mon, Aug 19, 2024 at 11:03:17AM +0200, Stefan Eichenberger wrote:
> From: Stefan Eichenberger <stefan.eichenberger@...adex.com>
>
> To avoid code duplication, move the code to disable the reset GPIO to a
> separate function.
Add help function imx6_pcie_deassert_reset_gpio() to handle reset GPIO.
>
> Signed-off-by: Stefan Eichenberger <stefan.eichenberger@...adex.com>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 964d67756eb2b..fda704d82431f 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -722,6 +722,17 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
> gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 1);
> }
>
> +static void imx6_pcie_deassert_reset_gpio(struct imx6_pcie *imx6_pcie)
> +{
> + /* Some boards don't have PCIe reset GPIO. */
> + if (imx6_pcie->reset_gpiod) {
> + msleep(100);
> + gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 0);
> + /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */
> + msleep(100);
> + }
> +}
> +
> static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
> {
> struct dw_pcie *pci = imx6_pcie->pci;
> @@ -766,13 +777,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
> break;
> }
>
> - /* Some boards don't have PCIe reset GPIO. */
> - if (imx6_pcie->reset_gpiod) {
> - msleep(100);
> - gpiod_set_value_cansleep(imx6_pcie->reset_gpiod, 0);
> - /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */
> - msleep(100);
> - }
> + imx6_pcie_deassert_reset_gpio(imx6_pcie);
>
> return 0;
> }
> --
> 2.43.0
>
Powered by blists - more mailing lists