All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@impinj.com>
To: "broonie@kernel.org" <broonie@kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>
Cc: "linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 2/3] spi: spi-gpio: Delete references to non-GENERIC_BITBANG
Date: Wed, 14 Feb 2018 18:53:43 +0000	[thread overview]
Message-ID: <1518634423.25567.42.camel@impinj.com> (raw)
In-Reply-To: <20180214160122.GE12658@sirena.org.uk>

On Wed, 2018-02-14 at 16:01 +0000, Mark Brown wrote:
> On Mon, Feb 12, 2018 at 01:45:31PM +0100, Linus Walleij wrote:
> 
> > The non-generic bitbang was a feature where a platform could optimize
> > SPI bit-banging by inlining the routines to hammer GPIO lines into
> > the GPIO bitbanging driver as direct register writes using a custom
> > set of GPIO library calls.
> > It does not work with multiplatform concepts, violates everything
> > about how GPIO is made generic and is just generally a bad idea,
> > even on legacy system. Also there is no single user in the entire
> > kernel (for good reasons).
> 
> It's not expected that users should go upstream and it doesn't seem
> helpful to delete without replacement.  The original idea was to allow
> things like setting multiple GPIOs at once if there were calls for that,
> now that gpiolib has support for that we should at least convert to it
> before removing the hook.

This ability really does make a difference.  I wrote a bit-banged JTAG
driver a powerpc embedded device.  Using the int based gpiolib, I could
get about a 1 MHz clock.  By allowing one to define a wrapper that
could take compiled in gpio settings, I could get that clock up to
something like 20 MHz.  The device had to load an FPGA image via JTAG
when it started, so this was something like 5 seconds of boot time that
would become almost two minutes without the ability to do GPIOs really
fast.  That's the difference between a product appearing to customers
as quick compared to what they expect vs pathetic.

Of course this never made it into the upstream kernel.  It only worked
on that specific product.

The biggest win was due to locking.  gpiolib needs each gpio set/get to
be atomic vs other gpio consumers, so you end up with locks around each
call.  This is huge overhead when a gpio only needs a single machine
instruction.  I could tell the wrapper to lock the gpios at the start
of a JTAG op and unlock after and reduce this overhead by orders of
magnitude.

  reply	other threads:[~2018-02-14 18:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 12:45 [PATCH 0/3] Convert GPIO SPI to use descriptors only Linus Walleij
2018-02-12 12:45 ` [PATCH 1/3] spi: spi-gpio: Rewrite to use GPIO descriptors Linus Walleij
     [not found]   ` <20180212124532.25776-2-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-13 14:17     ` Andy Shevchenko
     [not found]       ` <CAHp75VeOf6Zywgn9LWWX1kOwsqw28dhZ5EE+N-0KFX_0m-JxOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-13 16:17         ` Mark Brown
2018-02-14 16:28   ` Applied "spi: spi-gpio: Rewrite to use GPIO descriptors" to the spi tree Mark Brown
2018-02-14 16:28     ` Mark Brown
2018-02-12 12:45 ` [PATCH 2/3] spi: spi-gpio: Delete references to non-GENERIC_BITBANG Linus Walleij
     [not found]   ` <20180212124532.25776-3-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-14 16:01     ` Mark Brown
2018-02-14 18:53       ` Trent Piepho [this message]
2018-02-12 12:45 ` [PATCH 3/3] spi: spi-gpio: Augment device tree bindings Linus Walleij
2018-02-19  2:35   ` Rob Herring
     [not found] ` <20180212124532.25776-1-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-13 14:19   ` [PATCH 0/3] Convert GPIO SPI to use descriptors only 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=1518634423.25567.42.camel@impinj.com \
    --to=tpiepho@impinj.com \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-spi@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.