mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-14 12:59:29 +03:00
change(esp_hw_support): set HP/LP mem in retention mode in sleep
This commit is contained in:
@@ -14,9 +14,11 @@
|
||||
#include "soc/pmu_struct.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
#include "hal/pmu_hal.h"
|
||||
#include "hal/lp_sys_ll.h"
|
||||
#include "pmu_param.h"
|
||||
#include "esp_private/esp_pmu.h"
|
||||
#include "soc/regi2c_dig_reg.h"
|
||||
#include "soc/lp_system_reg.h"
|
||||
#include "regi2c_ctrl.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "soc/rtc.h"
|
||||
@@ -175,6 +177,9 @@ static void pmu_hp_system_init_default(pmu_context_t *ctx)
|
||||
pmu_hp_system_param_default(mode, ¶m);
|
||||
pmu_hp_system_init(ctx, mode, ¶m);
|
||||
}
|
||||
#if CONFIG_ESP32P4_REV_MIN_FULL >= 300
|
||||
lp_sys_ll_set_hp_mem_lowpower_mode(MEM_AUX_DEEPSLEEP);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void pmu_lp_system_param_default(pmu_lp_mode_t mode, pmu_lp_system_param_t *param)
|
||||
@@ -191,6 +196,9 @@ static void pmu_lp_system_init_default(pmu_context_t *ctx)
|
||||
pmu_lp_system_param_default(mode, ¶m);
|
||||
pmu_lp_system_init(ctx, mode, ¶m);
|
||||
}
|
||||
#if CONFIG_ESP32P4_REV_MIN_FULL >= 300
|
||||
lp_sys_ll_set_lp_mem_lowpower_mode(MEM_AUX_DEEPSLEEP);
|
||||
#endif
|
||||
}
|
||||
|
||||
void pmu_init(void)
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MEM_AUX_SHUTDOWN BIT(0)
|
||||
#define MEM_AUX_LIGHTSLEEP BIT(1)
|
||||
#define MEM_AUX_DEEPSLEEP BIT(2)
|
||||
|
||||
/**
|
||||
* @brief ROM obtains the wake-up type through LP_SYS_STORE9_REG[0].
|
||||
* Set the flag to inform
|
||||
@@ -65,6 +69,17 @@ FORCE_INLINE_ATTR void lp_sys_ll_set_pau_link_addr(uint32_t addr)
|
||||
LP_SYS.backup_dma_cfg2.link_addr_aon = addr;
|
||||
}
|
||||
|
||||
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300
|
||||
FORCE_INLINE_ATTR void lp_sys_ll_set_hp_mem_lowpower_mode(uint32_t mode)
|
||||
{
|
||||
LP_SYS.hp_mem_aux_ctrl.hp_mem_lowpower_mode = mode;
|
||||
}
|
||||
|
||||
FORCE_INLINE_ATTR void lp_sys_ll_set_lp_mem_lowpower_mode(uint32_t mode)
|
||||
{
|
||||
LP_SYS.lp_mem_aux_ctrl.lp_mem_lowpower_mode = mode;
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1083,7 +1083,15 @@ extern "C" {
|
||||
* need_des
|
||||
*/
|
||||
#define LP_SYSTEM_REG_HP_MEM_AUX_CTRL_REG (DR_REG_LP_SYS_BASE + 0x180)
|
||||
/** LP_SYSTEM_REG_HP_MEM_AUX_CTRL : R/W; bitpos: [31:0]; default: 8304;
|
||||
/** LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE : R/W; bitpos: [2:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
#define LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE 0x7U
|
||||
#define LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE_M (LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE_V << LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE_S)
|
||||
#define LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE_V 0x7U
|
||||
#define LP_SYSTEM_REG_HP_MEM_LOWPOWER_MODE_S 0
|
||||
|
||||
/** LP_SYSTEM_REG_HP_MEM_AUX_CTRL : R/W; bitpos: [31:3]; default: 1038;
|
||||
* need_des
|
||||
*/
|
||||
#define LP_SYSTEM_REG_HP_MEM_AUX_CTRL 0xFFFFFFFFU
|
||||
@@ -1095,7 +1103,14 @@ extern "C" {
|
||||
* need_des
|
||||
*/
|
||||
#define LP_SYSTEM_REG_LP_MEM_AUX_CTRL_REG (DR_REG_LP_SYS_BASE + 0x184)
|
||||
/** LP_SYSTEM_REG_LP_MEM_AUX_CTRL : R/W; bitpos: [31:0]; default: 8304;
|
||||
/** LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE : R/W; bitpos: [2:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
#define LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE 0x7U
|
||||
#define LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE_M (LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE_V << LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE_S)
|
||||
#define LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE_V 0x7U
|
||||
#define LP_SYSTEM_REG_LP_MEM_LOWPOWER_MODE_S 0
|
||||
/** LP_SYSTEM_REG_LP_MEM_AUX_CTRL : R/W; bitpos: [31:3]; default: 1038;
|
||||
* need_des
|
||||
*/
|
||||
#define LP_SYSTEM_REG_LP_MEM_AUX_CTRL 0xFFFFFFFFU
|
||||
|
||||
@@ -768,10 +768,14 @@ typedef union {
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** hp_mem_aux_ctrl : R/W; bitpos: [31:0]; default: 8304;
|
||||
/** hp_mem_lowpower_mode : R/W; bitpos: [2:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t hp_mem_aux_ctrl:32;
|
||||
uint32_t hp_mem_lowpower_mode:3;
|
||||
/** hp_mem_aux_ctrl : R/W; bitpos: [31:3]; default: 1038;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t hp_mem_aux_ctrl:29;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_system_reg_hp_mem_aux_ctrl_reg_t;
|
||||
@@ -781,10 +785,14 @@ typedef union {
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** lp_mem_aux_ctrl : R/W; bitpos: [31:0]; default: 8304;
|
||||
/** lp_mem_lowpower_mode : R/W; bitpos: [2:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t lp_mem_aux_ctrl:32;
|
||||
uint32_t lp_mem_lowpower_mode:3;
|
||||
/** lp_mem_aux_ctrl : R/W; bitpos: [31:3]; default: 1038;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t lp_mem_aux_ctrl:29;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_system_reg_lp_mem_aux_ctrl_reg_t;
|
||||
|
||||
Reference in New Issue
Block a user