Re: [PATCH] DMA: let filter functions of of_dma_simple_xlate possiblecheck of_node

From: Stephen Warren
Date: Fri Aug 02 2013 - 16:52:10 EST

On 08/02/2013 06:06 AM, Santosh Shilimkar wrote:
> On Thursday 01 August 2013 10:00 PM, Richard Zhao wrote:
>> pass of_phandle_args dma_spec to dma_request_channel in of_dma_simple_xlate,
>> so the filter function could access of_node in of_phandle_args.
> Am just curious the reasoning behind doing so. Can you please expand
> above bit more with why you need to change it.

I believe that this patch is attempting to solve an issue I pointed out
with the following patch, which enhances the Tegra DMA controller driver
to support the standard DMA DT bindings:
[PATCH 2/9] dma: tegra20-apbdma: move to generic device tree bindings

The issue is in particular that patch included:

> +static bool tegra_dma_filter_fn(struct dma_chan *dc, void *param)
> +{
> + if (dc->device->dev->driver == &tegra_dmac_driver.driver) {
> + struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
> + unsigned req = *(unsigned *)param;
> +
> + tdc->slave_id = req;
> +
> + return true;
> + }
> + return false;
> +}

Which is checking that the provider of the DMA channel is the correct
DMA controller. The DMA core should be able to work this out, since at
least under DT, the DT property specifies both the DMA controller's
phandle and the DMA specifier, so that DMA core should be able to
validate that it only attempts to match DMA channels for the specified
DMA controller, without each DMA controller driver having to implement a
custom filter function to do that.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at