linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver
@ 2012-08-22 22:25 Roland Stigge
  2012-08-22 22:25 ` [PATCH RESEND] mtd: lpc32xx_slc: " Roland Stigge
  2012-08-25 12:33 ` [PATCH RESEND] mtd: lpc32xx_mlc: " Artem Bityutskiy
  0 siblings, 2 replies; 4+ messages in thread
From: Roland Stigge @ 2012-08-22 22:25 UTC (permalink / raw)
  To: linux, artem.bityutskiy, linux-arm-kernel, arnd, linux-kernel,
	kevin.wells, srinivas.bakki, aletes.xgr, dwmw2, linux-mtd
  Cc: Roland Stigge

This patch makes the MLC NAND driver independent of the single AMBA DMA engine
driver by using the platform data provided dma_filter callback.

(This also fixes the build error of the MLC NAND driver in case of module
linking because the (not exported) reference to pl08x_filter_id is gone now.)

Signed-off-by: Roland Stigge <stigge@antcom.de>

---
Applies to: v3.6-rc2

 drivers/mtd/nand/lpc32xx_mlc.c  |   13 +++++++++++--
 include/linux/mtd/lpc32xx_mlc.h |   20 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

--- linux-2.6.orig/drivers/mtd/nand/lpc32xx_mlc.c
+++ linux-2.6/drivers/mtd/nand/lpc32xx_mlc.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_mlc.h>
 #include <linux/io.h>
 #include <linux/mm.h>
 #include <linux/dma-mapping.h>
@@ -171,6 +171,7 @@ static struct nand_bbt_descr lpc32xx_nan
 
 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 lpc3
 	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(
 	}
 	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;
--- /dev/null
+++ linux-2.6/include/linux/mtd/lpc32xx_mlc.h
@@ -0,0 +1,20 @@
+/*
+ * Platform data for LPC32xx SoC MLC NAND controller
+ *
+ * Copyright (C) 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 <linux/dmaengine.h>
+
+struct lpc32xx_mlc_platform_data {
+	bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
+};
+
+#endif  /* __LINUX_MTD_LPC32XX_MLC_H */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH RESEND] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver
  2012-08-22 22:25 [PATCH RESEND] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver Roland Stigge
@ 2012-08-22 22:25 ` Roland Stigge
  2012-08-25 12:33 ` [PATCH RESEND] mtd: lpc32xx_mlc: " Artem Bityutskiy
  1 sibling, 0 replies; 4+ messages in thread
From: Roland Stigge @ 2012-08-22 22:25 UTC (permalink / raw)
  To: linux, artem.bityutskiy, linux-arm-kernel, arnd, linux-kernel,
	kevin.wells, srinivas.bakki, aletes.xgr, dwmw2, linux-mtd
  Cc: Roland Stigge

This patch makes the SLC NAND driver independent of the single AMBA DMA engine
driver by using the platform data provided dma_filter callback.

(This also fixes the build error of the SLC NAND driver in case of module
linking because the (not exported) reference to pl08x_filter_id is gone now.)

Signed-off-by: Roland Stigge <stigge@antcom.de>

---
Applies to: v3.6-rc2

 drivers/mtd/nand/lpc32xx_slc.c  |   13 +++++++++++--
 include/linux/mtd/lpc32xx_slc.h |   20 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

--- linux-2.6.orig/drivers/mtd/nand/lpc32xx_slc.c
+++ linux-2.6/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;
@@ -714,9 +715,15 @@ static int lpc32xx_nand_dma_setup(struct
 	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;
@@ -814,6 +821,8 @@ static int __devinit lpc32xx_nand_probe(
 	}
 	lpc32xx_wp_disable(host);
 
+	host->pdata = pdev->dev.platform_data;
+
 	mtd = &host->mtd;
 	chip = &host->nand_chip;
 	chip->priv = host;
--- /dev/null
+++ linux-2.6/include/linux/mtd/lpc32xx_slc.h
@@ -0,0 +1,20 @@
+/*
+ * Platform data for LPC32xx SoC SLC NAND controller
+ *
+ * Copyright (C) 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 */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver
  2012-08-22 22:25 [PATCH RESEND] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver Roland Stigge
  2012-08-22 22:25 ` [PATCH RESEND] mtd: lpc32xx_slc: " Roland Stigge
@ 2012-08-25 12:33 ` Artem Bityutskiy
  2012-08-26 14:27   ` Roland Stigge
  1 sibling, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2012-08-25 12:33 UTC (permalink / raw)
  To: Roland Stigge
  Cc: linux, artem.bityutskiy, linux-arm-kernel, arnd, linux-kernel,
	kevin.wells, srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

On Thu, 2012-08-23 at 00:25 +0200, Roland Stigge wrote:
> This patch makes the MLC NAND driver independent of the single AMBA DMA engine
> driver by using the platform data provided dma_filter callback.
> 
> (This also fixes the build error of the MLC NAND driver in case of module
> linking because the (not exported) reference to pl08x_filter_id is gone now.)
> 
> Signed-off-by: Roland Stigge <stigge@antcom.de>

I already have both patches in l2-mtd.git. Please, use it as the
baseline for sending patches.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver
  2012-08-25 12:33 ` [PATCH RESEND] mtd: lpc32xx_mlc: " Artem Bityutskiy
@ 2012-08-26 14:27   ` Roland Stigge
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Stigge @ 2012-08-26 14:27 UTC (permalink / raw)
  To: dedekind1
  Cc: linux, artem.bityutskiy, linux-arm-kernel, arnd, linux-kernel,
	kevin.wells, srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

Hi,

On 25/08/12 14:33, Artem Bityutskiy wrote:
> On Thu, 2012-08-23 at 00:25 +0200, Roland Stigge wrote:
>> This patch makes the MLC NAND driver independent of the single
>> AMBA DMA engine driver by using the platform data provided
>> dma_filter callback.
>> 
>> (This also fixes the build error of the MLC NAND driver in case
>> of module linking because the (not exported) reference to
>> pl08x_filter_id is gone now.)
>> 
>> Signed-off-by: Roland Stigge <stigge@antcom.de>
> 
> I already have both patches in l2-mtd.git. Please, use it as the 
> baseline for sending patches.

Yes, noticed to late that you have already applied it, sorry.

The recently posted cleanup patches for LPC32xx SLC and MLC drivers
apply to l2-mtd.git, anyway.

Thanks,

Roland

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-26 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22 22:25 [PATCH RESEND] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver Roland Stigge
2012-08-22 22:25 ` [PATCH RESEND] mtd: lpc32xx_slc: " Roland Stigge
2012-08-25 12:33 ` [PATCH RESEND] mtd: lpc32xx_mlc: " Artem Bityutskiy
2012-08-26 14:27   ` Roland Stigge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).