Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: atmel_nand: add a new dt binding item for nand dma support

This patch will set the nand dma support in dts. Since we will not use
cpu_is_xxx() in nand driver. We needn't include the mach/cpu.h any more.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Josh Wu and committed by
David Woodhouse
1b719265 71b94e2e

+5 -8
+1
Documentation/devicetree/bindings/mtd/atmel-nand.txt
··· 15 15 optional gpio and may be set to 0 if not present. 16 16 17 17 Optional properties: 18 + - atmel,nand-has-dma : boolean to support dma transfer for nand read/write. 18 19 - nand-ecc-mode : String, operation mode of the NAND ecc mode, soft by default. 19 20 Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first", 20 21 "soft_bch".
+3 -8
drivers/mtd/nand/atmel_nand.c
··· 43 43 #include <linux/platform_data/atmel.h> 44 44 #include <linux/pinctrl/consumer.h> 45 45 46 - #include <mach/cpu.h> 47 - 48 46 static int use_dma = 1; 49 47 module_param(use_dma, int, 0); 50 48 ··· 125 127 }; 126 128 127 129 static struct nand_ecclayout atmel_pmecc_oobinfo; 128 - 129 - static int cpu_has_dma(void) 130 - { 131 - return cpu_is_at91sam9rl() || cpu_is_at91sam9g45(); 132 - } 133 130 134 131 /* 135 132 * Enable NAND. ··· 1329 1336 1330 1337 board->on_flash_bbt = of_get_nand_on_flash_bbt(np); 1331 1338 1339 + board->has_dma = of_property_read_bool(np, "atmel,nand-has-dma"); 1340 + 1332 1341 if (of_get_nand_bus_width(np) == 16) 1333 1342 board->bus_width_16 = 1; 1334 1343 ··· 1595 1600 nand_chip->bbt_options |= NAND_BBT_USE_FLASH; 1596 1601 } 1597 1602 1598 - if (!cpu_has_dma()) 1603 + if (!host->board.has_dma) 1599 1604 use_dma = 0; 1600 1605 1601 1606 if (use_dma) {
+1
include/linux/platform_data/atmel.h
··· 71 71 u8 on_flash_bbt; /* bbt on flash */ 72 72 struct mtd_partition *parts; 73 73 unsigned int num_parts; 74 + bool has_dma; /* support dma transfer */ 74 75 75 76 /* default is false, only for at32ap7000 chip is true */ 76 77 bool need_reset_workaround;