From patchwork Thu May 5 06:51:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 756002 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p456pEaJ021009 for ; Thu, 5 May 2011 06:51:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751950Ab1EEGvM (ORCPT ); Thu, 5 May 2011 02:51:12 -0400 Received: from webbox687.server-home.net ([195.149.74.151]:52584 "EHLO webbox687.server-home.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751967Ab1EEGvL (ORCPT ); Thu, 5 May 2011 02:51:11 -0400 Received: from comm.systec-electronic.de (178-25-116-119-dynip.superkabel.de [178.25.116.119]) by webbox687.server-home.net (Postfix) with ESMTP id 65C7F778020; Thu, 5 May 2011 08:51:10 +0200 (CEST) Received: from ws-stein.systec-electronic.de (unknown [192.168.10.93]) by comm.systec-electronic.de (Postfix) with ESMTP id 2EC2897C068; Thu, 5 May 2011 08:51:10 +0200 (CEST) From: Alexander Stein To: "linux-input@vger.kernel.org" Cc: Dmitry Torokhov , Alexander Stein Subject: [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Date: Thu, 5 May 2011 08:51:07 +0200 Message-Id: <1304578268-24887-1-git-send-email-alexander.stein@systec-electronic.com> X-Mailer: git-send-email 1.7.3.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 05 May 2011 06:51:14 +0000 (UTC) req.sample needs its own cacheline otherwise accessing req.msg fetches it in again. Note: This effect doesn't occur if the underlying SPI driver doesn't use DMA at all. Signed-off-by: Alexander Stein Acked-by: Jonathan Cameron --- This obsoletes the patch [PATCH 1/2] ads7846: Make buffers in ads7846_read12_ser and ads7845_read12_ser DMA save drivers/input/touchscreen/ads7846.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index c24946f..ab51a8d 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -281,17 +281,25 @@ struct ser_req { u8 command; u8 ref_off; u16 scratch; - __be16 sample; struct spi_message msg; struct spi_transfer xfer[6]; + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + __be16 sample ____cacheline_aligned; }; struct ads7845_ser_req { u8 command[3]; u8 pwrdown[3]; - u8 sample[3]; struct spi_message msg; struct spi_transfer xfer[2]; + /* + * DMA (thus cache coherency maintenance) requires the + * transfer buffers to live in their own cache lines. + */ + u8 sample[3] ____cacheline_aligned; }; static int ads7846_read12_ser(struct device *dev, unsigned command)