linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] ARM: LPC32xx: Device tree updates
@ 2014-09-10 13:58 Roland Stigge
  2014-09-10 16:37 ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Roland Stigge @ 2014-09-10 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

  Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

are available in the git repository at:

  git://git.antcom.de/linux-2.6 lpc32xx/dt

for you to fetch changes up to 280f965674dbc5090147724d90b701f2b81f07e3:

  ARM: LPC32xx: Use DMA for both SSP channels (2014-09-10 15:41:30 +0200)

----------------------------------------------------------------
Roland Stigge (1):
      ARM: LPC32xx: Use DMA for both SSP channels

 arch/arm/boot/dts/lpc32xx.dtsi | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
  2014-09-10 13:58 [GIT PULL] ARM: LPC32xx: Device tree updates Roland Stigge
@ 2014-09-10 16:37 ` Arnd Bergmann
  2014-09-11 13:10   ` Linus Walleij
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2014-09-10 16:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 10 September 2014 15:58:15 Roland Stigge wrote:
> The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:
> 
>   Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)
> 
> are available in the git repository at:
> 
>   git://git.antcom.de/linux-2.6 lpc32xx/dt
> 
> for you to fetch changes up to 280f965674dbc5090147724d90b701f2b81f07e3:
> 
>   ARM: LPC32xx: Use DMA for both SSP channels (2014-09-10 15:41:30 +0200)
> 
> ----------------------------------------------------------------
> Roland Stigge (1):
>       ARM: LPC32xx: Use DMA for both SSP channels
> 
>  arch/arm/boot/dts/lpc32xx.dtsi | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

This unfortunately uses a binding for pl08x that hasn't been reviewed
yet, so I can't pull it. See below for an illustration of how I think
the binding should work. There are probably bugs in that code, but
hopefully it's not too far off.

	Arnd

diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
index 3abebb75fc57..72b1923d6ad3 100644
--- a/arch/arm/boot/dts/lpc32xx.dtsi
+++ b/arch/arm/boot/dts/lpc32xx.dtsi
@@ -40,6 +40,8 @@
 			compatible = "nxp,lpc3220-slc";
 			reg = <0x20020000 0x1000>;
 			status = "disabled";
+			dmas = <&pl080 1 1>
+			dma-names = "data";
 		};
 
 		mlc: flash at 200a8000 {
@@ -47,12 +49,17 @@
 			reg = <0x200a8000 0x11000>;
 			interrupts = <11 0>;
 			status = "disabled";
+			dmas = <&pl080 12 1>;
+			dma-names = "data";
 		};
 
-		dma at 31000000 {
+		pl080: dma at 31000000 {
 			compatible = "arm,pl080", "arm,primecell";
 			reg = <0x31000000 0x1000>;
 			interrupts = <0x1c 0>;
+			#dma-cells = <2>;
+			dma-channels = <10>;
+			dma-requests = <32>;
 		};
 
 		/*
@@ -95,11 +102,15 @@
 				compatible = "arm,pl022", "arm,primecell";
 				reg = <0x20084000 0x1000>;
 				interrupts = <0x14 0>;
+				dmas = <&pl080 3 1>, <&pl080 11 1>;
+				dma-names = "rx", "tx";
 			};
 
 			spi1: spi at 20088000 {
 				compatible = "nxp,lpc3220-spi";
 				reg = <0x20088000 0x1000>;
+				dmas = <&pl080 14 1>, <&pl080 15 1>;
+				dma-names = "rx", "tx";
 			};
 
 			ssp1: ssp at 2008c000 {
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 7858d5b6f6ce..f8952f8d16aa 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -155,35 +155,8 @@ static struct clcd_board lpc32xx_clcd_data = {
 	.remove		= lpc32xx_clcd_remove,
 };
 
-static struct pl08x_channel_data pl08x_slave_channels[] = {
-	{
-		.bus_id = "nand-slc",
-		.min_signal = 1, /* SLC NAND Flash */
-		.max_signal = 1,
-		.periph_buses = PL08X_AHB1,
-	},
-	{
-		.bus_id = "nand-mlc",
-		.min_signal = 12, /* MLC NAND Flash */
-		.max_signal = 12,
-		.periph_buses = PL08X_AHB1,
-	},
-};
-
-static int pl08x_get_signal(const struct pl08x_channel_data *cd)
-{
-	return cd->min_signal;
-}
-
-static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
-{
-}
-
 static struct pl08x_platform_data pl08x_pd = {
-	.slave_channels = &pl08x_slave_channels[0],
-	.num_slave_channels = ARRAY_SIZE(pl08x_slave_channels),
-	.get_xfer_signal = pl08x_get_signal,
-	.put_xfer_signal = pl08x_put_signal,
+	.num_slave_channels = 0;
 	.lli_buses = PL08X_AHB1,
 	.mem_buses = PL08X_AHB1,
 };
@@ -204,14 +177,6 @@ static struct mmci_platform_data lpc32xx_mmci_data = {
 	.ios_handler	= mmc_handle_ios,
 };
 
-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", NULL),
 	OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
@@ -219,10 +184,8 @@ static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
 	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),
+	OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash", NULL)
+	OF_DEV_AUXDATA("nxp,lpc3220-mlc", 0x200a8000, "200a8000.flash", NULL)
 	{ }
 };
 
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index aa3f08683e73..0867c3cccf19 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1925,6 +1925,49 @@ static void pl08x_free_virtual_channels(struct dma_device *dmadev)
 	}
 }
 
+static struct dma_chan *of_dma_pl08x_xlate(struct of_phandle_args *dma_spec,
+						struct of_dma *ofdma)
+{
+	int count = dma_spec->args_count;
+	struct pl08x_driver_data *pl08x = ofdma->of_dma_data;
+	struct pl08x_dma_chan *chan;
+	struct pl08x_channel_data *data;
+
+	unsigned int chan_id;
+
+	if (!pl08x)
+		return NULL;
+
+	if (count < 2 || count > 3)
+		return NULL;
+
+	/* FIXME: memory leak, should first see if we already have this one */
+	chan = devm_kzalloc(pl08x->slave.dev,
+			    sizeof(*chan) + sizeof(struct pl08x_channel_data),
+			    GFP_KERNEL);
+	if (!chan)
+		return NULL;
+
+	data = (void *)&chan[1];
+	data->bus_id = "(none)";
+	data->min_signal = data->max_signal = dma_spec->args[0];
+	data->periph_buses = dma_spec->args[1];
+	if (count == 3)
+		chan->muxval = dma_spec->args[2];
+
+	chan->host = pl08x;
+	chan->slave = true;
+	chan->name = data->bus_id;
+	chan->state = PL08X_CHAN_IDLE;
+	chan->signal = -1;
+	chan->cd = data;
+	chan->vc.desc_free = pl08x_desc_free;
+
+	vchan_init(&chan->vc, dmadev);
+
+	return chan;
+}
+
 #ifdef CONFIG_DEBUG_FS
 static const char *pl08x_state_str(enum pl08x_dma_chan_state state)
 {
@@ -2200,6 +2243,16 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 		 amba_part(adev), pl08x->vd->pl080s ? "s" : "", amba_rev(adev),
 		 (unsigned long long)adev->res.start, adev->irq[0]);
 
+	if (adev->dev.of_node) {
+		ret = of_dma_controller_register(adev->dev.of_node,
+					 of_dma_pl08x_xlate, pl08x);
+		if (ret) {
+			dev_err(&adev->dev,
+			"unable to register DMA to the generic DT DMA helpers\n");
+		}
+	}
+
+
 	return 0;
 
 out_no_slave_reg:

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
  2014-09-10 16:37 ` Arnd Bergmann
@ 2014-09-11 13:10   ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2014-09-11 13:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 10, 2014 at 6:37 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday 10 September 2014 15:58:15 Roland Stigge wrote:
>> The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:
>>
>>   Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)
>>
>> are available in the git repository at:
>>
>>   git://git.antcom.de/linux-2.6 lpc32xx/dt
>>
>> for you to fetch changes up to 280f965674dbc5090147724d90b701f2b81f07e3:
>>
>>   ARM: LPC32xx: Use DMA for both SSP channels (2014-09-10 15:41:30 +0200)
>>
>> ----------------------------------------------------------------
>> Roland Stigge (1):
>>       ARM: LPC32xx: Use DMA for both SSP channels
>>
>>  arch/arm/boot/dts/lpc32xx.dtsi | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> This unfortunately uses a binding for pl08x that hasn't been reviewed
> yet, so I can't pull it. See below for an illustration of how I think
> the binding should work. There are probably bugs in that code, but
> hopefully it's not too far off.

I have a more complete PL08x DT binding which includes defining
all signals etc. I will kick my own butt to get it out tonight or so so
you can compare it with this.

I think Russell want to be involved in reviewing this, his input was
very important when I defined my bindings.

Yours,
Linus Walleij

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
  2014-09-10 14:26     ` Arnd Bergmann
@ 2014-09-12  8:03       ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2014-09-12  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 10, 2014 at 4:26 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday 10 September 2014 15:51:33 Roland Stigge wrote:
>>
>> > For
>> > lpc32xx, this is currently not possible because you are not using
>> > the common clk implementation. Would it be possible for you
>> > to look into converting that driver over and moving it to
>> > drivers/clk?
>>
>> It's certainly possible, but time might be scarce. What would be a good
>> reference platform to have a look into as example? Or a hint/link?
>
> I'll let Linus answer that one, he converted a couple of platform and
> probably has a better idea than I do.

Step-wise conversion on U300:

commit 50667d63085af108f625c83102430c1d74931d78
"ARM: u300: convert to common clock"
converts to common clock *without* using device tree.

commit 14c2607144c11653b27a423ead0703ffaa65d0b1
"clk: move the U300 fixed and fixed-factor to DT"
commit bba5f2cc2f0fe4191ad2699c7c03a6def31f54e2
"ARM: u300: move the gated system controller clocks to DT"
commit 85fb28bed813469ba56706a7e48fba596f47c253
"ARM: u300: convert MMC/SD clock to device tree"

Then gradually moves those clocks over to being handled
from the device tree.

For an example on a platform lacking clock implementation,
look at:

commit ef6eb322ce574ba73658a677e83e5da3cfab301b
"clk: nomadik: implement the Nomadik clocks properly"
where I implement the Nomadik per-bit enabled clocks
This includes device tree bindings.

commit c641d4dfef6d462c6d66a6fb57700086cd2f0106
"ARM: nomadik: add the new clocks to the device tree"
adds them to the device tree and make use of them.

Yours,
Linus Walleij

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
  2014-09-10 13:51   ` Roland Stigge
@ 2014-09-10 14:26     ` Arnd Bergmann
  2014-09-12  8:03       ` Linus Walleij
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2014-09-10 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 10 September 2014 15:51:33 Roland Stigge wrote:
> 
> > You cleaned up the platform a lot when you took
> > over in 2012, but now we have move other platforms much further
> > and I wonder if you could do some of the same changes.
> > Most importantly, I really want most platforms to be part of
> > ARCH_MULTIPLATFORM and build them into the same image. For
> > lpc32xx, this is currently not possible because you are not using
> > the common clk implementation. Would it be possible for you
> > to look into converting that driver over and moving it to
> > drivers/clk?
> 
> It's certainly possible, but time might be scarce. What would be a good
> reference platform to have a look into as example? Or a hint/link?

I'll let Linus answer that one, he converted a couple of platform and
probably has a better idea than I do.

	Arnd

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
  2014-09-09 15:43 ` Arnd Bergmann
@ 2014-09-10 13:51   ` Roland Stigge
  2014-09-10 14:26     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Roland Stigge @ 2014-09-10 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

On 09/09/2014 05:43 PM, Arnd Bergmann wrote:
> I have no objection to the patches, but I notice that you have just
> rebased them all today on the latest -rc.
> In general, we prefer the branches to be based on an older -rc,
> preferably -rc1, unless you have a dependency on a bug fix that
> went into a later one.
> Can you rebase them to -rc1 and send a new version?

OK, sending.

> On a separate topic, are you still actively working with lpc32xx
> based machines?

I was so busy working with it that I didn't have the time to upstream
the few kernel changes to mainline... :-)

Will continue this in the future also.

> You cleaned up the platform a lot when you took
> over in 2012, but now we have move other platforms much further
> and I wonder if you could do some of the same changes.
> Most importantly, I really want most platforms to be part of
> ARCH_MULTIPLATFORM and build them into the same image. For
> lpc32xx, this is currently not possible because you are not using
> the common clk implementation. Would it be possible for you
> to look into converting that driver over and moving it to
> drivers/clk?

It's certainly possible, but time might be scarce. What would be a good
reference platform to have a look into as example? Or a hint/link?

Thanks in advance,

Roland

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
  2014-09-09 14:51 Roland Stigge
@ 2014-09-09 15:43 ` Arnd Bergmann
  2014-09-10 13:51   ` Roland Stigge
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2014-09-09 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 09 September 2014 16:51:53 Roland Stigge wrote:
> The following changes since commit 2ce7598c9a453e0acd0e07be7be3f5eb39608ebd:
> 
>   Linux 3.17-rc4 (2014-09-07 16:09:43 -0700)
> 
> are available in the git repository at:
> 
>   git://git.antcom.de/linux-2.6 lpc32xx/dt
> 
> for you to fetch changes up to de1fcd7f8a6d313c92c2af476b012305d4fe6553:
> 
>   ARM: LPC32xx: Use DMA for both SSP channels (2014-09-09 15:05:31 +0200)
> 

Hi Roland,

I'm glad to see some pull requests from you again, you've been
absent for a while.

I have no objection to the patches, but I notice that you have just
rebased them all today on the latest -rc.
In general, we prefer the branches to be based on an older -rc,
preferably -rc1, unless you have a dependency on a bug fix that
went into a later one.
Can you rebase them to -rc1 and send a new version?

On a separate topic, are you still actively working with lpc32xx
based machines? You cleaned up the platform a lot when you took
over in 2012, but now we have move other platforms much further
and I wonder if you could do some of the same changes.
Most importantly, I really want most platforms to be part of
ARCH_MULTIPLATFORM and build them into the same image. For
lpc32xx, this is currently not possible because you are not using
the common clk implementation. Would it be possible for you
to look into converting that driver over and moving it to
drivers/clk?
There are a few other things that could be done if you are motivated,
but that is the only one that I need and can't do myself.

	Arnd

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

* [GIT PULL] ARM: LPC32xx: Device tree updates
@ 2014-09-09 14:51 Roland Stigge
  2014-09-09 15:43 ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Roland Stigge @ 2014-09-09 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

The following changes since commit 2ce7598c9a453e0acd0e07be7be3f5eb39608ebd:

  Linux 3.17-rc4 (2014-09-07 16:09:43 -0700)

are available in the git repository at:

  git://git.antcom.de/linux-2.6 lpc32xx/dt

for you to fetch changes up to de1fcd7f8a6d313c92c2af476b012305d4fe6553:

  ARM: LPC32xx: Use DMA for both SSP channels (2014-09-09 15:05:31 +0200)

----------------------------------------------------------------
Roland Stigge (1):
      ARM: LPC32xx: Use DMA for both SSP channels

 arch/arm/boot/dts/lpc32xx.dtsi | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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

end of thread, other threads:[~2014-09-12  8:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10 13:58 [GIT PULL] ARM: LPC32xx: Device tree updates Roland Stigge
2014-09-10 16:37 ` Arnd Bergmann
2014-09-11 13:10   ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2014-09-09 14:51 Roland Stigge
2014-09-09 15:43 ` Arnd Bergmann
2014-09-10 13:51   ` Roland Stigge
2014-09-10 14:26     ` Arnd Bergmann
2014-09-12  8:03       ` Linus Walleij

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).