chip: stm32l4: Register spi character driver when both spi port and driver available

This commit is contained in:
Jeonghyun Kim 2021-08-23 23:27:26 +09:00 committed by Xiang Xiao
parent f7295dd434
commit 1717ffdb38

View File

@ -30,6 +30,7 @@
#include <errno.h>
#include <nuttx/spi/spi.h>
#include <nuttx/spi/spi_transfer.h>
#include <arch/board/board.h>
#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 */