All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Ned Forrester <nforrester-/d+BM93fTQY@public.gmane.org>
Cc: spi-devel
	<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Vernon Sauder
	<vernoninhand-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"J. Scott Merritt" <merrij3-IL7dBOYR4Vg@public.gmane.org>
Subject: Re: SPI TX andRX buffer overlap
Date: Fri, 14 Nov 2008 20:41:01 -0800	[thread overview]
Message-ID: <200811142041.01410.david-b@pacbell.net> (raw)
In-Reply-To: <491E47BD.5080005-/d+BM93fTQY@public.gmane.org>

On Friday 14 November 2008, Ned Forrester wrote:
> David Brownell wrote:
> > Mapping any number of times *should* be OK -- unless one mapping
> > reports an error.  Or you do them in the wrong order (removing
> > cache entries before writing their data out to memory).
> 
> BINGO!  That was it.

Good news!  I haven't lost it yet.  ;)


> pxa2xx_spi has always done 
> 
> dma_map_single(..., rx, ..., DMA_FROM_DEVICE)
> 
> (thus invalidating the cache) before
> 
> dma_map_single(..., tx, ..., DMA_TO_DEVICE)
> 
> (thus copying possibly invalid data, if the buffers overlapped).
> 
> Thanks, it works now with a much more pleasant patch.

Yeah, mostly just swapping two blocks of code.  Much nicer.


> I never looked at 
> it that way before.  A patch will be coming soon.

Worth auditing the other SPI controller drivers too.  That'd
be easy to get wrong.  Hmmm ... au1550 and iMX goof it too,
while atmel_spi and omap2_mcspi get it right.  Wouldn't you
know ... the only DMA capable SPI drivers I used in DMA mode
don't have this problem.  ;)

- Dave
 
 
> -- 
> Ned Forrester                                       nforrester-/d+BM93fTQY@public.gmane.org
> Oceanographic Systems Lab                                  508-289-2226
> Applied Ocean Physics and Engineering Dept.
> Woods Hole Oceanographic Institution          Woods Hole, MA 02543, USA
> http://www.whoi.edu/sbl/liteSite.do?litesiteid=7212
> http://www.whoi.edu/hpb/Site.do?id=1532
> http://www.whoi.edu/page.do?pid=10079
> 
> 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

      parent reply	other threads:[~2008-11-15  4:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-13 20:02 SPI TX andRX buffer overlap Ned Forrester
     [not found] ` <491C87BF.6030905-/d+BM93fTQY@public.gmane.org>
2008-11-14 22:30   ` David Brownell
     [not found]     ` <200811141430.53146.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-14 23:01       ` Ned Forrester
     [not found]         ` <491E033E.9010008-/d+BM93fTQY@public.gmane.org>
2008-11-14 23:10           ` Ned Forrester
2008-11-14 23:41           ` David Brownell
     [not found]             ` <200811141541.46799.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-15  3:53               ` Ned Forrester
     [not found]                 ` <491E47BD.5080005-/d+BM93fTQY@public.gmane.org>
2008-11-15  4:41                   ` David Brownell [this message]

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=200811142041.01410.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=merrij3-IL7dBOYR4Vg@public.gmane.org \
    --cc=nforrester-/d+BM93fTQY@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=vernoninhand-Re5JQEeQqe8AvxtiuMwx3w@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 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.