linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ads7846: ads7846_read12_ser is not DMA save
@ 2011-05-04 14:02 Alexander Stein
  2011-05-04 14:17 ` Hennerich, Michael
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2011-05-04 14:02 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov

Hello,

I just encountered a problem on my ARMv5 (AT91SAM9263 based) board while using 
ads7843 or ads7846 (I replaced it). I tried reading 
/sys/class/hwmon/hwmon0/device/in0_input and got 0 most of the time. Sometimes 
the correct voltage was shown.
After digging a bit in the code I found out that sample (and command for Tx) 
from the following struct gets DMA mapped by the underlying atmel_spi driver 
for SPI Rx-Buffer.

struct ser_req {
	u8			ref_on;
	u8			command;
	u8			ref_off;
	u16			scratch;
	__be16			sample;
	struct spi_message	msg;
	struct spi_transfer	xfer[6];
};

The atmel_spi driver does proper dma_{,un}map_signgle on the Rx and Tx 
buffers. Now when the cache line for scratch is cleared and invalidated and 
the spi subsystem access msg (and maybe xfer) the cache line gets filled 
again, rendering the cache clear and invalidation before as useless.
As the ARMv5 core has 32Byte cache lines I added "char dummy[25];" after 
sample, so the spi structs are in a different cache line.
But this seem only to be a workaround as the cache lines might differ across 
each CPU.
Somebody an idea how to fix this in general?

Regards,
Alexander

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-05  1:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 14:02 ads7846: ads7846_read12_ser is not DMA save Alexander Stein
2011-05-04 14:17 ` Hennerich, Michael
2011-05-04 15:22   ` [PATCH 1/2] ads7846: Make buffers in ads7846_read12_ser and ads7845_read12_ser " Alexander Stein
2011-05-04 15:49     ` Jonathan Cameron
2011-05-04 15:55       ` Jonathan Cameron
2011-05-04 15:55       ` Alexander Stein
2011-05-04 16:07         ` Jonathan Cameron
2011-05-05  1:31         ` Dmitry Torokhov
2011-05-04 15:22   ` [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req Alexander Stein

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).