linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Geert Uytterhoeven
	<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
	Ulrich Hecht
	<ulrich.hecht+renesas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux-Renesas
	<linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] spi: sh-msiof: request and set cs-gpio direction to output
Date: Thu, 1 Sep 2016 12:08:07 +0200	[thread overview]
Message-ID: <20160901100807.GD2893@katana> (raw)
In-Reply-To: <CAMuHMdWb4PngmRa+U=4x1Nq8s+ehWu_ZSTvSzovPs9ngeKhK-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]

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
> <ulrich.hecht+renesas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Required for the CS signal to actually be visible to the device.
> >
> > Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Thanks, I can confirm this indeed makes cs-gpios work with MSIOF on
> Koelsch, hence
> Tested-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

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 -- geert@linux-m68k.org
> 
> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      parent reply	other threads:[~2016-09-01 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18  8:57 [PATCH] spi: sh-msiof: request and set cs-gpio direction to output Ulrich Hecht
2016-07-18 12:09 ` Geert Uytterhoeven
     [not found]   ` <CAMuHMdWb4PngmRa+U=4x1Nq8s+ehWu_ZSTvSzovPs9ngeKhK-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-01 10:08     ` Wolfram Sang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160901100807.GD2893@katana \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ulrich.hecht+renesas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).