* [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save
@ 2011-05-05 6:51 Alexander Stein
2011-05-05 6:51 ` [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req Alexander Stein
2011-05-05 9:06 ` [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Jonathan Cameron
0 siblings, 2 replies; 4+ messages in thread
From: Alexander Stein @ 2011-05-05 6:51 UTC (permalink / raw)
To: linux-input@vger.kernel.org; +Cc: Dmitry Torokhov, Alexander Stein
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 <alexander.stein@systec-electronic.com>
---
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)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req
2011-05-05 6:51 [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Alexander Stein
@ 2011-05-05 6:51 ` Alexander Stein
2011-05-05 9:06 ` [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Jonathan Cameron
1 sibling, 0 replies; 4+ messages in thread
From: Alexander Stein @ 2011-05-05 6:51 UTC (permalink / raw)
To: linux-input@vger.kernel.org; +Cc: Dmitry Torokhov, Alexander Stein
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
This obsolets the patch
[PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req
drivers/input/touchscreen/ads7846.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index ab51a8d..1de1c19 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -292,7 +292,6 @@ struct ser_req {
struct ads7845_ser_req {
u8 command[3];
- u8 pwrdown[3];
struct spi_message msg;
struct spi_transfer xfer[2];
/*
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save
2011-05-05 6:51 [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Alexander Stein
2011-05-05 6:51 ` [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req Alexander Stein
@ 2011-05-05 9:06 ` Jonathan Cameron
2011-05-05 16:15 ` Dmitry Torokhov
1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2011-05-05 9:06 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-input@vger.kernel.org, Dmitry Torokhov
On 05/05/11 07:51, Alexander Stein wrote:
> 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.
I would say the comment is a bit obvious, but then you are fixing a bug
because it was wrong - so fair call.
>
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> 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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save
2011-05-05 9:06 ` [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Jonathan Cameron
@ 2011-05-05 16:15 ` Dmitry Torokhov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2011-05-05 16:15 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Alexander Stein, linux-input@vger.kernel.org
On Thu, May 05, 2011 at 10:06:30AM +0100, Jonathan Cameron wrote:
> On 05/05/11 07:51, Alexander Stein wrote:
> > 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.
> I would say the comment is a bit obvious, but then you are fixing a bug
> because it was wrong - so fair call.
> >
> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Both applied, thanks Alexander and Jonathan.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-05 16:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05 6:51 [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Alexander Stein
2011-05-05 6:51 ` [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req Alexander Stein
2011-05-05 9:06 ` [PATCH 1/2] ads7846: Make buffers in struct ser_req and struct ads7845_ser_req DMA save Jonathan Cameron
2011-05-05 16:15 ` Dmitry Torokhov
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).