Skip to content

Commit e13722b

Browse files
FRASTMkartben
authored andcommitted
drivers: flash: stm32 xspi flash driver set the DelayBlock if exists
The stm32H7RS serie has no DelayBlock Bypass control in its DCR1 register. For other stm32 devices with DelayBlock bypass control, set the value directly in the structure. Signed-off-by: Francois Ramu <[email protected]>
1 parent 93b983d commit e13722b

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

drivers/flash/flash_stm32_xspi.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ LOG_MODULE_REGISTER(flash_stm32_xspi, CONFIG_FLASH_LOG_LEVEL);
4242

4343
#define STM32_XSPI_RESET_GPIO DT_INST_NODE_HAS_PROP(0, reset_gpios)
4444

45-
#define STM32_XSPI_DLYB_BYPASSED DT_PROP(STM32_XSPI_NODE, dlyb_bypass)
46-
4745
#define STM32_XSPI_USE_DMA DT_NODE_HAS_PROP(STM32_XSPI_NODE, dmas)
4846

4947
#if STM32_XSPI_USE_DMA
@@ -2149,17 +2147,7 @@ static int flash_stm32_xspi_init(const struct device *dev)
21492147
if (dev_cfg->data_rate == XSPI_DTR_TRANSFER) {
21502148
dev_data->hxspi.Init.MemoryType = HAL_XSPI_MEMTYPE_MACRONIX;
21512149
dev_data->hxspi.Init.DelayHoldQuarterCycle = HAL_XSPI_DHQC_ENABLE;
2152-
} else {
2153-
21542150
}
2155-
#if defined(XSPI_DCR1_DLYBYP)
2156-
#if STM32_XSPI_DLYB_BYPASSED
2157-
dev_data->hxspi.Init.DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_BYPASS;
2158-
#else
2159-
dev_data->hxspi.Init.DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_ON;
2160-
#endif /* STM32_XSPI_DLYB_BYPASSED */
2161-
#endif /* XSPI_DCR1_DLYBYP */
2162-
21632151

21642152
if (HAL_XSPI_Init(&dev_data->hxspi) != HAL_OK) {
21652153
LOG_ERR("XSPI Init failed");
@@ -2482,6 +2470,11 @@ static struct flash_stm32_xspi_data flash_stm32_xspi_dev_data = {
24822470
: HAL_XSPI_CSSEL_NCS2),
24832471
#endif
24842472
.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE,
2473+
#if defined(XSPI_DCR1_DLYBYP)
2474+
.DelayBlockBypass = (DT_PROP(STM32_XSPI_NODE, dlyb_bypass)
2475+
? HAL_XSPI_DELAY_BLOCK_BYPASS
2476+
: HAL_XSPI_DELAY_BLOCK_ON),
2477+
#endif /* XSPI_DCR1_DLYBYP */
24852478
#if defined(XSPI_DCR3_MAXTRAN)
24862479
.MaxTran = 0,
24872480
#endif /* XSPI_DCR3_MAXTRAN */

0 commit comments

Comments
 (0)