summaryrefslogtreecommitdiff
path: root/drivers/dma
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'dmaengine-5.7-rc1' of git://git.infradead.org/users/vkoul/slave-dmaLinus Torvalds2020-04-0234-494/+1625
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull dmaengine updates from Vinod Koul: "Core: - Some code cleanup and optimization in core by Andy - Debugfs support for displaying dmaengine channels by Peter Drivers: - New driver for uniphier-xdmac controller - Updates to stm32 dma, mdma and dmamux drivers and PM support - More updates to idxd drivers - Bunch of changes in tegra-apb driver and cleaning up of pm functions - Bunch of spelling fixes and Replace zero-length array patches - Shutdown hook for fsl-dpaa2-qdma driver - Support for interleaved transfers for ti-edma and virtualization support for k3-dma driver - Support for reset and updates in xilinx_dma driver - Improvements and locking updates in at_hdma driver" * tag 'dmaengine-5.7-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (89 commits) dt-bindings: dma: renesas,usb-dmac: add r8a77961 support dmaengine: uniphier-xdmac: Remove redandant error log for platform_get_irq dmaengine: tegra-apb: Improve DMA synchronization dmaengine: tegra-apb: Don't save/restore IRQ flags in interrupt handler dmaengine: tegra-apb: mark PM functions as __maybe_unused dmaengine: fix spelling mistake "exceds" -> "exceeds" dmaengine: sprd: Set request pending flag when DMA controller is active dmaengine: ppc4xx: Use scnprintf() for avoiding potential buffer overflow dmaengine: idxd: remove global token limit check dmaengine: idxd: reflect shadow copy of traffic class programming dmaengine: idxd: Merge definition of dsa_batch_desc into dsa_hw_desc dmaengine: Create debug directories for DMA devices dmaengine: ti: k3-udma: Implement custom dbg_summary_show for debugfs dmaengine: Add basic debugfs support dmaengine: fsl-dpaa2-qdma: remove set but not used variable 'dpaa2_qdma' dmaengine: ti: edma: fix null dereference because of a typo in pointer name dmaengine: fsl-dpaa2-qdma: Adding shutdown hook dmaengine: uniphier-xdmac: Add UniPhier external DMA controller driver dt-bindings: dmaengine: Add UniPhier external DMA controller bindings dmaengine: ti: k3-udma: Implement support for atype (for virtualization) ...
| * dmaengine: uniphier-xdmac: Remove redandant error log for platform_get_irqVinod Koul2020-03-261-3/+1
| | | | | | | | | | | | | | | | | | | | platform_get_irq prints the error on failure, so there is no need to have caller add a log. Remove the log in uniphier_xdmac_probe() for platform_get_irq() failure Reported-by: kbuild test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20200323171928.424223-1-vkoul@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Improve DMA synchronizationDmitry Osipenko2020-03-231-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Boot CPU0 always handles DMA interrupts and under some rare circumstances it could stuck in uninterruptible state for a significant time (like in a case of KASAN + NFS root). In this case sibling CPU, which waits for DMA transfer completion, will get a DMA transfer timeout. In order to handle this rare condition, interrupt status needs to be polled until interrupt is handled. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200319212321.3297-2-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Don't save/restore IRQ flags in interrupt handlerDmitry Osipenko2020-03-231-4/+3
| | | | | | | | | | | | | | | | | | The interrupt is already disabled while interrupt handler is running, and thus, there is no need to save/restore the IRQ flags within the spinlock. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200319212321.3297-1-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: mark PM functions as __maybe_unusedYueHaibing2020-03-231-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_PM is disabled, gcc warning this: drivers/dma/tegra20-apb-dma.c:1587:12: warning: 'tegra_dma_runtime_resume' defined but not used [-Wunused-function] drivers/dma/tegra20-apb-dma.c:1578:12: warning: 'tegra_dma_runtime_suspend' defined but not used [-Wunused-function] Make it as __maybe_unused to fix the warnings, also remove unneeded function declarations. Fixes: ec8a1586780c ("dma: tegra: add dmaengine based dma driver") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20200320071337.59756-1-yuehaibing@huawei.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: fix spelling mistake "exceds" -> "exceeds"Colin Ian King2020-03-232-2/+2
| | | | | | | | | | | | | | | | | | There are a couple of spelling mistakes in dev_err error messages. Fix them. Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200316091653.110984-1-colin.king@canonical.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: sprd: Set request pending flag when DMA controller is activeZhenfang Wang2020-03-231-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On new Spreadtrum platforms, when the CPU enters idle, it will close the DMA controllers' clock to save power if the DMA controller is not busy. Moreover the DMA controller's busy signal depends on the DMA enable flag and the request pending flag. When DMA controller starts to transfer data, which means we already set the DMA enable flag, but now we should also set the request pending flag, in case the DMA clock will be closed accidentally if the CPU can not detect the DMA controller's busy signal. Signed-off-by: Zhenfang Wang <zhenfang.wang@unisoc.com> Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/02adbe4364ec436ec2c5bc8fd2386bab98edd884.1584019223.git.baolin.wang7@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: ppc4xx: Use scnprintf() for avoiding potential buffer overflowTakashi Iwai2020-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200311071606.4485-1-tiwai@suse.de Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: idxd: remove global token limit checkDave Jiang2020-03-111-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | The global token_limit is not tied to group tokens_reserved and tokens_allowed parameters. Remove the check in order to allow independent configuration. Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of driver") Reported-by: Yixin Zhang <yixin.zhang@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/158386266911.11066.7545764533072221536.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: idxd: reflect shadow copy of traffic class programmingDave Jiang2020-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The traffic class are set to -1 at initialization until the user programs them. If the user choose not to, the driver will program appropriate defaults. The driver also needs to update the shadowed copies of the values after doing the programming. Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of driver") Reported-by: Yixin Zhang <yixin.zhang@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/158386263076.10898.4586509576813094559.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: Create debug directories for DMA devicesPeter Ujfalusi2020-03-112-1/+43
| | | | | | | | | | | | | | | | | | | | | | Create a placeholder directory for each registered DMA device. DMA drivers can use the dmaengine_get_debugfs_root() call to get their debugfs root and can populate with custom files to aim debugging. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200306142839.17910-4-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: ti: k3-udma: Implement custom dbg_summary_show for debugfsPeter Ujfalusi2020-03-111-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the custom dbg_summary_show the driver can show useful information about the used channels. dma0 (285c0000.dma-controller): number of channels: 24 dma1 (31150000.dma-controller): number of channels: 84 dma1chan0 | 2b00000.mcasp:tx (MEM_TO_DEV, tchan16 [0x1010 -> 0xc400], PDMA[ ACC32 BURST ], TR mode) dma1chan1 | 2b00000.mcasp:rx (DEV_TO_MEM, rchan16 [0x4400 -> 0x9010], PDMA[ ACC32 BURST ], TR mode) dma1chan2 | 2ba0000.mcasp:tx (MEM_TO_DEV, tchan17 [0x1011 -> 0xc507], PDMA[ ACC32 BURST ], TR mode) dma1chan3 | 2ba0000.mcasp:rx (DEV_TO_MEM, rchan17 [0x4507 -> 0x9011], PDMA[ ACC32 BURST ], TR mode) dma1chan4 | in-use (MEM_TO_MEM, chan0 pair [0x1000 -> 0x9000], PSI-L Native, TR mode) dma1chan5 | in-use (MEM_TO_MEM, chan1 pair [0x1001 -> 0x9001], PSI-L Native, TR mode) dma1chan6 | in-use (MEM_TO_MEM, chan4 pair [0x1004 -> 0x9004], PSI-L Native, TR mode) dma1chan7 | in-use (MEM_TO_MEM, chan5 pair [0x1005 -> 0x9005], PSI-L Native, TR mode) Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200306142839.17910-3-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: Add basic debugfs supportPeter Ujfalusi2020-03-111-1/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Via the /sys/kernel/debug/dmaengine/summary users can get information about the DMA devices and the used channels. Example output on am654-evm with audio using two channels and after running dmatest on 4 channels: dma0 (285c0000.dma-controller): number of channels: 96 dma1 (31150000.dma-controller): number of channels: 267 dma1chan0 | 2b00000.mcasp:tx dma1chan1 | 2b00000.mcasp:rx dma1chan2 | in-use dma1chan3 | in-use dma1chan4 | in-use dma1chan5 | in-use For slave channels we can show the device and the channel name a given channel is requested. For non slave devices the only information we know is that the channel is in use. DMA drivers can implement the optional dbg_summary_show callback to provide controller specific information instead of the generic one. It is easy to extend the generic dmaengine_summary_show() to print additional information about the used channels. I have taken the idea from gpiolib and clk subsystems. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200306142839.17910-2-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: fsl-dpaa2-qdma: remove set but not used variable 'dpaa2_qdma'YueHaibing2020-03-061-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c: In function dpaa2_qdma_shutdown: drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c:795:28: warning: variable dpaa2_qdma set but not used [-Wunused-but-set-variable] commit 3e0ca3c38dc2 ("dmaengine: fsl-dpaa2-qdma: Adding shutdown hook") involved this, remove it. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20200303131347.28392-1-yuehaibing@huawei.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: ti: edma: fix null dereference because of a typo in pointer nameColin Ian King2020-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently there is a dereference of the null pointer m_ddev. This appears to be a typo on the pointer, I believe s_ddev should be used instead. Fix this by using the correct pointer. Fixes: eb0249d50153 ("dmaengine: ti: edma: Support for interleaved mem to mem transfer") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Addresses-Coverity: ("Explicit null dereferenced") Link: https://lore.kernel.org/r/20200226185921.351693-1-colin.king@canonical.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: fsl-dpaa2-qdma: Adding shutdown hookPeng Ma2020-03-023-0/+40
| | | | | | | | | | | | | | | | | | | | We need to ensure DMA engine could be stopped in order for kexec to start the next kernel. So add the shutdown operation support. Signed-off-by: Peng Ma <peng.ma@nxp.com> Link: https://lore.kernel.org/r/20200227042841.18358-1-peng.ma@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: uniphier-xdmac: Add UniPhier external DMA controller driverKunihiko Hayashi2020-03-023-0/+623
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds external DMA controller driver implemented in Socionext UniPhier SoCs. This driver supports DMA_MEMCPY and DMA_SLAVE modes. Since this driver does not support the the way to transfer size unaligned to burst width, 'src_maxburst' or 'dst_maxburst' of dma_slave_config must be 1 to transfer arbitrary size. If transfer size is unaligned to burst size, the transfer isn't started and the driver displays an error message. Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Link: https://lore.kernel.org/r/1582271550-3403-3-git-send-email-hayashi.kunihiko@socionext.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: ti: k3-udma: Implement support for atype (for virtualization)Peter Ujfalusi2020-03-022-10/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DT for virtualized hosts have dma-cells == 2 where the second parameter is the ATYPE for the channel. In case of dma-cells == 1 we can configure the ATYPE as 0 (reset value). The ATYPE defined for j721e are: 0: pointers are physical addresses (no translation) 1: pointers are intermediate addresses (PVU) 2: pointers are virtual addresses (SMMU) Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200218143126.11361-3-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: idxd: expose general capabilities register in sysfsDave Jiang2020-03-021-0/+11
| | | | | | | | | | | | | | | | | | | | There are some capabilities for the device that are interesting to user apps that are interacting directly with the device. Expose gencap register in sysfs to allow that information. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/158256729399.55526.10842505054968710547.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: idxd: check return result from check_vma() in cdevDave Jiang2020-03-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | The returned result from the check_vma() function in the cdev ->mmap() call needs to be handled. Add the check and returning error. Fixes: 42d279f9137a ("dmaengine: idxd: add char driver to expose submission portal to userland") Reported-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/158264926659.9387.14325163515683047959.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Improve error message about DMA underflowDmitry Osipenko2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Technically it is possible that DMA could be misconfigured in a way that cyclic DMA transfer is processed slower than it takes to complete the cycle and in this case the DMA is getting aborted with a not very informative message about the problem, let's improve it. Suggested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-20-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Remove unused function argumentDmitry Osipenko2020-02-251-2/+1
| | | | | | | | | | | | | | | | | | Remove unused function argument from handle_continuous_head_request(). Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-19-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Support COMPILE_TESTDmitry Osipenko2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | There is nothing arch-specific in the driver's code, so let's enable compile-testing for the driver. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-18-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Remove MODULE_ALIASDmitry Osipenko2020-02-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | Tegra APB DMA driver is an Open Firmware driver, so it uses OF alias naming scheme which overrides MODULE_ALIAS, meaning that MODULE_ALIAS does nothing and could be removed safely. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-17-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Allow to compile as a loadable kernel moduleDmitry Osipenko2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | The driver's removal was fixed by a recent commit and module load/unload is working well now, tested on Tegra30. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-16-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Add missing of_dma_controller_freeDmitry Osipenko2020-02-251-0/+1
| | | | | | | | | | | | | | | | | | The DMA controller shall be released on driver's removal. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-15-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Clean up suspend-resumeDmitry Osipenko2020-02-251-67/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is enough to check whether hardware is busy on suspend and to reset it across of suspend-resume because: 1. Channel's configuration is fully re-programmed on each DMA transfer anyways. 2. Context save-restore of an active channel won't end up well without pausing transfer prior to the context's saving, but note that every channel shall be idling at the time of suspend, so save-restore is not needed at all. 3. The only case where context save-restore may be useful is when channel is in a paused state during suspend. But channel's pausing could be supported only on Tegra114+ and this functionality wasn't implemented by the driver for years now because there is no need for it in upstream kernel. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-14-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Keep clock enabled only during of DMA transferDmitry Osipenko2020-02-251-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | It's a bit impractical to enable hardware's clock at the time of DMA channel's allocation because most of DMA client drivers allocate DMA channel at the time of the driver's probing, and thus, DMA clock is kept always-enabled in practice, defeating the whole purpose of runtime PM. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-13-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Remove duplicated pending_sg_req checksDmitry Osipenko2020-02-251-12/+0
| | | | | | | | | | | | | | | | | | | | | | There are few place in the code which check whether pending_sg_req list is empty despite of the check already being done. Let's remove the duplicated checks to keep code clean. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-12-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Remove assumptions about unavailable runtime PMDmitry Osipenko2020-02-251-9/+1
| | | | | | | | | | | | | | | | | | | | | | The runtime PM is always available on all Tegra SoCs since the commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), so there is no need to handle the case of unavailable RPM in the code anymore. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-11-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Remove unneeded initialization of tdc->config_initDmitry Osipenko2020-02-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | There is no need to re-initialize the already initialized variables. The tdc->config_init=false after driver's probe and after channel's freeing, so there is no need to re-initialize it on the channel's allocation. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-10-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Fix coding style problemsDmitry Osipenko2020-02-251-131/+144
| | | | | | | | | | | | | | | | | | | | This patch fixes few dozens of coding style problems reported by checkpatch and prettifies code where makes sense. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-9-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Use devm_request_irqDmitry Osipenko2020-02-251-24/+11
| | | | | | | | | | | | | | | | | | Use resource-managed variant of request_irq for brevity. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-8-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Use devm_platform_ioremap_resourceDmitry Osipenko2020-02-251-2/+1
| | | | | | | | | | | | | | | | | | Use devm_platform_ioremap_resource to keep code cleaner a tad. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-7-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Clean up tasklet releasingDmitry Osipenko2020-02-251-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to kill tasklet when driver's probe fails because tasklet can't be scheduled at this time. It is also cleaner to kill tasklet on channel's freeing rather than to kill it on driver's removal, otherwise tasklet could perform a dummy execution after channel's releasing, which isn't very nice. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-6-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Prevent race conditions on channel's freeingDmitry Osipenko2020-02-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | It's incorrect to check the channel's "busy" state without taking a lock. That shouldn't cause any real troubles, nevertheless it's always better not to have any race conditions in the code. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-5-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: tegra-apb: Implement synchronization hookDmitry Osipenko2020-02-251-0/+8
| | | | | | | | | | | | | | | | | | | | The ISR tasklet could be kept scheduled after DMA transfer termination, let's add synchronization hook which blocks until tasklet is finished. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-4-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: ti: edma: Support for interleaved mem to mem transferPeter Ujfalusi2020-02-251-0/+79
| | | | | | | | | | | | | | | | Add basic interleaved support via EDMA. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200210094455.3615-1-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_xdmac: Fix locking in taskletTudor Ambarus2020-02-251-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tasklets run with all the interrupts enabled. This means that we should replace all the (already present) spin_lock_irqsave() uses in the tasklet with spin_lock_irq() to protect being interrupted by a IRQ which tries to get the same lock (via calls to device_prep_dma_* for example). spin_lock and spin_lock_bh in tasklets are not enough to protect from IRQs, update these to spin_lock_irq(). at_xdmac_advance_work() can be called with all the interrupts enabled (when called from tasklet), or with interrupts disabled (when called from at_xdmac_issue_pending). Move the locking in the callers to be able to use spin_lock_irq() and spin_lock_irqsave() for these cases. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-10-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_xdmac: GFP_KERNEL for user that can sleepTudor Ambarus2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | device_alloc_chan_resources can sleep, use GFP_KERNEL flag. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-9-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_xdmac: Drop locking in at_xdmac_alloc_chan_resources()Tudor Ambarus2020-02-251-9/+2
| | | | | | | | | | | | | | | | | | | | | | There is no need for locking in device_alloc_chan_resources(), the DMA core takes care of it by using a dma_list_mutex around the DMA devices. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-8-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_xdmac: Drop always true checkTudor Ambarus2020-02-251-5/+3
| | | | | | | | | | | | | | | | | | | | The code in cause is already in the else case of 'if (at_xdmac_chan_is_cyclic(atchan))', drop the redundant check. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-7-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_hdmac: Fix deadlocksTudor Ambarus2020-02-251-35/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following deadlocks: 1/ atc_handle_cyclic() and atc_chain_complete() called dmaengine_desc_get_callback_invoke() while wrongly holding the atchan->lock. Clients can set the callback to dmaengine_terminate_sync() which will end up trying to get the same lock, thus a deadlock occurred. 2/ dma_run_dependencies() was called with the atchan->lock held, but the method calls device_issue_pending() which tries to get the same lock, and so a deadlock occurred. The driver must not hold the lock when invoking the callback or when running dependencies. Releasing the spinlock within a called function before calling the callback is not a nice thing to do -> called functions become non-atomic when called within an atomic region. Thus the lock is now taken in the child routines whereever is needed. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-6-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_hdmac: Switch atomic allocations to GFP_NOWAITTudor Ambarus2020-02-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Avoids sleeping without depleting the emergency pool. The rationale being that in most cases a dma device is either offloading an operation that will automatically fallback to software when the descriptor allocation fails, or we can simply poll and wait for the dma device to release some in use descriptors. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-5-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_hdmac: Drop description for a not defined parameterTudor Ambarus2020-02-251-1/+0
| | | | | | | | | | | | | | | | | | Probably a leftover, drop it. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-4-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_hdmac: Return err in case the chan is not free at alloc res timeTudor Ambarus2020-02-252-25/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having a list of descriptors allocated for the channel at device_alloc_chan_resources() time is a sign for bad free usage. Return err and add a debug message in case the channel is not free from a previous use. atchan->descs_allocated becomes useless, get rid of it. More, drop the error message in atc_desc_get() because now it would introduce an extra if statement. The callers of atc_desc_get() already print error messages in case the callee fails, no one is hurt. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-3-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_hdmac: Drop locking in at_hdmac_alloc_chan_resources()Tudor Ambarus2020-02-251-6/+1
| | | | | | | | | | | | | | | | | | | | | | There is no need for locking in device_alloc_chan_resources(), the DMA core takes care of it by using a dma_list_mutex around the DMA devices. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-2-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: at_hdmac: Substitute kzalloc with kmallocTudor Ambarus2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | All members of the structure are initialized below in the function, there is no need to use kzalloc. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-1-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: xilinx_dma: In dma channel probe fix node order dependencyRadhey Shyam Pandey2020-02-251-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In overlay application we noticed that dma channel node probe order is inverted i.e s2mm channel is probed first followed by mm2s channel. The reason for this inversion is fdtoverlay utility which uses a function called fdt_add_subnode(*). It stores the subnodes after the properties, this has the effect of inserting the new subnode before any others and the end result is a reversal. Because of this inverted channel probe order, the node probed first is assigned a '0' index instead of Channel ID should be '0' for tx and '1' for rx and dmatest client using the DT convention fails in dma transfer as channel are swapped. To fix above behavior and make channel assignment index independent of probe order, always assign mm2s channel at '0' index and the s2mm channel at IP specific fixed offset derived from the max_channels count. Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Link: https://lore.kernel.org/r/1580388865-9960-3-git-send-email-radhey.shyam.pandey@xilinx.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
| * dmaengine: xilinx_dma: Extend dma_config structure to store max channel countRadhey Shyam Pandey2020-02-251-1/+8
| | | | | | | | | | | | | | | | | | | | | | Extend dma_config structure to store the max channel count. This input is used to populate dma device channel nodes at the fixed offset. It serves as a preparatory patch for removing dma channel DT node order dependency, added in the subsequent commit. Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Link: https://lore.kernel.org/r/1580388865-9960-2-git-send-email-radhey.shyam.pandey@xilinx.com Signed-off-by: Vinod Koul <vkoul@kernel.org>