Skip to content

Commit fc5c759

Browse files
cmake: wifi: Select a proper ext flash interface for varius boards
When WiFi FW patches are stored on SPI (not QSPI), do not assume a generic "spi" nodelabel. Locate the external flash via compatible "jedec,spi-nor" with dt_comp_path and derive the SPI controller path from that node using get_filename_component. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent c0b5032 commit fc5c759

2 files changed

Lines changed: 40 additions & 4 deletions

File tree

cmake/sysbuild/nrf700x.cmake

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,24 @@
55
#
66

77
function(setup_nrf700x_xip_data)
8-
dt_nodelabel(qspi_nodelabel TARGET ${DEFAULT_IMAGE} NODELABEL "qspi")
9-
dt_reg_addr(qspi_xip_address TARGET ${DEFAULT_IMAGE} PATH "${qspi_nodelabel}" NAME "qspi_mm")
8+
9+
set(interface_xip_address 0)
10+
11+
if(SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE_QSPI)
12+
dt_nodelabel(qspi_nodelabel TARGET ${DEFAULT_IMAGE} NODELABEL "qspi")
13+
dt_reg_addr(interface_xip_address TARGET ${DEFAULT_IMAGE} PATH "${qspi_nodelabel}" NAME "qspi_mm")
14+
elseif(SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE_SPI)
15+
# Multiple SPI controllers may exist; use the sole okay jedec,spi-nor node and its SPI parent.
16+
dt_comp_path(spi_nor_path TARGET ${DEFAULT_IMAGE} COMPATIBLE "jedec,spi-nor")
17+
18+
if(NOT DEFINED spi_nor_path)
19+
message(FATAL_ERROR
20+
"nRF WiFi FW patch external flash: no devicetree node with compatible \"jedec,spi-nor\"")
21+
endif()
22+
23+
get_filename_component(spi_path "${spi_nor_path}" DIRECTORY)
24+
dt_reg_addr(interface_xip_address TARGET ${DEFAULT_IMAGE} PATH "${spi_path}")
25+
endif()
1026

1127
set(NRF70_FW_BINS ${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_wifi/bin/ncs)
1228

@@ -58,7 +74,7 @@ function(setup_nrf700x_xip_data)
5874
${NRF70_PATCH}
5975
${CMAKE_BINARY_DIR}/nrf70.hex
6076
$<TARGET_PROPERTY:partition_manager,PM_NRF70_WIFI_FW_OFFSET>
61-
${qspi_xip_address}
77+
${interface_xip_address}
6278
VERBATIM
6379
)
6480
else()
@@ -75,7 +91,7 @@ function(setup_nrf700x_xip_data)
7591
${NRF70_PATCH}
7692
${CMAKE_BINARY_DIR}/nrf70.hex
7793
${nrf70_wifi_fw_partition_addr}
78-
${qspi_xip_address}
94+
${interface_xip_address}
7995
VERBATIM
8096
)
8197
endif()

sysbuild/Kconfig.wifi

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,26 @@ config WIFI_PATCHES_EXT_FLASH_STORE
6363

6464
endchoice
6565

66+
choice WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE
67+
bool "External flash interface"
68+
depends on WIFI_PATCHES_EXT_FLASH_XIP || WIFI_PATCHES_EXT_FLASH_STORE
69+
default WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE_QSPI if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840
70+
default WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE_SPI
71+
help
72+
Select this option to select the interface for external flash access
73+
74+
config WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE_SPI
75+
bool "SPI"
76+
help
77+
Select this option to use SPI interface for external flash access
78+
79+
config WIFI_PATCHES_EXT_FLASH_STORE_INTERFACE_QSPI
80+
bool "QSPI"
81+
help
82+
Select this option to use QSPI interface for external flash access
83+
84+
endchoice
85+
6686
endif # WIFI_NRF70
6787

6888
endmenu

0 commit comments

Comments
 (0)