DMA Engine development
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Akhil R <akhilrajeev@nvidia.com>,
	dmaengine@vger.kernel.org, ldewangan@nvidia.com,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	p.zabel@pengutronix.de, thierry.reding@gmail.com,
	vkoul@kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 1/2] dmaengine: tegra: Add terminate() for Tegra234
Date: Thu, 7 Jul 2022 11:40:02 +0100	[thread overview]
Message-ID: <1d0826ed-97e7-9571-b5e5-9da12286a626@nvidia.com> (raw)
In-Reply-To: <20220707102725.41383-2-akhilrajeev@nvidia.com>


On 07/07/2022 11:27, Akhil R wrote:
> In certain cases where the DMA client bus gets corrupted or if the
> end device ceases to send/receive data, DMA can wait indefinitely
> for the data to be received/sent. Attempting to terminate the transfer
> will put the DMA in pause flush mode and it remains there.
> 
> The channel is irrecoverable once this pause times out in Tegra194 and
> earlier chips. Whereas, from Tegra234, it can be recovered by disabling
> the channel and reprograming it.
> 
> Hence add a new terminate() function that ignores the outcome of
> dma_pause() and disables the channel.
> 
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
>   arch/arm64/boot/dts/nvidia/tegra234.dtsi |  5 +++--
>   drivers/dma/tegra186-gpc-dma.c           | 26 ++++++++++++++++++++++--
>   2 files changed, 27 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
> index cf611eff7f6b..83d1ad7d3c8c 100644
> --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
> +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
> @@ -22,8 +22,9 @@
>   		ranges = <0x0 0x0 0x0 0x40000000>;
>   
>   		gpcdma: dma-controller@2600000 {
> -			compatible = "nvidia,tegra194-gpcdma",
> -				      "nvidia,tegra186-gpcdma";
> +			compatible = "nvidia,tegra234-gpcdma",
> +				     "nvidia,tegra194-gpcdma",
> +				     "nvidia,tegra186-gpcdma";
>   			reg = <0x2600000 0x210000>;
>   			resets = <&bpmp TEGRA234_RESET_GPCDMA>;
>   			reset-names = "gpcdma";

I think that this should be split into two patches.

> diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
> index 05cd451f541d..fa9bda4a2bc6 100644
> --- a/drivers/dma/tegra186-gpc-dma.c
> +++ b/drivers/dma/tegra186-gpc-dma.c
> @@ -157,8 +157,8 @@
>    * If any burst is in flight and DMA paused then this is the time to complete
>    * on-flight burst and update DMA status register.
>    */
> -#define TEGRA_GPCDMA_BURST_COMPLETE_TIME	20
> -#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT	100
> +#define TEGRA_GPCDMA_BURST_COMPLETE_TIME	10
> +#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT	5000 /* 5 msec */
>   
>   /* Channel base address offset from GPCDMA base address */
>   #define TEGRA_GPCDMA_CHANNEL_BASE_ADD_OFFSET	0x20000
> @@ -432,6 +432,17 @@ static int tegra_dma_device_resume(struct dma_chan *dc)
>   	return 0;
>   }
>   
> +static inline int tegra_dma_pause_noerr(struct tegra_dma_channel *tdc)
> +{
> +	/* Return 0 irrespective of PAUSE status.
> +	 * This is useful to recover channels that can exit out of flush
> +	 * state when the channel is disabled.
> +	 */
> +
> +	tegra_dma_pause(tdc);
> +	return 0;
> +}

The commit message says that "add a new terminate() function that 
ignores the outcome of dma_pause() and disables the channel". But I only 
see pause being done here.

> +
>   static void tegra_dma_disable(struct tegra_dma_channel *tdc)
>   {
>   	u32 csr, status;
> @@ -1292,6 +1303,14 @@ static const struct tegra_dma_chip_data tegra194_dma_chip_data = {
>   	.terminate = tegra_dma_pause,
>   };
>   
> +static const struct tegra_dma_chip_data tegra234_dma_chip_data = {
> +	.nr_channels = 31,
> +	.channel_reg_size = SZ_64K,
> +	.max_dma_count = SZ_1G,
> +	.hw_support_pause = true,
> +	.terminate = tegra_dma_pause_noerr,
> +};
> +
>   static const struct of_device_id tegra_dma_of_match[] = {
>   	{
>   		.compatible = "nvidia,tegra186-gpcdma",
> @@ -1299,6 +1318,9 @@ static const struct of_device_id tegra_dma_of_match[] = {
>   	}, {
>   		.compatible = "nvidia,tegra194-gpcdma",
>   		.data = &tegra194_dma_chip_data,
> +	}, {
> +		.compatible = "nvidia,tegra234-gpcdma",
> +		.data = &tegra234_dma_chip_data,
>   	}, {
>   	},
>   };

-- 
nvpublic

  reply	other threads:[~2022-07-07 10:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 10:27 [PATCH 0/2] Add compatible for Tegra234 GPCDMA Akhil R
2022-07-07 10:27 ` [PATCH 1/2] dmaengine: tegra: Add terminate() for Tegra234 Akhil R
2022-07-07 10:40   ` Jon Hunter [this message]
2022-07-07 10:47     ` Akhil R
2022-07-07 14:11       ` Jon Hunter
2022-07-07 10:27 ` [PATCH 2/2] dt-bindings: dmaengine: Add compatible " Akhil R
2022-07-07 10:40   ` 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=1d0826ed-97e7-9571-b5e5-9da12286a626@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=akhilrajeev@nvidia.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --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