Some options from xilinx driver were enabled when other unrelated
drivers were enabled. Add a conditional to prevent that.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add DEVICE_DT_GET_COMMA helper macro to include/zephyr/device.h to
easily get a device pointer followed by a comma when expanding
devicetree foreach iterators like DT_FOREACH_STATUS_OKAY.
Update samples, drivers, and tests to use the common definition.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
Two-line copyright notices were wrapped in the SPDX "<text>...</text>"
construct, which is only valid in an SPDX document, not a file header.
The REUSE tool then folds the literal "<text>" into the holder name
and drops the second line from the SBOM.
Remove the markers and tag the continuation line. Holder, year and
e-mail are left unchanged; only the syntax is fixed.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
axi_dmac_isr() was defined unconditionally, but only referenced via
IRQ_CONNECT when the devicetree node has an interrupts property. A
core synthesized without an interrupt line (dma_get_status() drives
the state machine by polling instead) failed the build with
-Werror=unused-function. Guard the definition the same way
drivers/watchdog/wdt_dw.c does for the identical situation.
Adds a build-only test targeting arty_a7 covering both the IRQ-driven
and the no-IRQ polling configuration, since this AXI core only exists
in FPGA fabric with no SoC/board to instantiate it on.
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Provides DMA transfers for AXI-Stream peripherals through the standard
Zephyr DMA API, supporting both one-shot and cyclic capture modes. In
cyclic mode the transfer is automatically resubmitted on completion,
keeping the destination buffer continuously updated with no CPU
involvement. Cores synthesized without an interrupt line are driven
through the polling path in dma_get_status().
CONFIG_DMA_ADI_AXI_DMAC is auto-selected when DT_HAS_ADI_AXI_DMAC_ENABLED.
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Add support for both dedicated and shared IRQ lines based on
devicetree configuration using num-dedicated-irqs property.
- Dedicated IRQ: One IRQ per channel, uses CHINTFLAG register
- Shared IRQ: Multiple channels share one IRQ, uses INTPEND register
- Generate IRQ ISR functions using LISTIFY macro
- IRQ type (dedicated/shared) determined at compile time from DTS
Example: num-dedicated-irqs = <4> means ch0-ch3 have dedicated IRQs,
ch4+ share the remaining IRQ line.
Note: This dual-path design is required by hardware behavior, not just
an optimization. Channels with dedicated interrupt lines do not refresh
the INTPEND register (as per datasheet section 24.5.4), so the shared
handler using INTPEND is valid only for multiplexed channels, while
dedicated channels must use CHID and CHINTFLAG directly.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
CH_RESUME_WE() and CH_RESUME() expand to bit masks, but resume
passed them to WRITE_BIT(), which expects bit positions, shifting
by the mask value and leaving the suspend bit untouched. Operate
on the masks directly.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Adding a new DMA driver for the PSE84 AXIDMAC hardware based on the
Infineon PDL driver. The AXIDMAC is a high performance DMA controller
that uses the AXI bus. It is typically used for large memory-to-memory
transactions.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Brett Peterson <brett.peterson@infineon.com>
Update driver to use new HAL library that supports both
Series 2 and Series 3 SoCs that share the same IP.
Split the check for transfer doneness in the block append
function into semantically equivalent parts: Check CHSTATUS
to see if the channel is active when appending a block, and
check CHDONE in the ISR.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The DMADRV HAL is deprecated, switch to DMA manager HAL for
channel allocation bookkeeping.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
A dma_block_config whose block_size is zero is accepted and turned into
a descriptor that is handed to the hardware with a length of zero and
the owner bit set to DMA.
Because block_size is already zero when the loop reaches the test for
"did this block finish", the iteration behaves as though the block were
complete, so a chain containing a zero-length block silently gains a
zero-length link, and a single zero-length block produces a chain that
transfers nothing while dma_config() returns success.
dma_esp32_reload() has the same shape and sets the same owner bit, so a
reload of size zero reaches the hardware the same way.
Reject both rather than skipping them. Skipping would change the
observable structure of the block chain the caller described, and a
caller that passes zero has almost certainly made an arithmetic mistake
it would rather hear about.
Fixes#115720
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
dma_esp32_reload() resets the channel and rebuilds the descriptor list
before it can discover that the transfer does not fit. When it does not,
the list is memset to zero and -EINVAL returned, so a reload that was
refused has already destroyed the transfer that was configured before
it.
Compare the requested size against the pool the descriptors can cover
first, and return before the reset. The walk keeps its own check as a
backstop.
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
Three loops over desc_list took their limit from
CONFIG_DMA_ESP32_MAX_DESCRIPTOR_NUM while the exhaustion check beneath
them uses ARRAY_SIZE() of the same array. The two agree today, because
that is what sizes the array, but they are two statements of one fact
and only one of them follows the array if it ever changes.
Use ARRAY_SIZE() in all three. No behaviour change.
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
dma_esp32_stop() handled a memory-to-memory channel by disabling and
stopping both directions, and then fell straight into the per-direction
block, which stopped one of them a second time. There was no return and
no else between the two.
A memory-to-memory channel still carries a dir of DMA_RX or DMA_TX from
dma_esp32_config_rx() or dma_esp32_config_tx(), so one of the two arms
always matched.
The second stop is redundant in the driver's intended control flow.
Nothing here measures what the hardware does with a repeated stop, so
this is not offered as an equivalence: a M2M channel now takes one
interrupt disable and one stop per direction instead of two for one of
them. It is worth removing on its own terms, because the function reads
as though the two blocks are alternatives when they are not, and any
step added to the stop sequence later would be duplicated silently.
Chain the branches, which is what dma_esp32_start() directly above
already does with the same three cases.
Fixes#115503
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
Five entry points formed the channel pointer from the caller's index
before validating it:
struct dma_esp32_channel *dma_channel =
&config->dma_channel[channel];
if (channel >= config->dma_channel_max) {
LOG_ERR("Unsupported channel");
return -EINVAL;
}
Nothing is dereferenced before the check, so no wrong memory is read
today, but forming a pointer more than one past the end of an array is
undefined behaviour in C. It also gives the compiler licence to assume
the index is in range, and the thing it would be assuming away is the
check on the very next line.
dma_esp32_reload() went one step further and computed desc_iter from the
unvalidated pointer too.
Move each derivation below its check. Behaviour is unchanged for every
in-range channel; for an out-of-range one the driver no longer forms a
pointer the standard leaves undefined.
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
dma_esp32_config_descriptor() and dma_esp32_reload() both walk desc_list
with a pointer that advances once per iteration, and both then test for
descriptor exhaustion by dereferencing that pointer after the loop has
ended. The loop bound equals the array size, so a loop that runs to
completion leaves the pointer one past the last element and the test
reads out of bounds. In dma_esp32_reload() the error branch then writes
there as well.
config->dma_channel is an array of struct dma_esp32_channel, so the
memory just past one channel's desc_list is that channel's remaining
members or the next channel's. That memset lands in a live neighbouring
object rather than in padding.
There is a second consequence in dma_esp32_config_descriptor(). If the
out-of-bounds read happens to yield zero, the function reports success
while desc_list[N - 1].next still points at desc_list + N, so the
hardware is handed a chain that runs off the end of the array. Whether
the caller gets -EINVAL or a corrupt chain depends on the bytes that
happen to follow.
Compare the pointer against the end of the array instead. A loop that
breaks early exits with desc_iter below the end, and a loop that ran out
of descriptors exits with it exactly at the end, so the comparison
answers the same question the dereference was trying to answer without
forming an access. Comparing against one past the end is well defined.
dma_esp32_reload() also gains the whole-array clear that
dma_esp32_config_descriptor() already performs on this path, in place of
the single out-of-bounds descriptor it used to clear. Leaving a half
built chain behind on an error return serves no purpose.
Fixes#115502
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
- Set burst_len to 1 when zero, since CSZ=0 (zero bytes per trigger)
causes WRE/RDE interrupt errors
Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
Convert cached flash addresses to non-cached flash addresses in Realtek
Bee DMA driver. Without this conversion, DMA may access an invalid flash
mapping and read back 0xdeadbeef.
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.
This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with Linux shell commands like the one below and manually selecting the
applicable changes: only those located in drivers/ since soc/, boards/,
samples/ and tests/ content related to Espressif is addressed in
pull request https://github.com/zephyrproject-rtos/zephyr/pull/112190.
$ ./scripts/check_quoted_includes.py -w \
`./scripts/get_maintainer.py list "Espressif Platforms"`
Also update drivers/clock_control/clock_control_esp32_priv.h that was
not listed by './scripts/get_maintainer.py list "Espressif Platforms"'.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The GPDMA ownership register is a 16-bit MMIO register. Using
sys_write32() triggers a load/store width exception under LLVM strict
alignment checking. Replace with sys_write16() to match the actual
register width.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On STM32N6, HPDMA1 channels are subject to RIF CID filtering.
Channels reach the driver with no CID claimed (CCIDCFGR reads zero),
and transfers on such channels silently move no data: the transfer
completes and raises a transfer-complete event, but the destination
is untouched. GPDMA1 is unaffected; the vendor isolation API is
documented as HPDMA-only.
Claim CID1 (the CPU compartment) during controller initialization
using the LL isolation accessors, mirroring the vendor HAL's
HAL_DMA_SetIsolationAttributes().
Signed-off-by: Sher Amir Singh Dullat <sheramir51@gmail.com>
The width selectors are matched against the configured data sizes,
which are byte counts, but the word and long constants held enum
style values of three and four. A 32-bit element therefore
selected the 64-bit hardware width and the word width was
unreachable. Use the actual byte counts of four and eight.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The DMA Pico ISR disables the channel interrupt for the channel that
triggered it. A commonly used pattern is to start another DMA transfer from
inside the callback such as in `i2s_stm32.c` without configuring again by
calling the dma_reload() and dma_start() functions. Previously, the
dma_start() function re-enabled the channel interrupt and started the DMA
transfer whereas dma_reload() set the source and destination addresses and
started the DMA transfer. Calling either function on its own does not
produce the desired effect and calling both starts the DMA transfer twice.
The only remaining option would be to call dma_config() for every
transmission which is wasteful. This change brings the RPi Pico DMA API
functionally closer in line with the STM32 DMA API allowing dma_reload()
followed by dma_start() to correctly restart a DMA transfer with a
different source/destination address and enable the appropriate callback.
Signed-off-by: Robin Sachsenweger Ballantyne <makenenjoy@gmail.com>
The base controller holds channels 0 to 7, but the interrupt flag
lookup, flag clearing and ISR dispatch all treated channel 8 as a
base channel, shifting the 32-bit flag registers by 32 and leaving
the first extended slot unreachable. Split at eight consistently.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
get_status() indexed the channel table before validating the
channel and accepted a channel equal to the channel count, reading
one past the array. Validate first with an exclusive bound like
the other entry points.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
In the memory-to-memory path the RX configuration result was
immediately overwritten by the TX call, so a failed RX descriptor
setup was reported as success.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
A priority equal to the table size passed the check and read one
entry past the priority table.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Without ATTR_ATTACH and sleep_retention_module_attach(), GDMA channels
are created but not retained, so peripheral_domain_pd_allowed() stays
false and TOP never powers down in light sleep. Fix lowers light sleep
current when GDMA and peripheral power down are enabled.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Recent HAL update moved GDMA sleep-retention definitions from
hal/gdma_periph.h into the esp_driver_dma component. Include gdma_priv.h
and use the new gdma_retention_desc_t / gdma_retention_infos names in
place of the removed gdma_chx_reg_ctx_link_t / gdma_chx_regs_retention.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Two issues fixed for multi-fragment scatter-gather TX support:
- Completion callback was fired per descriptor; now fires only on the
EOF descriptor so the ethernet driver unrefs net_pkt once per packet.
- Ring reset (memset, index reset, CURDESC write) is skipped when the
DMA is not halted to avoid corrupting an active ring.
Signed-off-by: Venkatesh Odela <venkatesh.odela@amd.com>
The DMA main soft-reset bit is self-clearing and clears the block
enable while it is in progress. The previous sequence wrote the
enable bit immediately after the reset request (separated only by a
dummy I/O-delay write), so the enable could be dropped if the reset
had not yet finished. Poll the self-clearing SRST bit until it reads
back zero before setting the enable bit.
Signed-off-by: Scott Worley <scott.worley@microchip.com>
Add a Kconfig option, DMA_MCHP_XEC_DMAC_MAX_CHANNELS, defaulting to the
dmac node's dma-channels devicetree property,
Updated PCR and GIRQ properties of DMA node to use new macros
Also removed the XEC_DMA_DEBUG logic.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
Replace the CMSIS-style packed-struct register overlays
with register offset constants accessed via the Zephyr
sys_read32/sys_write32/sys_set_bit/sys_clear_bit helpers.
Signed-off-by: Scott Worley <scott.worley@microchip.com>
Add three TDM DAI instances (tdm_dai0/1/2) and one unified
acp_tdm_dma DMA controller node to the ACP 7.X device tree.
Update dma-channels default to 6 (2 per instance x 3 TDM
instances) in Kconfig.acp_tdm.
Signed-off-by: DineshKumar Kalva <DineshKumar.Kalva@amd.com>
Signed-off-by: Sneha Voona <sneha.voona@amd.com>
Extend the ACP TDM DMA driver for ACP 7.X:
- Include ACP 7.X chip headers (acp7x_fw_scratch_mem.h,
acp7x_chip_offsets.h, acp7x_chip_reg.h).
- Update ACP_TDM1_FIFO_SIZE from 512 to 768 bytes
- Add ACP_PDM_2_Enable check in acp_pdm_streams_stopped() for
ACP 7.X (2 PDM instances)
- Guard acp_sdw_all_streams_stopped() under CONFIG_SOC_ACP_7_0
since ACP 7.X has no SDW logic implemented.
- Add acp_get_sample_len_from_frame_fmt() helper for 7.X
- Propagate frame_fmt from acp_tdm_context into dma_start for
per-sample-length ITER/IRER configuration
- Default channel count changed from 8 to 6 (2 per TDM instance
x 3 instances for ACP 7.X)
Signed-off-by: DineshKumar Kalva <DineshKumar.Kalva@amd.com>
Signed-off-by: Sneha Voona <sneha.voona@amd.com>
ADd `brcm,iproc-pcie-ep-v2` to represent the version difference
with `brcm,iproc-pcie-ep`.
This property can replace the CONFIG_PCIE_EP_IPROC_V2.
So, we removed it.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
The FIFO error flag is triggered either by wrong configuration
or by overrun/underrun condition. The configuration is handled
by stm32_dma_check_fifo_mburst function. For overrun/underrun
condition, there is no data loss, so it is rather warning
and can be ignored.
Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
Wire the gdma driver to the esp32p4 AXI and AHB DMA instances,
selecting the per-bus LL calls and 8-byte aligned descriptors so
both buses work through the common driver.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Introduce Xilinx ADMA driver.
Features:
- Support for Xilinx ZynqMP ADMA (xlnx,zynqmp-dma-1.0)
and AMD Versal2 ADMA (amd,versal2-dma-1.0)
- Simple mode for single block memory-to-memory transfers
- Scatter-Gather mode for multi-block linked descriptor transfers
- Configurable 64-bit and 128-bit bus width support
- Maximum burst length of 256 beats for source and destination
- 64-bit addressing capability
- Software-managed cache coherency via flush/invalidate operations
- Optional hardware cache-coherent mode (device tree configurable)
- Interrupt-driven transfers with completion callbacks
- Error detection and reporting (AXI errors, overflow)
- Channel filtering support
Signed-off-by: Abin Joseph <abin.joseph@amd.com>
find_msb_set() returns 0 for a 0 argument, so the unconditional
"find_msb_set(cfg->source_burst_length) - 1" underflowed msize to
UINT_MAX when source_burst_length was 0, clobbering the msize = 3
default set at declaration.
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
dma_nxp_gdma_init() runs at PRE_KERNEL_1 and emitted an unconditional
LOG_INF on the init success path. Under the default deferred logging
mode that log captures a timestamp via the system clock, which on
RW612 is not initialized until PRE_KERNEL_2, hanging boot on frdm_rw612
(seen with the lvgl sample). ztest masks it by defaulting to minimal
logging, which takes no timestamp.
Other DMA drivers that log on init success run at POST_KERNEL, after
the clock is up; nxp_gdma is the only one doing so at PRE_KERNEL_1.
Remove the line to avoid the early-boot hang.
Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
The DMAMUX driver used direct calls to functions in the drivers for the
actual DMA controllers... but was doing so using a dispatch table, which
was effectively a duplicate of the existing DMA API.
Use the DMA API directly and drop the handrolled dispatch table, while
also cleaning up the DMA drivers which don't need to export functions
anymore when the DMAMUX driver is enabled.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Per DMA API, the `<dir>_burst_length` parameters are number of bytes;
however, the burst size for STM32 DMAv1 is in number of beats per burst,
not in number of bytes (where each "beat" = `<dir>_data_size` bytes).
Update driver to compute burst sizes properly instead of using the raw
`<dir>_burst_length` value as number of beats.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>