linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
@ 2019-12-12  3:38 Peng Ma
  2019-12-12  3:38 ` [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver Peng Ma
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Peng Ma @ 2019-12-12  3:38 UTC (permalink / raw)
  To: vkoul, robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel, Peng Ma

Our platforms(such as LS1021A, LS1012A, LS1043A, LS1046A, LS1028A) with
below registers(CHCFG0 - CHCFG15) of eDMA as follows:
*-----------------------------------------------------------*
|     Offset   |	OTHERS			|		LS1028A			|
|--------------|--------------------|-----------------------|
|     0x0      |        CHCFG0      |           CHCFG3      |
|--------------|--------------------|-----------------------|
|     0x1      |        CHCFG1      |           CHCFG2      |
|--------------|--------------------|-----------------------|
|     0x2      |        CHCFG2      |           CHCFG1      |
|--------------|--------------------|-----------------------|
|     0x3      |        CHCFG3      |           CHCFG0      |
|--------------|--------------------|-----------------------|
|     ...      |        ......      |           ......      |
|--------------|--------------------|-----------------------|
|     0xC      |        CHCFG12     |           CHCFG15     |
|--------------|--------------------|-----------------------|
|     0xD      |        CHCFG13     |           CHCFG14     |
|--------------|--------------------|-----------------------|
|     0xE      |        CHCFG14     |           CHCFG13     |
|--------------|--------------------|-----------------------|
|     0xF      |        CHCFG15     |           CHCFG12     |
*-----------------------------------------------------------*

This patch is to improve edma driver to fit LS1028A platform.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
---
Changed for v5:
	- no changes

 drivers/dma/fsl-edma-common.c | 5 +++++
 drivers/dma/fsl-edma-common.h | 1 +
 drivers/dma/fsl-edma.c        | 8 ++++++++
 3 files changed, 14 insertions(+)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index b1a7ca91701a..5697c3622699 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -109,10 +109,15 @@ void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan,
 	u32 ch = fsl_chan->vchan.chan.chan_id;
 	void __iomem *muxaddr;
 	unsigned int chans_per_mux, ch_off;
+	int endian_diff[4] = {3, 1, -1, -3};
 	u32 dmamux_nr = fsl_chan->edma->drvdata->dmamuxs;
 
 	chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr;
 	ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux;
+
+	if (fsl_chan->edma->drvdata->mux_swap)
+		ch_off += endian_diff[ch_off % 4];
+
 	muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux];
 	slot = EDMAMUX_CHCFG_SOURCE(slot);
 
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index 5eaa2902ed39..67e422590c9a 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -147,6 +147,7 @@ struct fsl_edma_drvdata {
 	enum edma_version	version;
 	u32			dmamuxs;
 	bool			has_dmaclk;
+	bool			mux_swap;
 	int			(*setup_irq)(struct platform_device *pdev,
 					     struct fsl_edma_engine *fsl_edma);
 };
diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c
index b626c06ac2e0..eff7ebd8cf35 100644
--- a/drivers/dma/fsl-edma.c
+++ b/drivers/dma/fsl-edma.c
@@ -233,6 +233,13 @@ static struct fsl_edma_drvdata vf610_data = {
 	.setup_irq = fsl_edma_irq_init,
 };
 
+static struct fsl_edma_drvdata ls1028a_data = {
+	.version = v1,
+	.dmamuxs = DMAMUX_NR,
+	.mux_swap = true,
+	.setup_irq = fsl_edma_irq_init,
+};
+
 static struct fsl_edma_drvdata imx7ulp_data = {
 	.version = v3,
 	.dmamuxs = 1,
@@ -242,6 +249,7 @@ static struct fsl_edma_drvdata imx7ulp_data = {
 
 static const struct of_device_id fsl_edma_dt_ids[] = {
 	{ .compatible = "fsl,vf610-edma", .data = &vf610_data},
+	{ .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data},
 	{ .compatible = "fsl,imx7ulp-edma", .data = &imx7ulp_data},
 	{ /* sentinel */ }
 };
-- 
2.17.1


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

* [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver
  2019-12-12  3:38 [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Peng Ma
@ 2019-12-12  3:38 ` Peng Ma
  2019-12-23  3:57   ` Shawn Guo
  2019-12-12  3:38 ` [v5 3/3] dt-bindings: dma: fsl-edma: add new fsl,fsl,ls1028a-edma Peng Ma
  2019-12-18  6:26 ` [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Vinod Koul
  2 siblings, 1 reply; 8+ messages in thread
From: Peng Ma @ 2019-12-12  3:38 UTC (permalink / raw)
  To: vkoul, robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel, Peng Ma

The eDMA of LS1028A soc has a little bit different from others, So we
should distinguish them in driver by compatible.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
---
Changed for v5:
	- separate dts and binding

 arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
index 8e8a77eb596a..b3716a89fa0d 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
@@ -316,7 +316,7 @@
 
 		edma0: dma-controller@22c0000 {
 			#dma-cells = <2>;
-			compatible = "fsl,vf610-edma";
+			compatible = "fsl,ls1028a-edma";
 			reg = <0x0 0x22c0000 0x0 0x10000>,
 			      <0x0 0x22d0000 0x0 0x10000>,
 			      <0x0 0x22e0000 0x0 0x10000>;
-- 
2.17.1


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

* [v5 3/3] dt-bindings: dma: fsl-edma: add new fsl,fsl,ls1028a-edma
  2019-12-12  3:38 [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Peng Ma
  2019-12-12  3:38 ` [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver Peng Ma
@ 2019-12-12  3:38 ` Peng Ma
  2019-12-18  6:26 ` [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Vinod Koul
  2 siblings, 0 replies; 8+ messages in thread
From: Peng Ma @ 2019-12-12  3:38 UTC (permalink / raw)
  To: vkoul, robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel, Peng Ma

QORIQ LS1028A soc used fsl,vf610-edma, but it has a little bit different
from others, so add new compatible to distinguish them.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
---
Changed for v5:
	- add new patch 

 Documentation/devicetree/bindings/dma/fsl-edma.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/dma/fsl-edma.txt b/Documentation/devicetree/bindings/dma/fsl-edma.txt
index 29dd3ccb1235..e77b08ebcd06 100644
--- a/Documentation/devicetree/bindings/dma/fsl-edma.txt
+++ b/Documentation/devicetree/bindings/dma/fsl-edma.txt
@@ -10,6 +10,7 @@ Required properties:
 - compatible :
 	- "fsl,vf610-edma" for eDMA used similar to that on Vybrid vf610 SoC
 	- "fsl,imx7ulp-edma" for eDMA2 used similar to that on i.mx7ulp
+	- "fsl,fsl,ls1028a-edma" for eDMA used similar to that on Vybrid vf610 SoC
 - reg : Specifies base physical address(s) and size of the eDMA registers.
 	The 1st region is eDMA control register's address and size.
 	The 2nd and the 3rd regions are programmable channel multiplexing
-- 
2.17.1


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

* Re: [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
  2019-12-12  3:38 [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Peng Ma
  2019-12-12  3:38 ` [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver Peng Ma
  2019-12-12  3:38 ` [v5 3/3] dt-bindings: dma: fsl-edma: add new fsl,fsl,ls1028a-edma Peng Ma
@ 2019-12-18  6:26 ` Vinod Koul
  2019-12-18  8:08   ` [EXT] " Peng Ma
  2 siblings, 1 reply; 8+ messages in thread
From: Vinod Koul @ 2019-12-18  6:26 UTC (permalink / raw)
  To: Peng Ma
  Cc: robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong, dmaengine, devicetree, linux-kernel,
	linux-arm-kernel

On 12-12-19, 03:38, Peng Ma wrote:
> Our platforms(such as LS1021A, LS1012A, LS1043A, LS1046A, LS1028A) with
> below registers(CHCFG0 - CHCFG15) of eDMA as follows:
> *-----------------------------------------------------------*
> |     Offset   |	OTHERS			|		LS1028A			|
> |--------------|--------------------|-----------------------|
> |     0x0      |        CHCFG0      |           CHCFG3      |
> |--------------|--------------------|-----------------------|
> |     0x1      |        CHCFG1      |           CHCFG2      |
> |--------------|--------------------|-----------------------|
> |     0x2      |        CHCFG2      |           CHCFG1      |
> |--------------|--------------------|-----------------------|
> |     0x3      |        CHCFG3      |           CHCFG0      |
> |--------------|--------------------|-----------------------|
> |     ...      |        ......      |           ......      |
> |--------------|--------------------|-----------------------|
> |     0xC      |        CHCFG12     |           CHCFG15     |
> |--------------|--------------------|-----------------------|
> |     0xD      |        CHCFG13     |           CHCFG14     |
> |--------------|--------------------|-----------------------|
> |     0xE      |        CHCFG14     |           CHCFG13     |
> |--------------|--------------------|-----------------------|
> |     0xF      |        CHCFG15     |           CHCFG12     |
> *-----------------------------------------------------------*
> 
> This patch is to improve edma driver to fit LS1028A platform.

Applied this and patch 3, thanks

Btw pls send bindings as patch1 and driver changes as patch2.
-- 
~Vinod

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

* RE: [EXT] Re: [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
  2019-12-18  6:26 ` [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Vinod Koul
@ 2019-12-18  8:08   ` Peng Ma
  2019-12-19 15:54     ` Vinod Koul
  0 siblings, 1 reply; 8+ messages in thread
From: Peng Ma @ 2019-12-18  8:08 UTC (permalink / raw)
  To: Vinod Koul
  Cc: robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong, dmaengine, devicetree, linux-kernel,
	linux-arm-kernel



>-----Original Message-----
>From: Vinod Koul <vkoul@kernel.org>
>Sent: 2019年12月18日 14:27
>To: Peng Ma <peng.ma@nxp.com>
>Cc: robh+dt@kernel.org; mark.rutland@arm.com; shawnguo@kernel.org; Leo
>Li <leoyang.li@nxp.com>; dan.j.williams@intel.com; Robin Gong
><yibin.gong@nxp.com>; dmaengine@vger.kernel.org;
>devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
>linux-arm-kernel@lists.infradead.org
>Subject: [EXT] Re: [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ
>LS1028A platform
>
>Caution: EXT Email
>
>On 12-12-19, 03:38, Peng Ma wrote:
>> Our platforms(such as LS1021A, LS1012A, LS1043A, LS1046A, LS1028A)
>> with below registers(CHCFG0 - CHCFG15) of eDMA as follows:
>> *-----------------------------------------------------------*
>> |     Offset   |      OTHERS                  |
>LS1028A                 |
>> |--------------|--------------------|-----------------------|
>> |     0x0      |        CHCFG0      |           CHCFG3      |
>> |--------------|--------------------|-----------------------|
>> |     0x1      |        CHCFG1      |           CHCFG2      |
>> |--------------|--------------------|-----------------------|
>> |     0x2      |        CHCFG2      |           CHCFG1      |
>> |--------------|--------------------|-----------------------|
>> |     0x3      |        CHCFG3      |           CHCFG0      |
>> |--------------|--------------------|-----------------------|
>> |     ...      |        ......      |           ......      |
>> |--------------|--------------------|-----------------------|
>> |     0xC      |        CHCFG12     |           CHCFG15     |
>> |--------------|--------------------|-----------------------|
>> |     0xD      |        CHCFG13     |           CHCFG14     |
>> |--------------|--------------------|-----------------------|
>> |     0xE      |        CHCFG14     |           CHCFG13     |
>> |--------------|--------------------|-----------------------|
>> |     0xF      |        CHCFG15     |           CHCFG12     |
>> *-----------------------------------------------------------*
>>
>> This patch is to improve edma driver to fit LS1028A platform.
>
Hi Vinod

>Applied this and patch 3, thanks
>
[Peng Ma] Many thanks.

>Btw pls send bindings as patch1 and driver changes as patch2.
[Peng Ma] I don't understand this sentence, Please give me more information.
As I know patch1 is driver changes, patch2 is dts changes, patch3 is binding changes.
You accepted patch1 and patch3, I am puzzled for patch2 and your comments.

Best Regards,
Peng
>--
>~Vinod

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

* Re: [EXT] Re: [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
  2019-12-18  8:08   ` [EXT] " Peng Ma
@ 2019-12-19 15:54     ` Vinod Koul
  2019-12-23  6:12       ` Peng Ma
  0 siblings, 1 reply; 8+ messages in thread
From: Vinod Koul @ 2019-12-19 15:54 UTC (permalink / raw)
  To: Peng Ma
  Cc: robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong, dmaengine, devicetree, linux-kernel,
	linux-arm-kernel

On 18-12-19, 08:08, Peng Ma wrote:
 >Btw pls send bindings as patch1 and driver changes as patch2.
> [Peng Ma] I don't understand this sentence, Please give me more information.
> As I know patch1 is driver changes, patch2 is dts changes, patch3 is binding changes.
> You accepted patch1 and patch3, I am puzzled for patch2 and your comments.

The order of patches should always be dt-bindings first, followerd by
driver change and the dts changes as the last one in the series.

-- 
~Vinod

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

* Re: [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver
  2019-12-12  3:38 ` [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver Peng Ma
@ 2019-12-23  3:57   ` Shawn Guo
  0 siblings, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2019-12-23  3:57 UTC (permalink / raw)
  To: Peng Ma
  Cc: vkoul, robh+dt, mark.rutland, Leo Li, dan.j.williams, Robin Gong,
	dmaengine, devicetree, linux-kernel, linux-arm-kernel

On Thu, Dec 12, 2019 at 03:38:15AM +0000, Peng Ma wrote:
> The eDMA of LS1028A soc has a little bit different from others, So we
> should distinguish them in driver by compatible.
> 
> Signed-off-by: Peng Ma <peng.ma@nxp.com>

Applied, thanks.

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

* RE: [EXT] Re: [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
  2019-12-19 15:54     ` Vinod Koul
@ 2019-12-23  6:12       ` Peng Ma
  0 siblings, 0 replies; 8+ messages in thread
From: Peng Ma @ 2019-12-23  6:12 UTC (permalink / raw)
  To: Vinod Koul
  Cc: robh+dt, mark.rutland, shawnguo, Leo Li, dan.j.williams,
	Robin Gong, dmaengine, devicetree, linux-kernel,
	linux-arm-kernel



>-----Original Message-----
>From: Vinod Koul <vkoul@kernel.org>
>Sent: 2019年12月19日 23:55
>To: Peng Ma <peng.ma@nxp.com>
>Cc: robh+dt@kernel.org; mark.rutland@arm.com; shawnguo@kernel.org; Leo
>Li <leoyang.li@nxp.com>; dan.j.williams@intel.com; Robin Gong
><yibin.gong@nxp.com>; dmaengine@vger.kernel.org;
>devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
>linux-arm-kernel@lists.infradead.org
>Subject: Re: [EXT] Re: [v5 1/3] dmaengine: fsl-edma: Add eDMA support for
>QorIQ LS1028A platform
>
>Caution: EXT Email
>
>On 18-12-19, 08:08, Peng Ma wrote:
> >Btw pls send bindings as patch1 and driver changes as patch2.
>> [Peng Ma] I don't understand this sentence, Please give me more
>information.
>> As I know patch1 is driver changes, patch2 is dts changes, patch3 is binding
>changes.
>> You accepted patch1 and patch3, I am puzzled for patch2 and your
>comments.
>
>The order of patches should always be dt-bindings first, followerd by driver
>change and the dts changes as the last one in the series.
>
[Peng Ma] OK,Got it.
Thanks very much!

Best Regards,
Peng
>--
>~Vinod

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

end of thread, other threads:[~2019-12-23  6:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12  3:38 [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Peng Ma
2019-12-12  3:38 ` [v5 2/3] arm64: dts: ls1028a: Update edma compatible to fit eDMA driver Peng Ma
2019-12-23  3:57   ` Shawn Guo
2019-12-12  3:38 ` [v5 3/3] dt-bindings: dma: fsl-edma: add new fsl,fsl,ls1028a-edma Peng Ma
2019-12-18  6:26 ` [v5 1/3] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform Vinod Koul
2019-12-18  8:08   ` [EXT] " Peng Ma
2019-12-19 15:54     ` Vinod Koul
2019-12-23  6:12       ` Peng Ma

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