[PATCH 15/30] gpio: renesas: Pass struct udevice to rcar_gpio_set_direction()

Lad, Prabhakar prabhakar.csengg at gmail.com
Thu May 20 19:01:04 CEST 2021


Hi Marek,

Thank you for the patch.

On Wed, Apr 28, 2021 at 8:33 PM Marek Vasut <marek.vasut at gmail.com> wrote:
>
> Pass struct udevice to rcar_gpio_set_direction() in preparation of
> quirk handling in rcar_gpio_set_direction(). No functional change.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> ---
>  drivers/gpio/gpio-rcar.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
Tested on RZ/G2{EHMN} boards

Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>

Cheers,
Prabhakar

> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> index daaac5e784..5f1ec39a9b 100644
> --- a/drivers/gpio/gpio-rcar.c
> +++ b/drivers/gpio/gpio-rcar.c
> @@ -66,9 +66,12 @@ static int rcar_gpio_set_value(struct udevice *dev, unsigned offset,
>         return 0;
>  }
>
> -static void rcar_gpio_set_direction(void __iomem *regs, unsigned offset,
> +static void rcar_gpio_set_direction(struct udevice *dev, unsigned offset,
>                                     bool output)
>  {
> +       struct rcar_gpio_priv *priv = dev_get_priv(dev);
> +       void __iomem *regs = priv->regs;
> +
>         /*
>          * follow steps in the GPIO documentation for
>          * "Setting General Output Mode" and
> @@ -90,9 +93,7 @@ static void rcar_gpio_set_direction(void __iomem *regs, unsigned offset,
>
>  static int rcar_gpio_direction_input(struct udevice *dev, unsigned offset)
>  {
> -       struct rcar_gpio_priv *priv = dev_get_priv(dev);
> -
> -       rcar_gpio_set_direction(priv->regs, offset, false);
> +       rcar_gpio_set_direction(dev, offset, false);
>
>         return 0;
>  }
> @@ -100,11 +101,9 @@ static int rcar_gpio_direction_input(struct udevice *dev, unsigned offset)
>  static int rcar_gpio_direction_output(struct udevice *dev, unsigned offset,
>                                       int value)
>  {
> -       struct rcar_gpio_priv *priv = dev_get_priv(dev);
> -
>         /* write GPIO value to output before selecting output mode of pin */
>         rcar_gpio_set_value(dev, offset, value);
> -       rcar_gpio_set_direction(priv->regs, offset, true);
> +       rcar_gpio_set_direction(dev, offset, true);
>
>         return 0;
>  }
> --
> 2.30.2
>


More information about the U-Boot mailing list