From 5fa960c71912b0c5dace6ccd60a8dba48dc9e2da Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 19 Dec 2024 10:58:21 +0100 Subject: [PATCH] stm32/spi: Retain the state of special SPI buses on soft reboot. Reserved and static SPI buses must remain initialized during a soft reboot as they may be used for SPI flash storage or XIP. Signed-off-by: iabdalkader --- ports/stm32/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/spi.c b/ports/stm32/spi.c index aa459119c..96dd17065 100644 --- a/ports/stm32/spi.c +++ b/ports/stm32/spi.c @@ -548,7 +548,7 @@ void spi_deinit(const spi_t *spi_obj) { void spi_deinit_all(void) { for (int i = 0; i < MP_ARRAY_SIZE(spi_obj); i++) { const spi_t *spi = &spi_obj[i]; - if (spi->spi != NULL) { + if (spi->spi != NULL && !MICROPY_HW_SPI_IS_RESERVED(i + 1) && !MICROPY_HW_SPI_IS_STATIC(i + 1)) { spi_deinit(spi); } }