dmaengine: fsl-edma: add 8ulp support
Frank Li
maintainerv2 cover 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
---
Changes in v2:
Fixed dt-bind about clocks number restriction for vf610. Keep the same
restriction for other compatible string.
Send out v2 to avoid consiste test rebot report build error. Fixed build error
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]/
Rework dt-binding commit message. Add reason why change clk number to 33.
- Link to v1: https://lore.kernel.org/r/[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: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
dmaengine: fsl-edma: add i.MX8ULP edma support
.../devicetree/bindings/dma/fsl,edma.yaml | 26 +++++++++++- drivers/dma/fsl-edma-common.c | 6 +++ drivers/dma/fsl-edma-common.h | 2 - drivers/dma/fsl-edma-main.c | 47 ++++++++++++++++------ drivers/dma/mcf-edma-main.c | 4 +- 5 files changed, 66 insertions(+), 19 deletions(-)
---
base-commit: 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e
change-id: 20240227-8ulp_edma-12ee2648d74b
Best regards,
Signature · 1 line
Frank Li <[email protected]>
Frank Li
maintainerPATCH v2 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.
--- drivers/dma/fsl-edma-common.h | 1 - drivers/dma/fsl-edma-main.c | 10 +++++----- drivers/dma/mcf-edma-main.c | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/dma/fsl-edma-common.h +0 -1
@@ -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;
drivers/dma/fsl-edma-main.c +5 -5
@@ -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 ))
drivers/dma/mcf-edma-main.c +2 -2
@@ -195,7 +195,7 @@ static int mcf_edma_probe(struct platform_device *pdev)struct fsl_edma_chan *mcf_chan = &mcf_edma->chans[i]; mcf_chan->edma = mcf_edma; - mcf_chan->slave_id = i; + mcf_chan->srcid = i; mcf_chan->idle = true; mcf_chan->dma_dir =DMA_NONE ; mcf_chan->vchan.desc_free = fsl_edma_free_desc;
@@ -277,7 +277,7 @@ bool mcf_edma_filter_fn(struct dma_chan *chan, void *param)if (chan->device->dev->driver == &mcf_edma_driver.driver) {struct fsl_edma_chan *mcf_chan =to_fsl_edma_chan (chan); -return (mcf_chan->slave_id == (uintptr_t )param); +return (mcf_chan->srcid == (uintptr_t )param); }return false;
Signature · 1 line
2.34.1
Frank Li
maintainerPATCH v2 2/5 dmaengine: fsl-edma: add safety check for 'srcid'
In reply to Frank LiEnsure that 'srcid' is a non-zero value to avoid dtb passing invalid 'srcid' to the driver.
--- drivers/dma/fsl-edma-main.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/dma/fsl-edma-main.c +7 -0
@@ -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);
Signature · 1 line
2.34.1
Frank Li
maintainerPATCH v2 3/5 dmaengine: fsl-edma: clean up chclk and FSL_EDMA_DRV_HAS_CHCLK
In reply to Frank LiNo device currently utilizes chclk and FSL_EDMA_DRV_HAS_CHCLK features. Removes these unused features.
--- drivers/dma/fsl-edma-common.h | 2 -- drivers/dma/fsl-edma-main.c | 8 -------- 2 files changed, 10 deletions(-)
drivers/dma/fsl-edma-common.h +0 -2
@@ -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;
drivers/dma/fsl-edma-main.c +0 -8
@@ -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 ) {
Signature · 1 line
2.34.1
Frank Li
maintainerPATCH v2 4/5 dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
In reply to Frank LiFrom: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/dma/fsl,edma.yaml +24 -2
@@ -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: |
@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0
@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma
@@ -151,6 +154,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:
Signature · 1 line
2.34.1
Rob Herring
maintainerRe: [PATCH v2 4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
Quoted 58 lines · Frank Li
From: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
Signed-off-by Joy Zou <[email protected]>Signed-off-by Frank Li <[email protected]>--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/dma/fsl,edma.yaml +5
-2@@ -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: |@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma@@ -151,6 +154,25 @@ allOf: dma-channels:
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 164
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +8
-0const: 32 + - if: + properties: + compatible: + contains: + const: fsl,imx8ulp-edma + then: + properties: + clock:
clocks
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 165
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl,edma.yaml +1
-0+ maxItems: 33
That is already the max. I think you want 'minItems: 33' here.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 169
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +4
-0+ clock-names: + items: + - const: dma + - pattern: "^CH[0-31]-clk$"
'-clk' is redundant. [0-31] is not how you do a range of numbers with regex.
This doesn't cover clocks 3-33. Not a great way to express in json-schema, but this should do it:
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
That doesn't enforce the order of 'chN' entries though. Probably good enough.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 172
Quoted 3 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +3
-0+ interrupt-names: false + interrupts: + maxItems: 32
minItems
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 174
Quoted 2 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +2
-0+ "#dma-cells": + const: 3
Is what is in each cell defined somewhere? If not, you need a description with those details.
Rob
Frank Li
maintainerRe: [PATCH v2 4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
Quoted 87 lines · Rob Herring
Quoted 58 lines · Frank Li
From: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
Signed-off-by Joy Zou <[email protected]>Signed-off-by Frank Li <[email protected]>--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/dma/fsl,edma.yaml +5
-2@@ -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: |@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma@@ -151,6 +154,25 @@ allOf: dma-channels:Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 164
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +8
-0const: 32 + - if: + properties: + compatible: + contains: + const: fsl,imx8ulp-edma + then: + properties: + clock:clocks
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 165
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl,edma.yaml +1
-0+ maxItems: 33That is already the max. I think you want 'minItems: 33' here.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 169
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +4
-0+ clock-names: + items: + - const: dma + - pattern: "^CH[0-31]-clk$"'-clk' is redundant. [0-31] is not how you do a range of numbers with regex.
This doesn't cover clocks 3-33. Not a great way to express in json-schema, but this should do it:
Quoted 7 lines
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
I understand pattern is wrong. But I don't understand why need 'allOf'. 8ulp need clock 'dma" and "ch*". I think
items:
- const: dma
- pattern: "^CH[0-31]-clk$"
should be enough.
If you means put on top allOf, other platform use clock name such as 'dmamux0'.
Frank
Quoted 18 lines
That doesn't enforce the order of 'chN' entries though. Probably good enough.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 172
Quoted 3 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +3
-0+ interrupt-names: false + interrupts: + maxItems: 32minItems
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 174
Quoted 2 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +2
-0+ "#dma-cells": + const: 3Is what is in each cell defined somewhere? If not, you need a description with those details.
Rob
Rob Herring
maintainerRe: [PATCH v2 4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
Quoted 97 lines · Frank Li
Quoted 87 lines · Rob Herring
Quoted 58 lines · Frank Li
From: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
Signed-off-by Joy Zou <[email protected]>Signed-off-by Frank Li <[email protected]>--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/dma/fsl,edma.yaml +5
-2@@ -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: |@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma@@ -151,6 +154,25 @@ allOf: dma-channels:Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 164
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +8
-0const: 32 + - if: + properties: + compatible: + contains: + const: fsl,imx8ulp-edma + then: + properties: + clock:clocks
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 165
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl,edma.yaml +1
-0+ maxItems: 33That is already the max. I think you want 'minItems: 33' here.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 169
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +4
-0+ clock-names: + items: + - const: dma + - pattern: "^CH[0-31]-clk$"'-clk' is redundant. [0-31] is not how you do a range of numbers with regex.
This doesn't cover clocks 3-33. Not a great way to express in json-schema, but this should do it:
Quoted 7 lines
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
Quoted 1 line
I understand pattern is wrong. But I don't understand why need 'allOf'.
The first 'items' says the 1st entry must be 'dma'. (It might need a 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all entries must be either 'dma' or the CHn pattern.
Quoted 7 lines
8ulp need clock 'dma" and "ch*". I think
items:
- const: dma
- pattern: "^CH[0-31]-clk$"should be enough.
If it was, then I would not have said anything. If you don't believe me see if this passes validation:
clock-names = "dma", "CH0", "foobar";
Quoted 2 lines
If you means put on top allOf, other platform use clock name such as 'dmamux0'.
What? It's under an if/then schema.
Rob
Frank Li
maintainerRe: [PATCH v2 4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
Quoted 110 lines · Rob Herring
Quoted 97 lines · Frank Li
Quoted 87 lines · Rob Herring
Quoted 58 lines · Frank Li
From: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
Signed-off-by Joy Zou <[email protected]>Signed-off-by Frank Li <[email protected]>--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/dma/fsl,edma.yaml +5
-2@@ -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: |@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma@@ -151,6 +154,25 @@ allOf: dma-channels:Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 164
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +8
-0const: 32 + - if: + properties: + compatible: + contains: + const: fsl,imx8ulp-edma + then: + properties: + clock:clocks
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 165
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl,edma.yaml +1
-0+ maxItems: 33That is already the max. I think you want 'minItems: 33' here.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 169
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +4
-0+ clock-names: + items: + - const: dma + - pattern: "^CH[0-31]-clk$"'-clk' is redundant. [0-31] is not how you do a range of numbers with regex.
This doesn't cover clocks 3-33. Not a great way to express in json-schema, but this should do it:
Quoted 7 lines
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"Quoted 1 line
I understand pattern is wrong. But I don't understand why need 'allOf'.
The first 'items' says the 1st entry must be 'dma'. (It might need a 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all entries must be either 'dma' or the CHn pattern.
Quoted 6 lines
8ulp need clock 'dma" and "ch*". I think
items:
- const: dma
- pattern: "^CH[0-31]-clk$"
Quoted 6 lines
Quoted 1 line
should be enough.
If it was, then I would not have said anything. If you don't believe me see if this passes validation:
clock-names = "dma", "CH0", "foobar";
clock-names:
minItems: 33
items:
oneOf:
- const: dma
- pattern: "^ch(0[0-9]|[1-2][0-9]|3[01])$"
Above code can pass check and detect error of "foobar", it should miss restriction about first item must be 'dma'.
Your previous allOf block,
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
It reported clock-names too long.
Frank
Quoted 7 lines
Quoted 3 lines
If you means put on top allOf, other platform use clock name such as 'dmamux0'.
What? It's under an if/then schema.
Rob
Frank Li
maintainerRe: [PATCH v2 4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
In reply to Rob HerringQuoted 98 lines · Rob Herring
Quoted 97 lines · Frank Li
Quoted 94 lines · Rob Herring
Quoted 58 lines · Frank Li
From: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
Signed-off-by Joy Zou <[email protected]>Signed-off-by Frank Li <[email protected]>--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/dma/fsl,edma.yaml +5
-2@@ -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: |@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma@@ -151,6 +154,25 @@ allOf: dma-channels:Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 164
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +8
-0const: 32 + - if: + properties: + compatible: + contains: + const: fsl,imx8ulp-edma + then: + properties: + clock:clocks
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 165
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl,edma.yaml +1
-0+ maxItems: 33That is already the max. I think you want 'minItems: 33' here.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 169
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +4
-0+ clock-names: + items: + - const: dma + - pattern: "^CH[0-31]-clk$"'-clk' is redundant. [0-31] is not how you do a range of numbers with regex.
This doesn't cover clocks 3-33. Not a great way to express in json-schema, but this should do it:
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
Quoted 5 lines
Quoted 1 line
I understand pattern is wrong. But I don't understand why need 'allOf'.
The first 'items' says the 1st entry must be 'dma'. (It might need a 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all entries must be either 'dma' or the CHn pattern.
After dig into dt_scheme and json scheme, I start understand what your means.
"clock-names": {
"minItems": 33,
"allOf": [
{
"items": [
{
"const": "dma"
}
],
"maxItems": 33,
^^^^^^^^
Here need a maxItem 33 and make sure first item is "dma" and totalarray is 33.
"type": "array",
"minItems": 1
},
{
"items": {
"oneOf": [
{
"const": "dma"
},
{
"pattern": "^ch(0[0-9]|[1-2][0-9]|3[01])$"
}
]
},
"type": "array"
}
]
}The yaml source is
allOf:
- items:
- const: dma
maxItems: 33
- items:
oneOf:
- const: dma
- pattern: "^ch(0[0-9]|[1-2][0-9]|3[01])$"
But unfortunately,
dtschema/meta-schemas/items.yaml
type: object
properties:
items:
type: array
additionalItems: false
required:
- items
- maxItems
then:
description: '"maxItems" is not needed with an "items" list' not:
required:
- maxItem
dt_binding check will complain
'"maxItems" is not needed with an "items" list'
I am not sure how to go futher. Maybe below 'stupid' method is less impact.
items
- const: dma
- const: ch00
...
- const: ch31
Frank
Quoted 20 lines
Quoted 8 lines
8ulp need clock 'dma" and "ch*". I think
items:
- const: dma
- pattern: "^CH[0-31]-clk$"should be enough.
If it was, then I would not have said anything. If you don't believe me see if this passes validation:
clock-names = "dma", "CH0", "foobar";
Quoted 2 lines
If you means put on top allOf, other platform use clock name such as 'dmamux0'.
What? It's under an if/then schema.
Rob
Frank Li
maintainerRe: [PATCH v2 4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string
Quoted 178 lines · Frank Li
Quoted 98 lines · Rob Herring
Quoted 97 lines · Frank Li
Quoted 94 lines · Rob Herring
Quoted 58 lines · Frank Li
From: Joy Zou <[email protected]>
Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP eDMA architecture features one clock for each DMA channel and an additional clock for the core controller. Given a maximum of 32 DMA channels, the maximum clock number consequently increases to 33.
Signed-off-by Joy Zou <[email protected]>Signed-off-by Frank Li <[email protected]>--- .../devicetree/bindings/dma/fsl,edma.yaml | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/dma/fsl,edma.yaml +5
-2@@ -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: |@@ -108,6 +109,7 @@ allOf: properties: clocks: minItems: 2 + maxItems: 2 clock-names: items: - const: dmamux0@@ -136,6 +138,7 @@ allOf: properties: clock: minItems: 2 + maxItems: 2 clock-names: items: - const: dma@@ -151,6 +154,25 @@ allOf: dma-channels:Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 164
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +8
-0const: 32 + - if: + properties: + compatible: + contains: + const: fsl,imx8ulp-edma + then: + properties: + clock:clocks
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 165
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl,edma.yaml +1
-0+ maxItems: 33That is already the max. I think you want 'minItems: 33' here.
Documentation/devicetree/bindings/dma/fsl,edma.yaml allOf: · line 169
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl,edma.yaml +4
-0+ clock-names: + items: + - const: dma + - pattern: "^CH[0-31]-clk$"'-clk' is redundant. [0-31] is not how you do a range of numbers with regex.
This doesn't cover clocks 3-33. Not a great way to express in json-schema, but this should do it:
allOf:
- items:
- const: dma
- items:
oneOf:
- const: dma
- pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"Quoted 5 lines
Quoted 1 line
I understand pattern is wrong. But I don't understand why need 'allOf'.
The first 'items' says the 1st entry must be 'dma'. (It might need a 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all entries must be either 'dma' or the CHn pattern.
After dig into
dt_schemeand json scheme, I start understand what your means."clock-names": { "minItems": 33, "allOf": [ { "items": [ { "const": "dma" } ], "maxItems": 33, ^^^^^^^^ Here need a maxItem 33 and make sure first item is "dma" and totalarray is 33.
"type": "array", "minItems": 1 }, { "items": { "oneOf": [ { "const": "dma" }, { "pattern": "^ch(0[0-9]|[1-2][0-9]|3[01])$" } ] }, "type": "array" } ] }The yaml source is
allOf:
- items:
- const: dma
maxItems: 33
- items:
oneOf:
- const: dma
- pattern: "^ch(0[0-9]|[1-2][0-9]|3[01])$"But unfortunately,
dtschema/meta-schemas/items.yamltype: object
properties:
items:
type: array
additionalItems: false
required:
- items
- maxItems
then:
description: '"maxItems" is not needed with an "items" list' not:
required:
- maxItem
dt_bindingcheck will complain
'"maxItems" is not needed with an "items" list'I am not sure how to go futher. Maybe below 'stupid' method is less impact.
Quoted 8 lines
items
- const: dma
- const: ch00
...
- const: ch31Frank
@rob:
I can't found out a way to to handle this case.dtschema/meta-schemas/items.yaml not allow 'maxItems' for 'items'.
Any suggestion?
Frank
Quoted 21 lines
Quoted 21 lines
Quoted 9 lines
8ulp need clock 'dma" and "ch*". I think
items:
- const: dma
- pattern: "^CH[0-31]-clk$"should be enough.
If it was, then I would not have said anything. If you don't believe me see if this passes validation:
clock-names = "dma", "CH0", "foobar";
Quoted 2 lines
If you means put on top allOf, other platform use clock name such as 'dmamux0'.
What? It's under an if/then schema.
Rob
Frank Li
maintainerPATCH v2 5/5 dmaengine: fsl-edma: add i.MX8ULP edma support
In reply to Frank LiFrom: 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.
--- 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(+)
drivers/dma/fsl-edma-common.c +6 -0
@@ -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)
drivers/dma/fsl-edma-common.h +1 -0
@@ -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)
drivers/dma/fsl-edma-main.c +22 -0
@@ -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);
Signature · 1 line
2.34.1