Commit graph

15 commits

Author SHA1 Message Date
Brett Witherspoon 33cb179b4f drivers: dma: stm32u5: set data length in bytes
The block data length field should be in bytes. Setting this to a value
that is not a multiple of the data size results in a user setting error.

Running the ADC DMA test prior to this commit:

west build -p -b nucleo_u575zi_q zephyr/tests/drivers/adc/adc_dma

E: Transfer Error.
I: tc: 0, ht: 0, dte: 0, ule: 0, use: 1
E: DMA sampling complete, but DMA reported error -5

Existing tests using DMA on the nucleo_u575zi_q were not effected
because they only use a data size of one and continue to function
as expected:

west build -p -b nucleo_u575zi_q zephyr/tests/drivers/spi/spi_loopback \
	-DOVERLAY_CONFIG="overlay-stm32-spi-dma.conf"

SUITE PASS - 100.00% [spi_loopback]: pass = 1, fail = 0, ...

west build -p -b nucleo_u575zi_q zephyr/tests/drivers/dma/loop_transfer

SUITE PASS - 100.00% [dma_m2m_loop]: pass = 3, fail = 0, ...

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-11 09:44:37 +02:00
Brett Witherspoon 6d9d44e2a5 drivers: dma: stm32u5: use correct tables for data width
The tables for the dest and src data width constants were incorrectly
swapped. This commit uses the correct constants and renames the tables.

This change is only cosmetic for the stm32u5 since these constants are
the same but the existing names were probably inherited from another
driver where the p_*/m_* prefix was more appropriate.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-11 09:44:37 +02:00
Brett Witherspoon f629f2c270 drivers: dma: stm32u5: enable error interrupts
Enable DMA error interrupts so that transfer errors are logged and
reported to the callback.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-11 09:44:37 +02:00
Cyril Fougeray 1be72d9888 dma: callback with 2 status codes for successful transfers
Make use of positive status values in the DMA callback to pass
info to the DMA client after a successful DMA operation.
A completed DMA transfer uses the status 0 while a reached
water mark uses the status 1.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-05-08 09:57:32 +02:00
Pieter De Gendt 6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Francois Ramu 93a1b61684 drivers: dma: stm32u5 dma driver with two dma instances
Add a second instance of DMA to the stm32 dma driver from the DTS
That can be found in the stm32H5 serie, where 2 GPDMA with 8 channels
are available. Rebuilding with Macro.
Use the dma_channels property of the dedive tree to count the nb
of dma channels: 16 or 8 (like in stm32h5).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-31 14:02:15 +02:00
Francois Ramu 4de473e4c9 drivers: dma for stm32u5 returns from a repeated start or stop command
On a repeated dma_start, the stm3u5 dma driver should return
immediately if it is already started.
On a repeated dma_stop, the stm3u5 dma driver should return
immediately if it is already stopped.
This like the dma driver does for other stm32 series.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-11 07:57:44 +09:00
Francois Ramu 9c49ee3e48 drivers: dma: stm32u5 dma with resume API function
Add the resume API function for the dma driver of the stm32U5 serie.
That completes the suspend API function.
Controlling the SUSPF bit of the GPDMA CR register is enough
to suspend/resume the channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-08 14:59:01 +00:00
Francois Ramu e5306ed8e3 drivers: dma: stm32u5 do not reset the dma channel when suspending
There is no need to reset the channel else DMA config is lost and
channel should be enabled again in case of resume.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-08 14:59:01 +00:00
Francois Ramu 1299c78c18 drivers: dma: stm32u5 dma drivers has a suspend function
Gives the stm32u5 dma driver a suspend function to
enhance the dma API.
This is a particular feature of the stm32U5 GPDMA
to suspend a channel.
A delay is required  ;1ms is compatible with both stm32u5 platforms.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu 6500c2377c drivers: dma: stm32u5 dma keep initial DMA_InitStruct
There is no reason to set DMA_InitStruct with same fields
as the LL_DMA_StructInit sets.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu c81dba6d45 drivers: dma stm32U5 GPDMA keeps the channel busy if overriden
For the stm32U5 serie, the busy flag is handled as other serie.
When the DMA is overriden by other HAL drivers, the busy flag
is not considered.
Refer to https://github.com/zephyrproject-rtos/zephyr/pull/47645
There is no Mux for this GPDMA and fixed 16 channels.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 12:00:00 +00:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Guillaume Gautier aba432348b drivers: Cleans variable scopes for STM32 drivers
Fix the scope of some variables in various STM32 drivers including:
 - SDMMC
 - DMA
 - OSPI/QSPI Flash
 - Interrupt controller

The variables are set static instead of global and const if appropriate.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-10-12 18:41:48 +02:00
Francois Ramu 3fafe7fdee drivers: dma: new dma peripheral driver for stm32u5
It includes the definition for the DMA peripheral of this type,
present on stm32U5 devices.
A particular DMA_STM32U5 config is selected for that purpose.
The driver is derived from the existing dma_stm32.c
The GPDMA is counting channels (0-15) ; stream offset is 0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-24 10:05:32 +02:00