Add NVIDIA Tegra GPC-DMA driver
v18 cover Add NVIDIA Tegra GPC-DMA driver
Add support for NVIDIA Tegra general purpose DMA driver for Tegra186 and Tegra194 platform.
v17 -> v18:
* Add get_residual() to get residual in tx_status()
* Added label for device tree node so that the phandle can be used in client devices using the dma.
Akhil R (4):
dt-bindings: dmaengine: Add doc for tegra gpcdma
dmaengine: tegra: Add tegra gpcdma driver
arm64: defconfig: tegra: Enable GPCDMA
arm64: tegra: Add GPCDMA node for tegra186 and tegra194
.../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 110 ++ arch/arm64/boot/dts/nvidia/tegra186.dtsi | 42 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 43 + arch/arm64/configs/defconfig | 1 + drivers/dma/Kconfig | 11 + drivers/dma/Makefile | 1 + drivers/dma/tegra186-gpc-dma.c | 1502 ++++++++++++++++++++ 7 files changed, 1710 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml create mode 100644 drivers/dma/tegra186-gpc-dma.c
Signature · 1 line
2.7.4
PATCH v18 1/4 dt-bindings: dmaengine: Add doc for tegra gpcdma
Add DT binding document for Nvidia Tegra GPCDMA controller.
--- .../bindings/dma/nvidia,tegra186-gpc-dma.yaml | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml
Documentation/devicetree/bindings/dma/nvidia,tegra186-gpc-dma.yaml new file +110 -0
@@ -0,0 +1,110 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/nvidia,tegra186-gpc-dma.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra GPC DMA Controller Device Tree Bindings + +description: | + The Tegra General Purpose Central (GPC) DMA controller is used for faster + data transfers between memory to memory, memory to device and device to + memory. + +maintainers: + - Jon Hunter <[email protected]> + - Rajesh Gumasta <[email protected]> + +allOf: + - $ref: "dma-controller.yaml#" + +properties: + compatible: + oneOf: + - const: nvidia,tegra186-gpcdma + - items: + - const: nvidia,tegra194-gpcdma + - const: nvidia,tegra186-gpcdma + + "#dma-cells": + const: 1 + + reg: + maxItems: 1 + + interrupts: + description: + Should contain all of the per-channel DMA interrupts in + ascending order with respect to the DMA channel index. + minItems: 1 + maxItems: 31 + + resets: + maxItems: 1 + + reset-names: + const: gpcdma + + iommus: + maxItems: 1 + + dma-coherent: true + +required: + - compatible + - reg + - interrupts + - resets + - reset-names + - "#dma-cells" + - iommus + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/memory/tegra186-mc.h> + #include <dt-bindings/reset/tegra186-reset.h> + + dma-controller@2600000 { + compatible = "nvidia,tegra186-gpcdma"; + reg = <0x2600000 0x210000>; + resets = <&bpmp TEGRA186_RESET_GPCDMA>; + reset-names = "gpcdma"; + interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; + #dma-cells = <1>; + iommus = <&smmu TEGRA186_SID_GPCDMA_0>; + dma-coherent; + }; +...
Signature · 1 line
2.7.4
PATCH v18 2/4 dmaengine: tegra: Add tegra gpcdma driver
In reply to Akhil RAdding GPC DMA controller driver for Tegra. The driver supports dma transfers between memory to memory, IO peripheral to memory and memory to IO peripheral.
--- drivers/dma/Kconfig | 11 + drivers/dma/Makefile | 1 + drivers/dma/tegra186-gpc-dma.c | 1502 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1514 insertions(+) create mode 100644 drivers/dma/tegra186-gpc-dma.c
drivers/dma/Kconfig +11 -0
@@ -629,6 +629,17 @@ config TXX9_DMAC Support the TXx9 SoC internal DMA controller. This can be integrated in chips such as the Toshiba TX4927/38/39. +config TEGRA186_GPC_DMA + tristate "NVIDIA Tegra GPC DMA support" + depends on ARCH_TEGRA || COMPILE_TEST + select DMA_ENGINE + help + Support for the NVIDIA Tegra General Purpose Central DMA controller. + The DMA controller has multiple DMA channels which can be configured + for different peripherals like UART, SPI, etc which are on APB bus. + This DMA controller transfers data from memory to peripheral FIFO + or vice versa. It also supports memory to memory data transfer. + config TEGRA20_APB_DMA tristate "NVIDIA Tegra20 APB DMA support" depends on ARCH_TEGRA || COMPILE_TEST
drivers/dma/Makefile +1 -0
@@ -72,6 +72,7 @@ obj-$(CONFIG_STM32_MDMA) += stm32-mdma.o obj-$(CONFIG_SPRD_DMA) += sprd-dma.o obj-$(CONFIG_S3C24XX_DMAC) += s3c24xx-dma.o obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o +obj-$(CONFIG_TEGRA186_GPC_DMA) += tegra186-gpc-dma.o obj-$(CONFIG_TEGRA20_APB_DMA) += tegra20-apb-dma.o obj-$(CONFIG_TEGRA210_ADMA) += tegra210-adma.o obj-$(CONFIG_TIMB_DMA) += timb_dma.o
drivers/dma/tegra186-gpc-dma.c new file +1502 -0
1,502 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
....
Quoted 23 lines
drivers/dma/tegra186-gpc-dma.c new file +23
-0+static int tegra_dma_pause (struct tegra_dma_channel *tdc) +{ +int ret; +u32 val; + + val =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSRE ); + val |=TEGRA_GPCDMA_CHAN_CSRE_PAUSE ; +tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSRE , val); + +/* Wait until busy bit is de-asserted */ + ret =readl_relaxed_poll_timeout_atomic (tdc->tdma->base_addr + + tdc->chan_base_offset +TEGRA_GPCDMA_CHAN_STATUS , + val, + !(val &TEGRA_GPCDMA_STATUS_BUSY ), +TEGRA_GPCDMA_BURST_COMPLETE_TIME , +TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT ); + +return ret; +} + +static int tegra_dma_device_pause (struct dma_chan *dc) +{ +struct tegra_dma_channel *tdc =to_tegra_dma_chan (dc);
drivers/dma/tegra186-gpc-dma.c line 401
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c new file +10
-0+unsigned long flags; +int ret =0 ; + +if (!tdc->tdma->chip_data->hw_support_pause) +return -ENOSYS ; + +spin_lock_irqsave (&tdc->vc.lock, flags); + ret =tegra_dma_pause (tdc); +if (ret) +dev_err (tdc2dev (tdc),"DMA pause timed out\n" );
Why error message shouldn't be printed by tegra_dma_terminate_all()?
The error message should be placed inside of tegra_dma_pause().
...
Quoted 41 lines
drivers/dma/tegra186-gpc-dma.c new file +41
-0+static int tegra_dma_stop_client (struct tegra_dma_channel *tdc) +{ +int ret; +unsigned long status; +u32 csr =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSR ); + +/* +* 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 +*/ + csr &= ~(TEGRA_GPCDMA_CSR_REQ_SEL_MASK ); + csr |=TEGRA_GPCDMA_CSR_REQ_SEL_UNUSED ; +tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , csr); + +/* 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 +*/ + + ret =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 ); +if (ret) { +dev_err (tdc2dev (tdc),"Timeout waiting for DMA burst completion!\n" ); +tegra_dma_dump_chan_regs (tdc); + } + +return ret; +} + +static int tegra_dma_terminate_all (struct dma_chan *dc) +{ +struct tegra_dma_channel *tdc =to_tegra_dma_chan (dc);
drivers/dma/tegra186-gpc-dma.c line 692
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c new file +10
-0+unsigned long flags; +LIST_HEAD (head); +int err; + +spin_lock_irqsave (&tdc->vc.lock, flags); + +if (tdc->dma_desc) { + err = tdc->tdma->chip_data->hw_support_pause ? +tegra_dma_pause (tdc) : +tegra_dma_stop_client (tdc);
The canonical coding style is:
if (tdc->tdma->chip_data->hw_support_pause)
err = tegra_dma_pause(tdc); else err = tegra_dma_stop_client(tdc);
But why do you need to pause at all here and can't use tegra_dma_stop_client() even if pause is supported?
RE: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
Quoted 37 lines
....
Quoted 23 lines
drivers/dma/tegra186-gpc-dma.c new file +23
-0+static int tegra_dma_pause (struct tegra_dma_channel *tdc) +{ +int ret; +u32 val; + + val =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSRE ); + val |=TEGRA_GPCDMA_CHAN_CSRE_PAUSE ; +tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSRE , val); + +/* Wait until busy bit is de-asserted */ + ret =readl_relaxed_poll_timeout_atomic (tdc->tdma->base_addr + + tdc->chan_base_offset +TEGRA_GPCDMA_CHAN_STATUS , + val, + !(val &TEGRA_GPCDMA_STATUS_BUSY ), +TEGRA_GPCDMA_BURST_COMPLETE_TIME , +TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT ); + +return ret; +} + +static int tegra_dma_device_pause (struct dma_chan *dc) +{ +struct tegra_dma_channel *tdc =to_tegra_dma_chan (dc);drivers/dma/tegra186-gpc-dma.c line 401
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c new file +10
-0+unsigned long flags; +int ret =0 ; + +if (!tdc->tdma->chip_data->hw_support_pause) +return -ENOSYS ; + +spin_lock_irqsave (&tdc->vc.lock, flags); + ret =tegra_dma_pause (tdc); +if (ret) +dev_err (tdc2dev (tdc),"DMA pause timed out\n" );Why error message shouldn't be printed by
tegra_dma_terminate_all()?
Quoted 1 line
The error message should be placed inside of
tegra_dma_pause().
Okay. Agreed.
Quoted 57 lines
...
Quoted 22 lines
drivers/dma/tegra186-gpc-dma.c new file +22
-0+static int tegra_dma_stop_client (struct tegra_dma_channel *tdc) +{ +int ret; +unsigned long status; +u32 csr =tdc_read (tdc,TEGRA_GPCDMA_CHAN_CSR ); + +/* +* 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 +*/ + csr &= ~(TEGRA_GPCDMA_CSR_REQ_SEL_MASK ); + csr |=TEGRA_GPCDMA_CSR_REQ_SEL_UNUSED ; +tdc_write (tdc,TEGRA_GPCDMA_CHAN_CSR , csr); + +/* 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 +*/ +drivers/dma/tegra186-gpc-dma.c
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c new file +10
-0+ ret =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 ); +if (ret) { + dev_err(tdc2dev(tdc), "Timeout waiting for DMA burstcompletion!\n");
Quoted 9 lines
drivers/dma/tegra186-gpc-dma.c new file +9
-0+tegra_dma_dump_chan_regs (tdc); + } + +return ret; +} + +static int tegra_dma_terminate_all (struct dma_chan *dc) +{ +struct tegra_dma_channel *tdc =to_tegra_dma_chan (dc);drivers/dma/tegra186-gpc-dma.c line 692
Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c new file +10
-0+unsigned long flags; +LIST_HEAD (head); +int err; + +spin_lock_irqsave (&tdc->vc.lock, flags); + +if (tdc->dma_desc) { + err = tdc->tdma->chip_data->hw_support_pause ? +tegra_dma_pause (tdc) : +tegra_dma_stop_client (tdc);The canonical coding style is:
Quoted 5 lines
if (
tdc->tdma->chip_data->hw_support_pause)err = tegra_dma_pause(tdc); else err = tegra_dma_stop_client(tdc);
Okay.
Quoted 3 lines
But why do you need to pause at all here and can't use
tegra_dma_stop_client()even if pause is supported?
The recommended method to terminate a transfer in between is to pause the channel first and then disable it. This is more graceful and stable for the hardware. stop_client() is more abrupt, though it does the job.
Thanks,
Akhil
Re: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
03.02.2022 06:44, Akhil R пишет:
Quoted 6 lines
Quoted 2 lines
But why do you need to pause at all here and can't use
tegra_dma_stop_client()even if pause is supported?The recommended method to terminate a transfer in between is to pause the channel first and then disable it. This is more graceful and stable for the hardware.
stop_client()is more abrupt, though it does the job.
If there is no real practical difference, then I'd use the common method only. This will make code cleaner and simpler a tad.
RE: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
Quoted 10 lines
03.02.2022 06:44, Akhil R пишет:
Quoted 6 lines
Quoted 2 lines
But why do you need to pause at all here and can't use
tegra_dma_stop_client()even if pause is supported?The recommended method to terminate a transfer in between is to pause the channel first and then disable it. This is more graceful and stable for the hardware.
stop_client()is more abrupt, though it does the job.If there is no real practical difference, then I'd use the common method only. This will make code cleaner and simpler a tad.
This is the documented way of clean exit from a transfer, especially for cyclic transfers where the DMA is configured in continuous mode. I guess it might not be a good idea to deviate from that unless there is something demanding it compulsorily.
I agree that the code will be cleaner. I would try to see if I can find a cleaner way to do this. Please do let me know if you have any suggestion.
Thanks,
Akhil
Re: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
04.02.2022 09:47, Akhil R пишет:
Quoted 10 lines
Quoted 10 lines
03.02.2022 06:44, Akhil R пишет:
Quoted 6 lines
Quoted 2 lines
But why do you need to pause at all here and can't use
tegra_dma_stop_client()even if pause is supported?The recommended method to terminate a transfer in between is to pause the channel first and then disable it. This is more graceful and stable for the hardware.
stop_client()is more abrupt, though it does the job.If there is no real practical difference, then I'd use the common method only. This will make code cleaner and simpler a tad.
Quoted 7 lines
This is the documented way of clean exit from a transfer, especially for cyclic transfers where the DMA is configured in continuous mode. I guess it might not be a good idea to deviate from that unless there is something demanding it compulsorily.
I agree that the code will be cleaner. I would try to see if I can find a cleaner way to do this. Please do let me know if you have any suggestion.
Will be great if you could find out and provide a detailed explanation about the exact differences of the methods from software perspective. Try to ask the hardware people.
If you won't be able to find out, then use both methods. Then you could specify the "pause" callback within the tegra_dma_chip_data [tdma->chip_data->pause(tdma)], instead of using condition in the code.
Re: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
04.02.2022 15:15, Dmitry Osipenko пишет:
Quoted 19 lines
04.02.2022 09:47, Akhil R пишет:
Quoted 10 lines
Quoted 10 lines
03.02.2022 06:44, Akhil R пишет:
Quoted 6 lines
Quoted 2 lines
But why do you need to pause at all here and can't use
tegra_dma_stop_client()even if pause is supported?The recommended method to terminate a transfer in between is to pause the channel first and then disable it. This is more graceful and stable for the hardware.
stop_client()is more abrupt, though it does the job.If there is no real practical difference, then I'd use the common method only. This will make code cleaner and simpler a tad.
Quoted 7 lines
This is the documented way of clean exit from a transfer, especially for cyclic transfers where the DMA is configured in continuous mode. I guess it might not be a good idea to deviate from that unless there is something demanding it compulsorily.
I agree that the code will be cleaner. I would try to see if I can find a cleaner way to do this. Please do let me know if you have any suggestion.
Quoted 7 lines
Will be great if you could find out and provide a detailed explanation about the exact differences of the methods from software perspective. Try to ask the hardware people.
If you won't be able to find out, then use both methods. Then you could specify the "pause" callback within the
tegra_dma_chip_data[tdma->chip_data->pause(tdma)], instead of using condition in the code.
s/pause/terminate/
kernel test robot
build botRe: [PATCH v18 2/4] dmaengine: tegra: Add tegra gpcdma driver
In reply to Akhil RThank you for the patch! Perhaps something to improve:
Hi Akhil,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on robh/for-next arm64/for-next/core v5.17-rc2 next-20220202] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Akhil-R/Add-NVIDIA-Tegra-GPC-DMA-driver/20220201-232959 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next config: nds32-allyesconfig (https://download.01.org/0day-ci/archive/20220203/202202030717.azJOwFpH-lkp(a)intel.com/config) compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/fb896830918f8dc1c138094bb4c5cc5e19d149c9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Akhil-R/Add-NVIDIA-Tegra-GPC-DMA-driver/20220201-232959
git checkout fb896830918f8dc1c138094bb4c5cc5e19d149c9
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash drivers/dma/ drivers/iommu/ drivers/mfd/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from <command-line>:
drivers/dma/tegra186-gpc-dma.c: In function 'tegra_dma_prep_dma_memset':
>> drivers/dma/tegra186-gpc-dma.c:896:74: warning: right shift count >= width of type [-Wshift-count-overflow]
896 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
include/linux/compiler_types.h:315:23: note: in definition of macro '__compiletime_assert'
315 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert'
335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:896:25: note: in expansion of macro 'FIELD_PREP'
896 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~~~~~~~~~
>> drivers/dma/tegra186-gpc-dma.c:896:74: warning: right shift count >= width of type [-Wshift-count-overflow]
896 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
include/linux/compiler_types.h:315:23: note: in definition of macro '__compiletime_assert'
315 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert'
335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:896:25: note: in expansion of macro 'FIELD_PREP'
896 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~~~~~~~~~
In file included from drivers/dma/tegra186-gpc-dma.c:8:
>> drivers/dma/tegra186-gpc-dma.c:896:74: warning: right shift count >= width of type [-Wshift-count-overflow]
896 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
include/linux/bitfield.h:95:34: note: in definition of macro 'FIELD_PREP'
95 | ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
| ^~~~
In file included from <command-line>:
drivers/dma/tegra186-gpc-dma.c: In function 'tegra_dma_prep_dma_memcpy':
drivers/dma/tegra186-gpc-dma.c:964:65: warning: right shift count >= width of type [-Wshift-count-overflow]
964 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (src >> 32));
| ^~
include/linux/compiler_types.h:315:23: note: in definition of macro '__compiletime_assert'
315 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert'
335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:964:17: note: in expansion of macro 'FIELD_PREP'
964 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (src >> 32));
| ^~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:964:65: warning: right shift count >= width of type [-Wshift-count-overflow]
964 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (src >> 32));
| ^~
include/linux/compiler_types.h:315:23: note: in definition of macro '__compiletime_assert'
315 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert'
335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:964:17: note: in expansion of macro 'FIELD_PREP'
964 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (src >> 32));
| ^~~~~~~~~~
In file included from drivers/dma/tegra186-gpc-dma.c:8:
drivers/dma/tegra186-gpc-dma.c:964:65: warning: right shift count >= width of type [-Wshift-count-overflow]
964 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_SRC_PTR, (src >> 32));
| ^~
include/linux/bitfield.h:95:34: note: in definition of macro 'FIELD_PREP'
95 | ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
| ^~~~
In file included from <command-line>:
drivers/dma/tegra186-gpc-dma.c:966:66: warning: right shift count >= width of type [-Wshift-count-overflow]
966 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
include/linux/compiler_types.h:315:23: note: in definition of macro '__compiletime_assert'
315 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert'
335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:966:17: note: in expansion of macro 'FIELD_PREP'
966 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:966:66: warning: right shift count >= width of type [-Wshift-count-overflow]
966 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~
include/linux/compiler_types.h:315:23: note: in definition of macro '__compiletime_assert'
315 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:335:9: note: in expansion of macro '_compiletime_assert'
335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/tegra186-gpc-dma.c:966:17: note: in expansion of macro 'FIELD_PREP'
966 | FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
| ^~~~~~~~~~ In file included from drivers/dma/tegra186-gpc-dma.c:8:
vim +896 drivers/dma/tegra186-gpc-dma.c
841
842 static struct dma_async_tx_descriptor *
843 tegra_dma_prep_dma_memset(struct dma_chan *dc, dma_addr_t dest, int value,
844 size_t len, unsigned long flags)
845 {
846 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
847 unsigned int max_dma_count = tdc->tdma->chip_data->max_dma_count;
848 struct tegra_dma_sg_req *sg_req;
849 struct tegra_dma_desc *dma_desc;
850 unsigned long csr, mc_seq;
851
852 if ((len & 3) || (dest & 3) || len > max_dma_count) {
853 dev_err(tdc2dev(tdc),
854 "DMA length/memory address is not supported\n");
855 return NULL;
856 }
857
858 /* Set dma mode to fixed pattern */
859 csr = TEGRA_GPCDMA_CSR_DMA_FIXED_PAT;
860 /* Enable once or continuous mode */
861 csr |= TEGRA_GPCDMA_CSR_ONCE;
862 /* Enable IRQ mask */
863 csr |= TEGRA_GPCDMA_CSR_IRQ_MASK;
864 /* Enable the dma interrupt */
865 if (flags & DMA_PREP_INTERRUPT)
866 csr |= TEGRA_GPCDMA_CSR_IE_EOC;
867 /* Configure default priority weight for the channel */
868 csr |= FIELD_PREP(TEGRA_GPCDMA_CSR_WEIGHT, 1);
869
870 mc_seq = tdc_read(tdc, TEGRA_GPCDMA_CHAN_MCSEQ);
871 /* retain stream-id and clean rest */
872 mc_seq &= TEGRA_GPCDMA_MCSEQ_STREAM_ID0_MASK;
873
874 /* Set the address wrapping */
875 mc_seq |= FIELD_PREP(TEGRA_GPCDMA_MCSEQ_WRAP0,
876 TEGRA_GPCDMA_MCSEQ_WRAP_NONE);
877 mc_seq |= FIELD_PREP(TEGRA_GPCDMA_MCSEQ_WRAP1,
878 TEGRA_GPCDMA_MCSEQ_WRAP_NONE);
879
880 /* Program outstanding MC requests */
881 mc_seq |= FIELD_PREP(TEGRA_GPCDMA_MCSEQ_REQ_COUNT, 1);
882 /* Set burst size */
883 mc_seq |= TEGRA_GPCDMA_MCSEQ_BURST_16;
884
885 dma_desc = kzalloc(struct_size(dma_desc, sg_req, 1), GFP_NOWAIT);
886 if (!dma_desc)
887 return NULL;
888
889 dma_desc->bytes_req = len;
890 dma_desc->sg_count = 1;
891 sg_req = dma_desc->sg_req;
892
893 sg_req[0].ch_regs.src_ptr = 0;
894 sg_req[0].ch_regs.dst_ptr = dest;
895 sg_req[0].ch_regs.high_addr_ptr =
> 896 FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >> 32));
897 sg_req[0].ch_regs.fixed_pattern = value;
898 /* Word count reg takes value as (N +1) words */
899 sg_req[0].ch_regs.wcount = ((len - 4) >> 2);
900 sg_req[0].ch_regs.csr = csr;
901 sg_req[0].ch_regs.mmio_seq = 0;
902 sg_req[0].ch_regs.mc_seq = mc_seq;
903 sg_req[0].len = len;
904
905 dma_desc->cyclic = false;
906 return vchan_tx_prep(&tdc->vc, &dma_desc->vd, flags);
907 }
908
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v18 3/4 arm64: defconfig: tegra: Enable GPCDMA
In reply to Akhil REnable TEGRA_GPC_DMA in defconfig for Tegra186 and Tegra196 gpc dma controller driver
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -956,6 +956,7 @@ CONFIG_MV_XOR=y CONFIG_MV_XOR_V2=y CONFIG_OWL_DMA=y CONFIG_PL330_DMA=y +CONFIG_TEGRA186_GPC_DMA=m CONFIG_TEGRA20_APB_DMA=y CONFIG_TEGRA210_ADMA=m CONFIG_QCOM_BAM_DMA=y
Signature · 1 line
2.7.4
PATCH v18 4/4 arm64: tegra: Add GPCDMA node for tegra186 and tegra194
In reply to Akhil RAdd device tree node for GPCDMA controller on Tegra186 target and Tegra194 target.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 42 +++++++++++++++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 43 ++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +42 -0
@@ -73,6 +73,48 @@ snps,rxpbl = <8>; }; + gpcdma: dma-controller@2600000 { + compatible = "nvidia,tegra186-gpcdma"; + reg = <0x0 0x2600000 0x0 0x210000>; + resets = <&bpmp TEGRA186_RESET_GPCDMA>; + reset-names = "gpcdma"; + interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; + #dma-cells = <1>; + iommus = <&smmu TEGRA186_SID_GPCDMA_0>; + dma-coherent; + status = "okay"; + }; + aconnect@2900000 { compatible = "nvidia,tegra186-aconnect", "nvidia,tegra210-aconnect";
arch/arm64/boot/dts/nvidia/tegra194.dtsi +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.7.4