All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	linux-samsung-soc@vger.kernel.org,
	Boojin Kim <boojin.kim@samsung.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V4 03-1/13] DMA: PL330: Support DMA_SLAVE_CONFIG command
Date: Thu, 21 Jul 2011 12:23:23 +0200	[thread overview]
Message-ID: <CACRpkdaP5D=URqAXAytm9s2e9HRVMB-MzsKZeLJ9v6ktkJUCRA@mail.gmail.com> (raw)
In-Reply-To: <CABb+yY2obv5JMBiRSXS-4tSCYX+7nVVaA0Q7gurA+NndrGVuvA@mail.gmail.com>

On Thu, Jul 21, 2011 at 11:14 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
> On Thu, Jul 21, 2011 at 1:41 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Thu, Jul 21, 2011 at 12:47:49AM +0530, Jassi Brar wrote:
>>> PL330 has fixed channels to peripherals.
>>> So FIFO addresses(burst_sz too?) should already be set via platform data.
>>> Client drivers shouldn't bother.
>>
>> That's utter crap, and isn't what the DMA engine API is about.
>>
>> The above looks correctly implemented.  Slave DMA engine users are
>> supposed to supply the device DMA register address via this
>> DMA_SLAVE_CONFIG call.  Doing this via platform data for the DMA
>> device is braindead.
>
> Rather than have 32 client drivers expect fifo_address from the
> platform and then
> provide to the DMAC, IMHO it is better for a single driver(DMAC) to
> get 32 addresses
> from the platform.

My idea (when I implemented it) is that the device driver knows the
physical and virtual base and thus the address where DMA data is
destined. It knows all other registers, it remaps them, noone else should
be bothered with containing the knowledge of adress ranges for the
specific hardware block.

Passing this through platform data requires the machine to keep track
not only of the base adress of the peripheral (as is generally contained
in the machine or device tree) but also the offset of specific registers
in that memory region, which is too much.

Usually this means the offsets are defined in files like <mach/perfoo.h>
which means they can't be pushed down into drivers/foo/foo.c and
creates unnecessary bindings and de-encapsulation of the driver.
We want to get rid of such stuff. (I think?)

Therefore I introduced this to confine the different registers into
the driver itself and ask the DMA engine to transfer to a specific
address.

> Esp when the DMAC driver already expect similar h/w
> parameter -- *direction*.
>
> I don't understand why is 'fifo_address' a property much different
> than 'direction' of the
> channel ?

struct dma_slave_config {
        enum dma_data_direction direction;
        dma_addr_t src_addr;
        dma_addr_t dst_addr;
        enum dma_slave_buswidth src_addr_width;
        enum dma_slave_buswidth dst_addr_width;
        u32 src_maxburst;
        u32 dst_maxburst;
};

We do support changing direction as well as src and dst address
(i.e. FIFO endpoint) at runtime.

Check drivers/mmc/host/mmci.c for an example of how we switch
a single channel from TX to RX in runtime using this one property.

However it has been noted by Russell that the direction member
is unnecessary since the device_prep_slave_sg() function in the
dmaengine vtable already takes a direction argument like this:

        struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
                struct dma_chan *chan, struct scatterlist *sgl,
                unsigned int sg_len, enum dma_data_direction direction,
                unsigned long flags);

Therefore the direction setting needs to go from either the config
struct or the device_prep_slave_sg() call, as right now the channel
is being told about the direction twice which is not elegant and
confusing.

So you even have two ways of changing direction at runtime...

Yours,
Linus Walleij

WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 03-1/13] DMA: PL330: Support DMA_SLAVE_CONFIG command
Date: Thu, 21 Jul 2011 12:23:23 +0200	[thread overview]
Message-ID: <CACRpkdaP5D=URqAXAytm9s2e9HRVMB-MzsKZeLJ9v6ktkJUCRA@mail.gmail.com> (raw)
In-Reply-To: <CABb+yY2obv5JMBiRSXS-4tSCYX+7nVVaA0Q7gurA+NndrGVuvA@mail.gmail.com>

On Thu, Jul 21, 2011 at 11:14 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
> On Thu, Jul 21, 2011 at 1:41 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Thu, Jul 21, 2011 at 12:47:49AM +0530, Jassi Brar wrote:
>>> PL330 has fixed channels to peripherals.
>>> So FIFO addresses(burst_sz too?) should already be set via platform data.
>>> Client drivers shouldn't bother.
>>
>> That's utter crap, and isn't what the DMA engine API is about.
>>
>> The above looks correctly implemented. ?Slave DMA engine users are
>> supposed to supply the device DMA register address via this
>> DMA_SLAVE_CONFIG call. ?Doing this via platform data for the DMA
>> device is braindead.
>
> Rather than have 32 client drivers expect fifo_address from the
> platform and then
> provide to the DMAC, IMHO it is better for a single driver(DMAC) to
> get 32 addresses
> from the platform.

My idea (when I implemented it) is that the device driver knows the
physical and virtual base and thus the address where DMA data is
destined. It knows all other registers, it remaps them, noone else should
be bothered with containing the knowledge of adress ranges for the
specific hardware block.

Passing this through platform data requires the machine to keep track
not only of the base adress of the peripheral (as is generally contained
in the machine or device tree) but also the offset of specific registers
in that memory region, which is too much.

Usually this means the offsets are defined in files like <mach/perfoo.h>
which means they can't be pushed down into drivers/foo/foo.c and
creates unnecessary bindings and de-encapsulation of the driver.
We want to get rid of such stuff. (I think?)

Therefore I introduced this to confine the different registers into
the driver itself and ask the DMA engine to transfer to a specific
address.

> Esp when the DMAC driver already expect similar h/w
> parameter -- *direction*.
>
> I don't understand why is 'fifo_address' a property much different
> than 'direction' of the
> channel ?

struct dma_slave_config {
        enum dma_data_direction direction;
        dma_addr_t src_addr;
        dma_addr_t dst_addr;
        enum dma_slave_buswidth src_addr_width;
        enum dma_slave_buswidth dst_addr_width;
        u32 src_maxburst;
        u32 dst_maxburst;
};

We do support changing direction as well as src and dst address
(i.e. FIFO endpoint) at runtime.

Check drivers/mmc/host/mmci.c for an example of how we switch
a single channel from TX to RX in runtime using this one property.

However it has been noted by Russell that the direction member
is unnecessary since the device_prep_slave_sg() function in the
dmaengine vtable already takes a direction argument like this:

        struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
                struct dma_chan *chan, struct scatterlist *sgl,
                unsigned int sg_len, enum dma_data_direction direction,
                unsigned long flags);

Therefore the direction setting needs to go from either the config
struct or the device_prep_slave_sg() call, as right now the channel
is being told about the direction twice which is not elegant and
confusing.

So you even have two ways of changing direction at runtime...

Yours,
Linus Walleij

  reply	other threads:[~2011-07-21 10:23 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 10:46 [PATCH V4 00/13] To use DMA generic APIs for Samsung DMA Boojin Kim
2011-07-20 10:46 ` Boojin Kim
2011-07-20 10:46 ` [PATCH V4 01/13] DMA: PL330: Add support runtime PM for PL330 DMAC Boojin Kim
2011-07-20 10:46   ` Boojin Kim
2011-07-20 18:35   ` Jassi Brar
2011-07-20 18:35     ` Jassi Brar
2011-07-20 10:46 ` [PATCH V4 03-1/13] DMA: PL330: Support DMA_SLAVE_CONFIG command Boojin Kim
2011-07-20 10:46   ` Boojin Kim
2011-07-20 19:17   ` Jassi Brar
2011-07-20 19:17     ` Jassi Brar
2011-07-21  4:13     ` Boojin Kim
2011-07-21  4:13       ` Boojin Kim
2011-07-21  5:00       ` Jassi Brar
2011-07-21  5:00         ` Jassi Brar
2011-07-21  6:34         ` Boojin Kim
2011-07-21  6:34           ` Boojin Kim
2011-07-21  7:31           ` Jassi Brar
2011-07-21  7:31             ` Jassi Brar
2011-07-21  8:11     ` Russell King - ARM Linux
2011-07-21  8:11       ` Russell King - ARM Linux
2011-07-21  9:14       ` Jassi Brar
2011-07-21  9:14         ` Jassi Brar
2011-07-21 10:23         ` Linus Walleij [this message]
2011-07-21 10:23           ` Linus Walleij
2011-07-21 14:28           ` Jassi Brar
2011-07-21 14:28             ` Jassi Brar
2011-07-21 15:28             ` Russell King - ARM Linux
2011-07-21 15:28               ` Russell King - ARM Linux
2011-07-22 13:59             ` Linus Walleij
2011-07-22 13:59               ` Linus Walleij
2011-07-21 11:29         ` Russell King - ARM Linux
2011-07-21 11:29           ` Russell King - ARM Linux
2011-07-21 15:12           ` Jassi Brar
2011-07-21 15:12             ` Jassi Brar
2011-07-21 15:23             ` Russell King - ARM Linux
2011-07-21 15:23               ` Russell King - ARM Linux
2011-07-21 15:56               ` Jassi Brar
2011-07-21 15:56                 ` Jassi Brar
2011-07-21 16:02                 ` Russell King - ARM Linux
2011-07-21 16:02                   ` Russell King - ARM Linux
2011-07-22  5:42   ` Jassi Brar
2011-07-22  5:42     ` Jassi Brar
2011-07-25  2:10     ` Boojin Kim
2011-07-25  2:10       ` Boojin Kim
2011-07-20 10:46 ` [PATCH V4 03-2/13] DMA: PL330: Add DMA_CYCLIC capability Boojin Kim
2011-07-20 10:46   ` Boojin Kim
2011-07-20 10:46 ` [PATCH V4 05/13] ARM: SAMSUNG: Add common DMA operations Boojin Kim
2011-07-20 10:46   ` Boojin Kim
2011-07-20 16:04 ` [PATCH V4 00/13] To use DMA generic APIs for Samsung DMA Kukjin Kim
2011-07-20 16:04   ` Kukjin Kim
2011-07-22 12:07 ` Koul, Vinod
2011-07-22 12:07   ` Koul, Vinod

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='CACRpkdaP5D=URqAXAytm9s2e9HRVMB-MzsKZeLJ9v6ktkJUCRA@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=boojin.kim@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=vinod.koul@intel.com \
    /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.