* [PATCH v2 0/3] Add compatible for Tegra234 GPCDMA
@ 2022-07-07 14:57 Akhil R
2022-07-07 14:57 ` [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234 Akhil R
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Akhil R @ 2022-07-07 14:57 UTC (permalink / raw)
To: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
p.zabel, thierry.reding, vkoul, robh+dt, devicetree
Cc: akhilrajeev
Tegra234 supports recovery of a channel hung in pause flush mode.
This could happen when the client bus gets corrupted or if the end
device ceases to send/receive data.
Add a separate compatible for Tegra234 so that this scenario can be
handled in the driver.
v1->v2:
* split device tree change to a different patch.
* Update commit message
Akhil R (3):
dt-bindings: dmaengine: Add compatible for Tegra234
dmaengine: tegra: Add terminate() for Tegra234
arm64: tegra: Update compatible for Tegra234 GPCDMA
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 1 +
arch/arm64/boot/dts/nvidia/tegra234.dtsi | 5 ++--
drivers/dma/tegra186-gpc-dma.c | 26 +++++++++++++++++--
3 files changed, 28 insertions(+), 4 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
2022-07-07 14:57 [PATCH v2 0/3] Add compatible for Tegra234 GPCDMA Akhil R
@ 2022-07-07 14:57 ` Akhil R
2022-07-08 14:35 ` Thierry Reding
2022-07-07 14:57 ` [PATCH v2 2/3] dmaengine: tegra: Add terminate() " Akhil R
2022-07-07 14:57 ` [PATCH v2 3/3] arm64: tegra: Update compatible for Tegra234 GPCDMA Akhil R
2 siblings, 1 reply; 7+ messages in thread
From: Akhil R @ 2022-07-07 14:57 UTC (permalink / raw)
To: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
p.zabel, thierry.reding, vkoul, robh+dt, devicetree
Cc: akhilrajeev
Document the compatible string used by GPCDMA controller for Tegra234.
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
.../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
index 9dd1476d1849..81f3badbc8ec 100644
--- a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
+++ b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
@@ -23,6 +23,7 @@ properties:
oneOf:
- const: nvidia,tegra186-gpcdma
- items:
+ - const: nvidia,tegra234-gpcdma
- const: nvidia,tegra194-gpcdma
- const: nvidia,tegra186-gpcdma
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] dmaengine: tegra: Add terminate() for Tegra234
2022-07-07 14:57 [PATCH v2 0/3] Add compatible for Tegra234 GPCDMA Akhil R
2022-07-07 14:57 ` [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234 Akhil R
@ 2022-07-07 14:57 ` Akhil R
2022-07-07 14:57 ` [PATCH v2 3/3] arm64: tegra: Update compatible for Tegra234 GPCDMA Akhil R
2 siblings, 0 replies; 7+ messages in thread
From: Akhil R @ 2022-07-07 14:57 UTC (permalink / raw)
To: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
p.zabel, thierry.reding, vkoul, robh+dt, devicetree
Cc: akhilrajeev
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() so that terminate_all() can proceed to disable the channel.
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
drivers/dma/tegra186-gpc-dma.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
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;
+}
+
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,
}, {
},
};
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] arm64: tegra: Update compatible for Tegra234 GPCDMA
2022-07-07 14:57 [PATCH v2 0/3] Add compatible for Tegra234 GPCDMA Akhil R
2022-07-07 14:57 ` [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234 Akhil R
2022-07-07 14:57 ` [PATCH v2 2/3] dmaengine: tegra: Add terminate() " Akhil R
@ 2022-07-07 14:57 ` Akhil R
2 siblings, 0 replies; 7+ messages in thread
From: Akhil R @ 2022-07-07 14:57 UTC (permalink / raw)
To: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
p.zabel, thierry.reding, vkoul, robh+dt, devicetree
Cc: akhilrajeev
Use the compatible specific to Tegra234 for GPCDMA to support
additional features.
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
arch/arm64/boot/dts/nvidia/tegra234.dtsi | 5 +++--
1 file changed, 3 insertions(+), 2 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";
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
2022-07-07 14:57 ` [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234 Akhil R
@ 2022-07-08 14:35 ` Thierry Reding
2022-07-08 16:10 ` Akhil R
0 siblings, 1 reply; 7+ messages in thread
From: Thierry Reding @ 2022-07-08 14:35 UTC (permalink / raw)
To: Akhil R
Cc: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
p.zabel, vkoul, robh+dt, devicetree
[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]
On Thu, Jul 07, 2022 at 08:27:27PM +0530, Akhil R wrote:
> Document the compatible string used by GPCDMA controller for Tegra234.
>
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> index 9dd1476d1849..81f3badbc8ec 100644
> --- a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> +++ b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> @@ -23,6 +23,7 @@ properties:
> oneOf:
> - const: nvidia,tegra186-gpcdma
> - items:
> + - const: nvidia,tegra234-gpcdma
> - const: nvidia,tegra194-gpcdma
> - const: nvidia,tegra186-gpcdma
I don't think this works because it will now fail to validate Tegra194
device trees. You'll need to create a separate set of items for
Tegra234.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
2022-07-08 14:35 ` Thierry Reding
@ 2022-07-08 16:10 ` Akhil R
2022-07-08 17:48 ` Thierry Reding
0 siblings, 1 reply; 7+ messages in thread
From: Akhil R @ 2022-07-08 16:10 UTC (permalink / raw)
To: Thierry Reding
Cc: dmaengine@vger.kernel.org, Jonathan Hunter, Laxman Dewangan,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
p.zabel@pengutronix.de, vkoul@kernel.org, robh+dt@kernel.org,
devicetree@vger.kernel.org
> On Thu, Jul 07, 2022 at 08:27:27PM +0530, Akhil R wrote:
> > Document the compatible string used by GPCDMA controller for Tegra234.
> >
> > Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> > ---
> > .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> > b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> > index 9dd1476d1849..81f3badbc8ec 100644
> > ---
> > a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> > +++ b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.ya
> > +++ ml
> > @@ -23,6 +23,7 @@ properties:
> > oneOf:
> > - const: nvidia,tegra186-gpcdma
> > - items:
> > + - const: nvidia,tegra234-gpcdma
> > - const: nvidia,tegra194-gpcdma
> > - const: nvidia,tegra186-gpcdma
>
> I don't think this works because it will now fail to validate Tegra194 device trees.
> You'll need to create a separate set of items for Tegra234.
If I update it as below, would it work?
- items:
- const: nvidia,tegra234-gpcdma
- const: nvidia,tegra186-gpcdma
- items:
- const: nvidia,tegra194-gpcdma
- const: nvidia,tegra186-gpcdma
Regards,
Akhil
--
nvpublic
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
2022-07-08 16:10 ` Akhil R
@ 2022-07-08 17:48 ` Thierry Reding
0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2022-07-08 17:48 UTC (permalink / raw)
To: Akhil R
Cc: dmaengine@vger.kernel.org, Jonathan Hunter, Laxman Dewangan,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
p.zabel@pengutronix.de, vkoul@kernel.org, robh+dt@kernel.org,
devicetree@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1965 bytes --]
On Fri, Jul 08, 2022 at 04:10:47PM +0000, Akhil R wrote:
> > On Thu, Jul 07, 2022 at 08:27:27PM +0530, Akhil R wrote:
> > > Document the compatible string used by GPCDMA controller for Tegra234.
> > >
> > > Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> > > ---
> > > .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> > > b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> > > index 9dd1476d1849..81f3badbc8ec 100644
> > > ---
> > > a/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
> > > +++ b/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.ya
> > > +++ ml
> > > @@ -23,6 +23,7 @@ properties:
> > > oneOf:
> > > - const: nvidia,tegra186-gpcdma
> > > - items:
> > > + - const: nvidia,tegra234-gpcdma
> > > - const: nvidia,tegra194-gpcdma
> > > - const: nvidia,tegra186-gpcdma
> >
> > I don't think this works because it will now fail to validate Tegra194 device trees.
> > You'll need to create a separate set of items for Tegra234.
>
> If I update it as below, would it work?
>
> - items:
> - const: nvidia,tegra234-gpcdma
> - const: nvidia,tegra186-gpcdma
>
> - items:
> - const: nvidia,tegra194-gpcdma
> - const: nvidia,tegra186-gpcdma
Yeah, that should work. You can verify that this works by running the
dtbs_check target, although this can be somewhat overwhelming right now
given that there are quite a few errors/warnings, so it's easy to miss
new ones.
According to the DTS change that you posted as part of this series, the
Tegra234 compatible string list also includes the Tegra194 compatible
string, so that should either also be updated, or you need to include it
in the binding as well, like in your original patch.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-07-08 17:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-07 14:57 [PATCH v2 0/3] Add compatible for Tegra234 GPCDMA Akhil R
2022-07-07 14:57 ` [PATCH v2 1/3] dt-bindings: dmaengine: Add compatible for Tegra234 Akhil R
2022-07-08 14:35 ` Thierry Reding
2022-07-08 16:10 ` Akhil R
2022-07-08 17:48 ` Thierry Reding
2022-07-07 14:57 ` [PATCH v2 2/3] dmaengine: tegra: Add terminate() " Akhil R
2022-07-07 14:57 ` [PATCH v2 3/3] arm64: tegra: Update compatible for Tegra234 GPCDMA Akhil R
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).