Add support for Tegra210 ADMA
v5 cover Add support for Tegra210 ADMA
Add support for the Tegra210 Audio DMA (ADMA) controller which is part of the Audio Processing Engine and used for transferring audio data.
V5 changes:
- Removed APE and APE2APB clocks as these clocks rightfully belong in the ACONNECT bus driver [0] and the ADMA is child of this device. Dropped power-domain from DT binding as this will be handled by ACONNECT bus driver as well.
- Minor update to case statement formatting based upon feedback from Vinod.
- Make ADMA dependent on Tegra210 as this is the only device (currently) that supports it.
V4 changes:
- Updated DT binding to include 'power-domains' entry for handling the APE power domain inconjunction with runtime-pm.
- Added missing clocks to the DT binding that were being handled by the bootloader.
- Added support for PM_CLK to simplify clock handling
V3 changes:
- Updated DT binding per feedback from Mark and Stephen
- Fixed up items mentioned by Vinod
V2 changes:
- Re-worked device-tree binding
[0] http://marc.info/?l=devicetree&m=146193804830747&w=2
Jon Hunter (3):
Documentation: DT: Add binding documentation for NVIDIA ADMA
dmaengine: tegra-adma: Add support for Tegra210 ADMA
MAINTAINERS: Update Tegra DMA maintainers
.../bindings/dma/nvidia,tegra210-adma.txt | 57 ++ MAINTAINERS | 5 +- drivers/dma/Kconfig | 14 + drivers/dma/Makefile | 1 + drivers/dma/tegra210-adma.c | 853 +++++++++++++++++++++ 5 files changed, 928 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt create mode 100644 drivers/dma/tegra210-adma.c
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1461940758-25722-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH v5 1/3 Documentation: DT: Add binding documentation for NVIDIA ADMA
Add device-tree binding documentation for the Tegra210 Audio DMA controller.
--- .../bindings/dma/nvidia,tegra210-adma.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt
Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt new file +57 -0
@@ -0,0 +1,57 @@ +* NVIDIA Tegra Audio DMA (ADMA) controller + +The Tegra Audio DMA controller that is used for transferring data +between system memory and the Audio Processing Engine (APE). + +Required properties: +- compatible: Must be "nvidia,tegra210-adma". +- reg: Should contain DMA registers location and length. This should be + a single entry that includes all of the per-channel registers in one + contiguous bank. +- interrupt-parent: Phandle to the interrupt parent controller. +- interrupts: Should contain all of the per-channel DMA interrupts in + ascending order with respect to the DMA channel index. +- clocks: Must contain one entry for the ADMA module clock + (TEGRA210_CLK_D_AUDIO). +- clock-names: Must contain the name "d_audio" for the corresponding + 'clocks' entry. +- #dma-cells : Must be 1. The first cell denotes the receive/transmit + request number and should be between 1 and the maximum number of + requests supported. This value corresponds to the RX/TX_REQUEST_SELECT + fields in the ADMA_CHn_CTRL register. +- power-domains: Must contain a phandle that points to the audio + powergate (namely 'aud') for Tegra210. + + +Example: + +adma: dma@702e2000 { + compatible = "nvidia,tegra210-adma"; + reg = <0x0 0x702e2000 0x0 0x2000>; + interrupt-parent = <&tegra_agic>; + interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&tegra_car TEGRA210_CLK_D_AUDIO>; + clock-names = "d_audio"; + #dma-cells = <1>; +};
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1461940758-25722-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Rob Herring
Acked-byRe: [PATCH V5 1/3] Documentation: DT: Add binding documentation for NVIDIA ADMA
Quoted 8 lines · Jon Hunter
Add device-tree binding documentation for the Tegra210 Audio DMA controller.
Signed-off-by Jon Hunter <[email protected]>--- .../bindings/dma/nvidia,tegra210-adma.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt
PATCH v5 2/3 dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveAdd support for the Tegra210 Audio DMA controller that is used for transferring data between system memory and the Audio sub-system. The driver only supports cyclic transfers because this is being solely used for audio.
This driver is based upon the work by Dara Ramesh <[email protected]>.
--- drivers/dma/Kconfig | 14 + drivers/dma/Makefile | 1 + drivers/dma/tegra210-adma.c | 853 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 868 insertions(+) create mode 100644 drivers/dma/tegra210-adma.c
drivers/dma/Kconfig +14 -0
@@ -467,6 +467,20 @@ config TEGRA20_APB_DMA This DMA controller transfers data from memory to peripheral fifo or vice versa. It does not support memory to memory data transfer. +config TEGRA210_ADMA + bool "NVIDIA Tegra210 ADMA support" + depends on ARCH_TEGRA_210_SOC + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + select PM_CLK + help + Support for the NVIDIA Tegra210 ADMA controller driver. The + DMA controller has multiple DMA channels and is used to service + various audio clients in the Tegra210 audio processing engine + (APE). This DMA controller transfers data from memory to + peripheral and vice versa. It does not support memory to + memory data transfer. + config TIMB_DMA tristate "Timberdale FPGA DMA support" depends on MFD_TIMBERDALE
drivers/dma/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-$(CONFIG_STM32_DMA) += stm32-dma.o obj-$(CONFIG_S3C24XX_DMAC) += s3c24xx-dma.o obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o obj-$(CONFIG_TEGRA20_APB_DMA) += tegra20-apb-dma.o +obj-$(CONFIG_TEGRA210_ADMA) += tegra210-adma.o obj-$(CONFIG_TIMB_DMA) += timb_dma.o obj-$(CONFIG_TI_CPPI41) += cppi41.o obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o
drivers/dma/tegra210-adma.c new file +853 -0
853 lines not on this page · raw message
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1461940758-25722-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH V5 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
drivers/dma/tegra210-adma.c line 541
Quoted 11 lines · Jon Hunter
drivers/dma/tegra210-adma.c new file +11
-0+static struct dma_async_tx_descriptor *tegra_adma_prep_slave_sg ( +struct dma_chan *dc,struct scatterlist *sgl,unsigned int sg_len, +enum dma_transfer_direction direction,unsigned long flags, +void *context) +{ +struct tegra_adma_chan *tdc =to_tegra_adma_chan (dc); + +dev_warn (tdc2dev (tdc),"scatter-gather transfers are not supported\n" ); + +return NULL ; +}
we don't need a place holder, please remove this
drivers/dma/tegra210-adma.c line 592
Quoted 11 lines
drivers/dma/tegra210-adma.c new file +11
-0+static int tegra_adma_alloc_chan_resources (struct dma_chan *dc) +{ +struct tegra_adma_chan *tdc =to_tegra_adma_chan (dc); +int ret; + + ret =request_irq (tdc->irq, tegra_adma_isr,0 ,dma_chan_name (dc), tdc); +if (ret) { +dev_err (tdc2dev (tdc),"failed to get interrupt for %s\n" , +dma_chan_name (dc)); +return ret; + }
Okay why are we requesting and freeing up irq while allocating channels..? Btw since he usage is cyclic the sound core grabs the channel at start and never releases it
drivers/dma/tegra210-adma.c line 754
Quoted 3 lines
drivers/dma/tegra210-adma.c new file +3
-0+dma_cap_set (DMA_SLAVE , tdma->dma_dev.cap_mask); +dma_cap_set (DMA_PRIVATE , tdma->dma_dev.cap_mask); +dma_cap_set (DMA_CYCLIC , tdma->dma_dev.cap_mask);
You should set only cyclic, btw why do you support only one. Cyclic is actually a special case for SLAVE, so ideally you should support slave too...
Signature · 1 line
~Vinod
Re: [PATCH V5 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
Quoted 15 lines · Vinod Koul
drivers/dma/tegra210-adma.c line 541
Quoted 11 lines · Jon Hunter
drivers/dma/tegra210-adma.c new file +11
-0+static struct dma_async_tx_descriptor *tegra_adma_prep_slave_sg ( +struct dma_chan *dc,struct scatterlist *sgl,unsigned int sg_len, +enum dma_transfer_direction direction,unsigned long flags, +void *context) +{ +struct tegra_adma_chan *tdc =to_tegra_adma_chan (dc); + +dev_warn (tdc2dev (tdc),"scatter-gather transfers are not supported\n" ); + +return NULL ; +}we don't need a place holder, please remove this
OK. I will remove this now you have added commit 757d12e5849b ("dmaengine: ensure dmaengine helpers check valid callback").
Quoted 7 lines
Quoted 7 lines
drivers/dma/tegra210-adma.c new file +7
-0+static int tegra_adma_alloc_chan_resources (struct dma_chan *dc) +{ +struct tegra_adma_chan *tdc =to_tegra_adma_chan (dc); +int ret; + + ret =request_irq (tdc->irq, tegra_adma_isr,0 ,dma_chan_name (dc), tdc); +if (ret) {
Quoted 8 lines
drivers/dma/tegra210-adma.c line 592
Quoted 4 lines
drivers/dma/tegra210-adma.c new file +4
-0+dev_err (tdc2dev (tdc),"failed to get interrupt for %s\n" , +dma_chan_name (dc)); +return ret; + }Okay why are we requesting and freeing up irq while allocating channels..? Btw since he usage is cyclic the sound core grabs the channel at start and never releases it
The interrupt controller used by this DMA is a 2nd level interrupt controller in a different power-domain. I am currently in the process of adding support for this interrupt controller and it requires runtime power-management and in discussions with tglx the only way to allow the interrupt controller to idle is by releasing the interrupt. Hence, here we will acquire and release the interrupts as they are used. Please note that probing the DMA controller will be deferred until the interrupt controller is present because we still map the interrupt in the probe.
Quoted 7 lines
drivers/dma/tegra210-adma.c line 754
Quoted 3 lines
drivers/dma/tegra210-adma.c new file +3
-0+dma_cap_set (DMA_SLAVE , tdma->dma_dev.cap_mask); +dma_cap_set (DMA_PRIVATE , tdma->dma_dev.cap_mask); +dma_cap_set (DMA_CYCLIC , tdma->dma_dev.cap_mask);You should set only cyclic, btw why do you support only one. Cyclic is actually a special case for SLAVE, so ideally you should support slave too...
Only CYCLIC is supported for now because this DMA is only used for audio. There is another DMA for Tegra210 (the APB-DMA) which is a more general purpose DMA and should be used for all other DMA activity. Hence, I am not sure if it is best to keep the PRIVATE flag as I assume that means that not anyone can request a channel. We only should use this DMA for audio.
We discussed the setting of the DMA_SLAVE flag before [0] and I need to set DMA_SLAVE because I am using dma_get_any_slave_channel() in the xlate. May be you forgot? I know you would prefer we don't, but as I explained in this case (and as for other DMAs) this is the most appropriate API to use. We agreed in that discussion with Arnd Bergmann that this is ok.
I will drop the tegra_adma_prep_slave_sg() function. Please let me know if you are ok with the other items given my explanation and I will send a V6. I would like to get this merged for v4.7 if possible.
Cheers
Jon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH V5 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
Quoted 11 lines · Jon Hunter
Quoted 10 lines
drivers/dma/tegra210-adma.c line 592
Quoted 6 lines
drivers/dma/tegra210-adma.c new file +6
-0+ ret =request_irq (tdc->irq, tegra_adma_isr,0 ,dma_chan_name (dc), tdc); +if (ret) { +dev_err (tdc2dev (tdc),"failed to get interrupt for %s\n" , +dma_chan_name (dc)); +return ret; + }Okay why are we requesting and freeing up irq while allocating channels..? Btw since he usage is cyclic the sound core grabs the channel at start and never releases it
Quoted 8 lines
The interrupt controller used by this DMA is a 2nd level interrupt controller in a different power-domain. I am currently in the process of adding support for this interrupt controller and it requires runtime power-management and in discussions with tglx the only way to allow the interrupt controller to idle is by releasing the interrupt. Hence, here we will acquire and release the interrupts as they are used. Please note that probing the DMA controller will be deferred until the interrupt controller is present because we still map the interrupt in the probe.
Okay, lets keep it
Quoted 22 lines
Quoted 7 lines
drivers/dma/tegra210-adma.c line 754
Quoted 3 lines
drivers/dma/tegra210-adma.c new file +3
-0+dma_cap_set (DMA_SLAVE , tdma->dma_dev.cap_mask); +dma_cap_set (DMA_PRIVATE , tdma->dma_dev.cap_mask); +dma_cap_set (DMA_CYCLIC , tdma->dma_dev.cap_mask);You should set only cyclic, btw why do you support only one. Cyclic is actually a special case for SLAVE, so ideally you should support slave too...
Only CYCLIC is supported for now because this DMA is only used for audio. There is another DMA for Tegra210 (the APB-DMA) which is a more general purpose DMA and should be used for all other DMA activity. Hence, I am not sure if it is best to keep the PRIVATE flag as I assume that means that not anyone can request a channel. We only should use this DMA for audio.
We discussed the setting of the
DMA_SLAVEflag before [0] and I need to setDMA_SLAVEbecause I am usingdma_get_any_slave_channel()in the xlate. May be you forgot? I know you would prefer we don't, but as I explained in this case (and as for other DMAs) this is the most appropriate API to use. We agreed in that discussion with Arnd Bergmann that this is ok.
Quoted 3 lines
I will drop the
tegra_adma_prep_slave_sg()function. Please let me know if you are ok with the other items given my explanation and I will send a V6. I would like to get this merged for v4.7 if possible.
Sure, looks fine to me
Signature · 1 line
~Vinod
PATCH v5 3/3 MAINTAINERS: Update Tegra DMA maintainers
In reply to a message not in the archiveUpdate the Tegra DMA driver maintainer field to include the newly added Tegra210 ADMA and add Jon Hunter as a co-maintainer for Tegra DMA.
--- MAINTAINERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
MAINTAINERS +3 -2
@@ -11011,10 +11011,11 @@ M: Prashant Gaikwad <[email protected]> S: Supported F: drivers/clk/tegra/ -TEGRA DMA DRIVER +TEGRA DMA DRIVERS M: Laxman Dewangan <[email protected]> +M: Jon Hunter <[email protected]> S: Supported -F: drivers/dma/tegra20-apb-dma.c +F: drivers/dma/tegra* TEGRA I2C DRIVER M: Laxman Dewangan <[email protected]>
Signature · 1 line
2.1.4
Hi Vinod,
Let me know if you are ok to pick up this version?
Cheers
Jon
Quoted 43 lines · Jon Hunter
Add support for the Tegra210 Audio DMA (ADMA) controller which is part of the Audio Processing Engine and used for transferring audio data.
V5 changes:
- Removed APE and APE2APB clocks as these clocks rightfully belong in the ACONNECT bus driver [0] and the ADMA is child of this device. Dropped power-domain from DT binding as this will be handled by ACONNECT bus driver as well.
- Minor update to case statement formatting based upon feedback from Vinod.
- Make ADMA dependent on Tegra210 as this is the only device (currently) that supports it.V4 changes:
- Updated DT binding to include 'power-domains' entry for handling the APE power domain inconjunction with runtime-pm.
- Added missing clocks to the DT binding that were being handled by the bootloader.
- Added support forPM_CLKto simplify clock handlingV3 changes:
- Updated DT binding per feedback from Mark and Stephen
- Fixed up items mentioned by VinodV2 changes:
- Re-worked device-tree binding[0] http://marc.info/?l=devicetree&m=146193804830747&w=2
Jon Hunter (3):
Documentation: DT: Add binding documentation for NVIDIA ADMA
dmaengine: tegra-adma: Add support for Tegra210 ADMA
MAINTAINERS: Update Tegra DMA maintainers.../bindings/dma/nvidia,tegra210-adma.txt | 57 ++ MAINTAINERS | 5 +- drivers/dma/Kconfig | 14 + drivers/dma/Makefile | 1 + drivers/dma/tegra210-adma.c | 853 +++++++++++++++++++++ 5 files changed, 928 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt create mode 100644 drivers/dma/tegra210-adma.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Vinod,
Ping?
Jon
Quoted 56 lines · Jon Hunter
Hi Vinod,
Let me know if you are ok to pick up this version?
Cheers
JonQuoted 34 lines · Jon Hunter
Add support for the Tegra210 Audio DMA (ADMA) controller which is part of the Audio Processing Engine and used for transferring audio data.
V5 changes:
- Removed APE and APE2APB clocks as these clocks rightfully belong in the ACONNECT bus driver [0] and the ADMA is child of this device. Dropped power-domain from DT binding as this will be handled by ACONNECT bus driver as well.
- Minor update to case statement formatting based upon feedback from Vinod.
- Make ADMA dependent on Tegra210 as this is the only device (currently) that supports it.V4 changes:
- Updated DT binding to include 'power-domains' entry for handling the APE power domain inconjunction with runtime-pm.
- Added missing clocks to the DT binding that were being handled by the bootloader.
- Added support forPM_CLKto simplify clock handlingV3 changes:
- Updated DT binding per feedback from Mark and Stephen
- Fixed up items mentioned by VinodV2 changes:
- Re-worked device-tree binding[0] http://marc.info/?l=devicetree&m=146193804830747&w=2
Jon Hunter (3):
Documentation: DT: Add binding documentation for NVIDIA ADMA
dmaengine: tegra-adma: Add support for Tegra210 ADMA
MAINTAINERS: Update Tegra DMA maintainersQuoted 9 lines
.../bindings/dma/nvidia,tegra210-adma.txt | 57 ++ MAINTAINERS | 5 +- drivers/dma/Kconfig | 14 + drivers/dma/Makefile | 1 + drivers/dma/tegra210-adma.c | 853 +++++++++++++++++++++ 5 files changed, 928 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.txt create mode 100644 drivers/dma/tegra210-adma.c--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html