Skip to content

Commit d9ef80b

Browse files
committed
soc: st: stm32: Use flash-controller to detect running from external flash
Use the zephyr,flash-controller node and the respective compatible 'st,stm32-xspi-nor' to detect if the device is running from external flash, instead of assuming that the parent node of the flash is the SPI controller. This fixes an issue when soc-nv-flash is used as the zephyr,flash node. Signed-off-by: Tim Pambor <[email protected]>
1 parent 196a1da commit d9ef80b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

soc/st/stm32/Kconfig.defconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ DT_FLASH_PARENT_IS_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_C
5555
DT_FLASH_PARENT_IS_OSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_OSPI))
5656
DT_FLASH_PARENT_IS_QSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_QSPI))
5757

58+
DT_CHOSEN_Z_FLASH_CTRL := zephyr,flash-controller
59+
DT_COMPAT_XSPI_NOR_CTRL := st,stm32-xspi-nor
60+
DT_CHOSEN_FLASH_CTRL_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_FLASH_CTRL))
61+
DT_FLASH_CTRL_IS_XSPI_NOR := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_CTRL_NODE),$(DT_COMPAT_XSPI_NOR_CTRL))
62+
5863
config SYS_CLOCK_HW_CYCLES_PER_SEC
5964
default "$(DT_STM32WB0_TIMER_FREQ)" if STM32WB0_RADIO_TIMER
6065
default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)"
@@ -104,7 +109,7 @@ config FLASH_BASE_ADDRESS
104109
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
105110

106111
config STM32_APP_IN_EXT_FLASH
107-
default $(DT_FLASH_PARENT_IS_XSPI)
112+
default $(DT_FLASH_PARENT_IS_XSPI) || $(DT_FLASH_CTRL_IS_XSPI_NOR)
108113

109114
# The XSPI PSRAM driver creates a SMH region with attribute SMH_REG_ATTR_EXTERNAL (2)
110115
# If applicable set the LTDC / VIDEO_BUFFER SMH attribute to SMH_REG_ATTR_EXTERNAL (2)

0 commit comments

Comments
 (0)