Re: [PATCH] spi: core: use gpio_request_one for configured gpio cs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+Cc: Mika, Jarkko

On Mon, Jul 24, 2017 at 12:53 PM, Martin Hundebøll <mnhu@xxxxxxxxx> wrote:
> Some gpio controllers requires lines to be configured as outputs to make
> subsequent calls to `gpio_set_value()` have any effect.
>
> Add a call to `gpio_request_one()` for configured gpio chip-selects to
> make it work on (at least) mvebu gpio controllers.
>

More and more hacks around plain GPIO integers... :-(

Perhaps we need to discuss how to convert SPI core to use GPIO
descriptors everywhere.

> Signed-off-by: Martin Hundebøll <mnhu@xxxxxxxxx>
> ---
>  drivers/spi/spi.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 0725c78b0de6..b7bfc52525aa 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -2010,8 +2010,13 @@ static int of_spi_register_master(struct spi_controller *ctlr)
>         for (i = 0; i < ctlr->num_chipselect; i++)
>                 cs[i] = -ENOENT;
>
> -       for (i = 0; i < nb; i++)
> +       for (i = 0; i < nb; i++) {
>                 cs[i] = of_get_named_gpio(np, "cs-gpios", i);
> +               if (gpio_is_valid(cs[i]) &&
> +                   gpio_request_one(cs[i], 0, "spi-cs") < 0)
> +                       dev_warn(&master->dev,
> +                                "gpio_request_one failed for chipselect %i\n", i);
> +       }
>
>         return 0;
>  }
> --
> 2.13.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-spi" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux