linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: viresh.kumar@st.com (Viresh KUMAR)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL081 PrimeCells
Date: Tue, 15 Jun 2010 10:55:54 +0530	[thread overview]
Message-ID: <4C170EE2.4010706@st.com> (raw)
In-Reply-To: <AANLkTim9n-p-Pw6FWvzQMBiAuB3h9ILq1Ya6XWk_0l-c@mail.gmail.com>

On 6/14/2010 7:09 PM, Linus Walleij wrote:
> Hi Viresh, thanks a lot for reviewing this and I'd be *very* happy if
> you could give it a spin on
> the SPEAr as well!

I would be happy too linus, will do it in few weeks, right now we are running
short of time.

> 
> 2010/6/14 Viresh KUMAR <viresh.kumar@st.com>:
>>> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
>>> (...)
>>> + * (Bursts are irrelevant for mem to mem transfers - there are no burst
>>> + * signals)
>>
>> I agree that there are no request lines from memories but still we can program
>> them with burst in order to faster the transfer. This burst feature is
>> automatically handled by DMA.
> 
> Actually in the example platform data I set this to the maxburst size
> 256 Bytes, however if I read the manual correctly this is simply ignored
> when you do mem2mem transfers.
> 
> It will simply AHB master the bus until the transaction is finished. That
> is why the manual states:
> 
> "You must program memory-to-memory transfers with a low channel
> priority, otherwise:
> ?    other DMA channels cannot access the bus until the
> memory-to-memory transfer
>      has finished
> ?    other AHB masters cannot perform any transaction."

Yes i have seen them. One more thing i have found related to mem to mem
transfers is:
"You must set this value to the burst size of the destination peripheral,
or if the destination is memory, to the memory boundary size."

>>> +static void pl08x_set_cregs(struct pl08x_driver_data *pl08x,
>>> +                         struct pl08x_phy_chan *ch)
>>> +{
>>> +     u32 val;
>>> +
>>> +     /* Wait for channel inactive */
>>> +     val = readl(ch->base + PL080_CH_CONFIG);
>>> +     while (val & PL080_CONFIG_ACTIVE)
>>> +             val = readl(ch->base + PL080_CH_CONFIG);
>>
>> can we use pl08x_phy_channel_busy() instead of above code?
> 
> Fixed.
> 
>>> +     /*
>>> +      * Do not access config register until channel shows as inactive
>>> +      */
>>> +     val = readl(ch->base + PL080_CH_CONFIG);
>>> +     while ((val & PL080_CONFIG_ACTIVE) || (val & PL080_CONFIG_ENABLE))
>>> +             val = readl(ch->base + PL080_CH_CONFIG);
>>
>> above 3 fns are always called in order, i.e. pl08x_enable_phy_chan will
>> be called after pl08x_set_cregs, so we may not require these checks
>> here. Is my understanding correct??
> 
> The previous check if the channel is active before proceeding, this check also
> checks the enable bit, this behaviour comes straight from the manual and is
> required to avoid hardware races, so I don't dare to touch it really...
> 

I was talking about the similar check present in pl08x_set_cregs, which will
be called before this routine. pl08x_set_cregs has already checked if channel
is active or not. so checking active in this routine is not required.


>>> +     .device_alloc_chan_resources    = pl08x_alloc_chan_resources,
>>> +     .device_free_chan_resources     = pl08x_free_chan_resources,
>>> +     .device_prep_dma_xor            = NULL,
>>> +     .device_prep_dma_memset         = NULL,
>>> +     .device_prep_dma_interrupt      = pl08x_prep_dma_interrupt,
>>> +     .device_tx_status               = pl08x_dma_tx_status,
>>> +     .device_issue_pending           = pl08x_issue_pending,
>>> +     .device_prep_slave_sg           = pl08x_prep_slave_sg,
>>> +     .device_control                 = pl08x_control,
>>> +};
>>> +
>>
>> One more thing linus, why do we need to create this separation between
>> channels. i.e. few are for memcpy and few for slave_sg. Why don't all
>> channels support everything and this is resolved at runtime.
> 
> This is done in all in-tree drivers, the reason is (I think) that for example
> the dmatest.c test client will look for:
> 
> 	if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
> 		cnt = dmatest_add_threads(dtc, DMA_MEMCPY);
> 		thread_count += cnt > 0 ? cnt : 0;
> 
> So if you want to partition some channels for device I/O (typically some
> which are hard-coded to some devices) and others for memcpy() you create
> a slave instance for the former and a memcpy() instance for the latter.
> 
> In this case we multiplex the memcpy and slave transfers on the few
> physical channels we have, but I haven't finally decided how to handle this:
> perhaps we should always set on physical channel aside for memcpy
> so this won't ever fail, and then this special memcpy device entry will help.
> 
> Ideas? Use cases?

Hmmm. I am not sure, but i think we can't hard code a channel for some device.
All channels should be available with both capabilities. If still there are
some conditions (that you might know), where we need to hard code channels
for devices, then this should come from plat data in some way.



I have few more doubts that i wanted to ask. Are following supported in your
driver, we need them in SPEAr:
 - Configure burst size of source or destination.
 - Configure DMA Master for src or dest.
 - Transfer from Peripheral to Peripheral.
 - Configure Width of src or dest peripheral.
 - Configure Flow controller of transfer.
 - Some callback for fixing Request line multiplexing just before
	initiating transfer.
 - Multiple sg elements in slave_sg transfer. I think it is not supported.
 - Control for autoincrement of addresses, both in case of memory and
	peripherals.


viresh.

  reply	other threads:[~2010-06-15  5:25 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-11 15:27 [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL081 PrimeCells Linus Walleij
2010-06-14  6:02 ` Viresh KUMAR
2010-06-14 13:39   ` Linus Walleij
2010-06-15  5:25     ` Viresh KUMAR [this message]
2010-06-15 20:14       ` Linus WALLEIJ
2010-06-16  3:59         ` Viresh KUMAR
2010-06-16  6:38           ` Linus Walleij
2010-06-15 10:25 ` Kukjin Kim
2010-06-15 10:45   ` Jassi Brar
2010-06-15 11:17     ` Maurus Cuelenaere
2010-06-15 11:39       ` Jassi Brar
2010-06-15 12:04         ` Maurus Cuelenaere
2010-06-15 20:55     ` Linus WALLEIJ
2010-12-21 18:20 ` Russell King - ARM Linux
2010-12-21 22:25   ` Russell King - ARM Linux
2010-12-22 12:22   ` Russell King - ARM Linux
2010-12-22 12:29   ` Russell King - ARM Linux
2010-12-22 23:45     ` Dan Williams
2010-12-22 23:54       ` Russell King - ARM Linux
2010-12-23  0:53         ` Dan Williams
2010-12-23  0:10       ` Russell King - ARM Linux
2010-12-23  1:11         ` Dan Williams
2010-12-23  1:31           ` Dan Williams
2010-12-31 21:50             ` Russell King - ARM Linux
2011-01-02  9:42               ` Dan Williams
2011-01-02 11:22                 ` Russell King - ARM Linux
2011-01-02 20:33               ` Linus Walleij
2011-01-03 11:14                 ` Russell King - ARM Linux
2010-12-23  9:18           ` Russell King - ARM Linux
2010-12-23  8:17       ` Linus Walleij
2010-12-23  8:30         ` Jassi Brar
2010-12-23 12:30         ` Russell King - ARM Linux
2010-12-28  0:33           ` Linus Walleij
2011-01-01 15:15       ` Russell King - ARM Linux
2011-01-02 20:29         ` Linus Walleij
2014-03-10 13:56         ` David Woodhouse
2014-03-10 14:11           ` Arnd Bergmann
2014-03-10 14:27             ` David Woodhouse
2014-03-10 14:40               ` Arnd Bergmann
2014-03-10 14:32           ` Russell King - ARM Linux
2014-03-10 14:52             ` David Woodhouse
2014-03-13  8:17               ` Linus Walleij
2014-03-13  8:52                 ` Arnd Bergmann
2014-03-13 14:35                   ` Linus Walleij
2011-01-01 15:36       ` Russell King - ARM Linux
2011-01-03 15:19       ` Russell King - ARM Linux
2011-01-04  0:41         ` Jassi Brar
2011-01-04 10:47         ` Linus Walleij

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=4C170EE2.4010706@st.com \
    --to=viresh.kumar@st.com \
    --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).