mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Sep 29 10:59:03 EDT 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=de20c22d2bf41f970a6300a89dd550f12121c126
Commit: de20c22d2bf41f970a6300a89dd550f12121c126
Parent: af69dcd3862ed174cf67637f4142c9c895862436
Author: Roland Stigge <stigge at antcom.de>
AuthorDate: Thu Aug 16 15:15:34 2012 +0200
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Sep 29 14:52:45 2012 +0100
mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver
This patch makes the SLC NAND driver independent of the single AMBA DMA engine
driver by using the platform data provided dma_filter callback.
Signed-off-by: Roland Stigge <stigge at antcom.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/nand/lpc32xx_slc.c | 13 +++++++++++--
include/linux/mtd/lpc32xx_slc.h | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index c8c1d06..1840350 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -37,7 +37,7 @@
#include <linux/of.h>
#include <linux/of_mtd.h>
#include <linux/of_gpio.h>
-#include <linux/amba/pl08x.h>
+#include <linux/mtd/lpc32xx_slc.h>
#define LPC32XX_MODNAME "lpc32xx-nand"
@@ -199,6 +199,7 @@ struct lpc32xx_nand_cfg_slc {
struct lpc32xx_nand_host {
struct nand_chip nand_chip;
+ struct lpc32xx_slc_platform_data *pdata;
struct clk *clk;
struct mtd_info mtd;
void __iomem *io_base;
@@ -719,9 +720,15 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
struct mtd_info *mtd = &host->mtd;
dma_cap_mask_t mask;
+ if (!host->pdata || !host->pdata->dma_filter) {
+ dev_err(mtd->dev.parent, "no DMA platform data\n");
+ return -ENOENT;
+ }
+
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
- host->dma_chan = dma_request_channel(mask, pl08x_filter_id, "nand-slc");
+ host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
+ "nand-slc");
if (!host->dma_chan) {
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
return -EBUSY;
@@ -819,6 +826,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
}
lpc32xx_wp_disable(host);
+ host->pdata = pdev->dev.platform_data;
+
mtd = &host->mtd;
chip = &host->nand_chip;
chip->priv = host;
diff --git a/include/linux/mtd/lpc32xx_slc.h b/include/linux/mtd/lpc32xx_slc.h
new file mode 100644
index 0000000..1169548
--- /dev/null
+++ b/include/linux/mtd/lpc32xx_slc.h
@@ -0,0 +1,20 @@
+/*
+ * Platform data for LPC32xx SoC SLC NAND controller
+ *
+ * Copyright © 2012 Roland Stigge
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_MTD_LPC32XX_SLC_H
+#define __LINUX_MTD_LPC32XX_SLC_H
+
+#include <linux/dmaengine.h>
+
+struct lpc32xx_slc_platform_data {
+ bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
+};
+
+#endif /* __LINUX_MTD_LPC32XX_SLC_H */
More information about the linux-mtd-cvs
mailing list