David Brownell | 16 Sep 01:30

[patch 2.6.27-rc6] ads7846: work better with DMA

From: David Brownell <dbrownell <at> users.sourceforge.net>

We had a report a while back that the ads7846 driver had some issues
when used with DMA-based SPI controllers (like atmel_spi) on systems
where main memory is not DMA-coherent (most non-x86 boards) ... but no
mergeable patch addressed it.  Pending any more comprehensive fix,
just push the relevant data into cache lines that won't be shared,
preventing those issues (but not in a very pretty way).

Signed-off-by: David Brownell <dbrownell <at> users.sourceforge.net>
---
Please merge for 2.6.27-final (and forward to -stable for backports);
this lack-of-patch has lingered for way too long.

 drivers/input/touchscreen/ads7846.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -85,10 +85,6 @@ struct ads7846 {
 	u16			x_plate_ohms;
 	u16			pressure_max;

-	u8			read_x, read_y, read_z1, read_z2, pwrdown;
-	u16			dummy;		/* for the pwrdown read */
-	struct ts_event		tc;
-
 	struct spi_transfer	xfer[18];
 	struct spi_message	msg[5];
 	struct spi_message	*last_msg;
(Continue reading)

Dmitry Torokhov | 16 Sep 21:21

Re: [patch 2.6.27-rc6] ads7846: work better with DMA

On Mon, Sep 15, 2008 at 04:32:17PM -0700, David Brownell wrote:
> From: David Brownell <dbrownell <at> users.sourceforge.net>
> 
> We had a report a while back that the ads7846 driver had some issues
> when used with DMA-based SPI controllers (like atmel_spi) on systems
> where main memory is not DMA-coherent (most non-x86 boards) ... but no
> mergeable patch addressed it.  Pending any more comprehensive fix,
> just push the relevant data into cache lines that won't be shared,
> preventing those issues (but not in a very pretty way).
> 

How about this one? Because the change is purely mechanical I feel
pretty safe about it...

--

-- 
Dmitry

Input: ads7846 - fix cache line sharing issue

We had a report a while back that the ads7846 driver had some issues
when used with DMA-based SPI controllers (like atmel_spi) on systems
where main memory is not DMA-coherent (most non-x86 boards). Allocate
memory potentially used for DMA separately to avoid cache line issues.

Reported-by: David Brownell <dbrownell <at> users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor <at> mail.ru>
---

 drivers/input/touchscreen/ads7846.c |   87 +++++++++++++++++++++--------------
 1 files changed, 51 insertions(+), 36 deletions(-)
(Continue reading)

David Brownell | 7 Oct 01:57

Re: [patch 2.6.27-rc6] ads7846: work better with DMA

On Tuesday 16 September 2008, Dmitry Torokhov wrote:
> On Mon, Sep 15, 2008 at 04:32:17PM -0700, David Brownell wrote:
> > From: David Brownell <dbrownell@...>
> > 
> > We had a report a while back that the ads7846 driver had some issues
> > when used with DMA-based SPI controllers (like atmel_spi) on systems
> > where main memory is not DMA-coherent (most non-x86 boards) ... but no
> > mergeable patch addressed it.  Pending any more comprehensive fix,
> > just push the relevant data into cache lines that won't be shared,
> > preventing those issues (but not in a very pretty way).
> > 
> 
> How about this one? Because the change is purely mechanical I feel
> pretty safe about it...

Looks OK to me ... sorry for the delayed response.

Nicolas:  this may be useful on the at91sam926[03] EK boards.

> 
> -- 
> Dmitry
> 
> 
> Input: ads7846 - fix cache line sharing issue
> 
> We had a report a while back that the ads7846 driver had some issues
> when used with DMA-based SPI controllers (like atmel_spi) on systems
> where main memory is not DMA-coherent (most non-x86 boards). Allocate
> memory potentially used for DMA separately to avoid cache line issues.
(Continue reading)


Gmane