refactor(spi_flash): Remove sdkconfig dependency in flash hal layer

This commit is contained in:
C.S.M
2025-07-28 18:16:19 +08:00
parent 9e2d857c9a
commit 6ad49c1146
5 changed files with 10 additions and 7 deletions

View File

@@ -97,6 +97,7 @@ typedef struct {
uint8_t tsus_val; ///< Tsus value of suspend (us). uint8_t tsus_val; ///< Tsus value of suspend (us).
uint8_t trs_val; ///< Trs value of suspend (us) uint8_t trs_val; ///< Trs value of suspend (us)
bool auto_waiti_pes; ///< True for auto-wait idle after suspend command. False for using time delay. bool auto_waiti_pes; ///< True for auto-wait idle after suspend command. False for using time delay.
bool software_resume; ///< True for software resume, false for hardware resume.
} spi_flash_hal_config_t; } spi_flash_hal_config_t;
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -135,9 +135,9 @@ esp_err_t spi_flash_hal_init(spi_flash_hal_context_t *data_out, const spi_flash_
data_out->auto_waiti_pes = cfg->auto_waiti_pes; data_out->auto_waiti_pes = cfg->auto_waiti_pes;
} }
#if CONFIG_SPI_FLASH_SOFTWARE_RESUME if (cfg->software_resume) {
data_out->flags &= ~SPI_FLASH_HOST_CONTEXT_FLAG_AUTO_RESUME; data_out->flags &= ~SPI_FLASH_HOST_CONTEXT_FLAG_AUTO_RESUME;
#endif }
#if SOC_SPI_MEM_SUPPORT_FLASH_OPI_MODE #if SOC_SPI_MEM_SUPPORT_FLASH_OPI_MODE
if (cfg->octal_mode_en) { if (cfg->octal_mode_en) {

View File

@@ -19,7 +19,6 @@
#include "soc/soc_caps.h" #include "soc/soc_caps.h"
#include "soc/chip_revision.h" #include "soc/chip_revision.h"
#include "hal/efuse_hal.h" #include "hal/efuse_hal.h"
#include "sdkconfig.h"
#define ADDRESS_MASK_24BIT 0xFFFFFF #define ADDRESS_MASK_24BIT 0xFFFFFF
#define COMPUTE_DUMMY_CYCLELEN(host, base) ((base) + ((spi_flash_hal_context_t*)host)->extra_dummy) #define COMPUTE_DUMMY_CYCLELEN(host, base) ((base) + ((spi_flash_hal_context_t*)host)->extra_dummy)
@@ -141,7 +140,7 @@ esp_err_t spi_flash_hal_configure_host_io_mode(
gpspi_flash_ll_set_dummy_out(dev, (conf_required? 1: 0), 1); gpspi_flash_ll_set_dummy_out(dev, (conf_required? 1: 0), 1);
#endif #endif
#if CONFIG_IDF_TARGET_ESP32P4 #if SOC_IS(ESP32P4)
// TODO: This is temporarily for ESP32P4-ECO0, please remove it when eco0 is not widly used. IDF-10019 // TODO: This is temporarily for ESP32P4-ECO0, please remove it when eco0 is not widly used. IDF-10019
unsigned chip_version = efuse_hal_chip_revision(); unsigned chip_version = efuse_hal_chip_revision();
if (unlikely(!ESP_CHIP_REV_ABOVE(chip_version, 1))) { if (unlikely(!ESP_CHIP_REV_ABOVE(chip_version, 1))) {

View File

@@ -541,6 +541,10 @@ esp_err_t esp_flash_init_default_chip(void)
cfg.auto_waiti_pes = true; cfg.auto_waiti_pes = true;
#endif #endif
#if CONFIG_SPI_FLASH_AUTO_RESUME
cfg.software_resume = true;
#endif
//the host is already initialized, only do init for the data and load it to the host //the host is already initialized, only do init for the data and load it to the host
esp_err_t err = memspi_host_init_pointers(&esp_flash_default_host, &cfg); esp_err_t err = memspi_host_init_pointers(&esp_flash_default_host, &cfg);
if (err != ESP_OK) { if (err != ESP_OK) {

View File

@@ -15,7 +15,6 @@ ignores:
- "components/hal/cache_hal.c" - "components/hal/cache_hal.c"
- "components/hal/ecdsa_hal.c" - "components/hal/ecdsa_hal.c"
- "components/hal/mmu_hal.c" - "components/hal/mmu_hal.c"
- "components/hal/spi_flash_hal.c"
- "components/hal/twai_hal_sja1000.c" - "components/hal/twai_hal_sja1000.c"
- "components/hal/esp32/gpio_hal_workaround.c" - "components/hal/esp32/gpio_hal_workaround.c"
- "components/hal/esp32/include/hal/twai_ll.h" - "components/hal/esp32/include/hal/twai_ll.h"