mvebu: backport mainline patches from kernel 3.13
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0129-mtd-nand-pxa3xx-Move-DMA-I-O-enabling.patch
1 From 18166290599760e8ff1b6c0389834beafd09a517 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Fri, 4 Oct 2013 15:30:37 -0300
4 Subject: [PATCH 129/203] mtd: nand: pxa3xx: Move DMA I/O enabling
5
6 Instead of setting info->dma each time a command is prepared,
7 we can move it after the DMA buffers are allocated.
8
9 This is more clear and it's the proper place to enable this, given
10 DMA cannot be turned on and off during runtime.
11
12 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
13 Tested-by: Daniel Mack <zonque@gmail.com>
14 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
15 ---
16  drivers/mtd/nand/pxa3xx_nand.c | 6 +++++-
17  1 file changed, 5 insertions(+), 1 deletion(-)
18
19 --- a/drivers/mtd/nand/pxa3xx_nand.c
20 +++ b/drivers/mtd/nand/pxa3xx_nand.c
21 @@ -540,7 +540,6 @@ static int prepare_command_pool(struct p
22         info->oob_size          = 0;
23         info->use_ecc           = 0;
24         info->use_spare         = 1;
25 -       info->use_dma           = (use_dma) ? 1 : 0;
26         info->is_ready          = 0;
27         info->retcode           = ERR_NONE;
28         if (info->cs != 0)
29 @@ -950,6 +949,11 @@ static int pxa3xx_nand_init_buff(struct
30                 return info->data_dma_ch;
31         }
32  
33 +       /*
34 +        * Now that DMA buffers are allocated we turn on
35 +        * DMA proper for I/O operations.
36 +        */
37 +       info->use_dma = 1;
38         return 0;
39  }
40