linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
@ 2012-08-16 13:15 Roland Stigge
  2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver Roland Stigge
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Roland Stigge @ 2012-08-16 13:15 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

The SLC and MLC NAND drivers now need their dma_filter callbacks via platform
data to make them independent of single DMA engine drivers.

(This also helps fixing build errors of the SLC and MLC drivers when building
as modules because direct access to AMBA dma filter functions isn't available
via export.)

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

---

Applies to v3.6-rc1

 arch/arm/mach-lpc32xx/phy3250.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- linux-2.6.orig/arch/arm/mach-lpc32xx/phy3250.c
+++ linux-2.6/arch/arm/mach-lpc32xx/phy3250.c
@@ -37,6 +37,8 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/clk.h>
+#include <linux/mtd/lpc32xx_slc.h>
+#include <linux/mtd/lpc32xx_mlc.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -223,6 +225,14 @@ static struct mmci_platform_data lpc32xx
 	 * gather, and the MMCI driver doesn't do it this way */
 };
 
+static struct lpc32xx_slc_platform_data lpc32xx_slc_data = {
+	.dma_filter = pl08x_filter_id,
+};
+
+static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
+	.dma_filter = pl08x_filter_id,
+};
+
 static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
 	OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", &lpc32xx_ssp0_data),
 	OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", &lpc32xx_ssp1_data),
@@ -230,6 +240,10 @@ static const struct of_dev_auxdata lpc32
 	OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
 	OF_DEV_AUXDATA("arm,pl18x", 0x20098000, "20098000.sd",
 		       &lpc32xx_mmci_data),
+	OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash",
+		       &lpc32xx_slc_data),
+	OF_DEV_AUXDATA("nxp,lpc3220-mlc", 0x200a8000, "200a8000.flash",
+		       &lpc32xx_mlc_data),
 	{ }
 };
 

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

* [PATCH] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver
  2012-08-16 13:15 [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Roland Stigge
@ 2012-08-16 13:15 ` Roland Stigge
  2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_mlc: " Roland Stigge
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Roland Stigge @ 2012-08-16 13:15 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.

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

---
 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] 10+ messages in thread

* [PATCH] mtd: lpc32xx_mlc: Make driver independent of AMBA DMA engine driver
  2012-08-16 13:15 [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Roland Stigge
  2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver Roland Stigge
@ 2012-08-16 13:15 ` Roland Stigge
  2012-08-16 13:59 ` [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Arnd Bergmann
  2012-08-17 10:09 ` Artem Bityutskiy
  3 siblings, 0 replies; 10+ messages in thread
From: Roland Stigge @ 2012-08-16 13:15 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.

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

---
 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] 10+ messages in thread

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-16 13:15 [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Roland Stigge
  2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver Roland Stigge
  2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_mlc: " Roland Stigge
@ 2012-08-16 13:59 ` Arnd Bergmann
  2012-08-17 10:09 ` Artem Bityutskiy
  3 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2012-08-16 13:59 UTC (permalink / raw)
  To: Roland Stigge
  Cc: linux, artem.bityutskiy, linux-arm-kernel, linux-kernel,
	kevin.wells, srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

On Thursday 16 August 2012, Roland Stigge wrote:
> The SLC and MLC NAND drivers now need their dma_filter callbacks via platform
> data to make them independent of single DMA engine drivers.
> 
> (This also helps fixing build errors of the SLC and MLC drivers when building
> as modules because direct access to AMBA dma filter functions isn't available
> via export.)
> 
> Signed-off-by: Roland Stigge <stigge@antcom.de>

Yes, this looks right.

Acked-by: Arnd Bergmann <arnd@arndb.de>

Once we have proper DT bindings for the DMA channels, we can hopefully
get rid of the auxdata again.

	Arnd

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

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-16 13:15 [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Roland Stigge
                   ` (2 preceding siblings ...)
  2012-08-16 13:59 ` [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Arnd Bergmann
@ 2012-08-17 10:09 ` Artem Bityutskiy
  2012-08-17 10:52   ` Roland Stigge
  3 siblings, 1 reply; 10+ messages in thread
From: Artem Bityutskiy @ 2012-08-17 10:09 UTC (permalink / raw)
  To: Roland Stigge
  Cc: linux, linux-arm-kernel, arnd, linux-kernel, kevin.wells,
	srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

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

On Thu, 2012-08-16 at 15:15 +0200, Roland Stigge wrote:
> The SLC and MLC NAND drivers now need their dma_filter callbacks via platform
> data to make them independent of single DMA engine drivers.
> 
> (This also helps fixing build errors of the SLC and MLC drivers when building
> as modules because direct access to AMBA dma filter functions isn't available
> via export.)
> 
> Signed-off-by: Roland Stigge <stigge@antcom.de>

Pushed the 3 patches to l2-mtd.git, thanks!

-- 
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] 10+ messages in thread

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-17 10:09 ` Artem Bityutskiy
@ 2012-08-17 10:52   ` Roland Stigge
  2012-08-17 11:01     ` Artem Bityutskiy
  0 siblings, 1 reply; 10+ messages in thread
From: Roland Stigge @ 2012-08-17 10:52 UTC (permalink / raw)
  To: artem.bityutskiy
  Cc: linux, linux-arm-kernel, arnd, linux-kernel, kevin.wells,
	srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

On 08/17/2012 12:09 PM, Artem Bityutskiy wrote:
> On Thu, 2012-08-16 at 15:15 +0200, Roland Stigge wrote:
>> The SLC and MLC NAND drivers now need their dma_filter callbacks
>> via platform data to make them independent of single DMA engine
>> drivers.
>> 
>> (This also helps fixing build errors of the SLC and MLC drivers
>> when building as modules because direct access to AMBA dma filter
>> functions isn't available via export.)
>> 
>> Signed-off-by: Roland Stigge <stigge@antcom.de>
> 
> Pushed the 3 patches to l2-mtd.git, thanks!

To later avoid collisions on subsystem merge, can you please leave the
patch with arch/arm/mach-lpc32xx/phy3250.c for arm-soc.git? (I will
provide a pull request for Arnd and Olof, as usual.)

Thanks,

Roland

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

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-17 10:52   ` Roland Stigge
@ 2012-08-17 11:01     ` Artem Bityutskiy
  2012-08-17 11:10       ` Artem Bityutskiy
  0 siblings, 1 reply; 10+ messages in thread
From: Artem Bityutskiy @ 2012-08-17 11:01 UTC (permalink / raw)
  To: Roland Stigge
  Cc: linux, linux-arm-kernel, arnd, linux-kernel, kevin.wells,
	srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

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

On Fri, 2012-08-17 at 12:52 +0200, Roland Stigge wrote:
> On 08/17/2012 12:09 PM, Artem Bityutskiy wrote:
> > On Thu, 2012-08-16 at 15:15 +0200, Roland Stigge wrote:
> >> The SLC and MLC NAND drivers now need their dma_filter callbacks
> >> via platform data to make them independent of single DMA engine
> >> drivers.
> >> 
> >> (This also helps fixing build errors of the SLC and MLC drivers
> >> when building as modules because direct access to AMBA dma filter
> >> functions isn't available via export.)
> >> 
> >> Signed-off-by: Roland Stigge <stigge@antcom.de>
> > 
> > Pushed the 3 patches to l2-mtd.git, thanks!
> 
> To later avoid collisions on subsystem merge, can you please leave the
> patch with arch/arm/mach-lpc32xx/phy3250.c for arm-soc.git? (I will
> provide a pull request for Arnd and Olof, as usual.)

Only if Arnd insists. Otherwise I'd prefer to resolve collisions (they
cannot be hard with this patch) than pulling the soc tree to the mtd
tree.

-- 
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] 10+ messages in thread

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-17 11:01     ` Artem Bityutskiy
@ 2012-08-17 11:10       ` Artem Bityutskiy
  2012-08-17 11:40         ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Artem Bityutskiy @ 2012-08-17 11:10 UTC (permalink / raw)
  To: Roland Stigge
  Cc: linux, linux-arm-kernel, arnd, linux-kernel, kevin.wells,
	srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

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

On Fri, 2012-08-17 at 14:01 +0300, Artem Bityutskiy wrote:
> > To later avoid collisions on subsystem merge, can you please leave the
> > patch with arch/arm/mach-lpc32xx/phy3250.c for arm-soc.git? (I will
> > provide a pull request for Arnd and Olof, as usual.)
> 
> Only if Arnd insists. Otherwise I'd prefer to resolve collisions (they
> cannot be hard with this patch) than pulling the soc tree to the mtd
> tree.

Actually the mtd patches do not compile-depend on it, sorry, I am
dropping it from the MTD tree. Thanks!

-- 
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] 10+ messages in thread

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-17 11:10       ` Artem Bityutskiy
@ 2012-08-17 11:40         ` Arnd Bergmann
  2012-08-17 11:45           ` Roland Stigge
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2012-08-17 11:40 UTC (permalink / raw)
  To: dedekind1
  Cc: Roland Stigge, linux, linux-arm-kernel, linux-kernel,
	kevin.wells, srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

On Friday 17 August 2012, Artem Bityutskiy wrote:
>   Show Details
>   On Fri, 2012-08-17 at 14:01 +0300, Artem Bityutskiy wrote:
> > > To later avoid collisions on subsystem merge, can you please leave the
> > > patch with arch/arm/mach-lpc32xx/phy3250.c for arm-soc.git? (I will
> > > provide a pull request for Arnd and Olof, as usual.)
> > 
> > Only if Arnd insists. Otherwise I'd prefer to resolve collisions (they
> > cannot be hard with this patch) than pulling the soc tree to the mtd
> > tree.
> 
> Actually the mtd patches do not compile-depend on it, sorry, I am
> dropping it from the MTD tree. Thanks!

For reference, I'm fine with either outcome, I don't mind seeing an
occasional collision with subsystem trees, as they tend to be trivial
to resolve.

If you split a series to go through multiple git trees, you have to
ensure that both halves are actually regression free by themselves,
which typically ends up being much harder than fixing a small merge
conflict.

	Arnd

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

* Re: [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data
  2012-08-17 11:40         ` Arnd Bergmann
@ 2012-08-17 11:45           ` Roland Stigge
  0 siblings, 0 replies; 10+ messages in thread
From: Roland Stigge @ 2012-08-17 11:45 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: dedekind1, linux, linux-arm-kernel, linux-kernel, kevin.wells,
	srinivas.bakki, aletes.xgr, dwmw2, linux-mtd

On 08/17/2012 01:40 PM, Arnd Bergmann wrote:
>> Actually the mtd patches do not compile-depend on it, sorry, I am
>> dropping it from the MTD tree. Thanks!
> 
> For reference, I'm fine with either outcome, I don't mind seeing an
> occasional collision with subsystem trees, as they tend to be trivial
> to resolve.
> 
> If you split a series to go through multiple git trees, you have to
> ensure that both halves are actually regression free by themselves,

Of course. But in this very case, they are. So I'd prefer pushing them
via different trees because I have other patches for mach-lpc32xx in the
queue and would like to minimize work for you. :-)

Roland

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

end of thread, other threads:[~2012-08-17 11:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-16 13:15 [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Roland Stigge
2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver Roland Stigge
2012-08-16 13:15 ` [PATCH] mtd: lpc32xx_mlc: " Roland Stigge
2012-08-16 13:59 ` [PATCH] ARM: LPC32xx: Provide DMA filter callbacks via platform data Arnd Bergmann
2012-08-17 10:09 ` Artem Bityutskiy
2012-08-17 10:52   ` Roland Stigge
2012-08-17 11:01     ` Artem Bityutskiy
2012-08-17 11:10       ` Artem Bityutskiy
2012-08-17 11:40         ` Arnd Bergmann
2012-08-17 11:45           ` 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).