public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Street <stephen@streetfiresound.com>
To: Manish Jaggi <manish.jaggi@gmail.com>
Cc: David Brownell <david-b@pacbell.net>,
	spi-devel-general@lists.sourceforge.net,
	Luke Yang <luke.adi@gmail.com>,
	dbrownell@users.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [spi-devel-general] [Patch] Add spi full duplex mode transfer support
Date: Wed, 30 Aug 2006 08:56:58 -0700	[thread overview]
Message-ID: <1156953418.6555.13.camel@localhost> (raw)
In-Reply-To: <2e2add590608300337h3e7e806bs69b63b24d73a104c@mail.gmail.com>

On Wed, 2006-08-30 at 16:07 +0530, Manish Jaggi wrote:
> On the same lines can we have a member in spi_transfer structure
> like bUseDMA.
> 
> In spi PIO mode for short writes of 2 to 8 words is better.
> And we use DMA for larger writes/reads
> 
This capability is built into the pxa2xx_spi driver.  

Excerpt from linux/Documentation/spi/pxa2xx:

The pxa2xx_spi driver support both DMA and interrupt driven PIO message
transfers.  The driver defaults to PIO mode and DMA transfers must
enabled by setting the "enable_dma" flag in the "pxa2xx_spi_master"
structure and and ensuring that the "pxa2xx_spi_chip.dma_burst_size"
field is non-zero.  The DMA mode support both coherent and stream based
DMA mappings.

The following logic is used to determine the type of I/O to be used on
a per "spi_transfer" basis:

if !enable_dma or dma_burst_size == 0 then
        always use PIO transfers

if spi_message.is_dma_mapped 
   and rx_dma_buf != 0 and tx_dma_buf != 0 then
        use coherent DMA mode

if rx_buf and tx_buf are aligned on 8 byte boundary then
        use streaming DMA mode

otherwise
        use PIO transfer

By enabling DMA tranfers, clearing the spi_message.is_dma_mapped and
providing transfer buffer NOT aligned on 8 byte boundary forced PIO mode
will transfer buffers aligned on 8 byte boundary forces a DMA mode.

My experiance has shown the most stack allocated transfer buffers are
not 8 byte aligned and thus use PIO mode.

Stephen


  parent reply	other threads:[~2006-08-30 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-30  4:40 [Patch] Add spi full duplex mode transfer support Luke Yang
2006-08-30  4:52 ` [spi-devel-general] " David Brownell
     [not found]   ` <2e2add590608300337h3e7e806bs69b63b24d73a104c@mail.gmail.com>
2006-08-30 15:35     ` David Brownell
2006-08-30 15:56     ` Stephen Street [this message]
2006-08-30 16:26       ` David Brownell

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=1156953418.6555.13.camel@localhost \
    --to=stephen@streetfiresound.com \
    --cc=david-b@pacbell.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke.adi@gmail.com \
    --cc=manish.jaggi@gmail.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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