diff mbox series

[U-Boot,4/7] pci: imx: request gpio before use

Message ID 1514856730-22871-4-git-send-email-peng.fan@nxp.com
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series [U-Boot,1/7] ARM: imx: Introduce dts for i.MX6SX-SDB | expand

Commit Message

Peng Fan Jan. 2, 2018, 1:32 a.m. UTC
Before use GPIO, we need to request gpio first.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/pci/pcie_imx.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Fabio Estevam Jan. 2, 2018, 10:34 a.m. UTC | #1
On Mon, Jan 1, 2018 at 11:32 PM, Peng Fan <peng.fan@nxp.com> wrote:
> Before use GPIO, we need to request gpio first.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  drivers/pci/pcie_imx.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
> index 2900c8d9d1..37a554abf2 100644
> --- a/drivers/pci/pcie_imx.c
> +++ b/drivers/pci/pcie_imx.c
> @@ -517,6 +517,7 @@ 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_reset");
>         gpio_direction_output(CONFIG_PCIE_IMX_POWER_GPIO, 0);
>         mdelay(20);
>         gpio_set_value(CONFIG_PCIE_IMX_POWER_GPIO, 1);
> @@ -556,6 +557,7 @@ __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");

There is no need to call gpio_request() twice. Please call it once.
Peng Fan Jan. 2, 2018, 10:36 a.m. UTC | #2
> -----Original Message-----

> From: Fabio Estevam [mailto:festevam@gmail.com]

> Sent: Tuesday, January 02, 2018 6:34 PM

> To: Peng Fan <peng.fan@nxp.com>

> Cc: Stefano Babic <sbabic@denx.de>; U-Boot-Denx <u-boot@lists.denx.de>;

> Fabio Estevam <fabio.estevam@nxp.com>

> Subject: Re: [U-Boot] [PATCH 4/7] pci: imx: request gpio before use

> 

> On Mon, Jan 1, 2018 at 11:32 PM, Peng Fan <peng.fan@nxp.com> wrote:

> > Before use GPIO, we need to request gpio first.

> >

> > Signed-off-by: Peng Fan <peng.fan@nxp.com>

> > Cc: Stefano Babic <sbabic@denx.de>

> > Cc: Fabio Estevam <fabio.estevam@nxp.com>

> > ---

> >  drivers/pci/pcie_imx.c | 2 ++

> >  1 file changed, 2 insertions(+)

> >

> > diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c index

> > 2900c8d9d1..37a554abf2 100644

> > --- a/drivers/pci/pcie_imx.c

> > +++ b/drivers/pci/pcie_imx.c

> > @@ -517,6 +517,7 @@ 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_reset");

> >         gpio_direction_output(CONFIG_PCIE_IMX_POWER_GPIO, 0);

> >         mdelay(20);

> >         gpio_set_value(CONFIG_PCIE_IMX_POWER_GPIO, 1); @@ -556,6

> > +557,7 @@ __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");

> 

> There is no need to call gpio_request() twice. Please call it once.


Typo. That should be pcie_power.

Thanks,
Peng.
diff mbox series

Patch

diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 2900c8d9d1..37a554abf2 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -517,6 +517,7 @@  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_reset");
 	gpio_direction_output(CONFIG_PCIE_IMX_POWER_GPIO, 0);
 	mdelay(20);
 	gpio_set_value(CONFIG_PCIE_IMX_POWER_GPIO, 1);
@@ -556,6 +557,7 @@  __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);