Re: [PATCH 2/2] mtd: sh_flctl: Use DMA for data fifo FLTDFIFO when available

Vikram Narayanan
2012-09-23T14:32:42Z

On 9/23/2012 5:31 PM, Bastian Hecht wrote:
> Map and unmap DMA buffers, trigger the DMA and wait for the completion.
> On failure we fallback to PIO mode.
>
> Signed-off-by: Bastian Hecht<hechtb@gmail.com>
> ---
> drivers/mtd/nand/sh_flctl.c | 99 +++++++++++++++++++++++++++++++++++++++++-
> include/linux/mtd/sh_flctl.h | 1 +
> 2 files changed, 98 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> index 2cf6871..00211f9 100644
> --- a/drivers/mtd/nand/sh_flctl.c
> +++ b/drivers/mtd/nand/sh_flctl.c
> @@ -24,6 +24,8 @@
> #include<linux/module.h>
> #include<linux/kernel.h>
> #include<linux/delay.h>
> +#include<linux/dmaengine.h>
> +#include<linux/dma-mapping.h>
> #include<linux/interrupt.h>
> #include<linux/io.h>
> #include<linux/platform_device.h>
> @@ -106,6 +108,13 @@ static void wait_completion(struct sh_flctl *flctl)
> writeb(0x0, FLTRCR(flctl));
> }
>
> +static void flctl_dma_complete(void *param)
> +{
> + struct sh_flctl *flctl = param;
> +
> + complete(&flctl->dma_complete);
> +}
> +
> static void set_addr(struct mtd_info *mtd, int column, int page_addr)
> {
> struct sh_flctl *flctl = mtd_to_flctl(mtd);
> @@ -261,6 +270,71 @@ static void wait_wecfifo_ready(struct sh_flctl *flctl)
> timeout_error(flctl, __func__);
> }
>
> +static void flctl_release_dma(struct sh_flctl *flctl);

I don't think the above statement is required.

~Vikram