Skip to content

Commit e4acee9

Browse files
ahasztagnvlsianpu
authored andcommitted
[nrf noup] boot: zephyr: cleanup of SQSPI for nRF54L
This commit ensures nrf_cleanup cleans up SQSPI if it is used, so that it can be used by the application as well. The main usage is external flash communication using SQSPI. Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
1 parent 63ab352 commit e4acee9

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

boot/zephyr/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,15 @@ if(SYSBUILD)
808808
endif()
809809

810810
if(CONFIG_MCUBOOT_NRF_CLEANUP_PERIPHERAL)
811-
zephyr_library_sources(
812-
${BOOT_DIR}/zephyr/nrf_cleanup.c
813-
)
811+
zephyr_library_sources(
812+
${BOOT_DIR}/zephyr/nrf_cleanup.c
813+
)
814+
815+
if(CONFIG_MSPI_NRF_SQSPI)
816+
zephyr_library_include_directories(
817+
${ZEPHYR_NRFXLIB_MODULE_DIR}/softperipheral/include
818+
)
819+
endif()
814820
endif()
815821

816822
if(SYSBUILD AND CONFIG_PCD_APP)

boot/zephyr/nrf_cleanup.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
#if defined(NRF_DPPIC)
2323
#include <hal/nrf_dppi.h>
2424
#endif
25+
#if defined(CONFIG_MSPI_NRF_SQSPI)
26+
#include <hal/nrf_vpr.h>
27+
#include <softperipheral_regif.h>
28+
#endif
29+
2530

2631
#include <string.h>
2732

@@ -110,6 +115,24 @@ static void nrf_cleanup_clock(void)
110115
nrf_clock_int_disable(NRF_CLOCK, 0xFFFFFFFF);
111116
}
112117
#endif
118+
#if defined(CONFIG_MSPI_NRF_SQSPI)
119+
static void nrf_cleanup_sqspi(void)
120+
{
121+
nrf_vpr_cpurun_set(NRF_VPR, false);
122+
123+
// Reset VPR.
124+
nrf_vpr_debugif_dmcontrol_mask_set(NRF_VPR,
125+
(VPR_DEBUGIF_DMCONTROL_NDMRESET_Active
126+
<< VPR_DEBUGIF_DMCONTROL_NDMRESET_Pos |
127+
VPR_DEBUGIF_DMCONTROL_DMACTIVE_Enabled
128+
<< VPR_DEBUGIF_DMCONTROL_DMACTIVE_Pos));
129+
nrf_vpr_debugif_dmcontrol_mask_set(NRF_VPR,
130+
(VPR_DEBUGIF_DMCONTROL_NDMRESET_Inactive
131+
<< VPR_DEBUGIF_DMCONTROL_NDMRESET_Pos |
132+
VPR_DEBUGIF_DMCONTROL_DMACTIVE_Disabled
133+
<< VPR_DEBUGIF_DMCONTROL_DMACTIVE_Pos));
134+
}
135+
#endif
113136

114137
void nrf_cleanup_peripheral(void)
115138
{
@@ -123,6 +146,10 @@ void nrf_cleanup_peripheral(void)
123146
nrf_cleanup_rtc(NRF_RTC2);
124147
#endif
125148

149+
#if defined(CONFIG_MSPI_NRF_SQSPI)
150+
nrf_cleanup_sqspi();
151+
#endif
152+
126153
#if defined(CONFIG_NRF_GRTC_TIMER)
127154
nrf_cleanup_grtc();
128155
#endif

0 commit comments

Comments
 (0)