diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-09 16:23:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-09 16:23:50 -0400 |
commit | 510ec7bc3bf6bc6d87662d16a6136135d747e535 (patch) | |
tree | c57d936028021c4f06c7bc4a020c431deecf4d35 /drivers | |
parent | 94c8a984ae2adbd9a9626fb42e0f2faf3e36e86f (diff) | |
parent | 80b4f81a49809774f1b123c456fb179e472dbd0e (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
mtd: atmel_nand: use CPU I/O when buffer is in vmalloc(ed) region
mtd: atmel_nand: modify test case for using DMA operations
mtd: atmel_nand: fix support for CPUs that do not support DMA access
mtd: atmel_nand: trivial: change DMA usage information trace
mtd: mtdswap: fix printk format warning
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/mtdswap.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 32 |
2 files changed, 13 insertions, 21 deletions
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index 237913c5c92c..fed215c4cfa1 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c | |||
@@ -1452,7 +1452,7 @@ static void mtdswap_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
1452 | oinfo = mtd->ecclayout; | 1452 | oinfo = mtd->ecclayout; |
1453 | if (!mtd->oobsize || !oinfo || oinfo->oobavail < MTDSWAP_OOBSIZE) { | 1453 | if (!mtd->oobsize || !oinfo || oinfo->oobavail < MTDSWAP_OOBSIZE) { |
1454 | printk(KERN_ERR "%s: Not enough free bytes in OOB, " | 1454 | printk(KERN_ERR "%s: Not enough free bytes in OOB, " |
1455 | "%d available, %lu needed.\n", | 1455 | "%d available, %zu needed.\n", |
1456 | MTDSWAP_PREFIX, oinfo->oobavail, MTDSWAP_OOBSIZE); | 1456 | MTDSWAP_PREFIX, oinfo->oobavail, MTDSWAP_OOBSIZE); |
1457 | return; | 1457 | return; |
1458 | } | 1458 | } |
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, | |||
209 | int err = -EIO; | 209 | int err = -EIO; |
210 | enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | 210 | enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE; |
211 | 211 | ||
212 | if (buf >= high_memory) { | 212 | if (buf >= high_memory) |
213 | struct page *pg; | 213 | goto err_buf; |
214 | |||
215 | if (((size_t)buf & PAGE_MASK) != | ||
216 | ((size_t)(buf + len - 1) & PAGE_MASK)) { | ||
217 | dev_warn(host->dev, "Buffer not fit in one page\n"); | ||
218 | goto err_buf; | ||
219 | } | ||
220 | |||
221 | pg = vmalloc_to_page(buf); | ||
222 | if (pg == 0) { | ||
223 | dev_err(host->dev, "Failed to vmalloc_to_page\n"); | ||
224 | goto err_buf; | ||
225 | } | ||
226 | p = page_address(pg) + ((size_t)buf & ~PAGE_MASK); | ||
227 | } | ||
228 | 214 | ||
229 | dma_dev = host->dma_chan->device; | 215 | dma_dev = host->dma_chan->device; |
230 | 216 | ||
@@ -280,7 +266,8 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) | |||
280 | struct nand_chip *chip = mtd->priv; | 266 | struct nand_chip *chip = mtd->priv; |
281 | struct atmel_nand_host *host = chip->priv; | 267 | struct atmel_nand_host *host = chip->priv; |
282 | 268 | ||
283 | if (use_dma && len >= mtd->oobsize) | 269 | if (use_dma && len > mtd->oobsize) |
270 | /* only use DMA for bigger than oob size: better performances */ | ||
284 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) | 271 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) |
285 | return; | 272 | return; |
286 | 273 | ||
@@ -295,7 +282,8 @@ static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) | |||
295 | struct nand_chip *chip = mtd->priv; | 282 | struct nand_chip *chip = mtd->priv; |
296 | struct atmel_nand_host *host = chip->priv; | 283 | struct atmel_nand_host *host = chip->priv; |
297 | 284 | ||
298 | if (use_dma && len >= mtd->oobsize) | 285 | if (use_dma && len > mtd->oobsize) |
286 | /* only use DMA for bigger than oob size: better performances */ | ||
299 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) | 287 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) |
300 | return; | 288 | return; |
301 | 289 | ||
@@ -599,7 +587,10 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
599 | nand_chip->options |= NAND_USE_FLASH_BBT; | 587 | nand_chip->options |= NAND_USE_FLASH_BBT; |
600 | } | 588 | } |
601 | 589 | ||
602 | if (cpu_has_dma() && use_dma) { | 590 | if (!cpu_has_dma()) |
591 | use_dma = 0; | ||
592 | |||
593 | if (use_dma) { | ||
603 | dma_cap_mask_t mask; | 594 | dma_cap_mask_t mask; |
604 | 595 | ||
605 | dma_cap_zero(mask); | 596 | dma_cap_zero(mask); |
@@ -611,7 +602,8 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
611 | } | 602 | } |
612 | } | 603 | } |
613 | if (use_dma) | 604 | if (use_dma) |
614 | dev_info(host->dev, "Using DMA for NAND access.\n"); | 605 | dev_info(host->dev, "Using %s for DMA transfers.\n", |
606 | dma_chan_name(host->dma_chan)); | ||
615 | else | 607 | else |
616 | dev_info(host->dev, "No DMA support for NAND access.\n"); | 608 | dev_info(host->dev, "No DMA support for NAND access.\n"); |
617 | 609 | ||