From 1717ffdb38c89540b081c9eefad3acd69f011d55 Mon Sep 17 00:00:00 2001 From: Jeonghyun Kim Date: Mon, 23 Aug 2021 23:27:26 +0900 Subject: [PATCH] chip: stm32l4: Register spi character driver when both spi port and driver available --- boards/arm/stm32l4/nucleo-l432kc/src/stm32_spi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_spi.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_spi.c index 6c71751829..9f40ce1ff8 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_spi.c +++ b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_spi.c @@ -30,6 +30,7 @@ #include #include +#include #include #include "chip.h" @@ -78,6 +79,13 @@ void stm32l4_spiinitialize(void) else { spiinfo("INFO: SPI port 1 initialized\n"); +#ifdef CONFIG_SPI_DRIVER + ret = spi_register(g_spi1, 1); + if (ret < 0) + { + spierr("ERROR: FAILED to register driver of SPI port 1\n"); + } +#endif } /* Setup CS, EN & IRQ line IOs */ @@ -98,6 +106,13 @@ void stm32l4_spiinitialize(void) else { spiinfo("INFO: SPI port 2 initialized\n"); +#ifdef CONFIG_SPI_DRIVER + ret = spi_register(g_spi2, 2); + if (ret < 0) + { + spierr("ERROR: FAILED to register driver of SPI port 2\n"); + } +#endif } /* Setup CS, EN & IRQ line IOs */