Commit Graph

27 Commits

Author SHA1 Message Date
wuzhenghui 353075ca30 change(esp_hw_support): reject sleep request if task stack in PSRAM 2025-12-19 10:27:28 +08:00
Xiao Xufeng 230ee88d99 feat(spi_flash): implement dynamic CPU frequency switching workaround for encrypted writes
This commit implements a workaround that allows ESP32-C5 to run at 240MHz CPU frequency
normally, while automatically reducing CPU frequency during encrypted flash writes to
ensure correct operation. The frequency limit is chip revision dependent:
- v1.2 and above: limited to 160MHz during encrypted writes
- v1.0 and below: limited to 80MHz during encrypted writes

Key implementation details:
- Frequency limiting is triggered automatically when esp_flash_write_encrypted() is called
- Uses start() flags (ESP_FLASH_START_FLAG_LIMIT_CPU_FREQ) to integrate with OS layer
- Works with both PM enabled and disabled configurations
- Frequency is automatically restored after encrypted write completes
- For ESP32-C5 with 120MHz flash, Flash clock and timing registers are adjusted when
  CPU frequency is reduced to 80MHz
- SPI1 timing registers are configured during frequency switching since encrypted writes
  use SPI1 and must work correctly at reduced CPU frequencies

Code improvements:
- Use SOC_MSPI_FREQ_AXI_CONSTRAINED capability macro instead of hardcoded chip checks
- Control workaround via Kconfig (CONFIG_PM_WORKAROUND_FREQ_LIMIT_ENABLED) instead of
  hardcoded macros
- Add comprehensive test cases covering various PM configurations and edge cases

This workaround enables ESP32-C5 applications to benefit from 240MHz CPU performance
while maintaining reliable encrypted flash write functionality.
2025-12-16 17:42:44 +08:00
hebinglin e29c2c9a36 feat(spi_flash): add flash deep power down support in spi flash 2025-12-09 17:19:01 +08:00
armando cbcee1625f refactor(flash): rename SOC_SPI_MEM_SUPPORT_OPI_MODE to SOC_SPI_MEM_SUPPORT_FLASH_OPI_MOD 2025-03-19 14:01:22 +08:00
wuzhenghui 7a4cc8ed35 fix(esp_hw_support): fix branch predictor access flash after cache disabled 2025-01-13 10:28:09 +08:00
C.S.M 374c89097f feat(spi_flash): Adjust flash clock to real 80M clock, and support 32bit address on eco1 2024-05-27 19:42:47 +08:00
Armando 10d3912c70 feat(xip_psram): support xip psram feature on esp32p4 2024-05-22 15:56:07 +08:00
Armando 13167d8479 change(flash): rename spi_timing_is_tuned to spi_flash_timing_is_tuned 2024-01-10 11:52:28 +08:00
Xiao Xufeng 1f5fb3f921 spi_flash: fixed issue that enabling HPM-DC by default may cause app unable to restart 2023-10-24 10:38:08 +08:00
Armando dbf3612d6d spi_flash: replace flash clock src change API with mspi timing API 2023-05-04 17:05:35 +08:00
laokaiyao c9f780dc2e gpio: support runtime preserve 2023-03-17 11:59:49 +08:00
Cao Sen Miao bc655a6890 spi_flash: Allow clock frequency up to 64M, and make it default on ESP32H2 2023-03-10 11:39:53 +08:00
Cao Sen Miao 29e0258de2 spi_flash: init wrap in app stage 2023-02-14 18:20:53 +08:00
Cao Sen Miao 0d37436f36 spi_flash: Support flash wrap (burst read), flash driver side 2023-02-13 11:10:15 +08:00
Armando b46cfd15a2 mspi: move timing tuning to esp_hw_support 2023-01-06 14:41:20 +08:00
Martin Vychodil c9c7573f71 Storage: Partition APIs moved to the new component 'esp_partition'
All the partition handling API functions and data-types were moved from the 'spi_flash' component to the new one named 'esp_partition'. See Storage 5.x migration guide for more details
2022-11-02 21:54:45 +01:00
Cao Sen Miao ec6a56ed0c spi_flash: re-enable the HPM mode on several XMC chips 2022-07-22 09:54:56 +08:00
Jing Li 66395a5c00 system/sleep: further fix spi flash/ram current leakage 2022-07-21 19:14:26 +08:00
Cao Sen Miao a690a87829 spi_flash: Remove legacy spi_flash drivers 2022-07-01 11:01:34 +08:00
Cao Sen Miao 435bbb444c spi_flash: move cache stuff to private 2022-07-01 10:59:34 +08:00
Cao Sen Miao 6a2d3509dc spi_flash: Making XMC flash works more stable when brownout detected 2022-06-02 10:38:55 +08:00
Cao Sen Miao 85dd785d8d spi_flash: Building a framework to enable HPM when flash works under high speed mode 2022-03-09 18:49:34 +08:00
Martin Vychodil 9a5f39ec2c spi_flash: Linux target emulation of Partition API
Emulator of Partition API layer for Linux OS
2022-03-04 14:36:46 +00:00
Cao Sen Miao b0decda1e3 bootloader: move bootloader flash support to isolate folders 2021-12-30 14:05:12 +08:00
Cao Sen Miao 3dd1cfea18 spi_flash: refactor spi_flash.h to decline duplicated code 2021-12-30 14:05:12 +08:00
Armando c331c85318 mspi: make cpu clock source switch safe
For some of the MSPI high frequency setting (e.g. 80M DDR mode Flash or PSRAM), timing tuning is required.
Certain delays will be added to the MSPI RX direction. When system clock switches down, the delays should be
cleared. When system clock switches up, the delays should be restored.
2021-10-19 21:47:27 +08:00
Armando 2655a506c9 mspi: support auto detect octal flash vendor 2021-10-08 15:59:57 +08:00