ads7846: ads7846_read12_ser is not DMA save

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux