linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Laxman Dewangan
	<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 2/3] dmaengine: Add driver for NVIDIA Tegra AHB DMA controller
Date: Fri, 6 Oct 2017 22:25:44 +0300	[thread overview]
Message-ID: <163a6cff-d620-e80e-a4c3-2975c536012f@gmail.com> (raw)
In-Reply-To: <fc684b85-b4a7-c68d-613c-adbe0b154c6c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 06.10.2017 20:23, Dmitry Osipenko wrote:
> On 06.10.2017 18:50, Jon Hunter wrote:
>>
>> On 06/10/17 16:26, Dmitry Osipenko wrote:
>>> On 06.10.2017 16:11, Jon Hunter wrote:
>>>>
>>>> On 04/10/17 00:58, Dmitry Osipenko wrote:
>>>>> AHB DMA controller presents on Tegra20/30 SoC's, it supports transfers
>>>>> memory <-> AHB bus peripherals as well as mem-to-mem transfers. Driver
>>>>> doesn't yet implement transfers larger than 64K and scatter-gather
>>>>> transfers that have NENT > 1, HW doesn't have native support for these
>>>>> cases, mem-to-mem isn't implemented as well.
>>>>
>>>> The APB DMA does not have h/w support for sg-transfers either, but
>>>> transfer request are placed on a list. Can we not do the same for AHB?
>>>>
>>>
>>> We can, but I'm not going to implement it without a use-case. It could be done
>>> later if needed.
>>
>> OK, that's fine, maybe state that above.
>>
> 
> Well, I think it is explicitly mentioned in the commit message.
> 
> "Driver doesn't yet implement transfers larger than 64K and scatter-gather
> transfers that have NENT > 1".
> 
> Isn't it enough?
> 
>> [...]
>>
>>>>> +static void tegra_ahbdma_issue_next_tx(struct tegra_ahbdma_chan *chan)
>>>>> +{
>>>>> +	struct tegra_ahbdma_tx_desc *tx = tegra_ahbdma_get_next_tx(chan);
>>>>> +
>>>>> +	if (tx) {
>>>>> +		writel_relaxed(tx->ahb_seq,  chan->regs + AHBDMA_CH_AHB_SEQ);
>>>>> +		writel_relaxed(tx->ahb_addr, chan->regs + AHBDMA_CH_AHB_PTR);
>>>>> +		writel_relaxed(tx->mem_addr, chan->regs + AHBDMA_CH_XMB_PTR);
>>>>> +		writel_relaxed(tx->csr,      chan->regs + AHBDMA_CH_CSR);
>>>>> +
>>>>> +		reinit_completion(&chan->idling);
>>>>
>>>> Should this be done before actually starting the DMA?
>>
>> OK, then that's fine.
>>
>> [...]
>>
>>>>> +	else {
>>>>> +		tx = to_ahbdma_tx_desc(vdesc);
>>>>> +
>>>>> +		if (tx == ahbdma_chan->active_tx)
>>>>> +			residual = tegra_ahbdma_residual(ahbdma_chan);
>>>>> +		else
>>>>> +			residual = tx->csr & AHBDMA_CH_WCOUNT_MASK;
>>>>> +
>>>>> +		residual += sizeof(u32);
>>>>> +	}
>>>>> +
>>>>> +	dma_set_residue(state, residual);
>>>>
>>>> I believe residue needs to be bytes.
>>
>> Oops yes indeed!
>>
>>>>> +static int tegra_ahbdma_terminate_all(struct dma_chan *chan)
>>>>> +{
>>>>> +	struct tegra_ahbdma_chan *ahbdma_chan = to_ahbdma_chan(chan);
>>>>> +	unsigned long flags;
>>>>> +	LIST_HEAD(head);
>>>>> +	u32 csr;
>>>>> +
>>>>> +	spin_lock_irqsave(&ahbdma_chan->vchan.lock, flags);
>>>>> +
>>>>> +	csr = readl_relaxed(ahbdma_chan->regs + AHBDMA_CH_CSR);
>>>>> +	writel_relaxed(csr & ~AHBDMA_CH_ENABLE,
>>>>> +		       ahbdma_chan->regs + AHBDMA_CH_CSR);
>>>>> +
>>>>> +	if (ahbdma_chan->active_tx) {
>>>>> +		udelay(AHBDMA_BURST_COMPLETE_TIME);
>>>>
>>>> Why not poll the status register and wait for the channel to stop?
>>>>
>>>
>>> That probably would also work. But I'm not sure whether status depends on the
>>> channels "enable" state..
>>
>> Well if it is not enabled, then we probably don't care about the state.
>> However, a quick test should tell us.
>>
> 
> Okay, I'll try to check it.
>
I have checked the 'busy' bit and it indeed reflects the real channels busy
state. I'll change code to poll the busy bit instead of the delaying. Thank you
for the suggestion!

  parent reply	other threads:[~2017-10-06 19:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 23:58 [PATCH v2 0/3] NVIDIA Tegra AHB DMA controller driver Dmitry Osipenko
     [not found] ` <cover.1507073384.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 23:58   ` [PATCH v2 1/3] dt-bindings: Add DT binding for NVIDIA Tegra AHB DMA controller Dmitry Osipenko
     [not found]     ` <ecf2e8248dc7b88e5fd04bebe8071027f538a40d.1507073384.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06  9:10       ` Jon Hunter
     [not found]         ` <542f69a2-5d70-47ae-8c04-2089b50cad30-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 11:40           ` Dmitry Osipenko
2017-10-06 13:56       ` Jon Hunter
     [not found]         ` <03810975-7eb0-aa79-964f-dcbcbaf9e4b4-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 15:27           ` Dmitry Osipenko
2017-10-03 23:58   ` [PATCH v2 2/3] dmaengine: Add driver " Dmitry Osipenko
     [not found]     ` <9ef93a0054a6a2e27b72e5bfeebe81e5ab11a224.1507073384.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 13:11       ` Jon Hunter
     [not found]         ` <58f8c049-4408-d6a7-7452-f5be8041b7b5-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 15:26           ` Dmitry Osipenko
     [not found]             ` <72374a74-f6bd-256f-73c0-fa970a2e1576-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 15:50               ` Jon Hunter
     [not found]                 ` <d4885545-6af1-b240-a197-1ed530cc4172-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-06 17:23                   ` Dmitry Osipenko
     [not found]                     ` <fc684b85-b4a7-c68d-613c-adbe0b154c6c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06 19:25                       ` Dmitry Osipenko [this message]
2017-10-09  9:51                       ` Jon Hunter
     [not found]                         ` <dd49d752-039a-464d-1638-08323d637f5a-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-09 13:28                           ` Dmitry Osipenko
2017-10-06 18:02                   ` Dmitry Osipenko
2017-10-06 19:11       ` Dmitry Osipenko
     [not found]         ` <CAOQPn8s50+XyGr2s3sQh5+qhek2n0A=3CT49YNJyftLv1pP=vg@mail.gmail.com>
     [not found]           ` <CAOQPn8s50+XyGr2s3sQh5+qhek2n0A=3CT49YNJyftLv1pP=vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-07 12:43             ` Dmitry Osipenko
     [not found]               ` <7c44b44b-ddfa-ad67-cf18-ce182e424ea5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-07 14:42                 ` Eric Pilmore (GigaIO)
     [not found]                   ` <DDFFA839-AC6C-45AE-9536-5C68BC2DE82A-Op3I1peydIbQT0dZR+AlfA@public.gmane.org>
2017-10-07 15:50                     ` Dmitry Osipenko
     [not found]         ` <35dd2e3a-1f97-b82e-4763-a9d064761bc8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-09  9:43           ` Jon Hunter
     [not found]             ` <b66c06cb-a63e-b13d-02f4-f7bacfd35112-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-10-09 10:39               ` Vinod Koul
2017-10-09 11:43                 ` Dmitry Osipenko
2017-10-03 23:58   ` [PATCH v2 3/3] ARM: dts: tegra: Add AHB DMA controller nodes Dmitry Osipenko
2017-12-13  3:41   ` [PATCH v2 0/3] NVIDIA Tegra AHB DMA controller driver Dmitry Osipenko

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=163a6cff-d620-e80e-a4c3-2975c536012f@gmail.com \
    --to=digetx-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@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 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).