Browse Source

devicetree: spi: stm32h7: Allow to enable SPI FIFO from DT

Allow to enable/disable the STM32 SPI FIFO usage from
devicetree.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
pull/68425/head
Daniel Gaston Ochoa 2 years ago committed by Fabio Baltieri
parent
commit
cc9c90c767
  1. 5
      drivers/spi/spi_ll_stm32.c
  2. 1
      drivers/spi/spi_ll_stm32.h
  3. 4
      dts/bindings/spi/st,stm32h7-spi.yaml

5
drivers/spi/spi_ll_stm32.c

@ -1146,7 +1146,9 @@ static void spi_stm32_irq_config_func_##id(const struct device *dev) \ @@ -1146,7 +1146,9 @@ static void spi_stm32_irq_config_func_##id(const struct device *dev) \
#define SPI_DMA_STATUS_SEM(id)
#endif
#define SPI_SUPPORTS_FIFO(id) DT_INST_NODE_HAS_PROP(id, fifo_enable)
#define SPI_GET_FIFO_PROP(id) DT_INST_PROP(id, fifo_enable)
#define SPI_FIFO_ENABLED(id) COND_CODE_1(SPI_SUPPORTS_FIFO(id), (SPI_GET_FIFO_PROP(id)), (0))
#define STM32_SPI_INIT(id) \
STM32_SPI_IRQ_HANDLER_DECL(id); \
@ -1161,6 +1163,7 @@ static const struct spi_stm32_config spi_stm32_cfg_##id = { \ @@ -1161,6 +1163,7 @@ static const struct spi_stm32_config spi_stm32_cfg_##id = { \
.pclken = pclken_##id, \
.pclk_len = DT_INST_NUM_CLOCKS(id), \
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id), \
.fifo_enabled = SPI_FIFO_ENABLED(id), \
STM32_SPI_IRQ_HANDLER_FUNC(id) \
IF_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_subghz), \
(.use_subghzspi_nss = \

1
drivers/spi/spi_ll_stm32.h

@ -34,6 +34,7 @@ struct spi_stm32_config { @@ -34,6 +34,7 @@ struct spi_stm32_config {
#endif
size_t pclk_len;
const struct stm32_pclken *pclken;
bool fifo_enabled;
};
#ifdef CONFIG_SPI_STM32_DMA

4
dts/bindings/spi/st,stm32h7-spi.yaml

@ -27,3 +27,7 @@ properties: @@ -27,3 +27,7 @@ properties:
description: |
(Master SS Idleness) minimum clock inserted between
start and first data transaction.
fifo-enable:
type: boolean
description: Enable the SPI FIFO usage for performance improvement.

Loading…
Cancel
Save