dma: imx-dma: OFTree support
Subsystems (3)
v4 cover dma: imx-dma: OFTree support
Hi,
Patch 1 removes in v4 the allocation of imx_dma_data and simplifies imx_dma_is_general_purpose.
Patch 2 is new and fixes the uninitialized use of imxdma->dev in warnings.
@Arnd: I assumed your Reviewed-by tag is still okay. If it is not please send me an email.
Regards,
Markus
PATCH v4 1/2 dma: imx-dma: Add oftree support
Adding devicetree support for imx-dma driver. Use driver name for function 'imx_dma_is_general_purpose' because the devicename for devicetree initialized devices is different.
Changes in V4:
- Directly use "imxdma_channel" as proposed by Arnd. This removes the allocation of imx_dma_data.
- Simplify function imx_dma_is_general_purpose using driver names.
Changes in V3:
- Create a imxdma translate function to pass the device object into the filter function.
Changes in V2:
- Change the driver to use generic DMA DT bindings.
- Add a imx-dma filter function that sets the dma request line in private data.
--- .../devicetree/bindings/dma/fsl-imx-dma.txt | 48 ++++++++++++++ drivers/dma/imx-dma.c | 77 +++++++++++++++++++++- include/linux/platform_data/dma-imx.h | 6 +- 3 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
Documentation/devicetree/bindings/dma/fsl-imx-dma.txt new file +48 -0
@@ -0,0 +1,48 @@ +* Freescale Direct Memory Access (DMA) Controller for i.MX + +This document will only describe differences to the generic DMA Controller and +DMA request bindings. + +* DMA controller + +Required properties: +- compatible : Should be "fsl,<chip>-dma". chip can be imx1, imx21 or imx27 +- reg : Should contain DMA registers location and length +- interrupts : First item should be DMA interrupt, second one is optional and + should contain DMA Error interrupt +- #dma-cells : Has to be 1. imx-dma does not support anything else. + +Optional properties: +- #dma-channels : Number of DMA channels supported. Should be 16. +- #dma-requests : Number of DMA requests supported. + +Example: + + dma: dma at 10001000 { + compatible = "fsl,imx27-dma"; + reg = <0x10001000 0x1000>; + interrupts = <32 33>; + #dma-cells = <1>; + #dma-channels = <16>; + }; + + +* DMA client + +Clients have to specify the DMA requests with phandles in a list. + +Required properties: +- dmas: List of one or more DMA request specifiers. One DMA request specifier + consists of a phandle to the DMA controller followed by the integer + specifiying the request line. +- dma-names: List of string identifiers for the DMA requests. For the correct + names, have a look at the specific client driver. + +Example: + + sdhci1: sdhci at 10013000 { + ... + dmas = <&dma 7>; + dma-names = "rx-tx"; + ... + };
drivers/dma/imx-dma.c +76 -1
135 lines not on this page · raw message
include/linux/platform_data/dma-imx.h +2 -4
@@ -60,10 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)static inline int imx_dma_is_general_purpose (struct dma_chan *chan) { -return strstr (dev_name (chan->device->dev),"sdma" ) || - !strcmp (dev_name (chan->device->dev),"imx1-dma" ) || - !strcmp (dev_name (chan->device->dev),"imx21-dma" ) || - !strcmp (dev_name (chan->device->dev),"imx27-dma" ); +return !strcmp (chan->device->dev->driver->name,"imx-sdma" ) || + !strcmp (chan->device->dev->driver->name,"imx-dma" ); }#endif
Signature · 1 line
1.8.1.4
PATCH v4 1/2 dma: imx-dma: Add oftree support
Quoted 3 lines · Markus Pargmann
Adding devicetree support for imx-dma driver. Use driver name for function '
imx_dma_is_general_purpose' because the devicename for devicetree initialized devices is different.
Just one small comment this time:
drivers/dma/imx-dma.c static int imxdma_alloc_chan_resources(struct dma_chan *chan) · line 765
Quoted 11 lines
drivers/dma/imx-dma.c +2
-1@@ -734,8 +757,9 @@ static int imxdma_alloc_chan_resources(struct dma_chan *chan)struct imxdma_channel *imxdmac =to_imxdma_chan (chan);struct imx_dma_data *data = chan->private; -if (data !=NULL ) +if (data !=NULL ) { imxdmac->dma_request = data->dma_request; + }while (imxdmac->descs_allocated <IMXDMA_MAX_CHAN_DESCRIPTORS ) {struct imxdma_desc *desc;
I assume that this change wasn't meant to be in here.
Arnd
PATCH v4 1/2 dma: imx-dma: Add oftree support
Quoted 16 lines · Arnd Bergmann
Quoted 3 lines · Markus Pargmann
Adding devicetree support for imx-dma driver. Use driver name for function '
imx_dma_is_general_purpose' because the devicename for devicetree initialized devices is different.Just one small comment this time:
Quoted 9 lines
drivers/dma/imx-dma.c +2
-1@@ -734,8 +757,9 @@ static int imxdma_alloc_chan_resources(struct dma_chan *chan)struct imxdma_channel *imxdmac =to_imxdma_chan (chan);struct imx_dma_data *data = chan->private; -if (data !=NULL ) +if (data !=NULL ) { imxdmac->dma_request = data->dma_request; + }
Quoted 4 lines
drivers/dma/imx-dma.c static int imxdma_alloc_chan_resources(struct dma_chan *chan) · line 765
Quoted 2 lines
drivers/dma/imx-dma.c +0
-0while (imxdmac->descs_allocated <IMXDMA_MAX_CHAN_DESCRIPTORS ) {struct imxdma_desc *desc;I assume that this change wasn't meant to be in here.
Yes exactly. I actually saw that before sending and removed it, but I obviously forgot to create the patch again ;).
Regards
Markus
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v4 2/2 DMA: imx-dma: imxdma->dev used uninitialized
In reply to Markus Pargmannimxdma->dev is used for dev_warn before it was set.
--- drivers/dma/imx-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/imx-dma.c +1 -1
@@ -1067,6 +1067,7 @@ static int __init imxdma_probe(struct platform_device *pdev)if (!imxdma)return -ENOMEM ; + imxdma->dev = &pdev->dev; imxdma->devtype = pdev->id_entry->driver_data; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -1171,7 +1172,6 @@ static int __init imxdma_probe(struct platform_device *pdev) &imxdma->dma_device.channels); } - imxdma->dev = &pdev->dev; imxdma->dma_device.dev = &pdev->dev; imxdma->dma_device.device_alloc_chan_resources = imxdma_alloc_chan_resources;
Signature · 1 line
1.8.1.4