Skip to content

Commit 5274d66

Browse files
travis3630cfriedt
authored andcommitted
drivers: flash: nordic: nrf_mramc update
Remove cache invalidation after flash write, cpu should automatically invalidate cache but for HW erase invalidation needed due to erase from different bus. Signed-off-by: Travis Lam <[email protected]>
1 parent 91ec38d commit 5274d66

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/flash/soc_flash_nrf_mramc.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <zephyr/logging/log.h>
1111
#include <nrfx_mramc.h>
1212
#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE)
13-
#include <hal/nrf_cache.h>
13+
#include <zephyr/cache.h>
1414
#endif
1515

1616
LOG_MODULE_REGISTER(flash_nrf_mramc, CONFIG_FLASH_LOG_LEVEL);
@@ -112,13 +112,7 @@ static int nrf_mramc_write(const struct device *dev, off_t offset,
112112
* and not number of bytes
113113
*/
114114
nrfx_mramc_words_write(addr, data, len / WRITE_BLOCK_SIZE);
115-
#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE)
116-
if (nrf_cache_enable_check(NRF_ICACHE)) {
117-
while (nrf_cache_busy_check(NRF_ICACHE)) {
118-
}
119-
nrf_cache_invalidate(NRF_ICACHE);
120-
}
121-
#endif
115+
122116
return 0;
123117
}
124118

@@ -144,11 +138,7 @@ static int nrf_mramc_erase(const struct device *dev, off_t offset, size_t size)
144138
*/
145139
nrfx_mramc_area_erase(addr, size / WRITE_BLOCK_SIZE);
146140
#if defined(CONFIG_SOC_FLASH_NRF_MRAMC_FLUSH_CACHE)
147-
if (nrf_cache_enable_check(NRF_ICACHE)) {
148-
while (nrf_cache_busy_check(NRF_ICACHE)) {
149-
}
150-
nrf_cache_invalidate(NRF_ICACHE);
151-
}
141+
sys_cache_instr_invd_all();
152142
#endif
153143
return 0;
154144
}

0 commit comments

Comments
 (0)