Add support for Tegra210 ADMA
v4 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.
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
Jon Hunter (3):
Documentation: DT: Add binding documentation for NVIDIA ADMA
dmaengine: tegra-adma: Add support for Tegra210 ADMA
MAINTAINERS: Update Tegra DMA maintainers
.../devicetree/bindings/dma/tegra210-adma.txt | 61 ++ MAINTAINERS | 5 +- drivers/dma/Kconfig | 14 + drivers/dma/Makefile | 1 + drivers/dma/tegra210-adma.c | 869 +++++++++++++++++++++ 5 files changed, 948 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/tegra210-adma.txt create mode 100644 drivers/dma/tegra210-adma.c
Signature · 1 line
2.1.4
PATCH v4 1/3 Documentation: DT: Add binding documentation for NVIDIA ADMA
In reply to a message not in the archiveAdd device-tree binding documentation for the Tegra210 Audio DMA controller.
--- .../devicetree/bindings/dma/tegra210-adma.txt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/tegra210-adma.txt
Documentation/devicetree/bindings/dma/tegra210-adma.txt new file +61 -0
@@ -0,0 +1,61 @@ +* 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 the entries for the APE clock (TEGRA210_CLK_APE), + APE interface clock (TEGRA210_CLK_APB2APE) and ADMA module clock + (TEGRA210_CLK_D_AUDIO). +- clock-names: Must contain the names "ape", "apb2ape" and "d_audio" + for the corresponding 'clocks' entries. +- #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_APE>, + <&tegra_car TEGRA210_CLK_APB2APE>, + <&tegra_car TEGRA210_CLK_D_AUDIO>; + clock-names = "ape", "apb2ape", "d_audio"; + power-domains = <&pd_audio>; + #dma-cells = <1>; +};
Signature · 1 line
2.1.4
PATCH v4 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 | 869 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 884 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 + 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 +869 -0
869 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v4 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
@@ -10881,10 +10881,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
Rob Herring
Acked-byRe: [PATCH V4 1/3] Documentation: DT: Add binding documentation for NVIDIA ADMA
In reply to a message not in the archiveQuoted 8 lines · Jon Hunter
Add device-tree binding documentation for the Tegra210 Audio DMA controller.
Signed-off-by Jon Hunter <[email protected]>--- .../devicetree/bindings/dma/tegra210-adma.txt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/tegra210-adma.txt
Hi Vinod,
Let me know if you have any comments on this.
Cheers
Jon
Quoted 31 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.
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 bindingJon Hunter (3):
Documentation: DT: Add binding documentation for NVIDIA ADMA
dmaengine: tegra-adma: Add support for Tegra210 ADMA
MAINTAINERS: Update Tegra DMA maintainers.../devicetree/bindings/dma/tegra210-adma.txt | 61 ++ MAINTAINERS | 5 +- drivers/dma/Kconfig | 14 + drivers/dma/Makefile | 1 + drivers/dma/tegra210-adma.c | 869 +++++++++++++++++++++ 5 files changed, 948 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/tegra210-adma.txt create mode 100644 drivers/dma/tegra210-adma.c
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archivedrivers/dma/tegra210-adma.c line 286
Quoted 11 lines · Jon Hunter
drivers/dma/tegra210-adma.c new file +11
-0+static void tegra_adma_request_free (struct tegra_adma_chan *tdc) +{ +struct tegra_adma *tdma = tdc->tdma; + +if (!tdc->sreq_reserved) +return ; + +switch (tdc->sreq_dir) { +case DMA_MEM_TO_DEV : +clear_bit (tdc->sreq_index, &tdma->tx_requests_reserved); +break ;
empty line here woould be nicer
drivers/dma/tegra210-adma.c line 468
Quoted 10 lines
drivers/dma/tegra210-adma.c new file +10
-0+ ret =dma_cookie_status (dc, cookie, txstate); +if (ret ==DMA_COMPLETE || !txstate) +return ret; + +spin_lock_irqsave (&tdc->vc.lock, flags); + + vd =vchan_find_desc (&tdc->vc, cookie); +if (vd) { + desc =to_tegra_adma_desc (&vd->tx); + residual = desc->ch_regs.tc;
Here we are filling up residue for desc found in issued list
drivers/dma/tegra210-adma.c line 470
Quoted 2 lines
drivers/dma/tegra210-adma.c new file +2
-0+ }else if (tdc->desc && tdc->desc->vd.tx.cookie == cookie) { + residual =tegra_adma_get_residue (tdc);
Well if it is not issued then why we we need to caluclate, its full size of descriptor
drivers/dma/tegra210-adma.c line 472
Quoted 2 lines
drivers/dma/tegra210-adma.c new file +2
-0+ }else { + residual =0 ;
why this?
drivers/dma/tegra210-adma.c line 539
Quoted 11 lines
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 ; +}
Why do we need this placeholder, If you dont support slave_sg dont add this as capability
drivers/dma/tegra210-adma.c line 688
Quoted 3 lines
drivers/dma/tegra210-adma.c new file +3
-0+static const struct tegra_adma_chip_data tegra210_chip_data = { + .nr_channels =22 , +};
why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
drivers/dma/tegra210-adma.c line 770
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);
I think you should not set DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?
Signature · 1 line
~Vinod
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveQuoted 15 lines · Vinod Koul
drivers/dma/tegra210-adma.c line 286
Quoted 11 lines · Jon Hunter
drivers/dma/tegra210-adma.c new file +11
-0+static void tegra_adma_request_free (struct tegra_adma_chan *tdc) +{ +struct tegra_adma *tdma = tdc->tdma; + +if (!tdc->sreq_reserved) +return ; + +switch (tdc->sreq_dir) { +case DMA_MEM_TO_DEV : +clear_bit (tdc->sreq_index, &tdma->tx_requests_reserved); +break ;empty line here woould be nicer
OK.
Quoted 13 lines
drivers/dma/tegra210-adma.c line 468
Quoted 10 lines
drivers/dma/tegra210-adma.c new file +10
-0+ ret =dma_cookie_status (dc, cookie, txstate); +if (ret ==DMA_COMPLETE || !txstate) +return ret; + +spin_lock_irqsave (&tdc->vc.lock, flags); + + vd =vchan_find_desc (&tdc->vc, cookie); +if (vd) { + desc =to_tegra_adma_desc (&vd->tx); + residual = desc->ch_regs.tc;Here we are filling up residue for desc found in issued list
Quoted 5 lines
drivers/dma/tegra210-adma.c line 470
Quoted 2 lines
drivers/dma/tegra210-adma.c new file +2
-0+ }else if (tdc->desc && tdc->desc->vd.tx.cookie == cookie) { + residual =tegra_adma_get_residue (tdc);Well if it is not issued then why we we need to caluclate, its full size of descriptor
This is the current/active descriptor which has been removed from the issued list and so it needs to be calculated.
Quoted 4 lines
drivers/dma/tegra210-adma.c line 472
Quoted 2 lines
drivers/dma/tegra210-adma.c new file +2
-0+ }else { + residual =0 ;why this?
So either the descriptor is still in the submitted list or it has completed but it has not been marked complete yet. In both cases, we don't have access to the descriptor and so the residue is marked as 0 and we return the current status. Please note this is based upon the omap dma driver (drivers/dma/omap-dma.c) which does the same. Other dma driver do very similar things here as well.
Quoted 6 lines
Quoted 6 lines
drivers/dma/tegra210-adma.c new file +6
-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);
Quoted 8 lines
drivers/dma/tegra210-adma.c line 539
Quoted 5 lines
drivers/dma/tegra210-adma.c new file +5
-0+ +dev_warn (tdc2dev (tdc),"scatter-gather transfers are not supported\n" ); + +return NULL ; +}Why do we need this placeholder, If you dont support
slave_sgdont add this as capability
So, AFAICT, dma_async_device_register() does not check to see if device_prep_slave_sg() is valid AND none of the functions dmaengine_prep_slave_single(), dmaengine_prep_slave_single() and dmaengine_prep_rio_sg() check to see if the function pointer is valid before calling chan->device->device_prep_slave_sg(). So it seems that we always expect this function pointer to be valid.
So should the inline functions ensure the function pointer is valid before attempting to call them? If so I can add a patch for this. Otherwise it seems the driver needs a stub. It would be a massive change to add a new capability, say SLAVE_SG, and populate this for all existing drivers.
Quoted 6 lines
drivers/dma/tegra210-adma.c line 688
Quoted 3 lines
drivers/dma/tegra210-adma.c new file +3
-0+static const struct tegra_adma_chip_data tegra210_chip_data = { + .nr_channels =22 , +};why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see driver/dma/tegra20-apb-dma.c) [0].
Quoted 8 lines
drivers/dma/tegra210-adma.c line 770
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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?
Why should I not be setting DMA_SLAVE? Should I not be calling dma_get_any_slave_channel() in the xlate?
I think that I do want to set DMA_CYCLIC as well to ensure that we check that the device->device_prep_dma_cyclic() function pointer is populated when registering the DMA controller.
Cheers
Jon
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveQuoted 47 lines · Jon Hunter
Quoted 15 lines · Vinod Koul
drivers/dma/tegra210-adma.c line 286
Quoted 11 lines · Jon Hunter
drivers/dma/tegra210-adma.c new file +11
-0+static void tegra_adma_request_free (struct tegra_adma_chan *tdc) +{ +struct tegra_adma *tdma = tdc->tdma; + +if (!tdc->sreq_reserved) +return ; + +switch (tdc->sreq_dir) { +case DMA_MEM_TO_DEV : +clear_bit (tdc->sreq_index, &tdma->tx_requests_reserved); +break ;empty line here woould be nicer
OK.
Quoted 13 lines
drivers/dma/tegra210-adma.c line 468
Quoted 10 lines
drivers/dma/tegra210-adma.c new file +10
-0+ ret =dma_cookie_status (dc, cookie, txstate); +if (ret ==DMA_COMPLETE || !txstate) +return ret; + +spin_lock_irqsave (&tdc->vc.lock, flags); + + vd =vchan_find_desc (&tdc->vc, cookie); +if (vd) { + desc =to_tegra_adma_desc (&vd->tx); + residual = desc->ch_regs.tc;Here we are filling up residue for desc found in issued list
Quoted 5 lines
drivers/dma/tegra210-adma.c line 470
Quoted 2 lines
drivers/dma/tegra210-adma.c new file +2
-0+ }else if (tdc->desc && tdc->desc->vd.tx.cookie == cookie) { + residual =tegra_adma_get_residue (tdc);Well if it is not issued then why we we need to caluclate, its full size of descriptor
This is the current/active descriptor which has been removed from the issued list and so it needs to be calculated.
Quoted 4 lines
drivers/dma/tegra210-adma.c line 472
Quoted 2 lines
drivers/dma/tegra210-adma.c new file +2
-0+ }else { + residual =0 ;why this?
Quoted 6 lines
So either the descriptor is still in the submitted list or it has completed but it has not been marked complete yet. In both cases, we don't have access to the descriptor and so the residue is marked as 0 and we return the current status. Please note this is based upon the omap dma driver (
drivers/dma/omap-dma.c) which does the same. Other dma driver do very similar things here as well.
Yes that's right, wanted to esnure people do understand this :)
Quoted 23 lines
Quoted 15 lines
drivers/dma/tegra210-adma.c line 539
Quoted 12 lines
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 ; +}Why do we need this placeholder, If you dont support
slave_sgdont add this as capabilitySo, AFAICT,
dma_async_device_register()does not check to see ifdevice_prep_slave_sg()is valid AND none of the functionsdmaengine_prep_slave_single(),dmaengine_prep_slave_single()anddmaengine_prep_rio_sg()check to see if the function pointer is valid before callingchan->device->device_prep_slave_sg(). So it seems that we always expect this function pointer to be valid.
Quoted 5 lines
So should the inline functions ensure the function pointer is valid before attempting to call them? If so I can add a patch for this. Otherwise it seems the driver needs a stub. It would be a massive change to add a new capability, say
SLAVE_SG, and populate this for all existing drivers.
No we should check here, it's indeed a miss, not sure why none complained about this. I was assuming this is due to caps not considering cyclic case, so I fixed that up.
I will fix these cases too, thanks for reporting
Quoted 10 lines
Quoted 6 lines
drivers/dma/tegra210-adma.c line 688
Quoted 3 lines
drivers/dma/tegra210-adma.c new file +3
-0+static const struct tegra_adma_chip_data tegra210_chip_data = { + .nr_channels =22 , +};why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].
But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?
Quoted 10 lines
Quoted 9 lines
drivers/dma/tegra210-adma.c line 770
Quoted 4 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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?
Quoted 6 lines
Why should I not be setting
DMA_SLAVE? Should I not be callingdma_get_any_slave_channel()in the xlate?I think that I do want to set
DMA_CYCLICas well to ensure that we check that thedevice->device_prep_dma_cyclic()function pointer is populated when registering the DMA controller.
Only setting DMA_CYCLIC should do, if you see any issues around that please get back, we cna fix those :)
Signature · 1 line
~Vinod
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
Quoted 3 lines · Vinod Koul
Quoted 2 lines · Jon Hunter
Quoted 1 line · Vinod Koul
On Tue, Mar 15, 2016 at 03:56:29PM +0000, Jon Hunter wrote:
[snip]
Quoted 13 lines
Quoted 7 lines
So, AFAICT,
dma_async_device_register()does not check to see ifdevice_prep_slave_sg()is valid AND none of the functionsdmaengine_prep_slave_single(),dmaengine_prep_slave_single()anddmaengine_prep_rio_sg()check to see if the function pointer is valid before callingchan->device->device_prep_slave_sg(). So it seems that we always expect this function pointer to be valid.Quoted 5 lines
So should the inline functions ensure the function pointer is valid before attempting to call them? If so I can add a patch for this. Otherwise it seems the driver needs a stub. It would be a massive change to add a new capability, say
SLAVE_SG, and populate this for all existing drivers.
Quoted 5 lines
No we should check here, it's indeed a miss, not sure why none complained about this. I was assuming this is due to caps not considering cyclic case, so I fixed that up.
I will fix these cases too, thanks for reporting
Ok, great.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+static const struct tegra_adma_chip_data tegra210_chip_data = { + .nr_channels = 22, +};why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Quoted 7 lines
Quoted 3 lines
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?
Same way we solve this for the tegra20-apb-dma driver by having different chip data per SoC in the driver ...
1259 /* Tegra20 specific DMA controller information */
1260 static const struct tegra_dma_chip_data tegra20_dma_chip_data = {
1261 .nr_channels = 16, 1262 .channel_reg_size = 0x20, 1263 .max_dma_count = 1024UL * 64, 1264 .support_channel_pause = false, 1265 .support_separate_wcount_reg = false,
1266 };
1267
1268 /* Tegra30 specific DMA controller information */
1269 static const struct tegra_dma_chip_data tegra30_dma_chip_data = {
1270 .nr_channels = 32, 1271 .channel_reg_size = 0x20, 1272 .max_dma_count = 1024UL * 64, 1273 .support_channel_pause = false, 1274 .support_separate_wcount_reg = false,
1275 };
1276
1277 /* Tegra114 specific DMA controller information */
1278 static const struct tegra_dma_chip_data tegra114_dma_chip_data = {
1279 .nr_channels = 32, 1280 .channel_reg_size = 0x20, 1281 .max_dma_count = 1024UL * 64, 1282 .support_channel_pause = true, 1283 .support_separate_wcount_reg = false,
1284 };
1285
1286 /* Tegra148 specific DMA controller information */
1287 static const struct tegra_dma_chip_data tegra148_dma_chip_data = {
1288 .nr_channels = 32, 1289 .channel_reg_size = 0x40, 1290 .max_dma_count = 1024UL * 64, 1291 .support_channel_pause = true, 1292 .support_separate_wcount_reg = true,
1293 };
You may still say this should be in the DT, but the Tegra maintainers prefer this data in the driver.
Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?Why should I not be setting
DMA_SLAVE? Should I not be callingdma_get_any_slave_channel()in the xlate?
Quoted 6 lines
Quoted 3 lines
I think that I do want to set
DMA_CYCLICas well to ensure that we check that thedevice->device_prep_dma_cyclic()function pointer is populated when registering the DMA controller.Only setting
DMA_CYCLICshould do, if you see any issues around that please get back, we cna fix those :)
It did not work for me because dma_get_any_slave_channel() wants a DMA device with the DMA_SLAVE bit capability set. So if I remove this above, then requesting the channel fails via dma_get_any_slave_channel() fails. Is there something I don't understand here?
Cheers
Jon
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveQuoted 48 lines · Jon Hunter
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?Same way we solve this for the tegra20-apb-dma driver by having different chip data per SoC in the driver ...
1259 /* Tegra20 specific DMA controller information */
1260 static const structtegra_dma_chip_datategra20_dma_chip_data= {1261 .nr_channels = 16, 1262 .channel_reg_size = 0x20, 1263 .max_dma_count = 1024UL * 64, 1264 .support_channel_pause = false, 1265 .support_separate_wcount_reg = false,1266 };
1267
1268 /* Tegra30 specific DMA controller information */
1269 static const structtegra_dma_chip_datategra30_dma_chip_data= {1270 .nr_channels = 32, 1271 .channel_reg_size = 0x20, 1272 .max_dma_count = 1024UL * 64, 1273 .support_channel_pause = false, 1274 .support_separate_wcount_reg = false,1275 };
1276
1277 /* Tegra114 specific DMA controller information */
1278 static const structtegra_dma_chip_datategra114_dma_chip_data= {1279 .nr_channels = 32, 1280 .channel_reg_size = 0x20, 1281 .max_dma_count = 1024UL * 64, 1282 .support_channel_pause = true, 1283 .support_separate_wcount_reg = false,1284 };
1285
1286 /* Tegra148 specific DMA controller information */
1287 static const structtegra_dma_chip_datategra148_dma_chip_data= {1288 .nr_channels = 32, 1289 .channel_reg_size = 0x40, 1290 .max_dma_count = 1024UL * 64, 1291 .support_channel_pause = true, 1292 .support_separate_wcount_reg = true,
Quoted 4 lines
1293 };
You may still say this should be in the DT, but the Tegra maintainers prefer this data in the driver.
Okay I don't see a a rationale behind this not being in DT, Stephan?
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
Review
Quoted 4 lines
(quoted diff) +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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?Why should I not be setting
DMA_SLAVE? Should I not be callingdma_get_any_slave_channel()in the xlate?I think that I do want to set
DMA_CYCLICas well to ensure that we check that thedevice->device_prep_dma_cyclic()function pointer is populated when registering the DMA controller.
Quoted 7 lines
Quoted 2 lines
Only setting
DMA_CYCLICshould do, if you see any issues around that please get back, we cna fix those :)It did not work for me because
dma_get_any_slave_channel()wants a DMA device with theDMA_SLAVEbit capability set. So if I remove this above, then requesting the channel fails viadma_get_any_slave_channel()fails. Is there something I don't understand here?
You should use dma_request_channel() we cleaned up the APIs and recommend to use dma_request_channel() for slave usages. See Documentation update ina8135d0d79e9: (dmaengine: core: Introduce new, universal API to request a channel)
Thanks
Signature · 1 line
~Vinod
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
Quoted 51 lines · Vinod Koul
Quoted 50 lines · Jon Hunter
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?Same way we solve this for the tegra20-apb-dma driver by having different chip data per SoC in the driver ...
1259 /* Tegra20 specific DMA controller information */
1260 static const structtegra_dma_chip_datategra20_dma_chip_data= {1261 .nr_channels = 16, 1262 .channel_reg_size = 0x20, 1263 .max_dma_count = 1024UL * 64, 1264 .support_channel_pause = false, 1265 .support_separate_wcount_reg = false,1266 };
1267
1268 /* Tegra30 specific DMA controller information */
1269 static const structtegra_dma_chip_datategra30_dma_chip_data= {1270 .nr_channels = 32, 1271 .channel_reg_size = 0x20, 1272 .max_dma_count = 1024UL * 64, 1273 .support_channel_pause = false, 1274 .support_separate_wcount_reg = false,1275 };
1276
1277 /* Tegra114 specific DMA controller information */
1278 static const structtegra_dma_chip_datategra114_dma_chip_data= {1279 .nr_channels = 32, 1280 .channel_reg_size = 0x20, 1281 .max_dma_count = 1024UL * 64, 1282 .support_channel_pause = true, 1283 .support_separate_wcount_reg = false,1284 };
1285
1286 /* Tegra148 specific DMA controller information */
1287 static const structtegra_dma_chip_datategra148_dma_chip_data= {1288 .nr_channels = 32, 1289 .channel_reg_size = 0x40, 1290 .max_dma_count = 1024UL * 64, 1291 .support_channel_pause = true, 1292 .support_separate_wcount_reg = true,1293 };
Quoted 4 lines
Quoted 2 lines
You may still say this should be in the DT, but the Tegra maintainers prefer this data in the driver.
Okay I don't see a a rationale behind this not being in DT, Stephan?
The rationale for putting such data into DT is that when a new SoC comes out, someone can simply modify the DT to change the parameter and the existing driver will magically work on the new HW.
In practice, at least for HW blocks on Tegra, this doesn't turn out to be true very often at all. We almost /always/ need some change to the driver, because it needs to manipulate some additional clock, program some new register/field, adapt to register/field layout changes, work around bugs differently, etc. As such, expecting driver code changes is the norm not the exception.
Given that, we have two choices about how to represent certain data in DT:
a) Put (hard-code) the data into the driver, and just use it. Perhaps this data is in a table in order to support different values per SoC, as in the code quoted above. This is very simple.
b) Put the data into DT, and write extra driver code to parse it, all just to extract the exact same value we would have hard-coded into the driver. This is useless overhead /unless/ it allows re-use of the driver unchanged on new SoCs, which rarely happens.
As such, it's much simpler to choose option (a).
If an initial version of a driver hard-codes some value and by magic a new version of the HW comes out for which the only difference is some value like this, then:
a) It's likely that the value has increased rather than decreased on new HW, so the existing hard-coded driver can work just as well as on old HW, but simply not exposing all HW capabilities. This won't always be true, but seems just as reasonable to expect as expecting the driver won't need modifications for any other reason.
b) At the time we add driver support for the new chip, we can define a new DT property that represents the previously hard-coded data. If the property is present, its value is used. Otherwise the previous hard-coded default can still be used. This allows us to retrospectively realise that a DT property would have been a good idea, yet not bog the code down with using the DT property until it is definitively known to be useful.
Now, my points above all refer to Tegra HW blocks. Hopefully they don't apply to IP vendors who sell their block to various SoC vendors. There, it's much more obviously beneficial to allow DT-based configuration of any IP block parameters, since different SoC vendors will almost certainly pick different configuration values if it's possible to do so. Note that this is more about different instances (parameterizations) of the same version of an IP block though.
Equally,, my points apply to on-SoC HW blocks rather than anything board specific. Board designs very obviously vary a lot, and it's obviously beneficial to use DT to represent those differences (for consumption by a generic OS; there's not so much benefit when talking about firmware consuming DT).
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to Vinod KoulQuoted 51 lines · Vinod Koul
Quoted 50 lines · Jon Hunter
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?Same way we solve this for the tegra20-apb-dma driver by having different chip data per SoC in the driver ...
1259 /* Tegra20 specific DMA controller information */
1260 static const structtegra_dma_chip_datategra20_dma_chip_data= {1261 .nr_channels = 16, 1262 .channel_reg_size = 0x20, 1263 .max_dma_count = 1024UL * 64, 1264 .support_channel_pause = false, 1265 .support_separate_wcount_reg = false,1266 };
1267
1268 /* Tegra30 specific DMA controller information */
1269 static const structtegra_dma_chip_datategra30_dma_chip_data= {1270 .nr_channels = 32, 1271 .channel_reg_size = 0x20, 1272 .max_dma_count = 1024UL * 64, 1273 .support_channel_pause = false, 1274 .support_separate_wcount_reg = false,1275 };
1276
1277 /* Tegra114 specific DMA controller information */
1278 static const structtegra_dma_chip_datategra114_dma_chip_data= {1279 .nr_channels = 32, 1280 .channel_reg_size = 0x20, 1281 .max_dma_count = 1024UL * 64, 1282 .support_channel_pause = true, 1283 .support_separate_wcount_reg = false,1284 };
1285
1286 /* Tegra148 specific DMA controller information */
1287 static const structtegra_dma_chip_datategra148_dma_chip_data= {1288 .nr_channels = 32, 1289 .channel_reg_size = 0x40, 1290 .max_dma_count = 1024UL * 64, 1291 .support_channel_pause = true, 1292 .support_separate_wcount_reg = true,1293 };
Quoted 4 lines
Quoted 2 lines
You may still say this should be in the DT, but the Tegra maintainers prefer this data in the driver.
Okay I don't see a a rationale behind this not being in DT, Stephan?
Let me know what you think of Stephen's feedback and if you are OK with this.
Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?Why should I not be setting
DMA_SLAVE? Should I not be callingdma_get_any_slave_channel()in the xlate?I think that I do want to set
DMA_CYCLICas well to ensure that we check that thedevice->device_prep_dma_cyclic()function pointer is populated when registering the DMA controller.Quoted 7 lines
Quoted 2 lines
Only setting
DMA_CYCLICshould do, if you see any issues around that please get back, we cna fix those :)It did not work for me because
dma_get_any_slave_channel()wants a DMA device with theDMA_SLAVEbit capability set. So if I remove this above, then requesting the channel fails viadma_get_any_slave_channel()fails. Is there something I don't understand here?
Quoted 4 lines
You should use
dma_request_channel()we cleaned up the APIs and recommend to usedma_request_channel()for slave usages. See Documentation update ina8135d0d79e9: (dmaengine: core: Introduce new, universal API to request a channel)
I had a look at this, but actually, I don't think this is going to work.
Looking at dma_request_channel(), it is going to get a DMA channel that matches the mask for any DMA controller. In the xlate I already know which DMA controller I am and I just want one of the channels. The flow here is ...
dma_request_chan()
--> of_dma_request_slave_channel()
--> xlate()
--> dma_get_any_slave_channel()There are several other DMA drivers that are calling dma_get_any_slave_channel() from their xlate function which makes sense because they are requesting one of their own channels.
I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their dma_device structure to ensure you get a channel for the appropriate DMA controller.
Cheers
Jon
--
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
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveHi Vinod,
Any more comments here? Or are you ok?
Cheers
Jon
Quoted 119 lines · Jon Hunter
Quoted 51 lines · Vinod Koul
Quoted 50 lines · Jon Hunter
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?Same way we solve this for the tegra20-apb-dma driver by having different chip data per SoC in the driver ...
1259 /* Tegra20 specific DMA controller information */
1260 static const structtegra_dma_chip_datategra20_dma_chip_data= {1261 .nr_channels = 16, 1262 .channel_reg_size = 0x20, 1263 .max_dma_count = 1024UL * 64, 1264 .support_channel_pause = false, 1265 .support_separate_wcount_reg = false,1266 };
1267
1268 /* Tegra30 specific DMA controller information */
1269 static const structtegra_dma_chip_datategra30_dma_chip_data= {1270 .nr_channels = 32, 1271 .channel_reg_size = 0x20, 1272 .max_dma_count = 1024UL * 64, 1273 .support_channel_pause = false, 1274 .support_separate_wcount_reg = false,1275 };
1276
1277 /* Tegra114 specific DMA controller information */
1278 static const structtegra_dma_chip_datategra114_dma_chip_data= {1279 .nr_channels = 32, 1280 .channel_reg_size = 0x20, 1281 .max_dma_count = 1024UL * 64, 1282 .support_channel_pause = true, 1283 .support_separate_wcount_reg = false,1284 };
1285
1286 /* Tegra148 specific DMA controller information */
1287 static const structtegra_dma_chip_datategra148_dma_chip_data= {1288 .nr_channels = 32, 1289 .channel_reg_size = 0x40, 1290 .max_dma_count = 1024UL * 64, 1291 .support_channel_pause = true, 1292 .support_separate_wcount_reg = true,1293 };
Quoted 4 lines
Quoted 2 lines
You may still say this should be in the DT, but the Tegra maintainers prefer this data in the driver.
Okay I don't see a a rationale behind this not being in DT, Stephan?
Let me know what you think of Stephen's feedback and if you are OK with this.
Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?Why should I not be setting
DMA_SLAVE? Should I not be callingdma_get_any_slave_channel()in the xlate?I think that I do want to set
DMA_CYCLICas well to ensure that we check that thedevice->device_prep_dma_cyclic()function pointer is populated when registering the DMA controller.Quoted 7 lines
Quoted 2 lines
Only setting
DMA_CYCLICshould do, if you see any issues around that please get back, we cna fix those :)It did not work for me because
dma_get_any_slave_channel()wants a DMA device with theDMA_SLAVEbit capability set. So if I remove this above, then requesting the channel fails viadma_get_any_slave_channel()fails. Is there something I don't understand here?Quoted 4 lines
You should use
dma_request_channel()we cleaned up the APIs and recommend to usedma_request_channel()for slave usages. See Documentation update ina8135d0d79e9: (dmaengine: core: Introduce new, universal API to request a channel)I had a look at this, but actually, I don't think this is going to work.
Looking at
dma_request_channel(), it is going to get a DMA channel that matches the mask for any DMA controller. In the xlate I already know which DMA controller I am and I just want one of the channels. The flow here is ...
dma_request_chan()
-->of_dma_request_slave_channel()--> xlate() --> dma_get_any_slave_channel()There are several other DMA drivers that are calling
dma_get_any_slave_channel()from their xlate function which makes sense because they are requesting one of their own channels.I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their
dma_devicestructure to ensure you get a channel for the appropriate DMA controller.Cheers
Jon--
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
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveQuoted 103 lines · Jon Hunter
Quoted 102 lines · Jon Hunter
Quoted 51 lines · Vinod Koul
Quoted 50 lines · Jon Hunter
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
why should this be hard coded in kernel and not queried from something like DT? This case seems to be hardware property
Originally, I did have this in DT, however, the Tegra maintainers prefer this and this is consistent with the other Tegra DMA driver (see
driver/dma/tegra20-apb-dma.c) [0].But this creates a problem when you have next generation of controller with different channel count!
How do we solve then?Same way we solve this for the tegra20-apb-dma driver by having different chip data per SoC in the driver ...
1259 /* Tegra20 specific DMA controller information */
1260 static const structtegra_dma_chip_datategra20_dma_chip_data= {1261 .nr_channels = 16, 1262 .channel_reg_size = 0x20, 1263 .max_dma_count = 1024UL * 64, 1264 .support_channel_pause = false, 1265 .support_separate_wcount_reg = false,1266 };
1267
1268 /* Tegra30 specific DMA controller information */
1269 static const structtegra_dma_chip_datategra30_dma_chip_data= {1270 .nr_channels = 32, 1271 .channel_reg_size = 0x20, 1272 .max_dma_count = 1024UL * 64, 1273 .support_channel_pause = false, 1274 .support_separate_wcount_reg = false,1275 };
1276
1277 /* Tegra114 specific DMA controller information */
1278 static const structtegra_dma_chip_datategra114_dma_chip_data= {1279 .nr_channels = 32, 1280 .channel_reg_size = 0x20, 1281 .max_dma_count = 1024UL * 64, 1282 .support_channel_pause = true, 1283 .support_separate_wcount_reg = false,1284 };
1285
1286 /* Tegra148 specific DMA controller information */
1287 static const structtegra_dma_chip_datategra148_dma_chip_data= {1288 .nr_channels = 32, 1289 .channel_reg_size = 0x40, 1290 .max_dma_count = 1024UL * 64, 1291 .support_channel_pause = true, 1292 .support_separate_wcount_reg = true,1293 };
Quoted 4 lines
Quoted 2 lines
You may still say this should be in the DT, but the Tegra maintainers prefer this data in the driver.
Okay I don't see a a rationale behind this not being in DT, Stephan?
Let me know what you think of Stephen's feedback and if you are OK with this.
Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +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);I think you should not set
DMA_SLAVE, do you need caps to be exported. I think that should be exported for cyclic too, let me know if that was the issue?Why should I not be setting
DMA_SLAVE? Should I not be callingdma_get_any_slave_channel()in the xlate?I think that I do want to set
DMA_CYCLICas well to ensure that we check that thedevice->device_prep_dma_cyclic()function pointer is populated when registering the DMA controller.Quoted 7 lines
Quoted 2 lines
Only setting
DMA_CYCLICshould do, if you see any issues around that please get back, we cna fix those :)It did not work for me because
dma_get_any_slave_channel()wants a DMA device with theDMA_SLAVEbit capability set. So if I remove this above, then requesting the channel fails viadma_get_any_slave_channel()fails. Is there something I don't understand here?Quoted 4 lines
You should use
dma_request_channel()we cleaned up the APIs and recommend to usedma_request_channel()for slave usages. See Documentation update ina8135d0d79e9: (dmaengine: core: Introduce new, universal API to request a channel)I had a look at this, but actually, I don't think this is going to work.
Looking at
dma_request_channel(), it is going to get a DMA channel that matches the mask for any DMA controller. In the xlate I already know which DMA controller I am and I just want one of the channels. The flow here is ...
dma_request_chan()
-->of_dma_request_slave_channel()--> xlate() --> dma_get_any_slave_channel()
Quoted 8 lines
Quoted 8 lines
There are several other DMA drivers that are calling
dma_get_any_slave_channel()from their xlate function which makes sense because they are requesting one of their own channels.I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their
dma_devicestructure to ensure you get a channel for the appropriate DMA controller.
Yes but the idea was that xlate will help you to get the right channel. The whole dmaengine property was supposed to help you with that
Please check the omap code which gets a specfic channel using this
Thanks
Signature · 1 line
~Vinod
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
Quoted 2 lines · Vinod Koul
Quoted 1 line · Jon Hunter
On 14/04/16 12:04, Jon Hunter wrote:
[snip]
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
I had a look at this, but actually, I don't think this is going to work.
Looking at
dma_request_channel(), it is going to get a DMA channel that matches the mask for any DMA controller. In the xlate I already know which DMA controller I am and I just want one of the channels. The flow here is ...
dma_request_chan()
-->of_dma_request_slave_channel()--> xlate() --> dma_get_any_slave_channel()There are several other DMA drivers that are calling
dma_get_any_slave_channel()from their xlate function which makes sense because they are requesting one of their own channels.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their
dma_devicestructure to ensure you get a channel for the appropriate DMA controller.Yes but the idea was that xlate will help you to get the right channel. The whole dmaengine property was supposed to help you with that
Well it depends on the DMA controller. In the case of tegra the xlate helps you extract the slave request ID for a given device. However, because any channel can be used with any slave request ID, we don't care about the exact channel. So we request any available channel for the DMA controller in question and program it with the slave request we got from the xlate.
Quoted 1 line
Please check the omap code which gets a specfic channel using this
Yes I have already seen this and it does not help here, because OMAP uses of_dma_simple_xlate() which calls dma_request_channel() and again this will get a channel from any DMA controller that matches the caps flags. For tegra we have two DMA controllers and both support CYCLIC transfers and so I am concerned we would get a channel from the wrong DMA controller.
I have seen some DMA drivers (such as imx-dma) use the filter function to match the DMA controller, but it seems daft to use the filter function to match the DMA controller when we already know in the xlate which DMA controller we are.
Cheers
Jon
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveQuoted 27 lines · On Tuesday 19 April 2016 14:59:49 Jon Hunter wrote:
Quoted 18 lines · Vinod Koul
Quoted 17 lines · Jon Hunter
Quoted 16 lines · Jon Hunter
I had a look at this, but actually, I don't think this is going to work.
Looking at
dma_request_channel(), it is going to get a DMA channel that matches the mask for any DMA controller. In the xlate I already know which DMA controller I am and I just want one of the channels. The flow here is ...
dma_request_chan()
-->of_dma_request_slave_channel()--> xlate() --> dma_get_any_slave_channel()There are several other DMA drivers that are calling
dma_get_any_slave_channel()from their xlate function which makes sense because they are requesting one of their own channels.Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their
dma_devicestructure to ensure you get a channel for the appropriate DMA controller.Yes but the idea was that xlate will help you to get the right channel. The whole dmaengine property was supposed to help you with that
Quoted 6 lines
Well it depends on the DMA controller. In the case of tegra the xlate helps you extract the slave request ID for a given device. However, because any channel can be used with any slave request ID, we don't care about the exact channel. So we request any available channel for the DMA controller in question and program it with the slave request we got from the xlate.
Right. the cleanup was supposed to reduce the number of interfaces that a slave driver can call and consolidate them as much as possible into dma_request_chan(), but we still need dma_get_any_slave_channel() as an interface for the dmaengine masters as you said.
Quoted 4 lines
I have seen some DMA drivers (such as imx-dma) use the filter function to match the DMA controller, but it seems daft to use the filter function to match the DMA controller when we already know in the xlate which DMA controller we are.
The filter functions should ideally all go away after the cleanup is complete.
Arnd
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
Quoted 35 lines · Arnd Bergmann
Quoted 27 lines · On Tuesday 19 April 2016 14:59:49 Jon Hunter wrote:
Quoted 18 lines · Vinod Koul
Quoted 17 lines · Jon Hunter
Quoted 16 lines · Jon Hunter
I had a look at this, but actually, I don't think this is going to work.
Looking at
dma_request_channel(), it is going to get a DMA channel that matches the mask for any DMA controller. In the xlate I already know which DMA controller I am and I just want one of the channels. The flow here is ...
dma_request_chan()
-->of_dma_request_slave_channel()--> xlate() --> dma_get_any_slave_channel()There are several other DMA drivers that are calling
dma_get_any_slave_channel()from their xlate function which makes sense because they are requesting one of their own channels.Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their
dma_devicestructure to ensure you get a channel for the appropriate DMA controller.Yes but the idea was that xlate will help you to get the right channel. The whole dmaengine property was supposed to help you with that
Quoted 6 lines
Well it depends on the DMA controller. In the case of tegra the xlate helps you extract the slave request ID for a given device. However, because any channel can be used with any slave request ID, we don't care about the exact channel. So we request any available channel for the DMA controller in question and program it with the slave request we got from the xlate.
Quoted 4 lines
Right. the cleanup was supposed to reduce the number of interfaces that a slave driver can call and consolidate them as much as possible into
dma_request_chan(), but we still needdma_get_any_slave_channel()as an interface for the dmaengine masters as you said.
OK, great.
Vinod, are you ok with this then? Any other items to fix-up?
Quoted 7 lines
Quoted 4 lines
I have seen some DMA drivers (such as imx-dma) use the filter function to match the DMA controller, but it seems daft to use the filter function to match the DMA controller when we already know in the xlate which DMA controller we are.
The filter functions should ideally all go away after the cleanup is complete.
Wonderful! Thanks for the info.
Cheers
Jon
Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA
In reply to a message not in the archiveQuoted 15 lines · Jon Hunter
Quoted 15 lines
Quoted 14 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I can understand that you wish to consolidate the APIs for requesting a channel, but it seems to me that you still need to have an API that DMA controller drivers can call where they can pass their
dma_devicestructure to ensure you get a channel for the appropriate DMA controller.Yes but the idea was that xlate will help you to get the right channel. The whole dmaengine property was supposed to help you with that
Well it depends on the DMA controller. In the case of tegra the xlate helps you extract the slave request ID for a given device. However, because any channel can be used with any slave request ID, we don't care about the exact channel. So we request any available channel for the DMA controller in question and program it with the slave request we got from the xlate.
Quoted 8 lines
Quoted 4 lines
Right. the cleanup was supposed to reduce the number of interfaces that a slave driver can call and consolidate them as much as possible into
dma_request_chan(), but we still needdma_get_any_slave_channel()as an interface for the dmaengine masters as you said.OK, great.
Vinod, are you ok with this then? Any other items to fix-up?
Okay from me.
Signature · 1 line
~Vinod