dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
Subsystems (2)
PATCH v2 1/1 dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
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.
---
Changed for V2:
- Explaining what's the "Our platforms"
drivers/dma/fsl-edma-common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/dma/fsl-edma-common.c +12 -0
@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/dma-mapping.h> +#include <linux/sys_soc.h> #include "fsl-edma-common.h"
@@ -42,6 +43,11 @@#define EDMA_TCD 0x1000 +static struct soc_device_attribute soc_fixup_tuning[] = { + { .family ="QorIQ LS1028A" }, + { }, +}; +static void fsl_edma_enable_request (struct fsl_edma_chan *fsl_chan) {struct edma_regs *regs = &fsl_chan->edma->regs;
@@ -109,10 +115,16 @@ 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->big_endian && +soc_device_match (soc_fixup_tuning)) + ch_off += endian_diff[ch_off %4 ]; + muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; slot =EDMAMUX_CHCFG_SOURCE (slot);
Signature · 1 line
2.9.5
Quoted 13 lines
-----Original Message-----
From: Peng Ma <[email protected]>
Sent: Sunday, October 20, 2019 9:22 PM
To: [email protected]
Cc: [email protected]; Leo Li <[email protected]>; [email protected]; Fabio Estevam <[email protected]>; [email protected]; [email protected]; Peng Ma <[email protected]>
Subject: [V2] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platform
Quoted 2 lines
Our
platforms(such as LS1021A, LS1012A, LS1043A, LS1046A, LS1028A)with below
You only covered QorIQ SoCs, how about the situation for IMX SoCs?
Quoted 60 lines
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 <[email protected]>---
Changed for V2:
- Explaining what's the "Our platforms"drivers/dma/fsl-edma-common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/dma/fsl-edma- renamed from drivers/dma/fsl-edma-common.c +0
-0
common.cindex b1a7ca9..611186b 100644drivers/dma/fsl-edma-common.c +7
-0@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/dma-mapping.h> +#include <linux/sys_soc.h> #include "fsl-edma-common.h" @@ -42,6 +43,11 @@#define EDMA_TCD 0x1000 +static struct soc_device_attribute soc_fixup_tuning[] = { + { .family ="QorIQ LS1028A" }, + { }, +}; +static void fsl_edma_enable_request (struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; @@ -109,10 +115,16 @@ 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;
drivers/dma/fsl-edma-common.c
Quoted 10 lines
drivers/dma/fsl-edma-common.c +6
-0+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->big_endian && +soc_device_match (soc_fixup_tuning)) + ch_off += endian_diff[ch_off %4 ]; +
This probably is not the best fix now. There is a new mux_configure32() API added but it doesn't consider endianness. How about making it properly taken care of endianness? And use it to set these registers?
Quoted 5 lines
drivers/dma/fsl-edma-common.c +0
-1muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; slot =EDMAMUX_CHCFG_SOURCE (slot); --2.9.5
Quoted 82 lines · Leo Li
Quoted 14 lines
-----Original Message-----
From: Peng Ma <[email protected]>
Sent: Sunday, October 20, 2019 9:22 PM
To: [email protected]
Cc: [email protected]; Leo Li <[email protected]>; [email protected]; Fabio Estevam <[email protected]>; [email protected]; [email protected]; Peng Ma <[email protected]>
Subject: [V2] dmaengine: fsl-edma: Add eDMA support for QorIQ LS1028A platformQuoted 2 lines
Our
platforms(such as LS1021A, LS1012A, LS1043A, LS1046A, LS1028A)with belowYou only covered QorIQ SoCs, how about the situation for IMX SoCs?
Quoted 63 lines
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 <[email protected]>---
Changed for V2:
- Explaining what's the "Our platforms"drivers/dma/fsl-edma-common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/dma/fsl-edma- renamed from drivers/dma/fsl-edma-common.c +0
-0
common.cindex b1a7ca9..611186b 100644drivers/dma/fsl-edma-common.c +8
-0@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/dma-mapping.h> +#include <linux/sys_soc.h> #include "fsl-edma-common.h" @@ -42,6 +43,11 @@#define EDMA_TCD 0x1000 +static struct soc_device_attribute soc_fixup_tuning[] = { + { .family ="QorIQ LS1028A" }, + { }, +}; +static void fsl_edma_enable_request (struct fsl_edma_chan *fsl_chan) { struct edma_regs *regs = &fsl_chan->edma->regs; @@ -109,10 +115,16 @@ 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;
Quoted 9 lines
drivers/dma/fsl-edma-common.c void fsl_edma_chan_mux(struct fsl_edma_chan *fsl_chan, · line 127
Quoted 7 lines
chans_per_mux = fsl_chan->edma->n_chans / dmamux_nr; ch_off = fsl_chan->vchan.chan.chan_id % chans_per_mux;drivers/dma/fsl-edma-common.c +5
-0+ +if (!fsl_chan->edma->big_endian && +soc_device_match (soc_fixup_tuning)) + ch_off += endian_diff[ch_off %4 ]; +This probably is not the best fix now. There is a new
mux_configure32()API added but it doesn't consider endianness. How about making it properly taken care of endianness? And use it to set these registers?
You can ignore this comment. The mux_configure32() seems to deal with a different register layout(32-bit register per CH).
Considering the register per channel is defined as 8-bit in the reference manual, the hardware seems to be weird to require byte-swapping as if the register is 32-bit. Probably you can rename soc_fixup_tuning something like mux_byte_swap_quirk.
Quoted 7 lines
Quoted 6 lines
muxaddr = fsl_chan->edma->muxbase[ch / chans_per_mux]; slot = EDMAMUX_CHCFG_SOURCE(slot);--
2.9.5