linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/32] dmaengine: ste_dma40: Amalgamate DMA source and destination channel numbers
Date: Thu, 25 Apr 2013 10:06:12 +0100	[thread overview]
Message-ID: <20130425090612.GC4623@gmail.com> (raw)
In-Reply-To: <CACRpkdaauDYTdoBHGG9FO4kKqvCYyCrjY8EGWs5gAQWErGW6_A@mail.gmail.com>

> > Devices which utilise DMA tend to use the same channel numbers for
> > transmitting and receiving. For this reason and the fact that it'll
> > decrease the burden of platform data passed to each device, we're
> > amalgamating source and destination device types.
> 
> I don't think this explains what the patch is actually doing.
> 
> Instead describe this:
> 
> > @@ -56,8 +54,7 @@ static struct stedma40_chan_cfg msp1_dma_rx = {
> >         .high_priority = true,
> >         .dir = STEDMA40_PERIPH_TO_MEM,
> >
> > -       .src_dev_type = DB8500_DMA_DEV30_MSP3_RX,
> > -       .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
> > +       .dev_type = DB8500_DMA_DEV30_MSP3,
> (...)
> 
> What the message should say is that we're encoding pairs of
> information for sources and destinations. Since every such
> entry contains a .dir entry stating the direction of the transfer
> it is implicit whether the channel is for RX or TX and this is what
> you're exploiting in this patch.
> 
> So channel numbers (as mentioned in the commit) is not
> the key issue here.

Channel numbers should really be device types in the commit
message. I'll expand using your explanation too though.

> Now we should ask ourselves why it was done like this from
> the beginning. The reason is that DMA40 supports device-to-device
> DMA, so if you encoded one device in .src_dev_type and another
> device in .dst_dev_type and set .dir to
> STEDMA40_PERIPH_TO_PERIPH (which as you can see is
> defined in <linux/platform_data/dma-ste-dma40.h>) you get a
> device to device transfer.
> 
> Are we now sacrificing that ability on the altar of simplification?
>
> I actually think not, but that we should do periph-to-periph transfers
> in some other way, and that the .dir attribute should go away from
> the struct stedma40_chan_cfg as well but I'm not entirely sure.
> Someone else?

Although the DMA40 device supports device-to-device transfers, Linux
does not, so this subject is moot AFAICT.

> (...)
> > +++ b/arch/arm/mach-ux500/cpu-db8500.c
> > @@ -167,25 +167,25 @@ static void __init db8500_add_gpios(struct device *parent)
> >  }
> >
> >  static int usb_db8500_rx_dma_cfg[] = {
> > -       DB8500_DMA_DEV38_USB_OTG_IEP_1_9,
> > -       DB8500_DMA_DEV37_USB_OTG_IEP_2_10,
> > -       DB8500_DMA_DEV36_USB_OTG_IEP_3_11,
> > -       DB8500_DMA_DEV19_USB_OTG_IEP_4_12,
> > -       DB8500_DMA_DEV18_USB_OTG_IEP_5_13,
> > -       DB8500_DMA_DEV17_USB_OTG_IEP_6_14,
> > -       DB8500_DMA_DEV16_USB_OTG_IEP_7_15,
> > -       DB8500_DMA_DEV39_USB_OTG_IEP_8
> > +       DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9,
> > +       DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10,
> > +       DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11,
> > +       DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12,
> > +       DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13,
> > +       DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14,
> > +       DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15,
> > +       DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8
> >  };
> >
> >  static int usb_db8500_tx_dma_cfg[] = {
> > -       DB8500_DMA_DEV38_USB_OTG_OEP_1_9,
> > -       DB8500_DMA_DEV37_USB_OTG_OEP_2_10,
> > -       DB8500_DMA_DEV36_USB_OTG_OEP_3_11,
> > -       DB8500_DMA_DEV19_USB_OTG_OEP_4_12,
> > -       DB8500_DMA_DEV18_USB_OTG_OEP_5_13,
> > -       DB8500_DMA_DEV17_USB_OTG_OEP_6_14,
> > -       DB8500_DMA_DEV16_USB_OTG_OEP_7_15,
> > -       DB8500_DMA_DEV39_USB_OTG_OEP_8
> > +       DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9,
> > +       DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10,
> > +       DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11,
> > +       DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12,
> > +       DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13,
> > +       DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14,
> > +       DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15,
> > +       DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8
> >  };
> 
> 
> If you're doing this change, and after this RX and TX has no semantical
> meaning for these lists, join these two config lists
> into one.

I agree. See patch: ARM: ux500: Strip out duplicate USB DMA configuration

> (...)
> > diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
> >  static u32 d40_chan_has_events(struct d40_chan *d40c)
> > @@ -1744,8 +1740,6 @@ static int d40_validate_conf(struct d40_chan *d40c,
> >                              struct stedma40_chan_cfg *conf)
> >  {
> >         int res = 0;
> > -       u32 dst_event_group = D40_TYPE_TO_GROUP(conf->dst_dev_type);
> > -       u32 src_event_group = D40_TYPE_TO_GROUP(conf->src_dev_type);
> 
> Please explain why this is not important to check anymore, I'm not
> following.
> 
> >         if (conf->dir == STEDMA40_MEM_TO_PERIPH &&
> > -           dst_event_group == STEDMA40_DEV_DST_MEMORY) {
> > -               chan_err(d40c, "Invalid dst\n");
> > +           d40c->base->plat_data->dev_tx[conf->dev_type] == 0 &&
> > +           d40c->runtime_addr == 0) {
> > +               chan_err(d40c, "Invalid TX channel address (%d)\n",
> > +                        conf->dev_type);
> 
> Like here. We are checking for inconsistency between group
> and channel direction, why is it no longer important to check this?

I'm not entirely sure how this ever worked:

  #define D40_TYPE_TO_GROUP(type) (type / 16)
  #define STEDMA40_DEV_DST_MEMORY (-1)

  (dev_type / 16) == -1

What number would dev_type have to be for this to be true? -16?

> >         if (conf->dir == STEDMA40_PERIPH_TO_MEM &&
> > -           src_event_group == STEDMA40_DEV_SRC_MEMORY) {
> > -               chan_err(d40c, "Invalid src\n");
> > -               res = -EINVAL;
> > -       }

As above.

> > -       if (src_event_group == STEDMA40_DEV_SRC_MEMORY &&
> > -           dst_event_group == STEDMA40_DEV_DST_MEMORY && is_log) {
> > -               chan_err(d40c, "No event line\n");
> > -               res = -EINVAL;
> > -       }

We still check for this.

> > -       if (conf->dir == STEDMA40_PERIPH_TO_PERIPH &&
> > -           (src_event_group != dst_event_group)) {
> > -               chan_err(d40c, "Invalid event group\n");
> > +           d40c->base->plat_data->dev_rx[conf->dev_type] == 0 &&
> > +           d40c->runtime_addr == 0) {
> > +               chan_err(d40c, "Invalid RX channel address (%d)\n",
> > +                        conf->dev_type);
> 
> Same here.

I stopped all 'dev_src/dev_dest' comparisons, as there is only 'dev' now.

> (...)
> > @@ -2062,7 +2035,7 @@ static int d40_free_dma(struct d40_chan *d40c)
> >  {
> >
> >         int res = 0;
> > -       u32 event;
> > +       u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type);
> >         struct d40_phy_res *phy = d40c->phy_chan;
> >         bool is_src;
> >
> > @@ -2081,13 +2054,11 @@ static int d40_free_dma(struct d40_chan *d40c)
> >         }
> >
> >         if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_PERIPH ||
> > -           d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) {
> > -               event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type);
> > +           d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM)
> 
> Why did you just stop checking dma_cfg.dir for == STEDMA40_MEM_TO_MEM
> above?

That's not what this is doing. STEDMA40_MEM_TO_MEM is still there.

This patch is doing this:

+       u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dev_type);
<snip>
-       event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type);
-       event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type);

> And why is dma_cfg.dir suddenly hardcoded to MEM_TO_MEM??

It's not. Look again. :)

> This seems like a totally unrelated change and should it be done
> it need to be a separate patch with a separate explanation
> AFAICT.
> 
> This seems to happen in some other places too,

If you could point those out, I'll re-evaluate, or explain.

> and I find it
> very hard to follow the changes here ... can you please consider
> splitting the changes to groups and types semantics into a separate
> patch?

Can you read the patch again and reconsider please?

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  parent reply	other threads:[~2013-04-25  9:06 UTC|newest]

Thread overview: 168+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 10:11 [PATCH 00/32] dmaengine: Refactor the DMA40 driver Lee Jones
2013-04-18 10:11 ` [PATCH 01/32] dmaengine: ste_dma40: Assign memcpy channels in the driver Lee Jones
2013-04-22  9:22   ` Vinod Koul
2013-04-25  9:20   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 02/32] dmaengine: ste_dma40: Move default memcpy configs into " Lee Jones
2013-04-22  9:21   ` Vinod Koul
2013-04-24 14:44   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 03/32] dmaengine: ste_dma40: Use the BIT macro to replace ugly '(1 << x)'s Lee Jones
2013-04-18 10:43   ` Russell King - ARM Linux
2013-04-18 11:00     ` Lee Jones
2013-04-18 12:16   ` [PATCH 03/32 v2] " Lee Jones
2013-04-22 10:13     ` Vinod Koul
2013-04-24 14:54     ` Linus Walleij
2013-04-24 15:08       ` Lee Jones
2013-04-24 15:09   ` [PATCH 03/32] " Lee Jones
2013-04-24 15:11   ` [PATCH 03/32 v3] " Lee Jones
2013-04-24 19:24     ` Rabin Vincent
2013-04-25  8:13       ` Lee Jones
2013-04-26 11:39   ` [PATCH 03/32 v4] " Lee Jones
2013-04-26 15:04     ` Linus Walleij
2013-04-18 10:11 ` [PATCH 04/32] dmaengine: ste_dma40: Amalgamate DMA source and destination channel numbers Lee Jones
2013-04-25  8:06   ` Linus Walleij
2013-04-25  8:36     ` Arnd Bergmann
2013-04-25  8:55       ` Linus Walleij
2013-04-25  9:06     ` Lee Jones [this message]
2013-04-25 12:43       ` Linus Walleij
2013-04-25 13:09         ` Russell King - ARM Linux
2013-04-25 13:21           ` Linus Walleij
2013-04-25 13:20         ` Lee Jones
2013-04-25 13:24           ` Linus Walleij
2013-04-26 14:28             ` Lee Jones
2013-04-18 10:11 ` [PATCH 05/32] dmaengine: ste_dma40: Supply macros to resolve 'src' and 'dst' directions Lee Jones
2013-04-18 10:50   ` Arnd Bergmann
2013-04-22  9:42   ` Vinod Koul
2013-04-22 10:27     ` Lee Jones
2013-04-22 10:19       ` Vinod Koul
2013-04-24  8:53       ` Lee Jones
2013-04-25  8:22   ` Linus Walleij
2013-04-25  9:19     ` Lee Jones
2013-04-18 10:11 ` [PATCH 06/32] ARM: ux500: Strip out duplicate USB DMA configuration Lee Jones
2013-04-18 10:51   ` Arnd Bergmann
2013-04-25  8:24   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 07/32] ARM: ux500: Supply address location names for the DMA40 DMA controller Lee Jones
2013-04-18 10:48   ` Arnd Bergmann
2013-04-18 11:01     ` Lee Jones
2013-04-18 11:09     ` Lee Jones
2013-04-25  8:26   ` Linus Walleij
2013-04-25  9:17     ` Lee Jones
2013-04-25 12:45       ` Linus Walleij
2013-04-18 10:11 ` [PATCH 08/32] dmaengine: ste_dma40: Optimise local MAX() macro Lee Jones
2013-04-18 10:46   ` Arnd Bergmann
2013-04-18 11:00     ` Russell King - ARM Linux
2013-04-18 11:19       ` Arnd Bergmann
2013-04-22 10:10   ` Vinod Koul
2013-04-22 10:53     ` Lee Jones
2013-04-24  8:49   ` [PATCH 08/32 v2] dmaengine: ste_dma40: Remove home-brew " Lee Jones
2013-04-25 12:48     ` Linus Walleij
2013-05-01 14:28       ` Lee Jones
2013-04-25  8:36   ` [PATCH 08/32] dmaengine: ste_dma40: Optimise local " Linus Walleij
2013-04-25  9:15     ` Lee Jones
2013-04-18 10:11 ` [PATCH 09/32] ARM: ux500: Remove unused 'data_width' attributes from SDI DMA configs Lee Jones
2013-04-25  8:44   ` Linus Walleij
2013-04-25  9:14     ` Lee Jones
2013-04-25 12:49       ` Linus Walleij
2013-04-25 13:13         ` Lee Jones
2013-04-18 10:11 ` [PATCH 10/32] ARM: ux500: Remove unused 'data_width' attributes from SSP " Lee Jones
2013-04-25  8:45   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 11/32] ARM: ux500: Remove unused 'data_width' attributes from UART " Lee Jones
2013-04-25  8:45   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 12/32] ARM: ux500: Remove superfluous 'psize' attribute from Audio platform data Lee Jones
2013-04-25  9:00   ` Linus Walleij
2013-05-01 14:42   ` Lee Jones
2013-05-02  8:38     ` Lee Jones
2013-05-03 13:57       ` Linus Walleij
2013-06-10  9:04         ` Lee Jones
2013-06-10  9:12           ` Lee Jones
2013-04-18 10:11 ` [PATCH 13/32] dmaengine: ste_dma40: Calculate number of logical channels from physical ones Lee Jones
2013-04-22  9:23   ` Vinod Koul
2013-04-22 10:11     ` Lee Jones
2013-04-25  9:13   ` Linus Walleij
2013-04-25  9:29     ` Lee Jones
2013-04-25 12:51       ` Linus Walleij
2013-04-18 10:11 ` [PATCH 14/32] dmaengine: ste_dma40: Remove 'always true' checking Lee Jones
2013-04-18 10:53   ` Arnd Bergmann
2013-04-22  9:44   ` Vinod Koul
2013-04-25  9:17   ` Linus Walleij
2013-04-25  9:24     ` Lee Jones
2013-04-18 10:11 ` [PATCH 15/32] dmaengine: ste_dma40: Separate Logical Global Interrupt Mask (GIM) unmasking Lee Jones
2013-04-18 10:45   ` Russell King - ARM Linux
2013-04-18 10:54   ` Arnd Bergmann
2013-04-22  9:51   ` Vinod Koul
2013-04-22 10:40     ` Lee Jones
2013-04-24  8:51       ` Lee Jones
2013-04-25 11:00   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 16/32] dmaengine: ste_dma40: Remove unnecessary call to d40_phy_cfg() Lee Jones
2013-04-18 10:55   ` Arnd Bergmann
2013-04-22  9:52   ` Vinod Koul
2013-04-25 11:09   ` Linus Walleij
2013-04-18 10:11 ` [PATCH 17/32] dmaengine: ste_dma40: Remove redundant argument from d40_phy_cfg() Lee Jones
2013-04-22  9:34   ` Vinod Koul
2013-04-22 10:18     ` Lee Jones
2013-04-25 11:14       ` Linus Walleij
2013-04-24  8:55     ` Lee Jones
2013-04-25 11:12   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 18/32] dmaengine: ste_dma40: Don't configure runtime configurable setup during allocate Lee Jones
2013-04-25 11:15   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 19/32] dmaengine: ste_dma40: Move more setup into the configuration routines Lee Jones
2013-04-22  9:37   ` Vinod Koul
2013-04-25 11:17   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 20/32] dmaengine: ste_dma40: Move rev error-check up to revision acquisition Lee Jones
2013-04-22  9:41   ` Vinod Koul
2013-04-25 11:17   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 21/32] dmaengine: ste_dma40: Also report the number of logical channels Lee Jones
2013-04-22  9:36   ` Vinod Koul
2013-04-22 10:14     ` Lee Jones
2013-04-22  9:48       ` Vinod Koul
2013-04-22 10:37         ` Lee Jones
2013-04-22 10:23           ` Vinod Koul
2013-04-22 10:52           ` Russell King - ARM Linux
2013-04-24  8:35             ` Lee Jones
2013-04-24  8:39   ` [PATCH 21/32 v2] " Lee Jones
2013-04-25 11:20     ` Linus Walleij
2013-04-18 10:12 ` [PATCH 22/32] dmaengine: ste_dma40: Allocate plat_data on declaration Lee Jones
2013-04-22  9:38   ` Vinod Koul
2013-04-22  9:40   ` Vinod Koul
2013-04-25 11:22   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 23/32] dmaengine: ste_dma40: Allow driver to be probe()able when DT is enabled Lee Jones
2013-04-18 10:58   ` Arnd Bergmann
2013-04-22 10:02   ` Vinod Koul
2013-04-25 11:24   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 24/32] dmaengine: ste_dma40: Supply full Device Tree parsing support Lee Jones
2013-04-18 11:06   ` Arnd Bergmann
2013-04-18 11:31     ` Lee Jones
2013-04-18 11:37       ` Arnd Bergmann
2013-04-18 11:47         ` Lee Jones
2013-04-18 12:23           ` Arnd Bergmann
2013-04-18 11:07   ` Arnd Bergmann
2013-04-18 12:12   ` [PATCH 24/32 v2] " Lee Jones
2013-04-18 12:32     ` Arnd Bergmann
2013-04-18 13:43       ` Lee Jones
2013-04-18 14:17     ` [PATCH 24/32 v3] " Lee Jones
2013-04-18 21:53       ` Arnd Bergmann
2013-04-22 10:18       ` Vinod Koul
2013-04-25 11:33       ` Linus Walleij
2013-04-22 10:17     ` [PATCH 24/32 v2] " Vinod Koul
2013-04-22 10:16   ` [PATCH 24/32] " Vinod Koul
2013-04-18 10:12 ` [PATCH 25/32] ARM: ux500: Setup the DMA40 driver's DT node using the new DMA API Lee Jones
2013-04-18 11:08   ` Arnd Bergmann
2013-04-25 11:35   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 26/32] ARM: ux500: Supply UART's DMA configuration via Device Tree Lee Jones
2013-04-25 11:36   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 27/32] ARM: ux500: Stop registering DMA40 from platform data when DT is enabled Lee Jones
2013-04-25 11:37   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 28/32] ARM: ux500: Pass remnant platform data though to DMA40 driver Lee Jones
2013-04-18 11:11   ` Arnd Bergmann
2013-04-25 11:39   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 29/32] ARM: ux500: Stop passing UART's platform data for Device Tree boots Lee Jones
2013-04-25 11:41   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 30/32] ARM: ux500: Supply MMC DMA configuration via Device Tree Lee Jones
2013-04-25 11:43   ` Linus Walleij
2013-04-25 11:49     ` Lee Jones
2013-04-25 12:56       ` Linus Walleij
2013-04-25 13:11         ` Lee Jones
2013-04-18 10:12 ` [PATCH 31/32] ARM: ux500: Stop passing MMC's platform data for Device Tree boots Lee Jones
2013-04-25 11:44   ` Linus Walleij
2013-04-18 10:12 ` [PATCH 32/32] ARM: ux500: Move SDI (MMC) and UART devices under more descriptive heading Lee Jones
2013-04-25 11:46   ` Linus Walleij
2013-04-26 13:42     ` Lee Jones

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=20130425090612.GC4623@gmail.com \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).