[PATCH v5 6/7] dmaengine: fsl-edma: support per-channel DT child nodes

Peng Fan peng.fan at oss.nxp.com
Wed Nov 11 16:41:16 PST 2026


On Wed, Nov 11, 2026 at 11:57:35AM -0600, Frank Li wrote:
>On Wed, Nov 11, 2026 at 09:47:34PM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan at nxp.com>
>>
>> Add support for parsing per-channel child nodes from devicetree.
>> Each child node can carry its own interrupts and iommus properties.
>> Child power-domains are not handled here; power domains remain attached
>> at the parent level.

[...]

>>
>> - fsl_edma_configure_chan_iommu(): called after
>>   dmaenginem_async_device_register() to configure per-channel IOMMU
>>   by calling of_dma_configure() on each dma_chan_dev and setting
>>   chan_dma_dev so dmaengine_get_dma_device() returns the per-channel
>>   device.  Propagate the controller dma_parms to the per-channel device
>>   so the DMA segment size limit is preserved.
>
>Needn't detail for each funciton.
>
>The implementation is split into three functions:
>  - fsl_edma_child_to_chan_id()
>  - fsl_edma_configure_chan_from_dt()
>  - fsl_edma_configure_chan_iommu()

Fix in v6.

>
>>
>> Child nodes beyond the configured dma-channels are ignored, which allows
>> boards to reduce dma-channels without disabling every unused child node.
>> If child nodes are present, every unmasked channel must have a child node
>> with a valid interrupt; otherwise probe fails with an error asking for
>> dma-channel-mask.  In child-node mode fsl_edma3_irq_init() does not fall
>> back to the parent's flat interrupt array.
>>
>> The shared error IRQ remains a parent-node interrupt.  A child-node-only
>> DTS without that entry simply has no shared error IRQ.

[...]

>>  	if (fsl_chan->dma_dir != DMA_NONE)
>> -		dma_unmap_resource(fsl_chan->vchan.chan.device->dev,
>> -				   fsl_chan->dma_dev_addr,
>> -				   fsl_chan->dma_dev_size,
>> +		dma_unmap_resource(dev, fsl_chan->dma_dev_addr, fsl_chan->dma_dev_size,
>>  				   fsl_chan->dma_dir, 0);
>
>Use dmaengine_get_dma_device() needs sperate patches.

ok. I will add a new patch in this series to handle it.

>
>>  	fsl_chan->dma_dir = DMA_NONE;
>>  }
>> @@ -321,7 +321,7 @@ static void fsl_edma_unprep_slave_dma(struct fsl_edma_chan *fsl_chan)
>>  static bool fsl_edma_prep_slave_dma(struct fsl_edma_chan *fsl_chan,
>>  				    enum dma_transfer_direction dir)
>>  {

[...]
>> @@ -397,15 +401,24 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi
>>
>>  		struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i];
>>
>> -		if (fsl_edma->chan_masked & BIT(i))
>> +		if (fsl_edma->chan_masked & BIT_ULL(i))
>>  			continue;
>
>
>This one need sperate patch to fix it.

Fix in v6.

>
>>
>> -		/* request channel irq */
>> -		fsl_chan->txirq = platform_get_irq(pdev, i);
>> -		if (fsl_chan->txirq < 0)
>> -			return  -EINVAL;
>> +		if (fsl_chan->txirq <= 0) {
>> +		return ret;
[...]
>> +
>> +	for_each_available_child_of_node(np, child) {
>
>for_each_available_child_of_node_scoped()

Fix in v6.

>
>> +		struct fsl_edma_chan *fsl_chan;
>> +		int ch_id, irq;
>> +
>> +		has_children = true;
>> +
>> +
[...]
>> +		list_for_each_entry(chan, &fsl_edma->dma_dev.channels,
>> +				    device_node) {
>> +			struct device *chdev;
>> +
>> +			if (to_fsl_edma_chan(chan) != fsl_chan)
>> +				continue;
>
>Can we avoid scan channel twice?

yeah. Fix in v6.

Thanks
Peng



More information about the linux-arm-kernel mailing list