Skip to content

Commit 3564ce5

Browse files
committed
alif/ospi_flash: Don't invalidate cache after erasing/writing.
It's not needed, the MPU configures the XIP as non-cacheable. Signed-off-by: Damien George <[email protected]>
1 parent 737acef commit 3564ce5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ports/alif/ospi_flash.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,11 @@ int ospi_flash_erase_sector(uint32_t addr) {
393393

394394
ospi_flash_write_cmd(self, self->set->write_en);
395395
int ret = ospi_flash_wait_wel1(self);
396-
if (ret < 0) {
397-
return ret;
396+
if (ret == 0) {
397+
ospi_flash_write_cmd_addr(self, self->set->erase_command, OSPI_ADDR_L_32bit, addr);
398+
ret = ospi_flash_wait_wip0(self);
398399
}
399400

400-
ospi_flash_write_cmd_addr(self, self->set->erase_command, OSPI_ADDR_L_32bit, addr);
401-
ret = ospi_flash_wait_wip0(self);
402-
403-
SCB_InvalidateDCache_by_Addr(global_flash.cfg.xip_base + addr, MICROPY_HW_FLASH_BLOCK_SIZE_BYTES);
404401
return ret;
405402
}
406403

@@ -463,7 +460,6 @@ int ospi_flash_write(uint32_t addr, uint32_t len, const uint8_t *src) {
463460
offset = 0;
464461
}
465462

466-
SCB_InvalidateDCache_by_Addr(global_flash.cfg.xip_base + addr, len);
467463
return ret;
468464
}
469465

0 commit comments

Comments
 (0)