lkml.org 
[lkml]   [2013]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 07/11] spi/pxa2xx: add support for DMA engine
From
On Mon, Jan 7, 2013 at 11:44 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:

> In order to use DMA with this driver on non-PXA platforms we implement support
> for the generic DMA engine API. This allows to use different DMA engines with
> little or no modification to the driver.
>
> Request lines and channel numbers can be passed to the driver from the
> platform specific data.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> drivers/spi/spi-pxa2xx.c | 351 +++++++++++++++++++++++++++++++++++++++-
> include/linux/spi/pxa2xx_spi.h | 6 +

So if the other DMA implementation could go into spi-pxa2xx-pxadma.c
this could be spi-pxa2xx-dma.c and they could use the common header
file spi-pxa2xx-dma.h and then Kconfig select which one to compile.

Just a suggestion to get the driver more readable.

> + /*
> + * Some DMA controllers have problems transferring buffers that are
> + * not multiple of 4 bytes. So we truncate the transfer so that it
> + * is suitable for such controllers, and handle the trailing bytes
> + * manually after the DMA completes.
> + */
> + len = ALIGN(drv_data->len, 4);

This is actually a property of the DMA controller.

struct dma_device already has this:

* @copy_align: alignment shift for memcpy operations
* @xor_align: alignment shift for xor operations
* @pq_align: alignment shift for pq operations
* @fill_align: alignment shift for memset operations
(...)
u8 copy_align;
u8 xor_align;
u8 pq_align;
u8 fill_align;

To align memcpy's on 4 bytes you can e.g. set .copy_align
to 2.

So the syntax is number of shifts 1 << 2 = 4.

If slave transfers can expose the same type of property we should
maybe introdyce .slave_align in the same manner so you don't have
to assume the worst in the driver.

Vinod/Dan? What do you say about this?

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2013-01-17 11:21    [W:0.155 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site