2024-02-27 17:25:26

by Frank Li

[permalink] [raw]
Subject: [PATCH 0/5] dmaengine: fsl-edma: add 8ulp support

Do some small clean up.

0c562876972ee dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan
d9b66cb5fdf62 dmaengine: fsl-edma: add safety check for 'srcid'
aae21b7528311 dmaengine: fsl-edma: clean up chclk and FSL_EDMA_DRV_HAS_CHCLK

Update binding doc.
23a1d1a6609fa dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string

Add 8ulp support.
dmaengine: fsl-edma: add i.MX8ULP edma support

Signed-off-by: Frank Li <[email protected]>
---
Frank Li (3):
dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan
dmaengine: fsl-edma: add safety check for 'srcid'
dmaengine: fsl-edma: clean up chclk and FSL_EDMA_DRV_HAS_CHCLK

Joy Zou (2):
dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string
dmaengine: fsl-edma: add i.MX8ULP edma support

.../devicetree/bindings/dma/fsl,edma.yaml | 24 ++++++++++-
drivers/dma/fsl-edma-common.c | 6 +++
drivers/dma/fsl-edma-common.h | 2 -
drivers/dma/fsl-edma-main.c | 47 ++++++++++++++++------
4 files changed, 62 insertions(+), 17 deletions(-)
---
base-commit: 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e
change-id: 20240227-8ulp_edma-12ee2648d74b

Best regards,
--
Frank Li <[email protected]>



2024-02-27 17:26:18

by Frank Li

[permalink] [raw]
Subject: [PATCH 1/5] dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan

The 'slave_id' field is redundant as it duplicates the functionality of
'srcid'. Remove 'slave_id' from fsl_edma_chan to eliminate redundancy.

Signed-off-by: Frank Li <[email protected]>
---
drivers/dma/fsl-edma-common.h | 1 -
drivers/dma/fsl-edma-main.c | 10 +++++-----
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index 7bf0aba471a8c..4cf1de9f0e512 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -151,7 +151,6 @@ struct fsl_edma_chan {
enum dma_status status;
enum fsl_edma_pm_state pm_state;
bool idle;
- u32 slave_id;
struct fsl_edma_engine *edma;
struct fsl_edma_desc *edesc;
struct dma_slave_config cfg;
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 402f0058a180c..0a6e0c4040274 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -114,8 +114,8 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec,
if (chan) {
chan->device->privatecnt++;
fsl_chan = to_fsl_edma_chan(chan);
- fsl_chan->slave_id = dma_spec->args[1];
- fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id,
+ fsl_chan->srcid = dma_spec->args[1];
+ fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid,
true);
mutex_unlock(&fsl_edma->fsl_edma_mutex);
return chan;
@@ -540,7 +540,7 @@ static int fsl_edma_probe(struct platform_device *pdev)

fsl_chan->edma = fsl_edma;
fsl_chan->pm_state = RUNNING;
- fsl_chan->slave_id = 0;
+ fsl_chan->srcid = 0;
fsl_chan->idle = true;
fsl_chan->dma_dir = DMA_NONE;
fsl_chan->vchan.desc_free = fsl_edma_free_desc;
@@ -682,8 +682,8 @@ static int fsl_edma_resume_early(struct device *dev)
continue;
fsl_chan->pm_state = RUNNING;
edma_write_tcdreg(fsl_chan, 0, csr);
- if (fsl_chan->slave_id != 0)
- fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true);
+ if (fsl_chan->srcid != 0)
+ fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid, true);
}

if (!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_SPLIT_REG))

--
2.34.1


2024-02-27 17:26:20

by Frank Li

[permalink] [raw]
Subject: [PATCH 3/5] dmaengine: fsl-edma: clean up chclk and FSL_EDMA_DRV_HAS_CHCLK

No device currently utilizes chclk and FSL_EDMA_DRV_HAS_CHCLK features.
Removes these unused features.

Signed-off-by: Frank Li <[email protected]>
---
drivers/dma/fsl-edma-common.h | 2 --
drivers/dma/fsl-edma-main.c | 8 --------
2 files changed, 10 deletions(-)

diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index 4cf1de9f0e512..532f647e540e7 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -192,7 +192,6 @@ struct fsl_edma_desc {
#define FSL_EDMA_DRV_WRAP_IO BIT(3)
#define FSL_EDMA_DRV_EDMA64 BIT(4)
#define FSL_EDMA_DRV_HAS_PD BIT(5)
-#define FSL_EDMA_DRV_HAS_CHCLK BIT(6)
#define FSL_EDMA_DRV_HAS_CHMUX BIT(7)
/* imx8 QM audio edma remote local swapped */
#define FSL_EDMA_DRV_QUIRK_SWAPPED BIT(8)
@@ -237,7 +236,6 @@ struct fsl_edma_engine {
void __iomem *muxbase[DMAMUX_NR];
struct clk *muxclk[DMAMUX_NR];
struct clk *dmaclk;
- struct clk *chclk;
struct mutex fsl_edma_mutex;
const struct fsl_edma_drvdata *drvdata;
u32 n_chans;
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 2148a7f1ae843..41c71c360ff1f 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -483,14 +483,6 @@ static int fsl_edma_probe(struct platform_device *pdev)
}
}

- if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) {
- fsl_edma->chclk = devm_clk_get_enabled(&pdev->dev, "mp");
- if (IS_ERR(fsl_edma->chclk)) {
- dev_err(&pdev->dev, "Missing MP block clock.\n");
- return PTR_ERR(fsl_edma->chclk);
- }
- }
-
ret = of_property_read_variable_u32_array(np, "dma-channel-mask", chan_mask, 1, 2);

if (ret > 0) {

--
2.34.1


2024-02-27 17:26:26

by Frank Li

[permalink] [raw]
Subject: [PATCH 2/5] dmaengine: fsl-edma: add safety check for 'srcid'

Ensure that 'srcid' is a non-zero value to avoid dtb passing invalid
'srcid' to the driver.

Signed-off-by: Frank Li <[email protected]>
---
drivers/dma/fsl-edma-main.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 0a6e0c4040274..2148a7f1ae843 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -115,6 +115,13 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec,
chan->device->privatecnt++;
fsl_chan = to_fsl_edma_chan(chan);
fsl_chan->srcid = dma_spec->args[1];
+
+ if (!fsl_chan->srcid) {
+ dev_err(&fsl_chan->pdev->dev, "Invalidate srcid %d\n",
+ fsl_chan->srcid);
+ return NULL;
+ }
+
fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid,
true);
mutex_unlock(&fsl_edma->fsl_edma_mutex);

--
2.34.1


2024-02-27 17:27:21

by Frank Li

[permalink] [raw]
Subject: [PATCH 4/5] dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string

From: Joy Zou <[email protected]>

Add the compatible string 'fsl,imx8ulp-edma' to support the i.MX8ulp's
eDMA, and modify the clock number.

Signed-off-by: Joy Zou <[email protected]>
Reviewed-by: Frank Li <[email protected]>
---
.../devicetree/bindings/dma/fsl,edma.yaml | 24 ++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
index aa51d278cb67b..6c04303dbe453 100644
--- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
+++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
@@ -23,6 +23,7 @@ properties:
- fsl,imx7ulp-edma
- fsl,imx8qm-adma
- fsl,imx8qm-edma
+ - fsl,imx8ulp-edma
- fsl,imx93-edma3
- fsl,imx93-edma4
- fsl,imx95-edma5
@@ -53,11 +54,11 @@ properties:

clocks:
minItems: 1
- maxItems: 2
+ maxItems: 33

clock-names:
minItems: 1
- maxItems: 2
+ maxItems: 33

big-endian:
description: |
@@ -151,6 +152,25 @@ allOf:
dma-channels:
const: 32

+ - if:
+ properties:
+ compatible:
+ contains:
+ const: fsl,imx8ulp-edma
+ then:
+ properties:
+ clock:
+ maxItems: 33
+ clock-names:
+ items:
+ - const: dma
+ - pattern: "^CH[0-31]-clk$"
+ interrupt-names: false
+ interrupts:
+ maxItems: 32
+ "#dma-cells":
+ const: 3
+
unevaluatedProperties: false

examples:

--
2.34.1


2024-02-27 17:27:29

by Frank Li

[permalink] [raw]
Subject: [PATCH 5/5] dmaengine: fsl-edma: add i.MX8ULP edma support

From: Joy Zou <[email protected]>

Add support for the i.MX8ULP platform to the eDMA driver. Introduce the use
of the correct FSL_EDMA_DRV_HAS_CHCLK flag to handle per-channel clock
configurations.

Signed-off-by: Joy Zou <[email protected]>
Reviewed-by: Frank Li <[email protected]>
---
drivers/dma/fsl-edma-common.c | 6 ++++++
drivers/dma/fsl-edma-common.h | 1 +
drivers/dma/fsl-edma-main.c | 22 ++++++++++++++++++++++
3 files changed, 29 insertions(+)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index b18faa7cfedb9..f9144b0154396 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -3,6 +3,7 @@
// Copyright (c) 2013-2014 Freescale Semiconductor, Inc
// Copyright (c) 2017 Sysam, Angelo Dureghello <[email protected]>

+#include <linux/clk.h>
#include <linux/dmapool.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -810,6 +811,9 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
{
struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan);

+ if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
+ clk_prepare_enable(fsl_chan->clk);
+
fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev,
fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_TCD64 ?
sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd),
@@ -838,6 +842,8 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan)
fsl_chan->tcd_pool = NULL;
fsl_chan->is_sw = false;
fsl_chan->srcid = 0;
+ if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
+ clk_disable_unprepare(fsl_chan->clk);
}

void fsl_edma_cleanup_vchan(struct dma_device *dmadev)
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index 532f647e540e7..01157912bfd5f 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -192,6 +192,7 @@ struct fsl_edma_desc {
#define FSL_EDMA_DRV_WRAP_IO BIT(3)
#define FSL_EDMA_DRV_EDMA64 BIT(4)
#define FSL_EDMA_DRV_HAS_PD BIT(5)
+#define FSL_EDMA_DRV_HAS_CHCLK BIT(6)
#define FSL_EDMA_DRV_HAS_CHMUX BIT(7)
/* imx8 QM audio edma remote local swapped */
#define FSL_EDMA_DRV_QUIRK_SWAPPED BIT(8)
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 41c71c360ff1f..0837535aa7548 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -356,6 +356,16 @@ static struct fsl_edma_drvdata imx8qm_audio_data = {
.setup_irq = fsl_edma3_irq_init,
};

+static struct fsl_edma_drvdata imx8ulp_data = {
+ .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_CHCLK | FSL_EDMA_DRV_HAS_DMACLK |
+ FSL_EDMA_DRV_EDMA3,
+ .chreg_space_sz = 0x10000,
+ .chreg_off = 0x10000,
+ .mux_off = 0x10000 + offsetof(struct fsl_edma3_ch_reg, ch_mux),
+ .mux_skip = 0x10000,
+ .setup_irq = fsl_edma3_irq_init,
+};
+
static struct fsl_edma_drvdata imx93_data3 = {
.flags = FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3,
.chreg_space_sz = 0x10000,
@@ -388,6 +398,7 @@ static const struct of_device_id fsl_edma_dt_ids[] = {
{ .compatible = "fsl,imx7ulp-edma", .data = &imx7ulp_data},
{ .compatible = "fsl,imx8qm-edma", .data = &imx8qm_data},
{ .compatible = "fsl,imx8qm-adma", .data = &imx8qm_audio_data},
+ { .compatible = "fsl,imx8ulp-edma", .data = &imx8ulp_data},
{ .compatible = "fsl,imx93-edma3", .data = &imx93_data3},
{ .compatible = "fsl,imx93-edma4", .data = &imx93_data4},
{ .compatible = "fsl,imx95-edma5", .data = &imx95_data5},
@@ -441,6 +452,7 @@ static int fsl_edma_probe(struct platform_device *pdev)
struct fsl_edma_engine *fsl_edma;
const struct fsl_edma_drvdata *drvdata = NULL;
u32 chan_mask[2] = {0, 0};
+ char clk_name[36];
struct edma_regs *regs;
int chans;
int ret, i;
@@ -550,11 +562,21 @@ static int fsl_edma_probe(struct platform_device *pdev)
+ i * drvdata->chreg_space_sz + drvdata->chreg_off + len;
fsl_chan->mux_addr = fsl_edma->membase + drvdata->mux_off + i * drvdata->mux_skip;

+ if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) {
+ snprintf(clk_name, sizeof(clk_name), "CH%02d-clk", i);
+ fsl_chan->clk = devm_clk_get_enabled(&pdev->dev,
+ (const char *)clk_name);
+
+ if (IS_ERR(fsl_chan->clk))
+ return PTR_ERR(fsl_chan->clk);
+ }
fsl_chan->pdev = pdev;
vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev);

edma_write_tcdreg(fsl_chan, cpu_to_le32(0), csr);
fsl_edma_chan_mux(fsl_chan, 0, false);
+ if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK)
+ clk_disable_unprepare(fsl_chan->clk);
}

ret = fsl_edma->drvdata->setup_irq(pdev, fsl_edma);

--
2.34.1


2024-02-29 09:50:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 4/5] dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string

On 27/02/2024 18:21, Frank Li wrote:
>
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: fsl,imx8ulp-edma
> + then:
> + properties:
> + clock:
> + maxItems: 33
> + clock-names:
> + items:
> + - const: dma
> + - pattern: "^CH[0-31]-clk$"
> + interrupt-names: false
> + interrupts:
> + maxItems: 32
> + "#dma-cells":
> + const: 3

Why suddenly fsl,vf610-edma can have from 2 to 33 clocks? Constrain
properly the variants.

Best regards,
Krzysztof


2024-02-29 14:11:12

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/5] dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan

Hi Frank,

kernel test robot noticed the following build errors:

[auto build test ERROR on 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e]

url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/dmaengine-fsl-edma-remove-slave_id-from-fsl_edma_chan/20240228-012842
base: 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e
patch link: https://lore.kernel.org/r/20240227-8ulp_edma-v1-1-7fcfe1e265c2%40nxp.com
patch subject: [PATCH 1/5] dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240229/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project edd4aee4dd9b5b98b2576a6f783e4086173d902a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240229/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/dma/mcf-edma-main.c:6:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2193:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/dma/mcf-edma-main.c:8:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
| ^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
| ^
In file included from drivers/dma/mcf-edma-main.c:8:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
In file included from drivers/dma/mcf-edma-main.c:8:
In file included from include/linux/dmaengine.h:12:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
692 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
700 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
708 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
717 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
726 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
735 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
>> drivers/dma/mcf-edma-main.c:198:13: error: no member named 'slave_id' in 'struct fsl_edma_chan'
198 | mcf_chan->slave_id = i;
| ~~~~~~~~ ^
drivers/dma/mcf-edma-main.c:280:21: error: no member named 'slave_id' in 'struct fsl_edma_chan'
280 | return (mcf_chan->slave_id == (uintptr_t)param);
| ~~~~~~~~ ^
17 warnings and 2 errors generated.


vim +198 drivers/dma/mcf-edma-main.c

af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 152
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 153 static int mcf_edma_probe(struct platform_device *pdev)
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 154 {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 155 struct mcf_edma_platform_data *pdata;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 156 struct fsl_edma_engine *mcf_edma;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 157 struct edma_regs *regs;
923b138388928a drivers/dma/mcf-edma.c Christophe JAILLET 2023-05-06 158 int ret, i, chans;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 159
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 160 pdata = dev_get_platdata(&pdev->dev);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 161 if (!pdata) {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 162 dev_err(&pdev->dev, "no platform data supplied\n");
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 163 return -EINVAL;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 164 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 165
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 166 if (!pdata->dma_channels) {
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 167 dev_info(&pdev->dev, "setting default channel number to 64");
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 168 chans = 64;
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 169 } else {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 170 chans = pdata->dma_channels;
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 171 }
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 172
923b138388928a drivers/dma/mcf-edma.c Christophe JAILLET 2023-05-06 173 mcf_edma = devm_kzalloc(&pdev->dev, struct_size(mcf_edma, chans, chans),
923b138388928a drivers/dma/mcf-edma.c Christophe JAILLET 2023-05-06 174 GFP_KERNEL);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 175 if (!mcf_edma)
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 176 return -ENOMEM;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 177
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 178 mcf_edma->n_chans = chans;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 179
af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 180 /* Set up drvdata for ColdFire edma */
af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 181 mcf_edma->drvdata = &mcf_data;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 182 mcf_edma->big_endian = 1;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 183
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 184 mutex_init(&mcf_edma->fsl_edma_mutex);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 185
4b23603a251d24 drivers/dma/mcf-edma.c Tudor Ambarus 2022-11-10 186 mcf_edma->membase = devm_platform_ioremap_resource(pdev, 0);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 187 if (IS_ERR(mcf_edma->membase))
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 188 return PTR_ERR(mcf_edma->membase);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 189
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 190 fsl_edma_setup_regs(mcf_edma);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 191 regs = &mcf_edma->regs;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 192
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 193 INIT_LIST_HEAD(&mcf_edma->dma_dev.channels);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 194 for (i = 0; i < mcf_edma->n_chans; i++) {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 195 struct fsl_edma_chan *mcf_chan = &mcf_edma->chans[i];
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 196
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 197 mcf_chan->edma = mcf_edma;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 @198 mcf_chan->slave_id = i;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 199 mcf_chan->idle = true;
0fa89f972da607 drivers/dma/mcf-edma.c Laurentiu Tudor 2019-01-18 200 mcf_chan->dma_dir = DMA_NONE;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 201 mcf_chan->vchan.desc_free = fsl_edma_free_desc;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 202 vchan_init(&mcf_chan->vchan, &mcf_edma->dma_dev);
7536f8b371adcc drivers/dma/mcf-edma-main.c Frank Li 2023-08-21 203 mcf_chan->tcd = mcf_edma->membase + EDMA_TCD
7536f8b371adcc drivers/dma/mcf-edma-main.c Frank Li 2023-08-21 204 + i * sizeof(struct fsl_edma_hw_tcd);
b51dd7c8aac292 drivers/dma/mcf-edma-main.c Frank Li 2023-12-21 205 edma_write_tcdreg(mcf_chan, cpu_to_le32(0), csr);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 206 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 207
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 208 iowrite32(~0, regs->inth);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 209 iowrite32(~0, regs->intl);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 210
af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 211 ret = mcf_edma->drvdata->setup_irq(pdev, mcf_edma);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 212 if (ret)
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 213 return ret;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 214
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 215 dma_cap_set(DMA_PRIVATE, mcf_edma->dma_dev.cap_mask);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 216 dma_cap_set(DMA_SLAVE, mcf_edma->dma_dev.cap_mask);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 217 dma_cap_set(DMA_CYCLIC, mcf_edma->dma_dev.cap_mask);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 218
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 219 mcf_edma->dma_dev.dev = &pdev->dev;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 220 mcf_edma->dma_dev.device_alloc_chan_resources =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 221 fsl_edma_alloc_chan_resources;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 222 mcf_edma->dma_dev.device_free_chan_resources =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 223 fsl_edma_free_chan_resources;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 224 mcf_edma->dma_dev.device_config = fsl_edma_slave_config;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 225 mcf_edma->dma_dev.device_prep_dma_cyclic =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 226 fsl_edma_prep_dma_cyclic;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 227 mcf_edma->dma_dev.device_prep_slave_sg = fsl_edma_prep_slave_sg;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 228 mcf_edma->dma_dev.device_tx_status = fsl_edma_tx_status;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 229 mcf_edma->dma_dev.device_pause = fsl_edma_pause;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 230 mcf_edma->dma_dev.device_resume = fsl_edma_resume;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 231 mcf_edma->dma_dev.device_terminate_all = fsl_edma_terminate_all;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 232 mcf_edma->dma_dev.device_issue_pending = fsl_edma_issue_pending;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 233
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 234 mcf_edma->dma_dev.src_addr_widths = FSL_EDMA_BUSWIDTHS;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 235 mcf_edma->dma_dev.dst_addr_widths = FSL_EDMA_BUSWIDTHS;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 236 mcf_edma->dma_dev.directions =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 237 BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 238
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 239 mcf_edma->dma_dev.filter.fn = mcf_edma_filter_fn;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 240 mcf_edma->dma_dev.filter.map = pdata->slave_map;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 241 mcf_edma->dma_dev.filter.mapcnt = pdata->slavecnt;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 242
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 243 platform_set_drvdata(pdev, mcf_edma);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 244
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 245 ret = dma_async_device_register(&mcf_edma->dma_dev);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 246 if (ret) {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 247 dev_err(&pdev->dev,
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 248 "Can't register Freescale eDMA engine. (%d)\n", ret);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 249 return ret;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 250 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 251
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 252 /* Enable round robin arbitration */
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 253 iowrite32(EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 254
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 255 return 0;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 256 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 257

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-02-29 16:18:31

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 4/5] dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string

On 29/02/2024 16:54, Frank Li wrote:
> On Thu, Feb 29, 2024 at 10:49:43AM +0100, Krzysztof Kozlowski wrote:
>> On 27/02/2024 18:21, Frank Li wrote:
>>>
>>> + - if:
>>> + properties:
>>> + compatible:
>>> + contains:
>>> + const: fsl,imx8ulp-edma
>>> + then:
>>> + properties:
>>> + clock:
>>> + maxItems: 33
>>> + clock-names:
>>> + items:
>>> + - const: dma
>>> + - pattern: "^CH[0-31]-clk$"
>>> + interrupt-names: false
>>> + interrupts:
>>> + maxItems: 32
>>> + "#dma-cells":
>>> + const: 3
>>
>> Why suddenly fsl,vf610-edma can have from 2 to 33 clocks? Constrain
>> properly the variants.
>
> Suppose you talk about 'fsl,imx8ulp-edma' instead 'fsl,vf610-edma'.
>
> imx8ulp each channel have one clk, there are 32 channel. 1 channel for core
> controller. So max became 32.
>
> I can add above information in commit message.

No, I meant Vybrid. Quick look at this code and the actual file suggest
that you allow vybrid with 30-whatever clocks. Test it.

Best regards,
Krzysztof


2024-02-29 16:21:36

by Frank Li

[permalink] [raw]
Subject: Re: [PATCH 4/5] dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string

On Thu, Feb 29, 2024 at 10:49:43AM +0100, Krzysztof Kozlowski wrote:
> On 27/02/2024 18:21, Frank Li wrote:
> >
> > + - if:
> > + properties:
> > + compatible:
> > + contains:
> > + const: fsl,imx8ulp-edma
> > + then:
> > + properties:
> > + clock:
> > + maxItems: 33
> > + clock-names:
> > + items:
> > + - const: dma
> > + - pattern: "^CH[0-31]-clk$"
> > + interrupt-names: false
> > + interrupts:
> > + maxItems: 32
> > + "#dma-cells":
> > + const: 3
>
> Why suddenly fsl,vf610-edma can have from 2 to 33 clocks? Constrain
> properly the variants.

Suppose you talk about 'fsl,imx8ulp-edma' instead 'fsl,vf610-edma'.

imx8ulp each channel have one clk, there are 32 channel. 1 channel for core
controller. So max became 32.

I can add above information in commit message.

>
> Best regards,
> Krzysztof
>

2024-02-29 16:47:44

by Frank Li

[permalink] [raw]
Subject: Re: [PATCH 4/5] dt-bindings: fsl-dma: fsl-edma: add fsl,imx8ulp-edma compatible string

On Thu, Feb 29, 2024 at 04:58:23PM +0100, Krzysztof Kozlowski wrote:
> On 29/02/2024 16:54, Frank Li wrote:
> > On Thu, Feb 29, 2024 at 10:49:43AM +0100, Krzysztof Kozlowski wrote:
> >> On 27/02/2024 18:21, Frank Li wrote:
> >>>
> >>> + - if:
> >>> + properties:
> >>> + compatible:
> >>> + contains:
> >>> + const: fsl,imx8ulp-edma
> >>> + then:
> >>> + properties:
> >>> + clock:
> >>> + maxItems: 33
> >>> + clock-names:
> >>> + items:
> >>> + - const: dma
> >>> + - pattern: "^CH[0-31]-clk$"
> >>> + interrupt-names: false
> >>> + interrupts:
> >>> + maxItems: 32
> >>> + "#dma-cells":
> >>> + const: 3
> >>
> >> Why suddenly fsl,vf610-edma can have from 2 to 33 clocks? Constrain
> >> properly the variants.
> >
> > Suppose you talk about 'fsl,imx8ulp-edma' instead 'fsl,vf610-edma'.
> >
> > imx8ulp each channel have one clk, there are 32 channel. 1 channel for core
> > controller. So max became 32.
> >
> > I can add above information in commit message.
>
> No, I meant Vybrid. Quick look at this code and the actual file suggest
> that you allow vybrid with 30-whatever clocks. Test it.

Any tools or good method to find it?

Frank

>
> Best regards,
> Krzysztof
>

2024-02-29 19:09:06

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/5] dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan

Hi Frank,

kernel test robot noticed the following build errors:

[auto build test ERROR on 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e]

url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/dmaengine-fsl-edma-remove-slave_id-from-fsl_edma_chan/20240228-012842
base: 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e
patch link: https://lore.kernel.org/r/20240227-8ulp_edma-v1-1-7fcfe1e265c2%40nxp.com
patch subject: [PATCH 1/5] dmaengine: fsl-edma: remove 'slave_id' from fsl_edma_chan
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240301/[email protected]/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240301/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/dma/mcf-edma-main.c: In function 'mcf_edma_probe':
>> drivers/dma/mcf-edma-main.c:198:25: error: 'struct fsl_edma_chan' has no member named 'slave_id'
198 | mcf_chan->slave_id = i;
| ^~
drivers/dma/mcf-edma-main.c: In function 'mcf_edma_filter_fn':
drivers/dma/mcf-edma-main.c:280:33: error: 'struct fsl_edma_chan' has no member named 'slave_id'
280 | return (mcf_chan->slave_id == (uintptr_t)param);
| ^~


vim +198 drivers/dma/mcf-edma-main.c

af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 152
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 153 static int mcf_edma_probe(struct platform_device *pdev)
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 154 {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 155 struct mcf_edma_platform_data *pdata;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 156 struct fsl_edma_engine *mcf_edma;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 157 struct edma_regs *regs;
923b138388928a drivers/dma/mcf-edma.c Christophe JAILLET 2023-05-06 158 int ret, i, chans;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 159
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 160 pdata = dev_get_platdata(&pdev->dev);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 161 if (!pdata) {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 162 dev_err(&pdev->dev, "no platform data supplied\n");
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 163 return -EINVAL;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 164 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 165
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 166 if (!pdata->dma_channels) {
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 167 dev_info(&pdev->dev, "setting default channel number to 64");
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 168 chans = 64;
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 169 } else {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 170 chans = pdata->dma_channels;
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 171 }
0a46781c89dece drivers/dma/mcf-edma.c Christophe JAILLET 2023-07-12 172
923b138388928a drivers/dma/mcf-edma.c Christophe JAILLET 2023-05-06 173 mcf_edma = devm_kzalloc(&pdev->dev, struct_size(mcf_edma, chans, chans),
923b138388928a drivers/dma/mcf-edma.c Christophe JAILLET 2023-05-06 174 GFP_KERNEL);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 175 if (!mcf_edma)
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 176 return -ENOMEM;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 177
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 178 mcf_edma->n_chans = chans;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 179
af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 180 /* Set up drvdata for ColdFire edma */
af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 181 mcf_edma->drvdata = &mcf_data;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 182 mcf_edma->big_endian = 1;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 183
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 184 mutex_init(&mcf_edma->fsl_edma_mutex);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 185
4b23603a251d24 drivers/dma/mcf-edma.c Tudor Ambarus 2022-11-10 186 mcf_edma->membase = devm_platform_ioremap_resource(pdev, 0);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 187 if (IS_ERR(mcf_edma->membase))
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 188 return PTR_ERR(mcf_edma->membase);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 189
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 190 fsl_edma_setup_regs(mcf_edma);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 191 regs = &mcf_edma->regs;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 192
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 193 INIT_LIST_HEAD(&mcf_edma->dma_dev.channels);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 194 for (i = 0; i < mcf_edma->n_chans; i++) {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 195 struct fsl_edma_chan *mcf_chan = &mcf_edma->chans[i];
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 196
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 197 mcf_chan->edma = mcf_edma;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 @198 mcf_chan->slave_id = i;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 199 mcf_chan->idle = true;
0fa89f972da607 drivers/dma/mcf-edma.c Laurentiu Tudor 2019-01-18 200 mcf_chan->dma_dir = DMA_NONE;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 201 mcf_chan->vchan.desc_free = fsl_edma_free_desc;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 202 vchan_init(&mcf_chan->vchan, &mcf_edma->dma_dev);
7536f8b371adcc drivers/dma/mcf-edma-main.c Frank Li 2023-08-21 203 mcf_chan->tcd = mcf_edma->membase + EDMA_TCD
7536f8b371adcc drivers/dma/mcf-edma-main.c Frank Li 2023-08-21 204 + i * sizeof(struct fsl_edma_hw_tcd);
b51dd7c8aac292 drivers/dma/mcf-edma-main.c Frank Li 2023-12-21 205 edma_write_tcdreg(mcf_chan, cpu_to_le32(0), csr);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 206 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 207
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 208 iowrite32(~0, regs->inth);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 209 iowrite32(~0, regs->intl);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 210
af802728e4ab07 drivers/dma/mcf-edma.c Robin Gong 2019-06-25 211 ret = mcf_edma->drvdata->setup_irq(pdev, mcf_edma);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 212 if (ret)
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 213 return ret;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 214
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 215 dma_cap_set(DMA_PRIVATE, mcf_edma->dma_dev.cap_mask);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 216 dma_cap_set(DMA_SLAVE, mcf_edma->dma_dev.cap_mask);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 217 dma_cap_set(DMA_CYCLIC, mcf_edma->dma_dev.cap_mask);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 218
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 219 mcf_edma->dma_dev.dev = &pdev->dev;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 220 mcf_edma->dma_dev.device_alloc_chan_resources =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 221 fsl_edma_alloc_chan_resources;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 222 mcf_edma->dma_dev.device_free_chan_resources =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 223 fsl_edma_free_chan_resources;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 224 mcf_edma->dma_dev.device_config = fsl_edma_slave_config;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 225 mcf_edma->dma_dev.device_prep_dma_cyclic =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 226 fsl_edma_prep_dma_cyclic;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 227 mcf_edma->dma_dev.device_prep_slave_sg = fsl_edma_prep_slave_sg;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 228 mcf_edma->dma_dev.device_tx_status = fsl_edma_tx_status;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 229 mcf_edma->dma_dev.device_pause = fsl_edma_pause;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 230 mcf_edma->dma_dev.device_resume = fsl_edma_resume;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 231 mcf_edma->dma_dev.device_terminate_all = fsl_edma_terminate_all;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 232 mcf_edma->dma_dev.device_issue_pending = fsl_edma_issue_pending;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 233
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 234 mcf_edma->dma_dev.src_addr_widths = FSL_EDMA_BUSWIDTHS;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 235 mcf_edma->dma_dev.dst_addr_widths = FSL_EDMA_BUSWIDTHS;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 236 mcf_edma->dma_dev.directions =
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 237 BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 238
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 239 mcf_edma->dma_dev.filter.fn = mcf_edma_filter_fn;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 240 mcf_edma->dma_dev.filter.map = pdata->slave_map;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 241 mcf_edma->dma_dev.filter.mapcnt = pdata->slavecnt;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 242
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 243 platform_set_drvdata(pdev, mcf_edma);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 244
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 245 ret = dma_async_device_register(&mcf_edma->dma_dev);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 246 if (ret) {
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 247 dev_err(&pdev->dev,
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 248 "Can't register Freescale eDMA engine. (%d)\n", ret);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 249 return ret;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 250 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 251
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 252 /* Enable round robin arbitration */
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 253 iowrite32(EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr);
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 254
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 255 return 0;
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 256 }
e7a3ff92eaf19e drivers/dma/mcf-edma.c Angelo Dureghello 2018-08-19 257

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki