summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/atmel_nand.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/atmel_nand.c')
-rw-r--r--drivers/mtd/nand/atmel_nand.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 6fae04b3fc6d..950646aa4c4b 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -209,22 +209,8 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len,
int err = -EIO;
enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
- if (buf >= high_memory) {
- struct page *pg;
-
- if (((size_t)buf & PAGE_MASK) !=
- ((size_t)(buf + len - 1) & PAGE_MASK)) {
- dev_warn(host->dev, "Buffer not fit in one page\n");
- goto err_buf;
- }
-
- pg = vmalloc_to_page(buf);
- if (pg == 0) {
- dev_err(host->dev, "Failed to vmalloc_to_page\n");
- goto err_buf;
- }
- p = page_address(pg) + ((size_t)buf & ~PAGE_MASK);
- }
+ if (buf >= high_memory)
+ goto err_buf;
dma_dev = host->dma_chan->device;
@@ -280,7 +266,8 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
struct nand_chip *chip = mtd->priv;
struct atmel_nand_host *host = chip->priv;
- if (use_dma && len >= mtd->oobsize)
+ if (use_dma && len > mtd->oobsize)
+ /* only use DMA for bigger than oob size: better performances */
if (atmel_nand_dma_op(mtd, buf, len, 1) == 0)
return;
@@ -295,7 +282,8 @@ static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
struct nand_chip *chip = mtd->priv;
struct atmel_nand_host *host = chip->priv;
- if (use_dma && len >= mtd->oobsize)
+ if (use_dma && len > mtd->oobsize)
+ /* only use DMA for bigger than oob size: better performances */
if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0)
return;
@@ -599,7 +587,10 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
nand_chip->options |= NAND_USE_FLASH_BBT;
}
- if (cpu_has_dma() && use_dma) {
+ if (!cpu_has_dma())
+ use_dma = 0;
+
+ if (use_dma) {
dma_cap_mask_t mask;
dma_cap_zero(mask);
@@ -611,7 +602,8 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
}
}
if (use_dma)
- dev_info(host->dev, "Using DMA for NAND access.\n");
+ dev_info(host->dev, "Using %s for DMA transfers.\n",
+ dma_chan_name(host->dma_chan));
else
dev_info(host->dev, "No DMA support for NAND access.\n");