aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2012-08-16 09:15:34 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-09-29 09:52:45 -0400
commitde20c22d2bf41f970a6300a89dd550f12121c126 (patch)
tree4a5639e2e07e1808698551573872498eaee443a0
parentaf69dcd3862ed174cf67637f4142c9c895862436 (diff)
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@antcom.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/nand/lpc32xx_slc.c13
-rw-r--r--include/linux/mtd/lpc32xx_slc.h20
2 files changed, 31 insertions, 2 deletions
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index c8c1d06b35ab..184035045208 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.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_slc.h>
41 41
42#define LPC32XX_MODNAME "lpc32xx-nand" 42#define LPC32XX_MODNAME "lpc32xx-nand"
43 43
@@ -199,6 +199,7 @@ struct lpc32xx_nand_cfg_slc {
199 199
200struct lpc32xx_nand_host { 200struct lpc32xx_nand_host {
201 struct nand_chip nand_chip; 201 struct nand_chip nand_chip;
202 struct lpc32xx_slc_platform_data *pdata;
202 struct clk *clk; 203 struct clk *clk;
203 struct mtd_info mtd; 204 struct mtd_info mtd;
204 void __iomem *io_base; 205 void __iomem *io_base;
@@ -719,9 +720,15 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
719 struct mtd_info *mtd = &host->mtd; 720 struct mtd_info *mtd = &host->mtd;
720 dma_cap_mask_t mask; 721 dma_cap_mask_t mask;
721 722
723 if (!host->pdata || !host->pdata->dma_filter) {
724 dev_err(mtd->dev.parent, "no DMA platform data\n");
725 return -ENOENT;
726 }
727
722 dma_cap_zero(mask); 728 dma_cap_zero(mask);
723 dma_cap_set(DMA_SLAVE, mask); 729 dma_cap_set(DMA_SLAVE, mask);
724 host->dma_chan = dma_request_channel(mask, pl08x_filter_id, "nand-slc"); 730 host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
731 "nand-slc");
725 if (!host->dma_chan) { 732 if (!host->dma_chan) {
726 dev_err(mtd->dev.parent, "Failed to request DMA channel\n"); 733 dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
727 return -EBUSY; 734 return -EBUSY;
@@ -819,6 +826,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
819 } 826 }
820 lpc32xx_wp_disable(host); 827 lpc32xx_wp_disable(host);
821 828
829 host->pdata = pdev->dev.platform_data;
830
822 mtd = &host->mtd; 831 mtd = &host->mtd;
823 chip = &host->nand_chip; 832 chip = &host->nand_chip;
824 chip->priv = host; 833 chip->priv = host;
diff --git a/include/linux/mtd/lpc32xx_slc.h b/include/linux/mtd/lpc32xx_slc.h
new file mode 100644
index 000000000000..1169548a1535
--- /dev/null
+++ b/include/linux/mtd/lpc32xx_slc.h
@@ -0,0 +1,20 @@
1/*
2 * Platform data for LPC32xx SoC SLC 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_SLC_H
12#define __LINUX_MTD_LPC32XX_SLC_H
13
14#include <linux/dmaengine.h>
15
16struct lpc32xx_slc_platform_data {
17 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
18};
19
20#endif /* __LINUX_MTD_LPC32XX_SLC_H */