Răsfoiți Sursa

spi_flash: Support suspend/resume mode for operations

- Adds arbitration between the erase and write in suspend mode
     (If the flash memory is suspended then only a read operation can be performed.)
- espcoredump: Dump does not use suspend feature, just resume before continue.
- spi_flash: Add release_cpu() to do suspend/release_cpu/resume
KonstantinKondrashov 5 ani în urmă
părinte
comite
afef16c2e9

+ 1 - 1
components/soc/esp32s2/include/soc/spi_mem_struct.h

@@ -266,7 +266,7 @@ typedef volatile struct spi_mem_dev_s {
         };
         };
         uint32_t val;
         uint32_t val;
     } fsm;
     } fsm;
-    uint32_t data_buf[18];                                                /*data buffer*/
+    uint32_t data_buf[16];                                                /*data buffer*/
     union {
     union {
         struct {
         struct {
             uint32_t waiti_en:             1;                   /*auto-waiting flash idle operation when program flash or erase flash. 1: enable 0: disable.*/
             uint32_t waiti_en:             1;                   /*auto-waiting flash idle operation when program flash or erase flash. 1: enable 0: disable.*/

+ 2 - 1
components/spi_flash/Kconfig

@@ -124,6 +124,7 @@ menu "SPI Flash driver"
     config SPI_FLASH_YIELD_DURING_ERASE
     config SPI_FLASH_YIELD_DURING_ERASE
         bool "Enables yield operation during flash erase"
         bool "Enables yield operation during flash erase"
         default y
         default y
+        depends on SPI_FLASH_USE_LEGACY_IMPL
         help
         help
             This allows to yield the CPUs between erase commands.
             This allows to yield the CPUs between erase commands.
             Prevents starvation of other tasks.
             Prevents starvation of other tasks.
@@ -137,7 +138,7 @@ menu "SPI Flash driver"
             then it will yield CPUs after finishing a current command.
             then it will yield CPUs after finishing a current command.
 
 
     config SPI_FLASH_ERASE_YIELD_TICKS
     config SPI_FLASH_ERASE_YIELD_TICKS
-        int "CPU release time (tick)"
+        int "CPU release time (tick) for an erase operation"
         depends on SPI_FLASH_YIELD_DURING_ERASE
         depends on SPI_FLASH_YIELD_DURING_ERASE
         default 1
         default 1
         help
         help

+ 2 - 0
components/spi_flash/private_include/spi_flash_defs.h

@@ -47,6 +47,8 @@
 #define CMD_LARGE_BLOCK_ERASE_4B 0xDC /* 64KB block erase command */
 #define CMD_LARGE_BLOCK_ERASE_4B 0xDC /* 64KB block erase command */
 #define CMD_PROGRAM_PAGE        0x02
 #define CMD_PROGRAM_PAGE        0x02
 #define CMD_PROGRAM_PAGE_4B     0x12
 #define CMD_PROGRAM_PAGE_4B     0x12
+#define CMD_SUSPEND     0x75
+#define CMD_RESUME      0x7A
 
 
 #define CMD_RST_EN      0x66
 #define CMD_RST_EN      0x66
 #define CMD_RST_DEV     0x99
 #define CMD_RST_DEV     0x99