linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Akhil R <akhilrajeev@nvidia.com>, <rgumasta@nvidia.com>
Cc: <dan.j.williams@intel.com>, <dmaengine@vger.kernel.org>,
	<kyarlagadda@nvidia.com>, <ldewangan@nvidia.com>,
	<linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	<p.zabel@pengutronix.de>, <thierry.reding@gmail.com>,
	<vkoul@kernel.org>, Pavan Kunapuli <pkunapuli@nvidia.com>
Subject: Re: [PATCH v3 2/4] dmaengine: tegra: Add tegra gpcdma driver
Date: Thu, 2 Sep 2021 11:57:19 +0100	[thread overview]
Message-ID: <64505970-1d68-b4cb-490b-7bfa1c842a1f@nvidia.com> (raw)
In-Reply-To: <4f0293e1-01de-8735-40e7-0622d185188a@nvidia.com>


On 01/09/2021 21:56, Jon Hunter wrote:
> 
> On 27/08/2021 07:04, Akhil R wrote:
>> Adding GPC DMA controller driver for Tegra186 and Tegra194. The driver
>> supports dma transfers between memory to memory, IO peripheral to memory
>> and memory to IO peripheral.
>>
>> Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
>> Signed-off-by: Rajesh Gumasta <rgumasta@nvidia.com>
>> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
>> ---
>>   drivers/dma/Kconfig         |   12 +
>>   drivers/dma/Makefile        |    1 +
>>   drivers/dma/tegra-gpc-dma.c | 1343 
>> +++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 1356 insertions(+)
>>   create mode 100644 drivers/dma/tegra-gpc-dma.c

...

>> +static int tegra_dma_terminate_all(struct dma_chan *dc)
>> +{
>> +    struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
>> +    unsigned long wcount = 0;
>> +    unsigned long status;
>> +    unsigned long flags;
>> +    bool was_busy;
>> +    int err;
>> +
>> +    raw_spin_lock_irqsave(&tdc->lock, flags);
>> +
>> +    if (!tdc->dma_desc) {
>> +        raw_spin_unlock_irqrestore(&tdc->lock, flags);
>> +        return 0;
>> +    }
>> +
>> +    if (!tdc->busy)
>> +        goto skip_dma_stop;
>> +
>> +    if (tdc->tdma->chip_data->hw_support_pause) {
>> +        err = tegra_dma_pause(tdc);
>> +        if (err) {
>> +            raw_spin_unlock_irqrestore(&tdc->lock, flags);
>> +            return err;
>> +        }
>> +    } else {
>> +        /* Before Reading DMA status to figure out number
>> +         * of bytes transferred by DMA channel:
>> +         * Change the client associated with the DMA channel
>> +         * to stop DMA engine from starting any more bursts for
>> +         * the given client and wait for in flight bursts to complete
>> +         */
>> +        tegra_dma_reset_client(tdc);
>> +
>> +        /* Wait for in flight data transfer to finish */
>> +        udelay(TEGRA_GPCDMA_BURST_COMPLETE_TIME);
>> +
>> +        /* If TX/RX path is still active wait till it becomes
>> +         * inactive
>> +         */
>> +
>> +        if (readl_relaxed_poll_timeout_atomic(tdc->tdma->base_addr +
>> +                tdc->chan_base_offset +
>> +                TEGRA_GPCDMA_CHAN_STATUS,
>> +                status,
>> +                !(status & (TEGRA_GPCDMA_STATUS_CHANNEL_TX |
>> +                TEGRA_GPCDMA_STATUS_CHANNEL_RX)),
>> +                5,
>> +                TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT)) {
>> +            dev_dbg(tdc2dev(tdc), "Timeout waiting for DMA burst 
>> completion!\n");
>> +            tegra_dma_dump_chan_regs(tdc);
>> +        }
> 
> I would be tempted to make the code in the 'else' clause 
> tegra_dma_sw_pause(). Then you could have tegra_dma_hw_pause() and 
> tegra_dma_sw_pause().


Thinking some more tegra_dma_hw_pause() and tegra_dma_sw_pause() it not 
very clear/accurate. I would be tempted to call these tegra_dma_pause() 
and tegra_dma_stop_client() or tegra_dma_stop_transactions(), because 
without having a proper hardware pause, you are simply ignoring the 
client sync events.

Jon
-- 
nvpublic

  reply	other threads:[~2021-09-02 10:57 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  7:30 [Patch v2 0/4] Add Nvidia Tegra GPC-DMA driver Rajesh Gumasta
2020-08-06  7:30 ` [Patch v2 1/4] dt-bindings: dma: Add DT binding document Rajesh Gumasta
2020-08-06  7:30 ` [Patch v2 2/4] dmaengine: tegra: Add Tegra GPC DMA driver Rajesh Gumasta
2020-08-06 13:46   ` Dmitry Osipenko
2020-08-06 13:56     ` Rajesh Gumasta
2020-08-06 14:22       ` Dmitry Osipenko
2020-08-06 14:49   ` Dmitry Osipenko
2020-08-06 15:02   ` Dmitry Osipenko
2020-08-07 16:03   ` Jon Hunter
2020-08-07 16:23   ` Jon Hunter
2020-08-06  7:30 ` [Patch v2 3/4] arm64: configs: enable tegra gpc dma Rajesh Gumasta
2020-08-06  7:30 ` [Patch v2 4/4] arm64: tegra: Add GPCDMA node in dt Rajesh Gumasta
2020-08-07 16:26   ` Jon Hunter
2021-01-14 10:11 ` [Patch v2 0/4] Add Nvidia Tegra GPC-DMA driver Jon Hunter
2021-01-15  5:56   ` Vinod Koul
2021-01-15 13:21     ` Jon Hunter
2021-01-15 13:42       ` Rajesh Gumasta
2021-08-27  6:04         ` [PATCH v3 " Akhil R
2021-08-27  6:04           ` [PATCH v3 1/4] dt-bindings: dmaengine: Add doc for tegra gpcdma Akhil R
2021-09-02 10:42             ` Jon Hunter
2021-08-27  6:04           ` [PATCH v3 2/4] dmaengine: tegra: Add tegra gpcdma driver Akhil R
2021-08-27 17:23             ` kernel test robot
2021-08-28 11:29             ` kernel test robot
2021-09-01 20:56             ` Jon Hunter
2021-09-02 10:57               ` Jon Hunter [this message]
2021-09-02 10:17             ` Jon Hunter
2021-08-27  6:04           ` [PATCH v3 3/4] arm64: defconfig: tegra: Enable GPCDMA Akhil R
2021-09-02 11:35             ` Jon Hunter
2021-08-27  6:04           ` [PATCH v3 4/4] arm64: tegra: Add GPCDMA node for tegra186 and tegra194 Akhil R
2021-09-02 10:36             ` Jon Hunter
2021-09-08 14:32           ` [PATCH v4 0/4] Add Nvidia Tegra GPC-DMA driver Akhil R
2021-09-08 14:32             ` [PATCH v4 1/4] dt-bindings: dmaengine: Add doc for tegra gpcdma Akhil R
2021-09-08 16:44               ` Jon Hunter
2021-09-15  8:08                 ` Akhil R
2021-09-08 14:32             ` [PATCH v4 2/4] dmaengine: tegra: Add tegra gpcdma driver Akhil R
2021-09-08 14:32             ` [PATCH v4 3/4] arm64: defconfig: tegra: Enable GPCDMA Akhil R
2021-09-08 14:32             ` [PATCH v4 4/4] arm64: tegra: Add GPCDMA node for tegra186 and tegra194 Akhil R
2021-09-08 16:45               ` Jon Hunter
2021-09-08 16:44             ` [PATCH v4 0/4] Add Nvidia Tegra GPC-DMA driver Jon Hunter
2021-09-13  4:08               ` Akhil R
2021-09-16 12:18             ` [PATCH v5 " Akhil R
2021-09-16 12:18               ` [PATCH v5 1/4] dt-bindings: dmaengine: Add doc for tegra gpcdma Akhil R
2021-09-16 14:30                 ` Jon Hunter
2021-09-16 12:18               ` [PATCH v5 2/4] dmaengine: tegra: Add tegra gpcdma driver Akhil R
2021-09-16 12:18               ` [PATCH v5 3/4] arm64: defconfig: tegra: Enable GPCDMA Akhil R
2021-09-16 12:18               ` [PATCH v5 4/4] arm64: tegra: Add GPCDMA node for tegra186 and tegra194 Akhil R
2021-09-16 14:33                 ` Jon Hunter

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=64505970-1d68-b4cb-490b-7bfa1c842a1f@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=akhilrajeev@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kyarlagadda@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pkunapuli@nvidia.com \
    --cc=rgumasta@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=vkoul@kernel.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).