linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	David Brownell
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] drivers: spi-gpio: add support for controllers without MISO or MOSI pin
Date: Wed, 16 Jun 2010 13:52:21 -0600	[thread overview]
Message-ID: <AANLkTimT_IHfv4dKXuvTpa8M4L_MDqIvjrDPBLgzKUWn@mail.gmail.com> (raw)
In-Reply-To: <000301cb07a3$679c6ec0$36d54c40$%szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

On Wed, Jun 9, 2010 at 1:14 AM, Marek Szyprowski
<m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> Hello,
>
> On Wednesday, June 02, 2010 11:00 AM Jassi Brar wrote:
>
>> On Wed, Jun 2, 2010 at 3:00 PM, Marek Szyprowski
>> <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
>> > On Tuesday, June 01, 2010 5:00 PM Grant Likely wrote:
>> >> On Tue, Jun 1, 2010 at 5:48 AM, Marek Szyprowski
>> >> <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
>> >> I'm not convinced this is the best approach.  I did look at it, but
>> >> decided not to merge it yet.  It adds code to the hottest path in the
>> >> spi-gpio driver (not that this driver will ever be fast, but on
>> >> bit-banged gpio, every instruction counts).
>> >
>> > If this is really a problem I can remove the 'if (SPI_{MOSI,MISO}_GPIO !=
>> > SPI_GPIO_NO_{MOSI,MISO})' checks. If we assume that the upper level of
>> the
>> > spi framework works correctly, these functions shouldn't be called if
>> > the pin is set to NO_GPIO (the master device has SPI_MASTER_NO_{TX,RX}
>> flags
>> > set).
>
> Ok. I've did a research and that SPI_{MOSI,MISO}_GPIO != SPI_GPIO_NO_{MOSI,MISO}
> checks cannot be easily removed, because in each loop both getmiso() and
> setmosi() are called by the bitbang_txrx_be_* functions. I also understand that
> this part of code is really hot and should be optimized as much as possible.
>
>> As I pointed in the last thread, such peculiar platforms had better
>> assign some virtual gpio
>> for such non-existent miso/mosi, rather than imposing these extra
>> checks on most of the normal platforms.
>
> Creating a virtual gpio bank only for this case is also an overhead imho.
> GPIO SPI masters without RX line will be used by more than one machine, so
> some kind of a generic driver is imho needed.

It is overhead, but it is overhead in the right place.  It costs
nothing when it isn't called, and it is trivial to create a do-nothing
gpio number for simple gpio drivers.  Systems using gpiolib can even
share the same no-op gpio controller driver.

> Notice that the spi_s3c24xx_gpio.c driver already silently handles such
> NO_RX transfers and machines that use it depends on such behavior. I expect
> that this driver will be soon removed in favor of generic spi_gpio driver,
> once plat-s3c24xx will be finally converted to use generic gpio lib.
>
> What do you think about duplicating spi_gpio driver with my proposed changes
> as spi_gpio_adv? The original spi_gpio driver won't be modified at all, so no
> performance lose will happen for machines that use it. For new machines the
> developers will be able to select weather they need a high speed transfers or
> a driver that supports some rarely used features.

I say no.  I don't think it warrants a duplicated driver, and the
dummy GPIO number is trivial to implement.  In gpiolib it would simply
mean setting aside one of the entries in the gpio_desc table; probably
at the top of the GPIO range so that existing users don't get broken.

>
> The other possibility would be to create a new version of the bitbang_txrx_be_*
> functions for NO_TX and NO_RX cases. Then the proper function can be assigned
> in spi_gpio_probe(). However this would increase the size of spi_gpio driver
> significantly.

Not that significantly, and it would keep all the relevant code
together.  I'm more in favor of this approach.

g.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo

  parent reply	other threads:[~2010-06-16 19:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-01 10:35 [PATCH] drivers: spi-gpio: add support for controllers without MISO or MOSI pin Marek Szyprowski
     [not found] ` <1270118151-13286-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2010-04-01 11:17   ` jassi brar
     [not found]     ` <i2r1b68c6791004010417q1aaa996au22f526afbedb9635-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-01 13:10       ` Marek Szyprowski
2010-06-01 11:48   ` Marek Szyprowski
     [not found]     ` <001701cb0180$60f0b320$22d21960$%szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2010-06-01 14:59       ` Grant Likely
     [not found]         ` <AANLkTilQ5yD16LAq4xEmXKAmrNqO8eWFh0BmHPd2cR0q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-02  6:00           ` Marek Szyprowski
     [not found]             ` <002b01cb0218$ddab68e0$99023aa0$%szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2010-06-02  9:00               ` Jassi Brar
     [not found]                 ` <AANLkTim-yZb55jAyOaQJ_pOnp-LcXh-wdzw4TKqAyfea-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-09  7:14                   ` Marek Szyprowski
     [not found]                     ` <000301cb07a3$679c6ec0$36d54c40$%szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2010-06-16 19:52                       ` Grant Likely [this message]
     [not found]                         ` <AANLkTimT_IHfv4dKXuvTpa8M4L_MDqIvjrDPBLgzKUWn-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-17  6:54                           ` Marek Szyprowski

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=AANLkTimT_IHfv4dKXuvTpa8M4L_MDqIvjrDPBLgzKUWn@mail.gmail.com \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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).