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>
This commit is contained in:
Song Qiang 2019-10-24 19:06:19 +08:00 committed by Kumar Gala
commit 749d2d21bf
27 changed files with 1307 additions and 698 deletions

View file

@ -107,4 +107,11 @@ config ADC_STM32
endif # ADC
if DMA
config DMA_STM32
default y
endif # DMA
endif # SOC_FAMILY_STM32

View file

@ -31,4 +31,11 @@ config I2C_STM32_V2
endif # I2C_STM32
if DMA_STM32
config DMA_STM32_V2
default y
endif # DMA
endif # SOC_SERIES_STM32F0X

View file

@ -67,6 +67,10 @@
#include <stm32f0xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32f0xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F0_SOC_H_ */

View file

@ -28,4 +28,11 @@ config I2C_STM32_V1
endif # I2C_STM32
if DMA_STM32
config DMA_STM32_V2
default y
endif # DMA
endif # SOC_SERIES_STM32F1X

View file

@ -67,6 +67,10 @@
#include <stm32f1xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32f1xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F1_SOC_H_ */

View file

@ -36,4 +36,11 @@ config GPIO_STM32_PORTI
endif # GPIO_STM32
if DMA_STM32
config DMA_STM32_V1
default y
endif # DMA
endif # SOC_SERIES_STM32F2X

View file

@ -58,6 +58,10 @@
#include <stm32f2xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32f2xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F2_SOC_H_ */

View file

@ -28,4 +28,11 @@ config I2C_STM32_V2
endif # I2C_STM32
if DMA_STM32
config DMA_STM32_V2
default y
endif # DMA
endif # SOC_SERIES_STM32F3X

View file

@ -74,6 +74,10 @@
#include <stm32f3xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32f3xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F3_SOC_H_ */

View file

@ -34,9 +34,9 @@ config I2C_STM32_V1
endif # I2C_STM32
if DMA
if DMA_STM32
config DMA_STM32F4X
config DMA_STM32_V1
default y
endif # DMA

View file

@ -76,6 +76,10 @@
#include <stm32f4xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32f4xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F4_SOC_H_ */

View file

@ -50,4 +50,11 @@ config ENTROPY_STM32_RNG
endif # ENTROPY_GENERATOR
if DMA_STM32
config DMA_STM32_V1
default y
endif # DMA
endif # SOC_SERIES_STM32F7X

View file

@ -75,6 +75,10 @@
#include <stm32f7xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32f7xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F7_SOC_H_ */

View file

@ -25,4 +25,11 @@ config I2C_STM32_V2
endif # I2C_STM32
if DMA_STM32
config DMA_STM32_V2
default y
endif # DMA
endif # SOC_SERIES_STM32L0X

View file

@ -68,6 +68,10 @@
#include <stm32l0xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32l0xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32L0_SOC_H_ */

View file

@ -37,4 +37,11 @@ config ENTROPY_STM32_RNG
endif # ENTROPY_GENERATOR
if DMA_STM32
config DMA_STM32_V2
default y
endif # DMA
endif # SOC_SERIES_STM32L4X

View file

@ -90,6 +90,10 @@
#include <stm32l4xx_ll_adc.h>
#endif
#ifdef CONFIG_DMA_STM32
#include <stm32l4xx_ll_dma.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32L4X_SOC_H_ */