Fix the STM32 DMA driver did not check if the optional dma_callback was
set in dma_stm32_configure(). This could lead to a hard fault when an
interrupt occurs and the callback is NULL, even though the API allows
the callback to be omitted.
Fixes#97454
Signed-off-by: Wenxi Xu <xuwenxi0517@gmail.com>
GPDMA does not support DMA_ADDR_ADJ_NO_CHANGE with a memory buffer. This
feature is required fro the SPI driver. Hopefully, SPI driver is the only
user of this feature.
Therefore, this commit introduces a hack for SPI. When the user want to
ignore the Rx data (= when he pass a NULL pointer for the Rx buffer),
rather than overwriting the destination in a loop, we just disable the rx
DMA.
This introduce a limitation: since Rx DMA stop early, any following Rx
request will start earlier than expected. Therefore, this patch breaks
cases with interleaved Rx buffers. In other words, the NULL buffer must be
the last one.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
GPDMA does not support DMA_ADDR_ADJ_NO_CHANGE with a memory buffer. This
feature is required for the SPI driver. Hopefully, SPI driver is the only
user of this feature.
Therefore, this commit introduces a hack for SPI. When the user request an
Rx transaction, rather than copying content of mosi_overrun parameter, it
configures the DMA to fill the destination memory (with either 0s or 1s).
Obviously, this only works if mosi_overrun is 0x00 or 0xFF. Hopefully, none
will need any other value.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Since the single-linked list management is well localized, the variable
names can now be abbreviated a bit.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
The management of the single-linked list was made in various places:
- RSI_GPDMA_BuildDescriptors()
- after sys_mem_blocks_alloc()
- at the end of the loop
Centralize it at the end of the loop.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Improve the STM32 DMA driver to only enable transfer and half-transfer
interrupts if the interrupt handler has effects beside clearing the
isr flag. This improves system performance as unnecessary interrupts
are no longer raised by the hardware.
Signed-off-by: Axel Utech <utech@sofiha.de>
GPDMA hardware block has some requirement regarding the buffers alignments.
Note the previous condition was too permissive. It ignored
source_burst_length during the check of the transaction size.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
The Kconfig symbols for selecting HAL content should be part
of the HAL module integration, not defined by the SoC. Split the
symbols between the Series 0/1 Gecko HAL and Series 2 SiSDK HAL
when moving them.
For now, the Series 0/1 HAL symbols retain their name, while new
names consistent with the symbols already defined in the module
integration layer are used for the Series 2 HAL.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
As the number of DMA channels could be different between DMA instances,
get the number from "XDMAC Global Type Register" and validate the
channel used.
Signed-off-by: Tony Han <tony.han@microchip.com>
In case of using HAL_OVERRIDE, avoid clearing the FIFO ERROR flag
before calling the HAL DMA IrqHandler so that the HAL DMA code
handling can be used.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
If hal_override is set, avoid reporting an error and clear the
transfer error (TE) bit so that HAL code can properly handle it.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Support EDMAv3 platform that do not have dmamux or always on capability.
Therefore, memory to memory transfer is limited in this environment.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Co-authored-by: Emilio Benavente <emilio.benavente@nxp.com>
DMA syscalls as they were implemented were unsafe. Accepting a void* was
never acceptable as many things could not be verified about it.
Accepting a channel identifier meant that a user mode thread could
start/stop any DMA channel which in theory could be owned by any other
driver. This shouldn't be possible.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Function stm32_dma_config_channel_function is unused hence remove it
from headers and dma_stm32_v1. In case of dma_stm32_v1, the related
configuration is already part of the LL_DMA_Init call done in
another place in dma_stm32.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
The dma_stm32_slot_to_channel function is only applicable on the
STM32Fx series since the LL_DMA_CHANNEL_x macros only exist for those
platforms among the one based on st,stm32-dma-v1.
While checking for !defined(CONFIG_DMAMUX_STM32) is ok to enable this
on STM32Fx, it prevents to disable dmamux on other platforms since
required symbols do not exist.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Convert address for dma when update tcd registers.
- This commit fixes a bug that dma reports source/destination bus errors
when dma try to access the unconveted addresses. The unconverted
addresses will be reserved address from dma view.
Signed-off-by: Biwen Li <biwen.li@nxp.com>
Add power management state validation in dw_dma_get_status() to ensure
the device is in active state before attempting to read DMA status.
Returns -EINVAL if device is not active, preventing potential issues
when accessing hardware registers while device is suspended.
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>