[U-Boot] [PATCH V2] pci: imx: request gpio before use
Stefano Babic
sbabic at denx.de
Wed Jan 3 13:24:11 UTC 2018
On 02/01/2018 11:27, Peng Fan wrote:
> Before use GPIO, we need to request gpio first. Free gpio after use.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Fabio Estevam <fabio.estevam at nxp.com>
> ---
>
> V2:
> Typo fix.
> Free gpio after use.
>
> drivers/pci/pcie_imx.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
> index 2900c8d9d1..90a34063b0 100644
> --- a/drivers/pci/pcie_imx.c
> +++ b/drivers/pci/pcie_imx.c
> @@ -517,10 +517,12 @@ static int imx6_pcie_init_phy(void)
> __weak int imx6_pcie_toggle_power(void)
> {
> #ifdef CONFIG_PCIE_IMX_POWER_GPIO
> + gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power");
> gpio_direction_output(CONFIG_PCIE_IMX_POWER_GPIO, 0);
> mdelay(20);
> gpio_set_value(CONFIG_PCIE_IMX_POWER_GPIO, 1);
> mdelay(20);
> + gpio_free(CONFIG_PCIE_IMX_POWER_GPIO);
> #endif
> return 0;
> }
> @@ -556,10 +558,12 @@ __weak int imx6_pcie_toggle_reset(void)
> * state due to being previously used in U-Boot.
> */
> #ifdef CONFIG_PCIE_IMX_PERST_GPIO
> + gpio_request(CONFIG_PCIE_IMX_PERST_GPIO, "pcie_reset");
> gpio_direction_output(CONFIG_PCIE_IMX_PERST_GPIO, 0);
> mdelay(20);
> gpio_set_value(CONFIG_PCIE_IMX_PERST_GPIO, 1);
> mdelay(20);
> + gpio_free(CONFIG_PCIE_IMX_PERST_GPIO);
> #else
> puts("WARNING: Make sure the PCIe #PERST line is connected!\n");
> #endif
>
Reviewed-by: Stefano Babic <ssbabic at denx.de>
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
More information about the U-Boot
mailing list