From c8cd57fe9ef4547b2d92d4733af57acdeb8e08e8 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 6 May 2024 16:36:10 +0200 Subject: [PATCH] drivers: flash: stm32 qspi driver when Dual-Flash not supported Some stm32 devices with quadspi (like stm32l47x or stm32l48x) does not support Dual-Flash Mode. Avoid building error even if the &quadspi node has a property defined. Signed-off-by: Francois Ramu --- drivers/flash/flash_stm32_qspi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/flash/flash_stm32_qspi.c b/drivers/flash/flash_stm32_qspi.c index 326c1129a36..8421d71f16e 100644 --- a/drivers/flash/flash_stm32_qspi.c +++ b/drivers/flash/flash_stm32_qspi.c @@ -1283,7 +1283,12 @@ static int flash_stm32_qspi_init(const struct device *dev) HAL_QSPI_Init(&dev_data->hqspi); -#if DT_NODE_HAS_PROP(DT_NODELABEL(quadspi), flash_id) +#if DT_NODE_HAS_PROP(DT_NODELABEL(quadspi), flash_id) && \ + defined(QUADSPI_CR_FSEL) + /* + * Some stm32 mcu with quadspi (like stm32l47x or stm32l48x) + * does not support Dual-Flash Mode + */ uint8_t qspi_flash_id = DT_PROP(DT_NODELABEL(quadspi), flash_id); HAL_QSPI_SetFlashID(&dev_data->hqspi,