aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/lpc32xx_mlc.c13
-rw-r--r--include/linux/mtd/lpc32xx_mlc.h20
2 files changed, 31 insertions, 2 deletions
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index 1cf35932a4d5..5da31795b693 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -37,7 +37,7 @@
37#include <linux/of.h> 37#include <linux/of.h>
38#include <linux/of_mtd.h> 38#include <linux/of_mtd.h>
39#include <linux/of_gpio.h> 39#include <linux/of_gpio.h>
40#include <linux/amba/pl08x.h> 40#include <linux/mtd/lpc32xx_mlc.h>
41#include <linux/io.h> 41#include <linux/io.h>
42#include <linux/mm.h> 42#include <linux/mm.h>
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
@@ -171,6 +171,7 @@ static struct nand_bbt_descr lpc32xx_nand_bbt_mirror = {
171 171
172struct lpc32xx_nand_host { 172struct lpc32xx_nand_host {
173 struct nand_chip nand_chip; 173 struct nand_chip nand_chip;
174 struct lpc32xx_mlc_platform_data *pdata;
174 struct clk *clk; 175 struct clk *clk;
175 struct mtd_info mtd; 176 struct mtd_info mtd;
176 void __iomem *io_base; 177 void __iomem *io_base;
@@ -581,9 +582,15 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
581 struct mtd_info *mtd = &host->mtd; 582 struct mtd_info *mtd = &host->mtd;
582 dma_cap_mask_t mask; 583 dma_cap_mask_t mask;
583 584
585 if (!host->pdata || !host->pdata->dma_filter) {
586 dev_err(mtd->dev.parent, "no DMA platform data\n");
587 return -ENOENT;
588 }
589
584 dma_cap_zero(mask); 590 dma_cap_zero(mask);
585 dma_cap_set(DMA_SLAVE, mask); 591 dma_cap_set(DMA_SLAVE, mask);
586 host->dma_chan = dma_request_channel(mask, pl08x_filter_id, "nand-mlc"); 592 host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
593 "nand-mlc");
587 if (!host->dma_chan) { 594 if (!host->dma_chan) {
588 dev_err(mtd->dev.parent, "Failed to request DMA channel\n"); 595 dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
589 return -EBUSY; 596 return -EBUSY;
@@ -703,6 +710,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
703 } 710 }
704 lpc32xx_wp_disable(host); 711 lpc32xx_wp_disable(host);
705 712
713 host->pdata = pdev->dev.platform_data;
714
706 nand_chip->priv = host; /* link the private data structures */ 715 nand_chip->priv = host; /* link the private data structures */
707 mtd->priv = nand_chip; 716 mtd->priv = nand_chip;
708 mtd->owner = THIS_MODULE; 717 mtd->owner = THIS_MODULE;
diff --git a/include/linux/mtd/lpc32xx_mlc.h b/include/linux/mtd/lpc32xx_mlc.h
new file mode 100644
index 000000000000..d91b1e35631e
--- /dev/null
+++ b/include/linux/mtd/lpc32xx_mlc.h
@@ -0,0 +1,20 @@
1/*
2 * Platform data for LPC32xx SoC MLC NAND controller
3 *
4 * Copyright © 2012 Roland Stigge
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_MTD_LPC32XX_MLC_H
12#define __LINUX_MTD_LPC32XX_MLC_H
13
14#include <linux/dmaengine.h>
15
16struct lpc32xx_mlc_platform_data {
17 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
18};
19
20#endif /* __LINUX_MTD_LPC32XX_MLC_H */