drivers/spi: stm32: Use device tree for device clock configuration
Use DT generated symbols to configure clock bus/bits of STM32 SPI devices. Fixes #10447 Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
d3c5a4964b
commit
121d68f379
8 changed files with 57 additions and 11 deletions
|
@ -486,13 +486,8 @@ static void spi_stm32_irq_config_func_1(struct device *port);
|
|||
static const struct spi_stm32_config spi_stm32_cfg_1 = {
|
||||
.spi = (SPI_TypeDef *) DT_SPI_1_BASE_ADDRESS,
|
||||
.pclken = {
|
||||
#ifdef CONFIG_SOC_SERIES_STM32F0X
|
||||
.enr = LL_APB1_GRP2_PERIPH_SPI1,
|
||||
.bus = STM32_CLOCK_BUS_APB1_2
|
||||
#else
|
||||
.enr = LL_APB2_GRP1_PERIPH_SPI1,
|
||||
.bus = STM32_CLOCK_BUS_APB2
|
||||
#endif
|
||||
.enr = DT_SPI_1_CLOCK_BITS,
|
||||
.bus = DT_SPI_1_CLOCK_BUS
|
||||
},
|
||||
#ifdef CONFIG_SPI_STM32_INTERRUPT
|
||||
.irq_config = spi_stm32_irq_config_func_1,
|
||||
|
@ -529,8 +524,8 @@ static void spi_stm32_irq_config_func_2(struct device *port);
|
|||
static const struct spi_stm32_config spi_stm32_cfg_2 = {
|
||||
.spi = (SPI_TypeDef *) DT_SPI_2_BASE_ADDRESS,
|
||||
.pclken = {
|
||||
.enr = LL_APB1_GRP1_PERIPH_SPI2,
|
||||
.bus = STM32_CLOCK_BUS_APB1
|
||||
.enr = DT_SPI_2_CLOCK_BITS,
|
||||
.bus = DT_SPI_2_CLOCK_BUS
|
||||
},
|
||||
#ifdef CONFIG_SPI_STM32_INTERRUPT
|
||||
.irq_config = spi_stm32_irq_config_func_2,
|
||||
|
@ -567,8 +562,8 @@ static void spi_stm32_irq_config_func_3(struct device *port);
|
|||
static const struct spi_stm32_config spi_stm32_cfg_3 = {
|
||||
.spi = (SPI_TypeDef *) DT_SPI_3_BASE_ADDRESS,
|
||||
.pclken = {
|
||||
.enr = LL_APB1_GRP1_PERIPH_SPI3,
|
||||
.bus = STM32_CLOCK_BUS_APB1
|
||||
.enr = DT_SPI_3_CLOCK_BITS,
|
||||
.bus = DT_SPI_3_CLOCK_BUS
|
||||
},
|
||||
#ifdef CONFIG_SPI_STM32_INTERRUPT
|
||||
.irq_config = spi_stm32_irq_config_func_3,
|
||||
|
|
|
@ -92,11 +92,16 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_FIFO_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_FIFO_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_FIFO_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40013000_CLOCK_BUS
|
||||
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_FIFO_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_FIFO_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_FIFO_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_CAN_1_BASE_ADDRESS DT_ST_STM32_CAN_40006400_BASE_ADDRESS
|
||||
#define DT_CAN_1_BUS_SPEED DT_ST_STM32_CAN_40006400_BUS_SPEED
|
||||
|
|
|
@ -121,11 +121,15 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_40013000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_3_BASE_ADDRESS DT_ST_STM32_SPI_40003C00_BASE_ADDRESS
|
||||
#define DT_SPI_3_IRQ_PRI DT_ST_STM32_SPI_40003C00_IRQ_0_PRIORITY
|
||||
|
|
|
@ -114,21 +114,29 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_FIFO_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_FIFO_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_FIFO_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40013000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_FIFO_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_FIFO_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_FIFO_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_3_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40003C00_BASE_ADDRESS
|
||||
#define DT_SPI_3_IRQ_PRI DT_ST_STM32_SPI_FIFO_40003C00_IRQ_0_PRIORITY
|
||||
#define DT_SPI_3_NAME DT_ST_STM32_SPI_FIFO_40003C00_LABEL
|
||||
#define DT_SPI_3_IRQ DT_ST_STM32_SPI_FIFO_40003C00_IRQ_0
|
||||
#define DT_SPI_3_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40003C00_CLOCK_BITS
|
||||
#define DT_SPI_3_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40003C00_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_4_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40013C00_BASE_ADDRESS
|
||||
#define DT_SPI_4_IRQ_PRI DT_ST_STM32_SPI_FIFO_40013C00_IRQ_0_PRIORITY
|
||||
#define DT_SPI_4_NAME DT_ST_STM32_SPI_FIFO_40013C00_LABEL
|
||||
#define DT_SPI_4_IRQ DT_ST_STM32_SPI_FIFO_40013C00_IRQ_0
|
||||
#define DT_SPI_4_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40013C00_CLOCK_BITS
|
||||
#define DT_SPI_4_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40013C00_CLOCK_BUS
|
||||
|
||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_ST_STM32F3_FLASH_CONTROLLER_40022000_BASE_ADDRESS
|
||||
#define DT_FLASH_DEV_NAME DT_ST_STM32F3_FLASH_CONTROLLER_40022000_LABEL
|
||||
|
|
|
@ -167,31 +167,43 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_40013000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_3_BASE_ADDRESS DT_ST_STM32_SPI_40003C00_BASE_ADDRESS
|
||||
#define DT_SPI_3_IRQ_PRI DT_ST_STM32_SPI_40003C00_IRQ_0_PRIORITY
|
||||
#define DT_SPI_3_NAME DT_ST_STM32_SPI_40003C00_LABEL
|
||||
#define DT_SPI_3_IRQ DT_ST_STM32_SPI_40003C00_IRQ_0
|
||||
#define DT_SPI_3_CLOCK_BITS DT_ST_STM32_SPI_40003C00_CLOCK_BITS
|
||||
#define DT_SPI_3_CLOCK_BUS DT_ST_STM32_SPI_40003C00_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_4_BASE_ADDRESS DT_ST_STM32_SPI_40013400_BASE_ADDRESS
|
||||
#define DT_SPI_4_IRQ_PRI DT_ST_STM32_SPI_40013400_IRQ_0_PRIORITY
|
||||
#define DT_SPI_4_NAME DT_ST_STM32_SPI_40013400_LABEL
|
||||
#define DT_SPI_4_IRQ DT_ST_STM32_SPI_40013400_IRQ_0
|
||||
#define DT_SPI_4_CLOCK_BITS DT_ST_STM32_SPI_40013400_CLOCK_BITS
|
||||
#define DT_SPI_4_CLOCK_BUS DT_ST_STM32_SPI_40013400_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_5_BASE_ADDRESS DT_ST_STM32_SPI_40015000_BASE_ADDRESS
|
||||
#define DT_SPI_5_IRQ_PRI DT_ST_STM32_SPI_40015000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_5_NAME DT_ST_STM32_SPI_40015000_LABEL
|
||||
#define DT_SPI_5_IRQ DT_ST_STM32_SPI_40015000_IRQ_0
|
||||
#define DT_SPI_5_CLOCK_BITS DT_ST_STM32_SPI_40015000_CLOCK_BITS
|
||||
#define DT_SPI_5_CLOCK_BUS DT_ST_STM32_SPI_40015000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_6_BASE_ADDRESS DT_ST_STM32_SPI_40015400_BASE_ADDRESS
|
||||
#define DT_SPI_6_IRQ_PRI DT_ST_STM32_SPI_40015400_IRQ_0_PRIORITY
|
||||
#define DT_SPI_6_NAME DT_ST_STM32_SPI_40015400_LABEL
|
||||
#define DT_SPI_6_IRQ DT_ST_STM32_SPI_40015400_IRQ_0
|
||||
#define DT_SPI_6_CLOCK_BITS DT_ST_STM32_SPI_40015400_CLOCK_BITS
|
||||
#define DT_SPI_6_CLOCK_BUS DT_ST_STM32_SPI_40015400_CLOCK_BUS
|
||||
|
||||
#define DT_I2S_1_BASE_ADDRESS DT_ST_STM32_I2S_40013000_BASE_ADDRESS
|
||||
#define DT_I2S_1_IRQ_PRI DT_ST_STM32_I2S_40013000_IRQ_0_PRIORITY
|
||||
|
|
|
@ -199,31 +199,43 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_40013000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_3_BASE_ADDRESS DT_ST_STM32_SPI_40003C00_BASE_ADDRESS
|
||||
#define DT_SPI_3_IRQ_PRI DT_ST_STM32_SPI_40003C00_IRQ_0_PRIORITY
|
||||
#define DT_SPI_3_NAME DT_ST_STM32_SPI_40003C00_LABEL
|
||||
#define DT_SPI_3_IRQ DT_ST_STM32_SPI_40003C00_IRQ_0
|
||||
#define DT_SPI_3_CLOCK_BITS DT_ST_STM32_SPI_40003C00_CLOCK_BITS
|
||||
#define DT_SPI_3_CLOCK_BUS DT_ST_STM32_SPI_40003C00_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_4_BASE_ADDRESS DT_ST_STM32_SPI_40013400_BASE_ADDRESS
|
||||
#define DT_SPI_4_IRQ_PRI DT_ST_STM32_SPI_40013400_IRQ_0_PRIORITY
|
||||
#define DT_SPI_4_NAME DT_ST_STM32_SPI_40013400_LABEL
|
||||
#define DT_SPI_4_IRQ DT_ST_STM32_SPI_40013400_IRQ_0
|
||||
#define DT_SPI_4_CLOCK_BITS DT_ST_STM32_SPI_40013400_CLOCK_BITS
|
||||
#define DT_SPI_4_CLOCK_BUS DT_ST_STM32_SPI_40013400_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_5_BASE_ADDRESS DT_ST_STM32_SPI_40015000_BASE_ADDRESS
|
||||
#define DT_SPI_5_IRQ_PRI DT_ST_STM32_SPI_40015000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_5_NAME DT_ST_STM32_SPI_40015000_LABEL
|
||||
#define DT_SPI_5_IRQ DT_ST_STM32_SPI_40015000_IRQ_0
|
||||
#define DT_SPI_5_CLOCK_BITS DT_ST_STM32_SPI_40015000_CLOCK_BITS
|
||||
#define DT_SPI_5_CLOCK_BUS DT_ST_STM32_SPI_40015000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_6_BASE_ADDRESS DT_ST_STM32_SPI_40015400_BASE_ADDRESS
|
||||
#define DT_SPI_6_IRQ_PRI DT_ST_STM32_SPI_40015400_IRQ_0_PRIORITY
|
||||
#define DT_SPI_6_NAME DT_ST_STM32_SPI_40015400_LABEL
|
||||
#define DT_SPI_6_IRQ DT_ST_STM32_SPI_40015400_IRQ_0
|
||||
#define DT_SPI_6_CLOCK_BITS DT_ST_STM32_SPI_40015400_CLOCK_BITS
|
||||
#define DT_SPI_6_CLOCK_BUS DT_ST_STM32_SPI_40015400_CLOCK_BUS
|
||||
|
||||
#ifdef DT_ST_STM32_OTGFS_50000000_BASE_ADDRESS
|
||||
#define DT_USB_BASE_ADDRESS DT_ST_STM32_OTGFS_50000000_BASE_ADDRESS
|
||||
|
|
|
@ -110,11 +110,15 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_40013000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_USB_BASE_ADDRESS DT_ST_STM32_USB_40005C00_BASE_ADDRESS
|
||||
#define DT_USB_IRQ DT_ST_STM32_USB_40005C00_IRQ_USB
|
||||
|
|
|
@ -181,16 +181,22 @@
|
|||
#define DT_SPI_1_IRQ_PRI DT_ST_STM32_SPI_FIFO_40013000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_ST_STM32_SPI_FIFO_40013000_LABEL
|
||||
#define DT_SPI_1_IRQ DT_ST_STM32_SPI_FIFO_40013000_IRQ_0
|
||||
#define DT_SPI_1_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40013000_CLOCK_BITS
|
||||
#define DT_SPI_1_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40013000_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_2_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40003800_BASE_ADDRESS
|
||||
#define DT_SPI_2_IRQ_PRI DT_ST_STM32_SPI_FIFO_40003800_IRQ_0_PRIORITY
|
||||
#define DT_SPI_2_NAME DT_ST_STM32_SPI_FIFO_40003800_LABEL
|
||||
#define DT_SPI_2_IRQ DT_ST_STM32_SPI_FIFO_40003800_IRQ_0
|
||||
#define DT_SPI_2_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40003800_CLOCK_BITS
|
||||
#define DT_SPI_2_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40003800_CLOCK_BUS
|
||||
|
||||
#define DT_SPI_3_BASE_ADDRESS DT_ST_STM32_SPI_FIFO_40003C00_BASE_ADDRESS
|
||||
#define DT_SPI_3_IRQ_PRI DT_ST_STM32_SPI_FIFO_40003C00_IRQ_0_PRIORITY
|
||||
#define DT_SPI_3_NAME DT_ST_STM32_SPI_FIFO_40003C00_LABEL
|
||||
#define DT_SPI_3_IRQ DT_ST_STM32_SPI_FIFO_40003C00_IRQ_0
|
||||
#define DT_SPI_3_CLOCK_BITS DT_ST_STM32_SPI_FIFO_40003C00_CLOCK_BITS
|
||||
#define DT_SPI_3_CLOCK_BUS DT_ST_STM32_SPI_FIFO_40003C00_CLOCK_BUS
|
||||
|
||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_ST_STM32L4_FLASH_CONTROLLER_40022000_BASE_ADDRESS
|
||||
#define DT_FLASH_DEV_NAME DT_ST_STM32L4_FLASH_CONTROLLER_40022000_LABEL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue