All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Vitaly Wool <vwool@ru.mvista.com>
Cc: linux-kernel@vger.kernel.org, dpervushin@gmail.com,
	akpm@osdl.org, greg@kroah.com, basicmark@yahoo.com,
	komal_shah802003@yahoo.com, stephen@streetfiresound.com,
	spi-devel-general@lists.sourceforge.net, Joachim_Jaeger@digi.com
Subject: Re: [PATCH/RFC] SPI:  async message handing library update
Date: Thu, 22 Dec 2005 09:28:33 -0800	[thread overview]
Message-ID: <200512220928.34457.david-b@pacbell.net> (raw)
In-Reply-To: <43A84730.9020602@ru.mvista.com>

On Tuesday 20 December 2005 10:02 am, Vitaly Wool wrote:
> Hi David --
> 
> just a cuple of notes here and below...
> 
> General one: how is it supposed to set SPI bus clock in this model? I 
> guess that the only option is to set it in txrx_*.

No, as I said separately:  the standard spi_master.setup() call does
this.  Things are arranged so that drivers using this code can splice
in their own code for it ... true bitbangers won't, because the
delays in the I/O loops suffice.  But drivers using "word-at-a-time"
controllers (hardware-assisted shift registers!) will, as will ones
that do "buffer-at-a-time" I/O (e.g. to stuff/unstuff fifos, or set
up non-queued DMA).


> >	if (!spi->max_speed_hz)
> >		spi->max_speed_hz = 500 * 1000;
> >
> >	/* nsecs = max(50, (clock period)/2), be optimistic */
> >	cs->nsecs = (1000000000/2) / (spi->max_speed_hz);
> >	if (cs->nsecs < 50)
> >		cs->nsecs = 50;
> >  
> >
> Suggest not to hardcode values here.

I suppose it'd make sense to just fail if max_speed_hz is invalid,
and if there's some board that an bitbang at over 10MHz we should
avoid getting in its way.


> >			/* set up default clock polarity, and activate chip */
> >			if (!chipselect) {
> >				bitbang->chipselect(spi, 1);
> >				ndelay(nsecs);
> >  
> >
> Suggest special enum/define for chipselect value.

Added.  Instead of "1", "BITBANG_CS_ACTIVE" ... which will normally
pull the nCS line low (after setting clock to match CPOL).


> >			/* protocol tweaks before next transfer */
> >			if (t->delay_usecs)
> >				udelay(t->delay_usecs);
> >  
> >
> Suggest nsecs here as well.

The relevant chip delays seem to be specified in usecs ... I don't
like using nsecs for the clock timings, but without doing that it'd
be impractical to define rates at the levels the hardware actually
uses.  There are still some "nsec" leakages out of the real-bitbang
code up to the next level, fixable over time.

 
> >                               /* FIXME if bitbang->use_dma, dma_map_single()
> >                                * before the transfer, and dma_unmap_single()
> >                                * afterwards, for either or both buffers...
> >                                */  
> 
> please *please* *_please_*!!! don't do it! :)
> Let the controller driver do it *only in case it's not working in PIO!*

OK.  That'd be more work for the controller driver, but you're
right that a lot of the drivers using these utilities are rather
likely to be PIO-oriented.  If they want DMA speedups, they can
do the mappings themselves (in cases where the driver didn't
do them already).


> Another one: I just feel comfortabel with using 'bitbang' term for the 
> variety of SPI stuff which this library suits.

You _do_ feel comfortable with it?  I actually feel a bit odd, since
only one of the three driver types is really bitbanging.  And in fact
it still bothers me that the other two tie down a task, but that's
the price for reusing common infrastructure.

- Dave


  reply	other threads:[~2005-12-22 17:28 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12 15:20 [PATCH 2.6-git 0/4] SPI core refresh Vitaly Wool
2005-12-12 15:22 ` [PATCH 2.6-git 1/4] SPI core refresh: SPI core patch Vitaly Wool
2005-12-12 15:49   ` Russell King
2005-12-12 15:24 ` [PATCH 2.6-git 2/4] SPI core refresh: MTD dataflash driver Vitaly Wool
2005-12-12 15:26 ` [PATCH 2.6-git 3/4] SPI core refresh: SPI/PNX controller Vitaly Wool
2005-12-12 15:27 ` [PATCH 2.6-git 4/4] SPI core refresh: dumb EEPROM driver Vitaly Wool
2005-12-12 18:01 ` [PATCH 2.6-git 0/4] SPI core refresh Rui Sousa
2005-12-13 12:09   ` [spi-devel-general] " dmitry pervushin
2005-12-13 15:11     ` Rui Sousa
2005-12-13 17:06       ` dmitry pervushin
2005-12-14  6:57       ` Vitaly Wool
2005-12-14 14:28         ` Rui Sousa
2005-12-13 16:35     ` David Brownell
2005-12-13 18:02       ` Rui Sousa
2005-12-13 14:06 ` [PATCH/RFC] SPI: add async message handing library to David Brownell's core Vitaly Wool
2005-12-13 16:53   ` [PATCH/RFC] SPI: add DMAUNSAFE analog " Vitaly Wool
2005-12-13 19:01     ` David Brownell
2005-12-13 19:15       ` Greg KH
2005-12-14 13:50         ` Vitaly Wool
2005-12-14 17:18           ` Greg KH
2005-12-14 17:53             ` Vitaly Wool
2005-12-14 18:50               ` [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-14 19:29                 ` Vitaly Wool
2005-12-14 19:02               ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core David Brownell
2005-12-14 19:19                 ` Vitaly Wool
2005-12-14 19:33                   ` [spi-devel-general] Re: [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-14 19:34                 ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core Vitaly Wool
2005-12-15  6:47                 ` Vitaly Wool
2005-12-15 16:44                   ` Greg KH
2005-12-15 22:23                     ` Vitaly Wool
2005-12-15 23:02                       ` Greg KH
2005-12-16  8:37                         ` Vitaly Wool
2005-12-16 17:34                           ` Greg KH
2005-12-16 18:32                             ` [spi-devel-general] Re: [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-15 20:06                   ` David Brownell
2005-12-15 22:17                     ` Vitaly Wool
2005-12-15 22:33                       ` Greg KH
2005-12-16  3:34                         ` Andy Isaacson
2005-12-16  5:17                           ` Greg KH
2005-12-14 19:16               ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core Greg KH
2005-12-14 19:30                 ` Vitaly Wool
2005-12-15 10:00               ` [spi-devel-general] " dmitry pervushin
2005-12-14 17:22           ` David Brownell
2005-12-14 17:50             ` Vitaly Wool
2005-12-14 19:17               ` [PATCH/RFC] SPI: add DMAUNSAFE analog David Brownell
2005-12-14 20:11                 ` Vitaly Wool
2005-12-13 21:47       ` [PATCH/RFC] SPI: add DMAUNSAFE analog to David Brownell's core Vitaly Wool
2005-12-13 22:15       ` Vitaly Wool
2005-12-14 16:55         ` David Brownell
2005-12-14 17:23           ` Vitaly Wool
2005-12-14 18:48   ` [PATCH/RFC] SPI: add async message handing library " Stephen Street
2005-12-14 19:41     ` Vitaly Wool
2005-12-14 21:19       ` Stephen Street
2005-12-14 19:31   ` [PATCH/RFC] SPI: add async message handing library David Brownell
2005-12-15 12:19   ` [PATCH/RFC] SPI: async message handing library update Vitaly Wool
2005-12-18 18:59     ` David Brownell
2005-12-19 15:40       ` [spi-devel-general] " dmitry pervushin
2005-12-20  7:23         ` David Brownell
2005-12-20 18:02       ` Vitaly Wool
2005-12-22 17:28         ` David Brownell [this message]
2005-12-22 22:10           ` Vitaly Wool
2005-12-22 23:55             ` David Brownell
2005-12-21 13:17       ` Vitaly Wool

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=200512220928.34457.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=Joachim_Jaeger@digi.com \
    --cc=akpm@osdl.org \
    --cc=basicmark@yahoo.com \
    --cc=dpervushin@gmail.com \
    --cc=greg@kroah.com \
    --cc=komal_shah802003@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=stephen@streetfiresound.com \
    --cc=vwool@ru.mvista.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 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.