linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Broadcom internal kernel review list 
	<bcm-kernel-feedback-list@broadcom.com>,
	linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [RFT PATCH] spi: bcm2835: reduce the abuse of the GPIO API
Date: Fri, 1 Sep 2023 09:40:11 +0200	[thread overview]
Message-ID: <CAMRc=Md-6i+nqDtYiUUtZExA32c0nJxhevYsiZqmd1PP8aaMng@mail.gmail.com> (raw)
In-Reply-To: <ZPEhS0uBWABpaE+/@smile.fi.intel.com>

On Fri, Sep 1, 2023 at 1:25 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Aug 31, 2023 at 09:49:34PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Currently the bcm2835 SPI driver uses functions meant for GPIO providers
> > exclusively to locate the GPIO chip it gets its CS pins from and request
> > the relevant pin. I don't know the background and what bug forced this.
>
> ...
>
> >       /*
> > +      * TODO: The code below is a slightly better alternative to the utter
> > +      * abuse of the GPIO API that I found here before. It creates a
> > +      * temporary lookup table, assigns it to the SPI device, gets the GPIO
> > +      * descriptor and then releases the lookup table.
> >        *
> > +      * Still the real problem is unsolved. Looks like the cs_gpiods table
> > +      * is not assigned correctly from DT?
> >        */
>
> I'm not sure why this quirk is here. AFAIR the SPI CS quirks are located in
> gpiolib-of.c.
>

I'm not sure this is a good candidate for the GPIOLIB quirks. This is
the SPI setup callback (which makes me think - I should have used
gpiod_get(), not devm_gpiod_get() and then put the descriptor in
.cleanup()) and not probe. It would be great to get some background on
why this is even needed in the first place. The only reason I see is
booting the driver with an invalid device-tree that doesn't assign the
GPIO to the SPI controller.

Bart

  reply	other threads:[~2023-09-01  7:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 19:49 [RFT PATCH] spi: bcm2835: reduce the abuse of the GPIO API Bartosz Golaszewski
2023-08-31 22:51 ` kernel test robot
2023-08-31 23:24 ` Andy Shevchenko
2023-09-01  7:40   ` Bartosz Golaszewski [this message]
2023-09-01  8:55     ` Andy Shevchenko
2023-09-01  9:22       ` Linus Walleij
2023-09-01  9:34         ` Bartosz Golaszewski
2023-08-31 23:27 ` Andy Shevchenko

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='CAMRc=Md-6i+nqDtYiUUtZExA32c0nJxhevYsiZqmd1PP8aaMng@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=broonie@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    /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).