Skip to content

Commit 299e067

Browse files
Alain Volmatjhedberg
authored andcommitted
drivers: memc: stm32_xspi_psram: avoid hardcode to XSPI1
The PSRAM could well be plugged to the XSPI2 instead of XSPI1 hence allow configuration of the IOPort and avoid forcing the ChipSelect in order to allow working on both XSPI1 or XSPI2. Signed-off-by: Alain Volmat <[email protected]>
1 parent d604af8 commit 299e067

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/memc/memc_stm32_xspi_psram.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,12 @@ static int memc_stm32_xspi_psram_init(const struct device *dev)
295295
return -EIO;
296296
}
297297

298-
cfg.nCSOverride = HAL_XSPI_CSSEL_OVR_NCS1;
299-
cfg.IOPort = HAL_XSPIM_IOPORT_1;
298+
if (hxspi->Instance == XSPI1) {
299+
cfg.IOPort = HAL_XSPIM_IOPORT_1;
300+
} else if (hxspi->Instance == XSPI2) {
301+
cfg.IOPort = HAL_XSPIM_IOPORT_2;
302+
}
303+
cfg.nCSOverride = HAL_XSPI_CSSEL_OVR_DISABLED;
300304

301305
if (HAL_XSPIM_Config(hxspi, &cfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
302306
LOG_ERR("XSPIMgr Init failed");

0 commit comments

Comments
 (0)