From: David Brownell <david-b@pacbell.net>
To: Barry Song <21cnbao@gmail.com>
Cc: "Song, Barry" <Barry.Song@analog.com>,
Mike Frysinger <vapier.adi@gmail.com>,
dtor@mail.ru, dmitry.torokhov@gmail.com,
spi-devel-general@lists.sourceforge.net,
linux-input@vger.kernel.org,
uclinux-dist-devel@blackfin.uclinux.org
Subject: Re: [Uclinux-dist-devel] [PATCH 2/2] add ad714x input driver forbutton/scrollwhell/slider/touchpad
Date: Wed, 2 Sep 2009 01:41:13 -0700 [thread overview]
Message-ID: <200909020141.13810.david-b@pacbell.net> (raw)
In-Reply-To: <3c17e3570909020051lfec50ecr77796655d75e12ca@mail.gmail.com>
On Wednesday 02 September 2009, Barry Song wrote:
> David,
> I am really surprised the kmalloc memory can keep DMA-safe.
Then you need to internalize more of the docs on the DMA
calls ... :)
Notably see in Documentation/DMA-mapping.txt the section up top
where it describes what memory can be used for DMA, and very
explicitly states stack data is not appropriate.
> Check the
> code, no matter spi_write_then_read and spi_init, they only get memory
> by a simple
> kmalloc(SPI_BUFSIZ, GFP_KERNEL);
> I can't find map_single or dma coherent operations at all. So did I
> lose something?
When the SPI master controller driver uses DMA and the caller
doesn't set up mappings, that controller driver does the DMA
mapping operations. That's what those code paths rely on.
You're writing code sitting a layer above that driver for the
SPI master controller. Your code won't know whether DMA will
be used or not, so your code must either (a) use DMA-safe buffers
in the first place, or else (b) use spi_write_then_read() which
provides a small bounce buffer. A non-option is (c) write your
code so it breaks on controllers that use DMA.
- Dave
> Thanks
> Barry
>
> On 9/2/09, David Brownell <david-b@pacbell.net> wrote:
> > On Tuesday 01 September 2009, Song, Barry wrote:
> >> >> + spi_message_add_tail(&t, &m);
> >> >> + ret = spi_sync(spi, &m);
> >> >
> >> >cant you use spi_write_then_read() ? dont let the u8* prototype scare
> >> >you, it should work with writing 16bits and then reading 16bits.
> >>
> >> I have never been scared by any u8* or something else. I only prefer
> >> to use raw spi API, which can show the bottom level timing and SPI
> >> bus feature better.
> >
> > In this case spi_write_then_read() is required, since
> > your tx and rx buffers are on the stack and hence not
> > DMA-safe.
> >
>
>
next prev parent reply other threads:[~2009-09-02 8:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 3:55 [PATCH 0/2] add ad714x captouch sensor input driver Barry Song
2009-09-01 3:55 ` [PATCH 1/2] add ad714x platform_data definition Barry Song
2009-09-01 3:55 ` [PATCH 2/2] add ad714x input driver for button/scrollwhell/slider/touchpad Barry Song
[not found] ` <1251777330-16994-3-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-09-01 19:30 ` Mike Frysinger
[not found] ` <8bd0f97a0909011230r50cb532ep46db64d65cbb49e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-02 2:04 ` [Uclinux-dist-devel] " David Brownell
2009-09-02 2:46 ` [Uclinux-dist-devel] [PATCH 2/2] add ad714x input driver forbutton/scrollwhell/slider/touchpad Song, Barry
2009-09-02 3:09 ` Mike Frysinger
2009-09-02 3:17 ` Song, Barry
2009-09-02 9:50 ` [Uclinux-dist-devel] [PATCH 2/2] add ad714x input driverforbutton/scrollwhell/slider/touchpad Robin Getz
2009-09-02 9:48 ` Mike Frysinger
[not found] ` <0F1B54C89D5F954D8535DB252AF412FA04A5CADA-SGdA1W8gREmuVPpjEGsWsTcYPEmu4y7e@public.gmane.org>
2009-09-02 4:31 ` [Uclinux-dist-devel] [PATCH 2/2] add ad714x input driver forbutton/scrollwhell/slider/touchpad David Brownell
2009-09-02 7:51 ` Barry Song
2009-09-02 8:37 ` Song, Barry
2009-09-02 8:41 ` David Brownell [this message]
2009-09-02 1:51 ` [PATCH 2/2] add ad714x input driver for button/scrollwhell/slider/touchpad David Brownell
2009-09-02 6:26 ` [Uclinux-dist-devel] [PATCH 2/2] add ad714x input driver forbutton/scrollwhell/slider/touchpad Song, Barry
2009-09-08 6:34 ` [PATCH 2/2] add ad714x input driver for button/scrollwhell/slider/touchpad Dmitry Torokhov
2009-09-08 6:48 ` [Uclinux-dist-devel] [PATCH 2/2] add ad714x input driverfor button/scrollwhell/slider/touchpad Song, Barry
2009-09-01 18:41 ` [Uclinux-dist-devel] [PATCH 1/2] add ad714x platform_data definition Mike Frysinger
2009-09-02 2:09 ` [Uclinux-dist-devel] [PATCH 1/2] add ad714x platform_datadefinition Song, Barry
[not found] ` <1251777330-16994-2-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-09-02 1:57 ` [PATCH 1/2] add ad714x platform_data definition David Brownell
2009-09-02 4:47 ` [Uclinux-dist-devel] [PATCH 1/2] add ad714x platform_datadefinition Song, Barry
[not found] ` <0F1B54C89D5F954D8535DB252AF412FA04A96A41-SGdA1W8gREmuVPpjEGsWsTcYPEmu4y7e@public.gmane.org>
2009-09-02 5:14 ` David Brownell
2009-09-02 5:24 ` [Uclinux-dist-devel] " Song, Barry
2009-09-02 12:16 ` [spi-devel-general] [PATCH 1/2] add ad714x platform_data definition Bill Gatliff
2009-09-01 18:46 ` [Uclinux-dist-devel] [PATCH 0/2] add ad714x captouch sensor input driver Mike Frysinger
[not found] ` <8bd0f97a0909011146t210cbacbx6b0fa323242ac3d3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-02 1:52 ` David Brownell
2009-09-02 2:08 ` [Uclinux-dist-devel] [PATCH 0/2] add ad714x captouch sensorinput driver Song, Barry
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=200909020141.13810.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=21cnbao@gmail.com \
--cc=Barry.Song@analog.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dtor@mail.ru \
--cc=linux-input@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier.adi@gmail.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 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).