Commit graph

14 commits

Author SHA1 Message Date
Benjamin Björnsson bd7929ce1a drivers: dma: dma_stm32: add stm32c0-series support
Add support for dma on the stm32c0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-05-27 06:21:39 -04:00
Francois Ramu 227226313a drivers: dma: stm32 dma driver support repeated start/stop
To support the repeated start/stop, the stm32 dma driver is
returning 0 if the channel is already started/stopped.
This is not done at the dmamux level if any.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-19 12:03:50 +01:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Thomas Stranger 1e3512c94e drivers/dma: stm32: don't omit IRQ status check in dma_is_irq_active
Fix stm32_dma_is_irq_active not checking the IRQ status(IsEnabled) for
active interrupts.
While the transfer-complete, half-transfer comp.  and transfer-error
is_XX_irq_active() functions check for IRQ status (IsEnabled),
ORing the result with dma_stm32_is_gi_active() overrides the
status check as gi is always 1 in case any of these flags is active.
Related to commit 96c92ed93f.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Erwan Gouriou 96c92ed93f drivers/dma: stm32: Don't omit IRQ status check
When checking for IRQ flags, we should also check
for IRQ status (IsEnabled ?).
If this is not done we can end up in Half Transfer
interrupt processing while it is not enabled.

Additionaly always use the id translation function
in LL API calls.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-04 12:35:04 -05:00
Alexandre Bourdiol 41621ba0bf drivers: dma: dma_stm32_v2: typo in compilation switch
For example, LL_DMA_IFCR_CTEF6 doesn't exist,
it must be replaced by LL_DMA_IFCR_CTEIF6.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-11 09:31:27 -05:00
Erwin Rol 113b016b51 drivers: dma: stm32: change order of disabling and checking result
The stm32_dma_disable_stream first checked if the stream was
disabled and if so returned OK. If it wasn't disabled it
tried to disable it and returned -EAGAIN.

The function is used in loops that try to disable the stream
by calling this function and if it fails wait for 1ms and
retry.

Becuase this function the first time (if the stream wasn't
disabled already) fails there is always a 1 ms delay. For
the SPI driver, that has a RX and TX stream, this means
a 2ms delay between the last data and CS going high.

By first trying to disable the stream and than checking
if it succeded most of the time the first call disables
the stream and the 1ms delay isn't needed.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-04 12:00:37 +02:00
Erwin Rol 3866b39bb2 drivers: dma: stm32: remove global function tables
Convert the driver from global function tables to functions
that use static const function tables.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol b05dc440e0 drivers: dma: stm32: convert global conversion tables to functions
Convert global conversion tables for id-to-stream and slot-to-channel
to functions that use local const static conversion tables.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol 67f68e68f1 drivers: dma: stm32: refactor irq handling
- Remove the need for kmalloc
- On hardware that supports it use 1 IRQ handler per stream to
  determine the stream ID, so the ISR does not have to loop
  over all ID's to see which one is active. On hardware (like
  STM32L0 and STM32F0) where up to 7 streams share 3 IRQ's use
  the loop to check which stream is active.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Francois Ramu 60644a3e2c drivers: dma: irq handler of the dma_stm32
define the irq handler in case of DMA V1 or V2,
for the stm32x soc series
with DMA V1 raise Fifo Error if enabled
with V2, handle the Global Interrupt

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-17 03:13:02 -05:00
Francois Ramu 53dec09037 driver: dma: update for different dma channels
This patches defines constants from dma registers
depending on the dma configuration of the stm32 soc
Some devices have 6 or 7 or 8 dma channels per dma instance

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-01-28 12:58:44 -06:00
Song Qiang 749d2d21bf drivers: dma: add generic driver support for some series of stm32
This commit adds driver support for DMA on f0/f1/f2/f3/f4/l0/l4
series stm32.

Notice due to some bugs, this is currently not working with f7.

There are two kinds of IP blocks are used across these stm32, one is the
one that has been used on F2/F4/F7 series, and the other one is the one
that has been used on F0/F1/F3/L0/L4 series.

Memory to memory transfer is only supported on the second DMA on
F2/F4 with 'st,mem2mem' to be declared in dts.

This driver depends on k_malloc to allocate memory for stream instances,
so CONFIG_HEAP_MEM_POOL_SIZE must be big enough to hold them.

Common parts of the driver are in dma_stm32.c and SoC related parts are
implemented in dma_stm32_v*.c.

This driver has been tested on multiple nucleo boards, including
NUCLEO_F091RC/F103RB/F207ZG/F302R8/F401RE/L073RZ/L476RG with the
loop_transfer and chan_blen_transfer test cases.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
2019-11-06 14:14:39 +01:00