[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdb+W5Xiek24X00p+bY8CaeErfCWuLqGOfeVTXCsi1KJxw@mail.gmail.com>
Date: Thu, 17 Jan 2013 10:48:15 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>,
Vinod Koul <vinod.koul@...el.com>, Dan Williams <djbw@...com>
Cc: linux-kernel@...r.kernel.org, grant.likely@...retlab.ca,
eric.y.miao@...il.com, linux@....linux.org.uk,
haojian.zhuang@...il.com, broonie@...nsource.wolfsonmicro.com,
chao.bi@...el.com, "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH 07/11] spi/pxa2xx: add support for DMA engine
On Mon, Jan 7, 2013 at 11:44 AM, Mika Westerberg
<mika.westerberg@...ux.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@...ux.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists