Skip to content

Commit 6cbf0b8

Browse files
committed
drivers: flash: stm32_xspi: Remove hard-coded XSPI2 dependency
Check the used XSPIx peripheral before calling the corresponding function instead of hard-coded calling the LL_PWR_EnableXSPIM2() and LL_SBS_EnableXSPI2SpeedOptim() during flash_stm32_xspi_init(...). Signed-off-by: Thomas Decker <[email protected]>
1 parent d0aeb47 commit 6cbf0b8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/flash/flash_stm32_xspi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,9 +2118,14 @@ static int flash_stm32_xspi_init(const struct device *dev)
21182118
return -ENOTSUP;
21192119
}
21202120
#if defined(CONFIG_SOC_SERIES_STM32H7RSX)
2121-
LL_PWR_EnableXSPIM2();
21222121
__HAL_RCC_SBS_CLK_ENABLE();
2123-
LL_SBS_EnableXSPI2SpeedOptim();
2122+
if (dev_data->hxspi.Instance == XSPI1) {
2123+
LL_PWR_EnableXSPIM1();
2124+
LL_SBS_EnableXSPI1SpeedOptim();
2125+
} else if (dev_data->hxspi.Instance == XSPI2) {
2126+
LL_PWR_EnableXSPIM2();
2127+
LL_SBS_EnableXSPI2SpeedOptim();
2128+
}
21242129
#endif /* CONFIG_SOC_SERIES_STM32H7RSX */
21252130

21262131
/* Signals configuration */

0 commit comments

Comments
 (0)