This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new dcec04f  xtensa/esp32: Writeback PSRAM data when mapping SPI Flash 
address to ESP32's address bus
dcec04f is described below

commit dcec04f5b200b202bcaee6681a36d761b4a03d47
Author: chenwen <chen...@espressif.com>
AuthorDate: Mon Feb 8 09:46:17 2021 +0800

    xtensa/esp32: Writeback PSRAM data when mapping SPI Flash address to 
ESP32's address bus
---
 arch/xtensa/src/esp32/esp32_spiflash.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_spiflash.c 
b/arch/xtensa/src/esp32/esp32_spiflash.c
index 56197e6..f3ed9bd 100644
--- a/arch/xtensa/src/esp32/esp32_spiflash.c
+++ b/arch/xtensa/src/esp32/esp32_spiflash.c
@@ -1328,6 +1328,7 @@ static int IRAM_ATTR esp32_mmap(FAR struct 
esp32_spiflash_s *priv,
   int flash_page;
   int page_cnt;
   struct spiflash_cachestate_s state;
+  bool flush = false;
 
   esp32_spiflash_opstart(&state);
 
@@ -1363,7 +1364,7 @@ static int IRAM_ATTR esp32_mmap(FAR struct 
esp32_spiflash_s *priv,
       req->ptr = (void *)(VADDR0_START_ADDR +
                           start_page * SPI_FLASH_MMU_PAGE_SIZE +
                           MMU_ADDR2OFF(req->src_addr));
-
+      flush = true;
       ret = 0;
     }
   else
@@ -1371,10 +1372,17 @@ static int IRAM_ATTR esp32_mmap(FAR struct 
esp32_spiflash_s *priv,
       ret = -ENOBUFS;
     }
 
-  Cache_Flush(0);
+  if (flush)
+    {
+#ifdef CONFIG_ESP32_SPIRAM
+      esp_spiram_writeback_cache();
+#endif
+      Cache_Flush(0);
 #ifdef CONFIG_SMP
-  Cache_Flush(1);
+      Cache_Flush(1);
 #endif
+    }
+
   esp32_spiflash_opdone(&state);
 
   return ret;

Reply via email to