From: Jonathan Cameron <jic23@kernel.org>
To: "Breana, Tiberiu A" <tiberiu.a.breana@intel.com>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 2/2] iio: accel: Add triggered buffer support for BMA220
Date: Sun, 1 May 2016 19:07:51 +0100 [thread overview]
Message-ID: <1266e70f-66d6-67f4-024a-a94fa5535a1f@kernel.org> (raw)
In-Reply-To: <4586F61A4A291F4DA44D32824E7C0F402358932C@IRSMSX109.ger.corp.intel.com>
On 29/04/16 13:41, Breana, Tiberiu A wrote:
>> -----Original Message-----
>> From: linux-iio-owner@vger.kernel.org [mailto:linux-iio-
>> owner@vger.kernel.org] On Behalf Of Peter Meerwald-Stadler
>> Sent: Friday, April 29, 2016 2:25 PM
>> To: Breana, Tiberiu A <tiberiu.a.breana@intel.com>
>> Cc: linux-iio@vger.kernel.org; Jonathan Cameron <jic23@kernel.org>
>> Subject: Re: [PATCH 2/2] iio: accel: Add triggered buffer support for BMA220
>>
>>
>>> Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
>>
>> comments below
>>
>>> ---
>>> drivers/iio/accel/bma220_spi.c | 67
>>> ++++++++++++++++++++++++++++++++++++++++--
>>> 1 file changed, 65 insertions(+), 2 deletions(-)
>>>
>
> <snip>
>
>>> -70,6 +84,42 @@ static inline int bma220_read_reg(struct spi_device *spi,
>> u8 reg)
>>> return spi_w8r8(spi, reg | BMA220_READ_MASK); }
>>>
>>> +static irqreturn_t bma220_trigger_handler(int irq, void *p) {
>>> + int i;
>>> + int ret;
>>> + int bit;
>>> + struct iio_poll_func *pf = p;
>>> + struct iio_dev *indio_dev = pf->indio_dev;
>>> + struct bma220_data *data = iio_priv(indio_dev);
>>> + struct spi_device *spi = data->spi_device;
>>> + u8 tx_buf = BMA220_REG_ACCEL_X | BMA220_READ_MASK;
>>> + u8 rx_buf[3];
>>
>> alignment requirements for SPI?
>
> I'm not sure what you mean by this. The chip seems to respond correctly
> to the testing I've done so far.
>
If an spi master is doing DMA (which you obviously can't control in a generic
driver) then there is no explicit protection of the cacheline. Thus it is possible
for the dma engine to spat garbage over the top of whatever else is in the cacheline
(usually a case of putting back an older version that is now wrong).
Thus buffers for DMA should existing in their own cacheline. There are two easy
ways to do this - kmalloc the buffer as ever separate allocation will end up in it's
own cacheline. Or put the buffer in your bma220_data (at the end) and use the
magic of ____cacheline_aligned markings for tx (with rx after it). We very carefully
ensure the whole priv data is cacheline aligned to allow this to work in drivers.
> Tiberiu
>
prev parent reply other threads:[~2016-05-01 21:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 11:07 [PATCH 0/2] Add support for the Bosch BMA220 accelerometer Tiberiu Breana
2016-04-29 11:07 ` [PATCH 1/2] iio: accel: Add support for Bosch BMA220 Tiberiu Breana
2016-04-29 11:19 ` Peter Meerwald-Stadler
2016-04-29 11:07 ` [PATCH 2/2] iio: accel: Add triggered buffer support for BMA220 Tiberiu Breana
2016-04-29 11:24 ` Peter Meerwald-Stadler
2016-04-29 12:41 ` Breana, Tiberiu A
2016-05-01 18:07 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266e70f-66d6-67f4-024a-a94fa5535a1f@kernel.org \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=tiberiu.a.breana@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).