From: Roland Stigge Date: Thu, 16 Aug 2012 13:15:35 +0000 (+0200) Subject: mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver X-Git-Tag: v3.7-rc1~70^2~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c6f62a7ef230253a7dfc0547c431f07d8a64721;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver This patch makes the MLC NAND driver independent of the single AMBA DMA engine driver by using the platform data provided dma_filter callback. Signed-off-by: Roland Stigge Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c index 1cf3593..5da3179 100644 --- a/drivers/mtd/nand/lpc32xx_mlc.c +++ b/drivers/mtd/nand/lpc32xx_mlc.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -171,6 +171,7 @@ static struct nand_bbt_descr lpc32xx_nand_bbt_mirror = { struct lpc32xx_nand_host { struct nand_chip nand_chip; + struct lpc32xx_mlc_platform_data *pdata; struct clk *clk; struct mtd_info mtd; void __iomem *io_base; @@ -581,9 +582,15 @@ static int lpc32xx_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-mlc"); + host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, + "nand-mlc"); if (!host->dma_chan) { dev_err(mtd->dev.parent, "Failed to request DMA channel\n"); return -EBUSY; @@ -703,6 +710,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev) } lpc32xx_wp_disable(host); + host->pdata = pdev->dev.platform_data; + nand_chip->priv = host; /* link the private data structures */ mtd->priv = nand_chip; 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 0000000..d91b1e3 --- /dev/null +++ b/include/linux/mtd/lpc32xx_mlc.h @@ -0,0 +1,20 @@ +/* + * Platform data for LPC32xx SoC MLC 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_MLC_H +#define __LINUX_MTD_LPC32XX_MLC_H + +#include + +struct lpc32xx_mlc_platform_data { + bool (*dma_filter)(struct dma_chan *chan, void *filter_param); +}; + +#endif /* __LINUX_MTD_LPC32XX_MLC_H */