All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Shawn Guo <shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: Guo Shawn-R65073 <r65073-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Tabi Timur-B04825
	<B04825-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: Re: Is there a binding for IORESOURCE_DMA population?
Date: Sat, 16 Jul 2011 17:19:32 +0200	[thread overview]
Message-ID: <201107161719.32543.arnd@arndb.de> (raw)
In-Reply-To: <20110716143456.GA2374-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>

On Saturday 16 July 2011, Shawn Guo wrote:
> Though I do not understand what you said about channel numbers within
> within the parent dma controller, I do think the dma has something
> in common with 'interrupt-controller', and we can has a property like
> 'dma-channels' under the node of devices that are dma clients to contain
> the their channel/event numbers, just like property 'interrupts'
> containing devices' IRQ number.

I think that would be ok, and it's basically what I tried to express.

> Then like that IRQ number is decoded and populated into IORESOURCE_IRQ
> by device tree infrastructural code, we can also do the same into
> IORESOURCE_DMA.  In that case, drivers do not need any code change for
> getting dma channel/event numbers from device tree, as
> platform_get_resource(pdev, IORESOURCE_DMA) still works for them.

But I really don't think there is value in using IORESOURCE_DMA for this.
We don't have the code to manage DMA resources for more than one DMA
controller AFAICT, and I think we should not add it. Globally
unique interrupt numbers cause us a lot of trouble and we go to great
lengths to fake them on modern devices. It would be much better
not to have them visible in the OS, and I don't want to add them to
a modern API like the dmaengine.

> Right now, I have the following as the solution.  I do not prefer to
> it as much as I prefer to IORESOURCE_DMA solution, but I think it's
> better than that huge and meaningless dma-channel node list.
> 
> ssi@83fcc000 { /* SSI1 */
>         compatible = "fsl,imx51-ssi", "fsl,imx1-ssi";
>         reg = <0x83fcc000 0x4000>;
>         interrupts = <29>;
>         fsl,dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
>         fsl,ssi-uses-dma;
> };
> 
> of_property_read_u32_array(pdev->dev.of_node, "fsl,dma-events",
>                            dma_events, ARRAY_SIZE(dma_events));
> 

Why fsl,dma-events? A driver consuming a DMA channel should not
need to care if it's an freescale DMA controller or something else.

I also don't like the drivers having to decode that property themselves.
If you want bindings for dma channels, they should be implementation
indepedent and work as easily as possible with the dmaengine API.

I would turn the above into 

ssi@83fcc000 { /* SSI1 */
         compatible = "fsl,imx51-ssi", "fsl,imx1-ssi";
         reg = <0x83fcc000 0x4000>;
         interrupts = <29>;
	 dma-parent = &fsldma1;
         dma-channels = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
};

struct dma_chan *tx0_chan = of_dma_find_chan(ssidev->dev, 0);
struct dma_chan *rx0_chan = of_dma_find_chan(ssidev->dev, 1);
struct dma_chan *tx1_chan = of_dma_find_chan(ssidev->dev, 2);
struct dma_chan *rx1_chan = of_dma_find_chan(ssidev->dev, 3);

	Arnd

  parent reply	other threads:[~2011-07-16 15:19 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15 16:32 Is there a binding for IORESOURCE_DMA population? Shawn Guo
     [not found] ` <20110715163254.GG1840-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-15 16:45   ` Tabi Timur-B04825
     [not found]     ` <CAOZdJXVeM4Axf=TC4qKNHyqb=iDoDceGr-xjLNpD20WfL2h46Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-15 18:11       ` Arnd Bergmann
     [not found]         ` <201107152011.41546.arnd-r2nGTMty4D4@public.gmane.org>
2011-07-15 23:49           ` Grant Likely
2011-07-16  7:57           ` Shawn Guo
     [not found]             ` <20110716075748.GI1840-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-16 12:09               ` Arnd Bergmann
     [not found]                 ` <201107161409.46719.arnd-r2nGTMty4D4@public.gmane.org>
2011-07-16 12:55                   ` Tabi Timur-B04825
     [not found]                     ` <4E218A4C.8000603-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-16 14:40                       ` Shawn Guo
     [not found]                         ` <20110716144026.GB2374-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-16 14:38                           ` Tabi Timur-B04825
     [not found]                             ` <4E21A252.4060606-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-17  7:18                               ` Shawn Guo
2011-07-16 19:16                           ` Rob Herring
     [not found]                             ` <4E21E398.4060808-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-07-17  7:30                               ` Shawn Guo
2011-07-16 20:18                           ` Tabi Timur-B04825
     [not found]                             ` <4E21F22C.3020804-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-16 20:44                               ` Arnd Bergmann
     [not found]                                 ` <201107162244.47740.arnd-r2nGTMty4D4@public.gmane.org>
2011-07-16 20:54                                   ` Tabi Timur-B04825
     [not found]                                     ` <4E21FA7C.2000602-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-17  7:38                                       ` Shawn Guo
2011-07-16 14:34                   ` Shawn Guo
     [not found]                     ` <20110716143456.GA2374-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-16 14:43                       ` Tabi Timur-B04825
     [not found]                         ` <4E21A392.3010608-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-17  7:41                           ` Shawn Guo
     [not found]                             ` <20110717074159.GF2374-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-17 13:41                               ` Tabi Timur-B04825
     [not found]                                 ` <4E22E66D.5010809-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-17 14:28                                   ` Shawn Guo
     [not found]                                     ` <20110717142838.GI2374-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-17 14:57                                       ` Tabi Timur-B04825
     [not found]                                         ` <4E22F867.5090707-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-17 15:47                                           ` Shawn Guo
     [not found]                                             ` <20110717154730.GK2374-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-17 16:04                                               ` Tabi Timur-B04825
     [not found]                                                 ` <4E230802.9030805-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-19 15:16                                                   ` Arnd Bergmann
     [not found]                                                     ` <201107191716.56203.arnd-r2nGTMty4D4@public.gmane.org>
2011-07-20  2:53                                                       ` Shawn Guo
2011-07-17 15:04                                       ` Arnd Bergmann
     [not found]                                         ` <201107171704.17779.arnd-r2nGTMty4D4@public.gmane.org>
2011-07-17 15:41                                           ` Shawn Guo
2011-07-18  4:39                                   ` Grant Likely
     [not found]                                     ` <20110718043940.GD15023-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-18 11:19                                       ` Tabi Timur-B04825
2011-07-16 15:19                       ` Arnd Bergmann [this message]
     [not found]                         ` <201107161719.32543.arnd-r2nGTMty4D4@public.gmane.org>
2011-07-16 15:27                           ` Tabi Timur-B04825
     [not found]                             ` <4E21ADC5.5010205-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2011-07-16 17:33                               ` Arnd Bergmann
2011-07-17  8:02                               ` Shawn Guo
2011-07-17  7:59                           ` Shawn Guo
2011-07-18  4:34                   ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107161719.32543.arnd@arndb.de \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=B04825-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=r65073-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.