On Mon, Jul 18, 2016 at 02:09:03PM +0200, Geert Uytterhoeven wrote:
> Hi Ulrich,
> 
> On Mon, Jul 18, 2016 at 10:57 AM, Ulrich Hecht
> <[email protected]> wrote:
> > Required for the CS signal to actually be visible to the device.
> >
> > Signed-off-by: Ulrich Hecht <[email protected]>
> 
> Thanks, I can confirm this indeed makes cs-gpios work with MSIOF on
> Koelsch, hence
> Tested-by: Geert Uytterhoeven <[email protected]>

This one doesn't show up in renesas-drivers. What about V2?

Thanks!

> 
> > ---
> >  drivers/spi/spi-sh-msiof.c | 25 +++++++++++++++++++++++--
> >  1 file changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
> > index a7934ab..d4b5772 100644
> > --- a/drivers/spi/spi-sh-msiof.c
> > +++ b/drivers/spi/spi-sh-msiof.c
> > @@ -536,15 +536,35 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
> 
> Is there any specific reason you don't do this in .probe(), like spi-efm32
> does?
> 
> >                                   !!(spi->mode & SPI_LSB_FIRST),
> >                                   !!(spi->mode & SPI_CS_HIGH));
> >
> > -       if (spi->cs_gpio >= 0)
> > -               gpio_set_value(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
> > +       if (spi->cs_gpio >= 0 && !spi_get_ctldata(spi)) {
> > +               int status = gpio_request(spi->cs_gpio, 
> > dev_name(&spi->dev));
> 
> devm_gpio_request()...
> 
> > +
> > +               if (status)
> > +                       return status;
> >
> > +               status = gpio_direction_output(spi->cs_gpio,
> > +                                              !(spi->mode & SPI_CS_HIGH));
> > +               if (status) {
> > +                       gpio_free(spi->cs_gpio);
> > +                       return status;
> > +               }
> 
> ... or even better, devm_gpio_request_one(), as it allows configuring 
> direction
> and initial level in one go.
> 
> > +
> > +               spi_set_ctldata(spi, (void *)spi->cs_gpio);
> > +       }
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> [email protected]
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
>                                 -- Linus Torvalds

Attachment: signature.asc
Description: PGP signature

Reply via email to