Add compatible for Tegra234 GPCDMA
v3 cover Add compatible for Tegra234 GPCDMA
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.
v2->v3:
* Updated binding docs and device tree compatible
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 | 4 +++ arch/arm64/boot/dts/nvidia/tegra234.dtsi | 4 +-- drivers/dma/tegra186-gpc-dma.c | 26 +++++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/3 dt-bindings: dmaengine: Add compatible for Tegra234
Document the compatible string used by GPCDMA controller for Tegra234.
--- .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +4 -0
@@ -26,6 +26,10 @@ properties: - const: nvidia,tegra194-gpcdma - const: nvidia,tegra186-gpcdma + - items: + - const: nvidia,tegra234-gpcdma + - const: nvidia,tegra186-gpcdma + "#dma-cells": const: 1
Signature · 1 line
2.17.1
Re: [PATCH v3 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
Quoted 12 lines · Akhil R
Document the compatible string used by GPCDMA controller for Tegra234.
Signed-off-by Akhil R <[email protected]>--- .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +0
-0
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml properties: · line 35
Quoted 10 lines
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +4
-0@@ -26,6 +26,10 @@ properties: - const: nvidia,tegra194-gpcdma - const: nvidia,tegra186-gpcdma + - items: + - const: nvidia,tegra234-gpcdma + - const: nvidia,tegra186-gpcdma + "#dma-cells": const: 1
Cheers
Jon
Signature · 1 line
nvpublic
Rob Herring
maintainerRe: [PATCH v3 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
In reply to Akhil RQuoted 12 lines · Akhil R
Document the compatible string used by GPCDMA controller for Tegra234.
Signed-off-by Akhil R <[email protected]>--- .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +0
-0
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml properties: · line 30
Quoted 5 lines
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +2
-0@@ -26,6 +26,10 @@ properties: - const: nvidia,tegra194-gpcdma - const: nvidia,tegra186-gpcdma + - items: + - const: nvidia,tegra234-gpcdma
This can be added to the above entry changing it from a const to enum.
Quoted 9 lines
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +2
-0+ - const: nvidia,tegra186-gpcdma + "#dma-cells": const: 1Signature · 1 line
2.17.1
RE: [PATCH v3 1/3] dt-bindings: dmaengine: Add compatible for Tegra234
Quoted 15 lines · Akhil R
Review
Quoted 8 lines
Document the compatible string used by GPCDMA controller for Tegra234.
Signed-off-by Akhil R <[email protected]>--- .../devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
dma.yamlb/Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yamlDocumentation/devicetree/bindings/dma/nvidia,tegra186-gpc-
Quoted 3 lines
index
9dd1476d1849..399edcd5cecf100644Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc- renamed from Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +0
-0
dma.yaml
Quoted 9 lines
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc- properties: · line 30
Quoted 6 lines
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc- renamed from Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml +2
-0@@ -26,6 +26,10 @@ properties: - const: nvidia,tegra194-gpcdma - const: nvidia,tegra186-gpcdma + - items: + - const: nvidia,tegra234-gpcdmaThis can be added to the above entry changing it from a const to enum.
So, it could look like this, correct?
compatible:
oneOf:
- const: nvidia,tegra186-gpcdma
- items:
- enum:
- nvidia,tegra234-gpcdma
- nvidia,tegra194-gpcdma
- const: nvidia,tegra186-gpcdma
Tried dt_binding_check and dtbs_check with this change and did not see any error.
Regards,
Akhil
--
nvpublic
PATCH v3 2/3 dmaengine: tegra: Add terminate() for Tegra234
In reply to Akhil RIn 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.
--- drivers/dma/tegra186-gpc-dma.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/dma/tegra186-gpc-dma.c +24 -2
@@ -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, }, { }, };
Signature · 1 line
2.17.1
Re: [PATCH v3 2/3] dmaengine: tegra: Add terminate() for Tegra234
Quoted 66 lines · Akhil R
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 ofdma_pause()so thatterminate_all()can proceed to disable the channel.Signed-off-by Akhil R <[email protected]>--- drivers/dma/tegra186-gpc-dma.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)drivers/dma/tegra186-gpc-dma.c +21
-2@@ -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" ,
drivers/dma/tegra186-gpc-dma.c static const struct of_device_id tegra_dma_of_match[] = { · line 1326
Quoted 9 lines
drivers/dma/tegra186-gpc-dma.c +3
-0@@ -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, }, { }, };
Cheers
Jon
Signature · 1 line
nvpublic
PATCH v3 3/3 arm64: tegra: Update compatible for Tegra234 GPCDMA
In reply to Akhil RUse the compatible specific to Tegra234 for GPCDMA to support additional features.
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2 -2
@@ -22,8 +22,8 @@ ranges = <0x0 0x0 0x0 0x40000000>; gpcdma: dma-controller@2600000 { - compatible = "nvidia,tegra194-gpcdma", - "nvidia,tegra186-gpcdma"; + compatible = "nvidia,tegra234-gpcdma", + "nvidia,tegra186-gpcdma"; reg = <0x2600000 0x210000>; resets = <&bpmp TEGRA234_RESET_GPCDMA>; reset-names = "gpcdma";
Signature · 1 line
2.17.1
Re: [PATCH v3 3/3] arm64: tegra: Update compatible for Tegra234 GPCDMA
Quoted 13 lines · Akhil R
Use the compatible specific to Tegra234 for GPCDMA to support additional features.
Signed-off-by Akhil R <[email protected]>--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm64/boot/dts/nvidia/tegra234.dtsi +0
-0
arch/arm64/boot/dts/nvidia/tegra234.dtsi line 29
Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2
-2@@ -22,8 +22,8 @@ ranges = <0x0 0x0 0x0 0x40000000>; gpcdma: dma-controller@2600000 { - compatible = "nvidia,tegra194-gpcdma", - "nvidia,tegra186-gpcdma"; + compatible = "nvidia,tegra234-gpcdma", + "nvidia,tegra186-gpcdma"; reg = <0x2600000 0x210000>; resets = <&bpmp TEGRA234_RESET_GPCDMA>; reset-names = "gpcdma";
Cheers
Jon
Signature · 1 line
nvpublic