mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
change(flash): acquire the LDO channel used by flash
so that even if the same channel has other consumers, the voltage won't be changed
This commit is contained in:
parent
cf59c00564
commit
5369b68bc8
@ -1,6 +1,31 @@
|
|||||||
menu "LDO Regulator Configurations"
|
menu "LDO Regulator Configurations"
|
||||||
depends on SOC_GP_LDO_SUPPORTED
|
depends on SOC_GP_LDO_SUPPORTED
|
||||||
|
|
||||||
|
config ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN
|
||||||
|
int "LDO regulator channel that used to power SPI NOR Flash (READ HELP)"
|
||||||
|
default 1
|
||||||
|
range -1 4
|
||||||
|
help
|
||||||
|
The internal LDO regulator can be used to power the SPI Flash specific power domain.
|
||||||
|
This option is to select which LDO channel to connect to that domain.
|
||||||
|
Please set this option correctly according to your schematic.
|
||||||
|
Set to -1 if the Flash is using any external power supply.
|
||||||
|
|
||||||
|
choice ESP_LDO_VOLTAGE_SPI_NOR_FLASH_DOMAIN
|
||||||
|
prompt "SPI NOR Flash power domain voltage"
|
||||||
|
depends on ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN != -1
|
||||||
|
default ESP_LDO_VOLTAGE_SPI_NOR_FLASH_3300_MV
|
||||||
|
help
|
||||||
|
Select the voltage used by the Flash power domain.
|
||||||
|
|
||||||
|
config ESP_LDO_VOLTAGE_SPI_NOR_FLASH_3300_MV
|
||||||
|
bool "3.3V"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ESP_LDO_VOLTAGE_SPI_NOR_FLASH_DOMAIN
|
||||||
|
int
|
||||||
|
default 3300 if ESP_LDO_VOLTAGE_SPI_NOR_FLASH_3300_MV
|
||||||
|
|
||||||
config ESP_LDO_CHAN_PSRAM_DOMAIN
|
config ESP_LDO_CHAN_PSRAM_DOMAIN
|
||||||
int "LDO regulator channel that used to power PSRAM and MPLL (READ HELP)"
|
int "LDO regulator channel that used to power PSRAM and MPLL (READ HELP)"
|
||||||
default 2
|
default 2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -15,6 +15,7 @@
|
|||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "hal/spi_types.h"
|
#include "hal/spi_types.h"
|
||||||
#include "esp_private/spi_share_hw_ctrl.h"
|
#include "esp_private/spi_share_hw_ctrl.h"
|
||||||
|
#include "esp_ldo_regulator.h"
|
||||||
#include "hal/spi_flash_hal.h"
|
#include "hal/spi_flash_hal.h"
|
||||||
#include "hal/gpio_hal.h"
|
#include "hal/gpio_hal.h"
|
||||||
#include "esp_flash_internal.h"
|
#include "esp_flash_internal.h"
|
||||||
@ -420,6 +421,19 @@ esp_err_t esp_flash_init_default_chip(void)
|
|||||||
esp_err_t esp_flash_app_init(void)
|
esp_err_t esp_flash_app_init(void)
|
||||||
{
|
{
|
||||||
esp_err_t err = ESP_OK;
|
esp_err_t err = ESP_OK;
|
||||||
|
|
||||||
|
// Acquire the LDO channel used by the SPI NOR flash
|
||||||
|
// in case the LDO voltage is changed by other users
|
||||||
|
#if defined(CONFIG_ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN) && CONFIG_ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN != -1
|
||||||
|
static esp_ldo_channel_handle_t s_ldo_chan = NULL;
|
||||||
|
esp_ldo_channel_config_t ldo_config = {
|
||||||
|
.chan_id = CONFIG_ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN,
|
||||||
|
.voltage_mv = CONFIG_ESP_LDO_VOLTAGE_SPI_NOR_FLASH_DOMAIN,
|
||||||
|
};
|
||||||
|
err = esp_ldo_acquire_channel(&ldo_config, &s_ldo_chan);
|
||||||
|
if (err != ESP_OK) return err;
|
||||||
|
#endif
|
||||||
|
|
||||||
spi_flash_init_lock();
|
spi_flash_init_lock();
|
||||||
spi_flash_guard_set(&g_flash_guard_default_ops);
|
spi_flash_guard_set(&g_flash_guard_default_ops);
|
||||||
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
||||||
|
Loading…
Reference in New Issue
Block a user