Skip to content

Commit f11da3d

Browse files
author
Alain Volmat
committed
memc: stm32_xspi_psram: avoid XSPIM_Config if running from flash
Avoid calling the HAL_XSPIM_Config function if the app is running from flash in order to avoid locking since HAL_XSPIM_Config is once turning off each XSPI instance when performing the configuration. Signed-off-by: Alain Volmat <[email protected]>
1 parent 40c4966 commit f11da3d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/memc/memc_stm32_xspi_psram.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ static int memc_stm32_xspi_psram_init(const struct device *dev)
217217
struct memc_stm32_xspi_psram_data *dev_data = dev->data;
218218
XSPI_HandleTypeDef *hxspi = &dev_data->hxspi;
219219
uint32_t ahb_clock_freq;
220+
#ifndef CONFIG_STM32_APP_IN_EXT_FLASH
220221
XSPIM_CfgTypeDef cfg = {0};
222+
#endif
221223
XSPI_RegularCmdTypeDef cmd = {0};
222224
XSPI_MemoryMappedTypeDef mem_mapped_cfg = {0};
223225
uint32_t prescaler = STM32_XSPI_CLOCK_PRESCALER_MIN;
@@ -295,6 +297,11 @@ static int memc_stm32_xspi_psram_init(const struct device *dev)
295297
return -EIO;
296298
}
297299

300+
#ifndef CONFIG_STM32_APP_IN_EXT_FLASH
301+
/*
302+
* Do not configure the XSPIManager if running on the ext flash
303+
* since this includes stopping each XSPI instance during configuration
304+
*/
298305
if (hxspi->Instance == XSPI1) {
299306
cfg.IOPort = HAL_XSPIM_IOPORT_1;
300307
} else if (hxspi->Instance == XSPI2) {
@@ -306,6 +313,7 @@ static int memc_stm32_xspi_psram_init(const struct device *dev)
306313
LOG_ERR("XSPIMgr Init failed");
307314
return -EIO;
308315
}
316+
#endif
309317

310318
/* Configure AP memory registers */
311319
ret = ap_memory_configure(hxspi);

0 commit comments

Comments
 (0)