Commit graph

670 commits

Author SHA1 Message Date
Khanh Nguyen
bc15acc0fa drivers: dma: add support for Renesas RA DMAC driver
Add support for the Renesas RA Direct Memory Access Controller,
including driver source files, Kconfig options, and DTS bindings.

- Add initial implementation of the RA DMAC driver
- Add dedicated Kconfig and CMake integration
- Provide Devicetree bindings for the RA DMAC
- Update module Kconfig to include the new driver

This enables DMA functionality on Renesas RA series MCUs.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-09-12 14:23:37 -04:00
Julien Panis
051539e867 drivers: dma: cc23x0: Add power management
Add runtime PM support to cc23x0 DMA module.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-09-11 14:17:11 +01:00
Vit Stanicek
1c0ae3cc18 drivers: dma_mcux_lpc: Sanitise chan. data overrun
Add a num_of_allocated_channels field to struct dma_mcux_lpc_config. Add
a a capacity check for dma_X_channel_data_arr in dma_mcux_lpc_configure.

Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
2025-09-04 14:42:27 +02:00
Benjamin Cabé
0132ea07fb doc: fix spelling errors tree-wide
fix some spelling errors in code comments and Kconfig helps

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-03 17:04:13 +02:00
Erwan Gouriou
db1d31e938 drivers: dma: stm32: Minor indentation fix
Makes it easier to grep.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Erwan Gouriou
b9577e6edb drivers: dma: stm32: Align channel offset handling in all API functions
To ease code understanding of offset handling within the driver,
harmonize its treatment within impacted functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Erwan Gouriou
5e4bf3780d drivers: dma: stm32u5: Clean up stream offset code
STM32_DMA_STREAM_OFFSET is defined as 0 in case "dma u5" is in use.
Clean up code relating to this define.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Kevin Wang
618b6b46a5 tests: drivers: dma: Update board config and overlay for adp_xc7k_ae350
1. Add config and overlay file in test scatter_gather for adp_xc7k_ae350
   and adp_xc7k_ae350_clic to support the test case.
2. Modify the config file in test chan_blen_transfer and loop_transfer
   because the tests do not support the NOCACHE memory configuration,
   the DCACHE configuration needs to be disabled.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2025-08-21 15:58:35 +02:00
Kevin Wang
06bec271d9 drivers: dma: atcdmac300: Upgrade atcdmac driver to support series device
1. Upgrade the ATCDMAC driver to make it compatible with multiple
   ATCDMAC series drivers.
2. Rename the driver from ATCDMAC300 to ATCDMACX00.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2025-08-21 15:58:35 +02:00
Mike J. Chen
d47353928c drivers: dma_mcux_lpc: fix missing peripheral case
Change 4e0e3c990d caused
a regression in that SPI_MCUX_FLEXCOMM_TX DMA
transfers weren't properly set to be a peripheral
transfer.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-08-20 07:40:13 +02:00
Declan Snyder
0f66420cb2 drivers: mcux_edma: Fix dtcm desc kconfig dep
The syntax was wrong for the chosen dtcm node. Also fixing build error
on 1180 by re-allowing the symbol on some tests.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-20 07:39:54 +02:00
Fabrice DJIATSA
d48026b446 drivers: dma: stm32u5: update dma_suspend function
The previous 1ms sleep introduced unnecessary latency
while waiting for the SUSPF flag.
Switching to a 750µs busy-wait provides a more responsive
and precise delay,improving performance in time-sensitive contexts.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-08-18 11:58:08 +02:00
Declan Snyder
9278404021 dma_mcux_edma: Simplify mmap ifdefs
Halve all this ifdef code by making a macro function for the memory
mapping.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Declan Snyder
0dcc642886 dma_mcux_edma: Extract dmamux code to helpers
Extract and group dmamux related code together for readability.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Declan Snyder
071aa4cc29 dma_mcux_edma: Split configure function into helpers
There was actually three different types of configuration modes
happening here, and this function was getting extremely bulky and hard
to read due to the amount of nesting of conditionals. Split these into
separate functions and call them appropriately depending on the type of
transfer.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Declan Snyder
2379fac44f dma_mcux_edma: Split reload function into helpers
There is two completely different types of reload modes happening here,
therefore we should split this function into two completely separate
functions because it was getting large and hard to read. Removes
one level of indentation.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Declan Snyder
fcfbf247e1 dma_mcux_edma: Simplify max data size code
Instead of having preprocessor code, make a hidden kconfig
to indicate this and be smarter about the C code (these are all powers
of two)

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Declan Snyder
2a2449056c dma_mcux_edma: Simplify channel gap compliation
One #ifdef outside the functions is simpler to read than two #ifdefs
inside the functions.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Declan Snyder
7610eba406 drivers: dma_mcux_edma: Simplify cache attr macros
The dependency on the chosen node for dtcm can be expressed in Kconfig
language.

Cache we care about is CPU DCACHE, not the meaningless "MCUX Cache"

The macros can be reordered to be simpler by having only one level of
conditional (no nesting) instead of three levels.

Move this code closer in the file to where this cache attribute macro is
actually going to be used (the init macro) instead of randomly splitting
up the struct definitions at the top.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-14 22:38:08 -04:00
Mike J. Chen
737aa7d9f3 drivers: dma: dma_mcux_lpc: fix multiple bugs with continuous mode
There are multiple bugs related to continuous/circular mode.
Continuous/circular mode is where the DMA runs continuously
until the stop API is called, instead of auto-stopping on
completion on a single transfer. After a stop, the DMA
can then be reconfigured/restarted.

1. Fix bug where stop didn't actually stop. This can cause memory
   corruption if the user thought the DMA stopped and repurposed
   the dest memory, but in fact the DMA is still writing to it.
   The bug was due the incorrect usage of the DMA controller busy
   state. The DMA controller is busy only when a transfer is
   actively in progress, but the driver needed to stop even if
   the transfer is not active but is only enabled (and may become
   active on a subsequent trigger event). Change so that data->busy
   doesn't use the DMA controller busy state but tracks the enable
   state. Also, to make it doubly safe, make stop function always stop
   regardless of data->busy state because it is alway safe/correct
   to do so.

2. Fix race condition where a stop request from another ISR might race
   with a DMA completion interrupt, and the DMA completion callback
   gets invoked after the DMA has already been stopped. The fix
   is to unregister the callback with the sdk DMA driver, so the
   ISR still runs and clear the interrupt without invoking the
   callback. There is potentially still a race if the interrupt
   is restarted before the ISR fires, so the callback might be
   called too early. However, the Zephyr DMA driver doesn't
   have the channel level details that the SDK driver does and
   it cannot clear just the channel interrupt.

Also a couple of general fixes/improvements:

a. Use interrupt B for end of transfer (single transfer or end
   of block list). Use interrupt A for interrupts of a block
   in the middle of a transfer or for continuous/circular transfers.
   This fixes the dma callback so it can properly report
   DMA_STATUS_BLOCK vs DMA_STATUS_COMPLETE.

b. Reorder some fields in struct channel_data to pack a little
   better in memory

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-08-13 11:08:21 +01:00
Mike J. Chen
4e0e3c990d drivers: dma: dma_mcux_lpc: fix src_inc/dst_inc for block chain
The dma driver was determining src_inc and dst_inc from the
config of the first block buffer and ignoring the config
flags for any additional buffers in the chain, which could
lead to incorrect transfers (e.g. in a multiple rx buffer
case, if the first buffer was to receive to NULL,
but the subsequent buffers were not NULL, the bug
would manifest as all transfers being made with
dst_inc of 0). Change the driver to setup
each dma descriptor according to the addr_adj flag
of each block_buffer.

Add check that peripheral transfers have addr_adj set to
NO_CHANGE instead of assuming it, to help catch errors.

Also now check for invalid addr_adj request of
decrement, which this controller doesn't support.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-08-13 11:08:21 +01:00
Mike J. Chen
1c4351a208 drivers: mcux: spi and dma: add explicit dma channel type for SPI_TX
The spi_mcux_flexcomm driver uses a special last DMA blk_cfg
to trigger a release of the SPI chip select. This transfer
is always a 4-byte transfer, regardless of the width specified
during dma_configure().

The way the spi_mcux_flexcomm driver communicated this special
transfer was kind of a hack, where the dma_mcux_lpc driver would
assume that when a blk_cfg with source_addr_adj and dest_addr_adj
both set to NO_CHANGE was for this SPI_TX special case.

However, this is an unsafe hack since it is perfectly valid
to have dma use cases for both src/dest_addr_adj to be NO_CHANGE
that is not for SPI_TX. One example is when transmitting a
fixed/repeating value to a periperhal address (e.g. send 100
bytes of the same value from a single memory address over SPI).

This CL introduces a dma_mcux_lpc specific dma channel_direction
which the two drivers now use to cleary request this special
transfer case.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-08-13 11:08:21 +01:00
Martin Hoff
d64db7c5ec drivers: dma: silabs: change default max descriptor from 8 to 16
We need to add CONFIG_DMA_MAX_DESCRIPTOR=16 for a lot of tests, then
this default value of this parameter need to be higher. It allows to
delete some overlay files.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-08-11 13:17:45 -05:00
Martin Hoff
9ed0ded09d drivers: dma: silabs: add dma block splitting for high transfer size
The LDMA driver currently has a 1:1 mapping between hardware LDMA
descriptors and struct dma_block_config. This patch allows multiple
hardware descriptors to be allocated for a single struct dma_block_config
if the block size exceeds the transfer capacity of a single hardware
LDMA descriptor. This is beneficial for other peripheral drivers: it is
no longer necessary to split the payload by the transfer capacity of a
single hardware LDMA descriptor.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-08-11 13:17:45 -05:00
Tomasz Leman
bfdab166e3 intel_adsp: Introduce ACE 4.0 architecture with NVL/NVL-S platforms
Introduce the ACE 4.0 architecture, along with support for the NVL and
NVL-S platforms within the Intel ADSP framework in the Zephyr project.

This update includes:

- Addition of ACE 4.0 architecture configurations in Kconfig and
  Kconfig.intel_adsp.
- Inclusion of device tree source files for NVL and NVL-S platforms,
  defining CPU, memory, and peripheral configurations.
- Updates to driver files to support ACE 4.0 specific features,
  including DMIC and SSP configurations.
- Introduction of new header files for ACE 4.0, detailing boot,
  interrupt, IPC, power, and shim functionalities.
- Modifications to the CMakeLists.txt to include ACE 4.0 MMU support.
- Addition of default configurations for NVL and NVL-S platforms in
  Kconfig.defconfig.ace40.

The NVL and NVL-S platforms are part of the Nova Lake series, targeting
advanced audio processing capabilities. ACE 4.0 introduces enhanced DSP
capabilities and advanced power management features, improving audio
stream handling and synchronization compared to ACE 3.0.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2025-08-11 12:50:10 +03:00
Vit Stanicek
e679ef486a hal_nxp: Factorise inclusion of fsl_inputmux
Create Kconfig variable NXP_INPUTMUX, which selects the fsl_inputmux
driver. Imply the MCUX component symbol from it. Imply that variable
from the NXP PINT, SmartDMA and LPC DMA drivers and from the mimxrt685s
SoC.

This needed to be done for the mimxrt700_evk/mimxrt798s/hifi4 domain, as
the INPUTMUX peripheral handles IRQ assginments and its driver
(fsl_inputmux) is used directly by the domain's soc.c. Instantiating the
currently dependent drivers (for PINT and SmartDMA) isn's possible nor
reasonable on the said target.

Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
2025-07-31 17:11:54 -04:00
Declan Snyder
a622070a24 dma_mcux_edma: Remove header file
There is really no need for this header file at all besides if
there is a requirement to be annoying.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-07-11 09:41:14 -05:00
Declan Snyder
a94a16c454 dma_mcux_edma: Abort transfer before clear status
The transfer must be aborted before clearing the status flags otherwise
they will be set again before the transfer is aborted and stay set
causing infinite interrupt.

Also, elevate the log message to error level and give it actual useful
information. The "flag" being logged before literally just is a bit that
says if there is an error or not, which we already know by virtue of
handling an error. The channel error status has actual details about
what was the reason of the error. Also this status should be reported
before the transfer is aborted to get the right status.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-07-11 09:41:14 -05:00
Pisit Sawangvonganan
b8a8173c1f drivers: kconfig: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `drivers` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Yongxu Wang
0bf39e8213 drivers: dma: Update NXP EDMA driver for version 5
1. The edma version 5 share one driver with edma 4.
2. Edma5 tcd structure some difference, Use tcd type to distinguish,
   and Edma5 uses 64 bytes for alignment instead of 32.
3. Some platforms have some address offsets for certain memory
   when processing from a DMA perspective, such as imx95 cm7 TCM,
   so add offset processing.

Signed-off-by: Yongxu Wang <yongxu.wang@nxp.com>
2025-06-24 20:02:35 -10:00
Lucien Zhao
7101c7257c drivers: dma: dma_mcux_edma.c: add xcache support for tcd pool
XCACHE has been designed for RT700, tcd pool need to be put in
noncache region, update driver to support

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2025-06-24 15:35:07 -05:00
Benjamin Cabé
e936d7759c drivers: dma: dma_iproc_pax_v1: fix variable name in logging macro
Corrected the variable name from 'xfer_size' to 'xfer_sz' in
iproc-pax-dma-v1 driver.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 09:30:55 -04:00
Anuj Pathak
2af6adc745 drivers: dma: max32: check if bit other than status is set
we iterate over all the channels, and if more than one channel is
active at a time. interrupt on any one of active channel was
triggering callback for other active channel, because flags value
is 1 (enabled). this is commit handle this behaviour and only
trigger callback if bits other than status is set

Signed-off-by: Anuj Pathak <anuj@croxel.com>
2025-06-17 17:46:05 +02:00
Yicheng Li
dea8cd3fcf dma_mcux_lpc: Fix descriptor address conversion when used by DSP
The SDK FSL DMA driver converts descriptor addresses to DMA's address
space when linking descriptors. The Zephyr dma_mcux_lpc driver is
missing the inverse conversion when dereferencing the linked next
descriptor pointer.

This isn't a problem when this driver is used on the M33 core
of the MIMXRT595S because the M33 can access the address space
of the DMA (0x20000000+). But when the Fusion F1 DSP core uses
this driver, the DSP cannot access the DMA's address space
so the inverse conversion is needed.

Signed-off-by: Yicheng Li <yichengli@google.com>
2025-06-17 07:23:31 +02:00
c37abf115d drivers: dma: fix the WCH DMA transfer width
The driver treats the `source_data_size` and `dest_data_size` as a
width in bits and converts 8 bits to 1, 16 bits to 2, and 32 bits to 3.

This should be a width in bytes with 1 byte mapping to 0, 2 bytes to
1, and 4 bytes to 3.

Note that this preserves the current behaviour of silently accepting
invalid transfer bit widths.

Signed-off-by: Michael Hope <michaelh@juju.nz>
2025-06-16 14:01:54 -04:00
Benjamin Cabé
bc03f23d50 drivers: dma: fix off-by-one error in silabs LDMA
Channel numbers are 0-based so a channel number equal to the number of
channels is invalid.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-16 10:43:00 -04:00
Tahsin Mutlugun
f7d315cf49 drivers: dma: max32: Handle channel index conversion in HAL
Handle SoC-level differences in channel numbering logic in HAL.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-06-10 08:47:42 +02:00
Furkan Akkiz
85ef719eb2 drivers: dma: Add a wrapper function to fix build error
For MAX32657, 'MXC_DMA_EnableInt' function requires DMA instance
and this causes build error. To fix this, created wrapper version
of this function and update driver with it.

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
2025-06-10 08:47:42 +02:00
jacob kung
2fe357a592 drivers: dma: atcdmac300: add flush chain_block when Data cache is enabled
Add cache flush to ensure dma_chain is written back to memory
for DMA coherence

Signed-off-by: jacob kung <jacob.kung@egistec.com>
2025-06-10 08:47:34 +02:00
Mike J. Chen
9564a5e07b drivers: dma_mcux_lpc: fix bug using INPUTMUX
The typical way of calling INPUTMUX_AttachSignal() is to
bracket it around INPUTMUX_Init() and INPUTMUX_Deinit()
calls because we can reduce power consumption by not
keeping the interface powered when not changing INPUTMUX.

This driver was violating that convention, which caused
it to not coexist well with other code that followed the
usage convention because the INPUTMUX might be initialized
or not depending on execution order with the other modules.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-06-06 08:44:54 +02:00
Manuel Argüelles
77c2c454f7 drivers: dma: esp32: guard driver's kconfig options
Wrap the driver's options to prevent them from showing up in the global
Kconfig menu.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2025-06-03 09:15:28 +02:00
Daniel Baluta
85b6ff0b0b drivers: dma: sdma: Make access to DMA channel stats atomic
DMA channel stats like pending_length or free is not protected
and can be modified in parallel by a consumer and a producer.

This can result in non-atomic updates which in turn will result
in using stale data.

Fix this by making regions of code accessing dma stats atomic.

Fixes: e94c86f395 ("drivers: dma: Add initial support for NXP SDMA")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2025-05-28 20:02:31 +02:00
Daniel Baluta
312ff1c904 drivers: dma: sdma: Fix noise issue with pause/resume
Each time we configure an SDMA channel we also compute the total
allocated DMA buffer length but we assume is initialized with zero.

This is true each time a channel is requested. But if there are
multiple calls to configure without releasing the channel the buffer
length is not correctly computed.

So, we need to initialize it with zero each time we reconfigure the dma
channel.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2025-05-28 20:02:31 +02:00
5c2e2b7edc drivers: wch: fix the ch32vfun.h path after the recent HAL update
https://github.com/zephyrproject-rtos/zephyr/pull/87125 renamed the
`ch32vfun.h` header but missed some of the drivers. Fix.

Signed-off-by: Michael Hope <michaelh@juju.nz>
2025-05-28 05:54:28 +02:00
Mahesh Mahadevan
6698f3b4e8 drivers: dma: Add PM handler for NXP LPC DMA driver
Add the PM handler. Reinitialize the DMA block in the
TURN_ON action, this is needed for some SoC's after the system
exits certain power modes.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-05-19 21:54:55 +02:00
Anas Nashif
2aacbcaab5 style: add missing curly braces in if/while/for statements.
Add missing curly braces in if/while/for statements.

This is a style guideline we have that was not enforced in CI. All
issues fixed here were detected by sonarqube SCA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-17 14:10:33 +02:00
Hake Huang
0c5f13a599 tests: dma: enable dma test setting for NXP KE1XZ
NXP Ke1xz series need using mux starting from 60

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2025-05-16 19:00:17 +02:00
Kai Vehmanen
d411288bda dma: intel_adsp_hda: re-enable interrupts upon resume
Commit fa4a9db7a3 ("dma: intel_adsp_hda: Fix invalid init sequence and
register use") moved intel_adsp_hda_channels_init() out from resume
path. This causes a regression to CONFIG_DMA_INTEL_ADSP_HDA_TIMING_L1_EXIT
as without irq_config() call the interrupt configuration may be partial.

Address this by calling irq_config() unconditionally on resume path.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2025-05-14 15:19:06 +02:00
Sai Santhosh Malae
5572e49bc9 drivers: dma: siwx91x: DMA reload bug fix
Current DMA driver reload function only works for 8-bit
data. This is due to incorrect interpretation of size
argument. Added changes to support other xfer sizes.

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-05-13 22:21:30 -04:00
Vit Stanicek
eeaf860dfa dma_mcux_lpc: add host directions, DMA driver ctx, getter func
Add support for HOST_TO_MEMORY, MEMORY_TO_HOST directions (aliases of
MEMORY_TO_MEMORY). Implement dma_mcux_lpc_get_attribute function. Fix
missing DMA driver context.

Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
2025-05-05 18:07:15 +02:00