dmaengine: ingenic: add Ingenic PDMA controller support.
Subsystems (2)
PATCH 1/2 dmaengine: ingenic: add Ingenic PDMA controller support.
From: "bin.yao" <[email protected]>
This module can be found on ingenic victory soc.
--- drivers/dma/Kconfig | 6 + drivers/dma/Makefile | 1 + drivers/dma/ingenic-pdma.c | 1356 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1363 insertions(+) create mode 100644 drivers/dma/ingenic-pdma.c
drivers/dma/Kconfig +6 -0
@@ -179,6 +179,12 @@ config DMA_SUN6I help Support for the DMA engine first found in Allwinner A31 SoCs. +config DMA_INGENIC_SOC + tristate "Ingenic SoC DMA support" + select DMA_ENGINE + help + Support the DMA engine found on Ingenic SoCs. + config DW_AXI_DMAC tristate "Synopsys DesignWare AXI DMA support" depends on OF
drivers/dma/Makefile +1 -0
@@ -81,6 +81,7 @@ obj-$(CONFIG_UNIPHIER_MDMAC) += uniphier-mdmac.o obj-$(CONFIG_UNIPHIER_XDMAC) += uniphier-xdmac.o obj-$(CONFIG_XGENE_DMA) += xgene-dma.o obj-$(CONFIG_ST_FDMA) += st_fdma.o +obj-$(CONFIG_DMA_INGENIC_SOC) += ingenic-pdma.o obj-$(CONFIG_FSL_DPAA2_QDMA) += fsl-dpaa2-qdma/ obj-$(CONFIG_INTEL_LDMA) += lgm/
drivers/dma/ingenic-pdma.c new file +1356 -0
1,356 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/2 dt-bindings: dma: Convert ingenic-pdma doc to YAML
From: "bin.yao" <[email protected]>
Convert the textual documentation for the Ingenic SoCs PDMA Controller devicetree binding to YAML.
--- .../devicetree/bindings/dma/ingenic,pdma.yaml | 67 +++++++++++++++++++ include/dt-bindings/dma/ingenic-pdma.h | 45 +++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ingenic,pdma.yaml create mode 100644 include/dt-bindings/dma/ingenic-pdma.h
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +67 -0
@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/ingenic,pdma.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ingenic SoCs PDMA Controller + +maintainers: + - bin.yao <[email protected]> + +allOf: + - $ref: dma-controller.yaml# + +properties: + compatible: + enum: + - ingenic,t33-pdma + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupts-names: + const: pdma + + "#dma-cells": + const: 1 + + dma-channels: + const: 32 + + clocks: + maxItems: 1 + + clock-names: + const: gate_pdma + +required: + - compatible + - reg + - interrupts + - interrupts-names + - "#dma-cells" + - dma-channels + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/ingenic,jz4780-cgu.h> + pdma:dma@13420000 { + compatible = "ingenic,t33-pdma"; + reg = <0x13420000 0x10000>; + interrupt-parent = <&intc>; + interrupt-names = "pdma"; + interrupts = <10>; + #dma-cells = <0x1>; + dma-channels = <0x20>; + clocks = <&cgu JZ4780_CLK_PDMA>; + clock-names = "gate_pdma"; + }; +
include/dt-bindings/dma/ingenic-pdma.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH 2/2] dt-bindings: dma: Convert ingenic-pdma doc to YAML
Quoted 3 lines · On 21/03/2024 09:02, [email protected] wrote:
From: "bin.yao" <[email protected]>
Convert the textual documentation for the Ingenic SoCs PDMA Controller
I don't see any conversion here.
Quoted 3 lines
devicetree binding to YAML.
Signed-off-by bin.yao <[email protected]>
Are you sure this is Latin transliteration of your name? With a dot in between? Looks like email login...
Quoted 16 lines
--- .../devicetree/bindings/dma/ingenic,pdma.yaml | 67 +++++++++++++++++++ include/dt-bindings/dma/ingenic-pdma.h | 45 +++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ingenic,pdma.yaml create mode 100644 include/dt-bindings/dma/ingenic-pdma.hDocumentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +1
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 11
Quoted 10 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +10
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/ingenic,pdma.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ingenic SoCs PDMA Controller + +maintainers: + - bin.yao <[email protected]> +
What is PDMA? Why this is not DMA? Provide description explaining this.
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 18
Quoted 7 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +7
-0+allOf: + - $ref: dma-controller.yaml# + +properties: + compatible: + enum: + - ingenic,t33-pdma
There is no such soc like t33 so far. Please point me to SoC/board/other bindings.
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 27
Quoted 9 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +9
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupts-names: + const: pdma
Drop names, not needed.
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 33
Quoted 6 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +6
-0+ + "#dma-cells": + const: 1 + + dma-channels: + const: 32
Drop property, not needed.
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 39
Quoted 6 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +6
-0+ + clocks: + maxItems: 1 + + clock-names: + const: gate_pdma
Drop names, not needed.
Quoted 7 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +7
-0+ +required: + - compatible + - reg + - interrupts + - interrupts-names + - "#dma-cells"
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 56
Quoted 10 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +10
-0+ - dma-channels + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/ingenic,jz4780-cgu.h> + pdma:dma@13420000 {
Drop label.
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml line 62
Quoted 6 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +6
-0+ compatible = "ingenic,t33-pdma"; + reg = <0x13420000 0x10000>; + interrupt-parent = <&intc>; + interrupt-names = "pdma"; + interrupts = <10>; + #dma-cells = <0x1>;
That's not hex!
include/dt-bindings/dma/ingenic-pdma.h
Quoted 10 lines
Documentation/devicetree/bindings/dma/ingenic,pdma.yaml new file +5
-0+ dma-channels = <0x20>; + clocks = <&cgu JZ4780_CLK_PDMA>; + clock-names = "gate_pdma"; + }; +include/dt-bindings/dma/ingenic-pdma.h new file +0
-0
Same filename as binding.
Quoted 4 lines
include/dt-bindings/dma/ingenic-pdma.h new file +3
-0@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* +* Copyright (C) 2024 Ingenic Semiconductor Co., Ltd.
include/dt-bindings/dma/ingenic-pdma.h line 13
Quoted 10 lines
include/dt-bindings/dma/ingenic-pdma.h new file +10
-0+* Author: bin.yao <[email protected]> +*/ + +#ifndef __DT_BINDINGS_INGENIC_PDMA_H__ +#define __DT_BINDINGS_INGENIC_PDMA_H__ + +/* +* Request type numbers for the INGENIC DMA controller. +*/ +#define INGENIC_DMA_REQ_AIC_LOOP_RX 0x5
IDs start from 0, not 5. IDs are decimal, not hex.
Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH 2/2] dt-bindings: dma: Convert ingenic-pdma doc to YAML
In reply to [email protected]Quoted 5 lines · On Thu, 21 Mar 2024 16:02:28 +0800, [email protected] wrote:
From: "bin.yao" <[email protected]>
Convert the textual documentation for the Ingenic SoCs PDMA Controller devicetree binding to YAML.
Quoted 8 lines
Signed-off-by bin.yao <[email protected]>--- .../devicetree/bindings/dma/ingenic,pdma.yaml | 67 +++++++++++++++++++ include/dt-bindings/dma/ingenic-pdma.h | 45 +++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/ingenic,pdma.yaml create mode 100644 include/dt-bindings/dma/ingenic-pdma.h
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/dma/ingenic,pdma.example.dtb: dma@13420000: $nodename:0: 'dma@13420000' does not match '^dma-controller(@.*)?$'
from schema $id: http://devicetree.org/schemas/dma/ingenic,pdma.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/dma/ingenic,pdma.example.dtb: dma@13420000: 'interrupts-names' is a required property
from schema $id: http://devicetree.org/schemas/dma/ingenic,pdma.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/dma/ingenic,pdma.example.dtb: dma@13420000: Unevaluated properties are not allowed ('interrupt-names' was unexpected)
from schema $id: http://devicetree.org/schemas/dma/ingenic,pdma.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Quoted 4 lines · On 21/03/2024 09:02, [email protected] wrote:
From: "bin.yao" <[email protected]>
This module can be found on ingenic victory soc.
Quoted 8 lines
Signed-off-by bin.yao <[email protected]>--- drivers/dma/Kconfig | 6 + drivers/dma/Makefile | 1 + drivers/dma/ingenic-pdma.c | 1356 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1363 insertions(+) create mode 100644 drivers/dma/ingenic-pdma.c
You did not even compile this code... You don't have ingenic-pdma.h header at this point.
Best regards,
Krzysztof
Quoted 11 lines · On 21/03/2024 09:02, [email protected] wrote:
From: "bin.yao" <[email protected]>
This module can be found on ingenic victory soc.
Signed-off-by bin.yao <[email protected]>--- drivers/dma/Kconfig | 6 + drivers/dma/Makefile | 1 + drivers/dma/ingenic-pdma.c | 1356 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1363 insertions(+) create mode 100644 drivers/dma/ingenic-pdma.c
...
Quoted 32 lines
drivers/dma/ingenic-pdma.c new file +32
-0+static int ingenic_dma_chan_init (struct ingenic_dma_engine *dma,int id) +{ +struct ingenic_dma_chan *dmac =NULL ; + +if ((id <0 ) || (id >=INGENIC_DMA_CHAN_CNT )) +return -EINVAL ; + + dmac =devm_kzalloc (dma->dev,sizeof (*dmac),GFP_KERNEL ); +if (!dmac) +return -ENOMEM ; + + dmac->id = id; + dmac->iomem = dma->iomem + dmac->id *DMACH_OFF ; + dmac->engine = dma; + +spin_lock_init (&dmac->hdesc_lock); +init_completion (&dmac->completion); + + dmac->slave_id = pdma_maps[id] &INGENIC_DMA_TYPE_REQ_MSK ; + dma->chan[id] = dmac; +INIT_LIST_HEAD (&dmac->ingenic_dma_sdesc_list_submitted); +INIT_LIST_HEAD (&dmac->ingenic_dma_sdesc_list_issued); + +dma_cookie_init (&dmac->chan); + dmac->chan.device = &dma->dma_device; + dmac->working_sdesc =NULL ; +list_add_tail (&dmac->chan.device_node, &dma->dma_device.channels); +tasklet_init (&dmac->task, ingenic_dma_complete, (unsigned long )dmac); + +return 0 ; +} +
drivers/dma/ingenic-pdma.c line 1123
Quoted 10 lines
drivers/dma/ingenic-pdma.c new file +10
-0+static int ingenic_dma_probe (struct platform_device *pdev) +{ +struct ingenic_dma_engine *ingenic_dma =NULL ; +unsigned int reg_dmac =DMAC_DMAE ; +struct device *dev = &pdev->dev; +struct resource *iores; +int i, ret =0 ; + +if (!dev->of_node) { +dev_err (dev,"This driver must be probed from devicetree\n" );
This driver cannot be probed other way. Drop.
drivers/dma/ingenic-pdma.c line 1127
Quoted 4 lines
drivers/dma/ingenic-pdma.c new file +4
-0+return -EINVAL ; + } + + ingenic_dma = devm_kzalloc(&pdev->dev, sizeof(struct ingenic_dma_engine),
ssizeof(*(
drivers/dma/ingenic-pdma.c line 1132
Quoted 5 lines
drivers/dma/ingenic-pdma.c new file +5
-0+ GFP_KERNEL); +if (!ingenic_dma) +return -ENOMEM ; + + ingenic_dma->dma_data = (struct ingenic_dma_data *)device_get_match_data (dev);
Why the cast?
drivers/dma/ingenic-pdma.c line 1138
Quoted 6 lines
drivers/dma/ingenic-pdma.c new file +6
-0+if (!ingenic_dma->dma_data) +return -EINVAL ; + +/* +* Obtaining parameters from the device tree. +*/
Drop obvious comments.
drivers/dma/ingenic-pdma.c line 1140
Quoted 2 lines
drivers/dma/ingenic-pdma.c new file +2
-0+ ingenic_dma->dev = dev; + if (!of_property_read_u32(pdev->dev.of_node, "programed-chs",
No, there is no such property. NAK.
Upstream your DTS or I will be NAKing your patches. Because otherwise you try to sneak a lot of undocumented stuff here.
Quoted 16 lines
drivers/dma/ingenic-pdma.c new file +16
-0+ &ingenic_dma->chan_programed)) + ingenic_dma->chan_reserved |= ingenic_dma->chan_programed; + +if (HWATTR_SPECIAL_CH01_SUP (ingenic_dma->dma_data->hwattr) && +of_property_read_bool (pdev->dev.of_node,"special-chs" )) { + ingenic_dma->chan_reserved |=DMA_SPECAIL_CHS ; + ingenic_dma->chan_programed |=DMA_SPECAIL_CHS ; + ingenic_dma->special_ch = true; + } + + ingenic_dma->intc_ch =-1 ; +if (HWATTR_INTC_IRQ_SUP (ingenic_dma->dma_data->hwattr) && + !of_property_read_u32 (pdev->dev.of_node,"intc-ch" , + &ingenic_dma->intc_ch)) { + +if (BIT (ingenic_dma->intc_ch) & ingenic_dma->chan_reserved)
drivers/dma/ingenic-pdma.c line 1166
Quoted 10 lines
drivers/dma/ingenic-pdma.c new file +10
-0+dev_warn (ingenic_dma->dev, +"intc irq channel %d is already reserved\n" , + ingenic_dma->intc_ch); + + ingenic_dma->chan_reserved |=BIT (ingenic_dma->intc_ch); + } + +/* +* obtaining the base address of the DMA peripheral. +*/
Drop obvious comments.
drivers/dma/ingenic-pdma.c line 1169
Quoted 3 lines
drivers/dma/ingenic-pdma.c new file +3
-0+ iores =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (iores) { + ingenic_dma->iomem =devm_ioremap_resource (&pdev->dev, iores);
Combine these two, there's helper for this.
drivers/dma/ingenic-pdma.c line 1179
Quoted 10 lines
drivers/dma/ingenic-pdma.c new file +10
-0+if (IS_ERR (ingenic_dma->iomem)) +return PTR_ERR (ingenic_dma->iomem); + }else { +dev_err (dev,"Failed to get I/O memory\n" ); +return -EINVAL ; + } + +/* +* Get PDMA interrupt. +*/
Drop
drivers/dma/ingenic-pdma.c line 1183
Quoted 4 lines
drivers/dma/ingenic-pdma.c new file +4
-0+ ingenic_dma->irq_pdma =platform_get_irq_byname (pdev,"pdma" ); +if (ingenic_dma->irq_pdma <0 ) { +dev_err (dev,"Unable to get pdma irq\n" ); +return ingenic_dma->irq_pdma;
Syntax is return dev_err_probe().
Quoted 4 lines
drivers/dma/ingenic-pdma.c new file +4
-0+ } + + ret =devm_request_irq (&pdev->dev, ingenic_dma->irq_pdma, + pdma_int_handler,0 ,"pdma" , ingenic_dma);
drivers/dma/ingenic-pdma.c line 1197
Quoted 10 lines
drivers/dma/ingenic-pdma.c new file +10
-0+if (ret) { +dev_err (dev,"Failed to request pdma irq\n" ); +return ret; + } + +/* +* Get PDMA descriptor interrupt. +*/ +if (HWATTR_DESC_INTER_SUP (ingenic_dma->dma_data->hwattr)) { + ingenic_dma->irq_pdmad =platform_get_irq_byname (pdev,"pdmad" );
NAK, you must be joking. You do not have second interrupt.
You must clean your code before upstream from all downstream weirdness and incorrectness. You cannot send different binding than driver.
What's more, I don't trust that you will send usable binding, judging by the driver, so I expect to see upstreamed DTS.
Quoted 121 lines
drivers/dma/ingenic-pdma.c new file +121
-0+if (ingenic_dma->irq_pdmad <0 ) { +dev_err (&pdev->dev,"Unable to get pdmad irq\n" ); +return ingenic_dma->irq_pdmad; + } + ret =devm_request_irq (&pdev->dev, ingenic_dma->irq_pdmad, + pdmad_int_handler,0 ,"pdmad" , ingenic_dma); +if (ret) { +dev_err (dev,"Failed to request pdmad irq\n" ); +return ret; + } + } + +/* +* Initialize dma channel. +*/ +INIT_LIST_HEAD (&ingenic_dma->dma_device.channels); +for (i =0 ; i < ingenic_dma->dma_data->nb_channels; i++) { +/*reserved one channel for intc interrupt*/ +if (ingenic_dma->intc_ch == i) +continue ; +ingenic_dma_chan_init (ingenic_dma, i); + } + +dma_cap_set (DMA_MEMCPY , ingenic_dma->dma_device.cap_mask); +dma_cap_set (DMA_SLAVE , ingenic_dma->dma_device.cap_mask); +dma_cap_set (DMA_CYCLIC , ingenic_dma->dma_device.cap_mask); + + ingenic_dma->dma_device.dev = &pdev->dev; + ingenic_dma->dma_device.device_alloc_chan_resources = ingenic_dma_alloc_chan_resources; + ingenic_dma->dma_device.device_free_chan_resources = ingenic_dma_free_chan_resources; + ingenic_dma->dma_device.device_tx_status = ingenic_dma_tx_status; + ingenic_dma->dma_device.device_prep_slave_sg = ingenic_dma_prep_slave_sg; + ingenic_dma->dma_device.device_prep_dma_cyclic = ingenic_dma_prep_dma_cyclic; + ingenic_dma->dma_device.device_prep_dma_memcpy = ingenic_dma_prep_dma_memcpy; + ingenic_dma->dma_device.device_config = ingenic_dma_config; + ingenic_dma->dma_device.device_terminate_all = ingenic_dma_terminate_all; + ingenic_dma->dma_device.device_issue_pending = ingenic_dma_issue_pending; + ingenic_dma->dma_device.copy_align =DMAENGINE_ALIGN_4_BYTES ; + ingenic_dma->dma_device.src_addr_widths =BIT (DMA_SLAVE_BUSWIDTH_1_BYTE ) | +BIT (DMA_SLAVE_BUSWIDTH_2_BYTES ) | +BIT (DMA_SLAVE_BUSWIDTH_4_BYTES ); + ingenic_dma->dma_device.dst_addr_widths = ingenic_dma->dma_device.src_addr_widths; + ingenic_dma->dma_device.directions =BIT (DMA_DEV_TO_MEM ) | +BIT (DMA_MEM_TO_DEV ) | +BIT (DMA_MEM_TO_MEM ); + ingenic_dma->dma_device.residue_granularity =DMA_RESIDUE_GRANULARITY_BURST ; + +dma_set_max_seg_size (ingenic_dma->dma_device.dev,DTC_TC_MSK ); + + ingenic_dma->gate_clk =devm_clk_get (&pdev->dev,"gate_pdma" ); +if (IS_ERR (ingenic_dma->gate_clk)) +return PTR_ERR (ingenic_dma->gate_clk); + + ret =dma_async_device_register (&ingenic_dma->dma_device); +if (ret) { +dev_err (&pdev->dev,"Unable to register dma\n" ); +clk_disable (ingenic_dma->gate_clk); +return ret; + } + + of_ingenic_dma_info.dma_cap = ingenic_dma->dma_device.cap_mask; + ret =of_dma_controller_register (pdev->dev.of_node, + of_dma_simple_xlate, + &of_ingenic_dma_info); +if (ret) { +dev_err (&pdev->dev,"Unable to register dma to device tree\n" ); +dma_async_device_unregister (&ingenic_dma->dma_device); +clk_disable (ingenic_dma->gate_clk); +return ret; + } + +platform_set_drvdata (pdev, ingenic_dma); + +clk_prepare_enable (ingenic_dma->gate_clk); + +if (ingenic_dma->chan_programed) +writel (ingenic_dma->chan_programed, ingenic_dma->iomem +DMACP ); +if (ingenic_dma->intc_ch >=0 ) + reg_dmac |=DMAC_INTCE | + ((ingenic_dma->intc_ch <<DMAC_INTCC_SFT ) &DMAC_INTCC_MSK ); +if (ingenic_dma->special_ch) + reg_dmac |=DMAC_CH01 ; +writel (reg_dmac, ingenic_dma->iomem +DMAC ); + +return 0 ; +} + +static int __maybe_unused ingenic_dma_suspend (struct device *dev) +{ +struct ingenic_dma_engine *ingenic_dma =dev_get_drvdata (dev); +struct ingenic_dma_chan *dmac; +unsigned long flg; +int i; + +for (i =0 ; i < ingenic_dma->dma_data->nb_channels; i++) { + dmac = ingenic_dma->chan[i]; +spin_lock_irqsave (&dmac->hdesc_lock, flg); +if (!list_empty (&dmac->ingenic_dma_sdesc_list_submitted)) { +spin_unlock_irqrestore (&dmac->hdesc_lock, flg); +return -EBUSY ; + } +if (!list_empty (&dmac->ingenic_dma_sdesc_list_issued)) { +spin_unlock_irqrestore (&dmac->hdesc_lock, flg); +return -EBUSY ; + } +spin_unlock_irqrestore (&dmac->hdesc_lock, flg); + } +clk_disable_unprepare (ingenic_dma->gate_clk); + +return 0 ; +} + +static int __maybe_unused ingenic_dma_resume (struct device *dev) +{ +struct ingenic_dma_engine *ingenic_dma =dev_get_drvdata (dev); + +clk_prepare_enable (ingenic_dma->gate_clk); + +return 0 ; +} +
drivers/dma/ingenic-pdma.c line 1328
Quoted 10 lines
drivers/dma/ingenic-pdma.c new file +10
-0+static const struct dev_pm_ops ingenic_dma_dev_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (ingenic_dma_suspend, ingenic_dma_resume) +}; + +static const struct ingenic_dma_data t33_soc_data = { + .nb_channels =32 , +}; + +static const struct of_device_id ingenic_dma_dt_match[] = { + { .compatible ="ingenic,t33-pdma" , .data = &t33_soc_data },
Don't merge lines. Open existing code and look how it is done there.
Quoted 17 lines
drivers/dma/ingenic-pdma.c new file +17
-0+ {}, +}; +MODULE_DEVICE_TABLE (of, ingenic_dma_dt_match); + +static struct platform_driver ingenic_dma_driver = { + .probe = ingenic_dma_probe, + .driver = { + .name ="ingenic-dma" , + .of_match_table = ingenic_dma_dt_match, + .pm = &ingenic_dma_dev_pm_ops, + }, +}; + +static int __init ingenic_dma_init (void ) +{ +return platform_driver_register (&ingenic_dma_driver); +}
drivers/dma/ingenic-pdma.c line 1355
Quoted 10 lines
drivers/dma/ingenic-pdma.c new file +10
-0+subsys_initcall (ingenic_dma_init); + +static void __exit ingenic_dma_exit(void) +{ +platform_driver_unregister (&ingenic_dma_driver); +} +module_exit (ingenic_dma_exit); + +MODULE_AUTHOR ("bin.yao <[email protected]>" ); +MODULE_DESCRIPTION ("Ingenic dma driver" );
Why do you add second Ingenic dma driver? That's duplication.
Best regards,
Krzysztof