summaryrefslogtreecommitdiff
path: root/drivers/dma/loongson
AgeCommit message (Collapse)Author
2026-10-05dmaengine: loongson: use named initializers for acpi_device_idPawel Zalewski
Use a named initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Unify the list terminator to have a single space between the brackets and no trailing comma. Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk> Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260916-acpi-dma-v3-2-0dac05654967@thegoodpenguin.co.uk Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-10-05dmaengine: loongson2-apb-cmc: fix descriptor leak in prep_slave_sg()Diego Fernando Mancera Gomez
loongson2_cmc_dma_prep_slave_sg() allocates the descriptor with kzalloc_flex() before iterating over the scatterlist. If loongson2_cmc_dma_set_xfer_param() fails inside the loop, the function returns ERR_PTR(ret) without freeing the descriptor. At this point the descriptor has not been handed to vchan_tx_prep() yet, so nothing else will ever free it, leaking it on every failed ->device_prep_slave_sg() call (e.g. an unsupported transfer direction or bus width). The neighbouring error path for the num_items check already frees the descriptor before returning; do the same on the set_xfer_param() failure path. Fixes: 1c0028e725f1 ("dmaengine: loongson: New driver for the Loongson Multi-Channel DMA controller") Link: https://lore.kernel.org/all/20260818094957.7D2221F000E9@smtp.kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Diego Fernando Mancera Gomez <diegomancera.dev@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bUV3WshMSfTq61n1cgh1i Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260905062833.272484-1-diegomancera.dev@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-09-15dmaengine: add (dmaengine|vchan)_chan_dev() helperFrank Li
Add a new helper function (dmaengine|vchan)_chan_dev() to access the DMA channel device embedded in struct dma_chan_dev (chan->dev->device). This provides a cleaner API instead of open-coding &chan->dev->device throughout the drivers. Replay private chan2dev() and dchan2dev() with this new common APIs in indivial DMA engine drivers. Prepare rename dma_chan::dev field. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260909-dma-chan_dev-rename-v4-3-d8fb6892a70f@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-09-15dmaengine: use dma_chan_name() helper to get per-channel device nameFrank Li
Use the existing dma_chan_name() helper to obtain the per-channel device name instead of open-coding: dev_name(chan->dev->device) / dev_name(chan2dev()). Simplify the code, improve consistency and reduce line wrapping where possible. No functional change intended. Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com> # For STM32 Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260909-dma-chan_dev-rename-v4-2-d8fb6892a70f@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-09-15dmaengine: vchan: add vchan_chan_name() to get channel device nameFrank Li
Introduce vchan_chan_name() to obtain the DMA channel device name. Use a dedicated helper instead of directly accessing dma_chan::dev so callers remain unaffected by an upcoming rename of the struct member. Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com> # For STM32 Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260909-dma-chan_dev-rename-v4-1-d8fb6892a70f@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-09-10dmaengine: loongson: loongson2-apb-cmc: Fix signedness bug in irq handlingBinbin Zhou
Storing that negative value into an unsigned variable makes the check `if (lchan->irq < 0)` always false, so probe errors are not correctly detected and propagated. Fix this by changing the type of `irq` to `int`, which allows proper signed comparison and error handling. Fixes: 1c0028e725f1 ("dmaengine: loongson: New driver for the Loongson Multi-Channel DMA controller") Reported-by: Julia Lawall <julia.lawall@inria.fr> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/r/202608152230.p20WPlS0-lkp@intel.com/ Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/20260818093448.3597016-1-zhoubinbin@loongson.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-03-18dmaengine: loongson: Fix spelling mistake "Looongson" -> "Looogson"Colin Ian King
There are a couple of spelling mistakes, one in a comment block and one in a module description. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://patch.msgid.link/20260317204631.120332-1-colin.i.king@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-03-17dmaengine: loongson: New driver for the Loongson Multi-Channel DMA controllerBinbin Zhou
This DMA controller appears in Loongson-2K0300 and Loongson-2K3000. It is a chain multi-channel controller that enables data transfers from memory to memory, device to memory, and memory to device, as well as channel prioritization configurable through the channel configuration registers. In addition, there are slight differences between Loongson-2K0300 and Loongson-2K3000, such as channel register offsets and the number of channels. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/73bc32ba6249f1eef94fec9b349bc9efa98278ea.1772853681.git.zhoubinbin@loongson.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-03-17dmaengine: loongson: loongson2-apb: Simplify locking with guard() and ↵Binbin Zhou
scoped_guard() Use guard() and scoped_guard() infrastructure instead of explicitly acquiring and releasing spinlocks to simplify the code and ensure that all locks are released properly. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/fb59bb25e5c4fcb84d9aa7b351285fa8d02ea8cb.1772853681.git.zhoubinbin@loongson.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-03-17dmaengine: loongson: loongson2-apb: Convert to devm_clk_get_enabled()Binbin Zhou
Use the devm_clk_get_enabled() helper function to simplify the probe routine. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/4f3aad22d14e730cc040ece8b0ced37853d52876.1772853681.git.zhoubinbin@loongson.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-03-17dmaengine: loongson: loongson2-apb: Convert to ↵Binbin Zhou
dmaenginem_async_device_register() Use the dmaenginem_async_device_register() helper function to simplify the probe routine. Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/c56e67ecde38e9a3bda5f88ea3fc20b97a5cba6c.1772853681.git.zhoubinbin@loongson.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
2026-03-17dmaengine: loongson: New directory for Loongson DMA controllers driversBinbin Zhou
Gather the Loongson DMA controllers under drivers/dma/loongson/ Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Keguang Zhang <keguang.zhang@gmail.com> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/0a0853a85630724741061f6fe08680610e49a06e.1772853681.git.zhoubinbin@loongson.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>