Is there a binding for IORESOURCE_DMA population?

Shawn Guo shawn.guo at freescale.com
Sat Jul 16 17:57:49 EST 2011


On Fri, Jul 15, 2011 at 08:11:41PM +0200, Arnd Bergmann wrote:
> On Friday 15 July 2011 18:45:38 Tabi Timur-B04825 wrote:
> > 
> > On Fri, Jul 15, 2011 at 11:32 AM, Shawn Guo <shawn.guo at freescale.com> wrote:
> > 
> > > First of all, using powerpc dma-channel binding on such dma event
> > > seems not reflecting the hardware facts.  Secondly, the binding in
> > > this case (below) looks silly.  Thirdly, device driver need to make
> > > code change for simply getting a dma event number.
> > 
> > Take a look at p1022ds.dts or mpc8610hpcd.dts.  We create separate DMA
> > channel nodes on Freescale PowerPC parts because the channels really
> > are independent.  On these two boards, some of the DMA channels are
> > used by the async DMA driver, and two of the channels are used by the
> > audio driver.
> 
> I think this is much better than using IORESOURCE_DMA fields, which
> basically are only well-defined for PC-style i8237 DMA controllers
> used in stuff like floppy drives and ISA sound cards.
> 
> However, we should find a way to standardize finding the dma_chan
> for an platform_device based on a phandle. Maybe a little helper
> that will scan a well-known property (dma-channels?) for phandles
> to a device_node that is backing a struct dma_chan.
> 
If I understand this correctly, this is something I demonstrated in
the initial message.  I do not think we always have individual
device_node for each channel (struct dma_chan).  The most common
situation is all channels are backed by one device_node (dmaengine).

As I stated in the initial message, (for i.mx sdma example) the
problem is 'struct dma_chan' stands for a physical dma channel, while
all platform_device has is a virtual channel number (known as sdma
event) assigned by hardware.  This virtual channel can only be
dynamically mapped to a physical one by sdma driver.  That said there
is no way for us to specify a physical channel in device tree.  We can
only specify the virtual one there.  (I think this is kinda common,
and sdma is just one example.)

i.mx sdma has 32 physically channels and 48 virtual ones (events).
If we go the way you are suggesting, we will have to have 48 nodes
under sdma node just for giving event number, and then have
dma-channels property of device specifying the phanldles to these
event nodes belonging to it.

So we get something like below, which looks silly to me.

sdma at 83fb0000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
        reg = <0x83fb0000 0x4000>;
        interrupts = <6>;
        fsl,sdma-ram-script-name = "sdma-imx51.bin";

        dma00: dma-channel at 0 {
                compatible = "fsl,sdma-channel";
                reg = <0>;
        };

        dma01: dma-channel at 1 {
                compatible = "fsl,sdma-channel";
                reg = <1>;
        };

        ......

        dma47: dma-channel at 47 {
                compatible = "fsl,sdma-channel";
                reg = <47>;
        };
};

ssi at 83fcc000 { /* SSI1 */
        compatible = "fsl,imx51-ssi", "fsl,imx1-ssi";
        reg = <0x83fcc000 0x4000>;
        interrupts = <29>;
        fsl,ssi-uses-dma;
        dma-channels = <&dma00, &dma01>;
};

Did I state the problem clear?  Or am I missing anything?

-- 
Regards,
Shawn



More information about the devicetree-discuss mailing list