Skip to content

Commit 3abfd17

Browse files
committed
feat(uart): support uart sleep retention on C5/C61
1 parent 8771607 commit 3abfd17

File tree

20 files changed

+199
-96
lines changed

20 files changed

+199
-96
lines changed

components/esp_driver_uart/src/uart.c

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,6 @@ typedef struct {
170170
uart_hal_context_t hal; /*!< UART hal context*/
171171
DECLARE_CRIT_SECTION_LOCK_IN_STRUCT(spinlock)
172172
bool hw_enabled;
173-
#if SOC_UART_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
174-
bool retention_link_inited; /*!< Mark whether the retention link is inited */
175-
bool retention_link_created; /*!< Mark whether the retention link is created */
176-
#endif
177173
} uart_context_t;
178174

179175
static uart_obj_t *p_uart_obj[UART_NUM_MAX] = {0};
@@ -197,7 +193,7 @@ static uart_context_t uart_context[UART_NUM_MAX] = {
197193

198194
static portMUX_TYPE uart_selectlock = portMUX_INITIALIZER_UNLOCKED;
199195

200-
#if SOC_UART_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
196+
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
201197
static esp_err_t uart_create_sleep_retention_link_cb(void *arg);
202198
#endif
203199

@@ -218,11 +214,11 @@ static void uart_module_enable(uart_port_t uart_num)
218214
}
219215
}
220216

221-
#if SOC_UART_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
217+
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP // for targets that is !SOC_UART_SUPPORT_SLEEP_RETENTION, retention module should still be inited to avoid TOP PD
222218
// Initialize sleep retention module for HP UART
223219
if (uart_num != CONFIG_ESP_CONSOLE_UART_NUM) { // Console uart retention has been taken care in sleep_sys_periph_stdout_console_uart_retention_init
224-
assert(!uart_context[uart_num].retention_link_inited);
225220
sleep_retention_module_t module = uart_reg_retention_info[uart_num].module;
221+
assert(!sleep_retention_is_module_inited(module));
226222
sleep_retention_module_init_param_t init_param = {
227223
.cbs = {
228224
.create = {
@@ -232,9 +228,7 @@ static void uart_module_enable(uart_port_t uart_num)
232228
},
233229
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
234230
};
235-
if (sleep_retention_module_init(module, &init_param) == ESP_OK) {
236-
uart_context[uart_num].retention_link_inited = true;
237-
} else {
231+
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
238232
ESP_LOGW(UART_TAG, "init sleep retention failed for uart%d, power domain may be turned off during sleep", uart_num);
239233
}
240234
}
@@ -259,13 +253,12 @@ static void uart_module_disable(uart_port_t uart_num)
259253
_lock_acquire(&(uart_context[uart_num].mutex));
260254
if (uart_context[uart_num].hw_enabled != false) {
261255
if (uart_num != CONFIG_ESP_CONSOLE_UART_NUM && uart_num < SOC_UART_HP_NUM) {
262-
#if SOC_UART_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
256+
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
263257
// Uninitialize sleep retention module for HP UART
264258
sleep_retention_module_t module = uart_reg_retention_info[uart_num].module;
265-
assert(!uart_context[uart_num].retention_link_created); // HP UART sleep retention should have been freed at this moment
266-
if (uart_context[uart_num].retention_link_inited) {
259+
assert(!sleep_retention_is_module_created(module)); // HP UART sleep retention should have been freed at this moment
260+
if (sleep_retention_is_module_inited(module)) {
267261
sleep_retention_module_deinit(module);
268-
uart_context[uart_num].retention_link_inited = false;
269262
}
270263
#endif
271264
HP_UART_SRC_CLK_ATOMIC() {
@@ -888,21 +881,18 @@ esp_err_t uart_param_config(uart_port_t uart_num, const uart_config_t *uart_conf
888881
if (uart_num != CONFIG_ESP_CONSOLE_UART_NUM && uart_num < SOC_UART_HP_NUM) {
889882
_lock_acquire(&(uart_context[uart_num].mutex));
890883
sleep_retention_module_t module = uart_reg_retention_info[uart_num].module;
891-
if (allow_pd && !uart_context[uart_num].retention_link_created) {
892-
if (uart_context[uart_num].retention_link_inited) {
893-
if (sleep_retention_module_allocate(module) == ESP_OK) {
894-
uart_context[uart_num].retention_link_created = true;
895-
} else {
884+
if (allow_pd && !sleep_retention_is_module_created(module)) {
885+
if (sleep_retention_is_module_inited(module)) {
886+
if (sleep_retention_module_allocate(module) != ESP_OK) {
896887
// Even though the sleep retention module create failed, UART driver should still work, so just warning here
897888
ESP_LOGW(UART_TAG, "create retention module failed, power domain can't turn off");
898889
}
899890
} else {
900891
ESP_LOGW(UART_TAG, "retention module not initialized first, unable to create retention module");
901892
}
902-
} else if (!allow_pd && uart_context[uart_num].retention_link_created) {
903-
assert(uart_context[uart_num].retention_link_inited);
893+
} else if (!allow_pd && sleep_retention_is_module_created(module)) {
894+
assert(sleep_retention_is_module_inited(module));
904895
sleep_retention_module_free(module);
905-
uart_context[uart_num].retention_link_created = false;
906896
}
907897
_lock_release(&(uart_context[uart_num].mutex));
908898
}
@@ -1831,10 +1821,9 @@ esp_err_t uart_driver_delete(uart_port_t uart_num)
18311821
if (uart_num != CONFIG_ESP_CONSOLE_UART_NUM && uart_num < SOC_UART_HP_NUM) {
18321822
sleep_retention_module_t module = uart_reg_retention_info[uart_num].module;
18331823
_lock_acquire(&(uart_context[uart_num].mutex));
1834-
if (uart_context[uart_num].retention_link_created) {
1835-
assert(uart_context[uart_num].retention_link_inited);
1824+
if (sleep_retention_is_module_created(module)) {
1825+
assert(sleep_retention_is_module_inited(module));
18361826
sleep_retention_module_free(module);
1837-
uart_context[uart_num].retention_link_created = false;
18381827
}
18391828
_lock_release(&(uart_context[uart_num].mutex));
18401829
}
@@ -1998,16 +1987,18 @@ void uart_set_always_rx_timeout(uart_port_t uart_num, bool always_rx_timeout)
19981987
}
19991988
}
20001989

2001-
#if SOC_UART_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
1990+
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
20021991
static esp_err_t uart_create_sleep_retention_link_cb(void *arg)
20031992
{
1993+
#if SOC_UART_SUPPORT_SLEEP_RETENTION
20041994
uart_context_t *group = (uart_context_t *)arg;
20051995
uart_port_t uart_num = group->port_id;
20061996
sleep_retention_module_t module = uart_reg_retention_info[uart_num].module;
20071997
esp_err_t err = sleep_retention_entries_create(uart_reg_retention_info[uart_num].regdma_entry_array,
20081998
uart_reg_retention_info[uart_num].array_size,
20091999
REGDMA_LINK_PRI_UART, module);
20102000
ESP_RETURN_ON_ERROR(err, UART_TAG, "create retention link failed");
2001+
#endif
20112002
return ESP_OK;
20122003
}
20132004
#endif

components/esp_hw_support/sleep_system_peripheral.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ bool peripheral_domain_pd_allowed(void)
182182
#if SOC_UART_SUPPORT_SLEEP_RETENTION
183183
mask.bitmap[SLEEP_RETENTION_MODULE_UART0 >> 5] |= BIT(SLEEP_RETENTION_MODULE_UART0 % 32);
184184
mask.bitmap[SLEEP_RETENTION_MODULE_UART1 >> 5] |= BIT(SLEEP_RETENTION_MODULE_UART1 % 32);
185-
# if (SOC_UART_HP_NUM > 2) && !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-11370
185+
# if (SOC_UART_HP_NUM > 2)
186186
mask.bitmap[SLEEP_RETENTION_MODULE_UART2 >> 5] |= BIT(SLEEP_RETENTION_MODULE_UART2 % 32);
187187
# endif
188188
# if (SOC_UART_HP_NUM > 3)

components/soc/esp32c5/register/soc/lp_uart_reg.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,27 @@ extern "C" {
12871287
* LP UART core clock configuration
12881288
*/
12891289
#define LP_UART_CLK_CONF_REG (DR_REG_LP_UART_BASE + 0x88)
1290+
/** LP_UART_SCLK_DIV_B : R/W; bitpos: [5:0]; default: 0;
1291+
* The denominator of the frequency divider factor.
1292+
*/
1293+
#define LP_UART_SCLK_DIV_B 0x0000003FU
1294+
#define LP_UART_SCLK_DIV_B_M (LP_UART_SCLK_DIV_B_V << LP_UART_SCLK_DIV_B_S)
1295+
#define LP_UART_SCLK_DIV_B_V 0x0000003FU
1296+
#define LP_UART_SCLK_DIV_B_S 0
1297+
/** LP_UART_SCLK_DIV_A : R/W; bitpos: [11:6]; default: 0;
1298+
* The numerator of the frequency divider factor.
1299+
*/
1300+
#define LP_UART_SCLK_DIV_A 0x0000003FU
1301+
#define LP_UART_SCLK_DIV_A_M (LP_UART_SCLK_DIV_A_V << LP_UART_SCLK_DIV_A_S)
1302+
#define LP_UART_SCLK_DIV_A_V 0x0000003FU
1303+
#define LP_UART_SCLK_DIV_A_S 6
1304+
/** LP_UART_SCLK_DIV_NUM : R/W; bitpos: [19:12]; default: 1;
1305+
* The integral part of the frequency divider factor.
1306+
*/
1307+
#define LP_UART_SCLK_DIV_NUM 0x000000FFU
1308+
#define LP_UART_SCLK_DIV_NUM_M (LP_UART_SCLK_DIV_NUM_V << LP_UART_SCLK_DIV_NUM_S)
1309+
#define LP_UART_SCLK_DIV_NUM_V 0x000000FFU
1310+
#define LP_UART_SCLK_DIV_NUM_S 12
12901311
/** LP_UART_TX_SCLK_EN : R/W; bitpos: [24]; default: 1;
12911312
* Configures whether or not to enable LP UART TX clock.\\
12921313
* 0: Disable\\

components/soc/esp32c5/register/soc/uart_struct.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extern "C" {
1616
*/
1717
typedef union {
1818
struct {
19-
/** rxfifo_rd_byte : RO; bitpos: [7:0]; default: 0;
19+
/** rxfifo_rd_byte : RO; bitpos: [31:0]; default: 0;
2020
* Represents the data UART $n read from FIFO.\\
2121
* Measurement unit: byte.
2222
*/
@@ -950,17 +950,17 @@ typedef union {
950950
* The denominator of the frequency divider factor.'
951951
* Only available to LP UART instance
952952
*/
953-
uint32_t sclk_div_b:6;
953+
uint32_t sclk_div_b:6; /* UART0/1 instance have this field reserved, configure in corresponding PCR registers */
954954
/** sclk_div_a : R/W; bitpos: [11:6]; default: 0;
955955
* The numerator of the frequency divider factor.
956956
* Only available to LP UART instance
957957
*/
958-
uint32_t sclk_div_a:6;
958+
uint32_t sclk_div_a:6; /* UART0/1 instance have this field reserved, configure in corresponding PCR registers */
959959
/** sclk_div_num : R/W; bitpos: [19:12]; default: 1;
960960
* The integral part of the frequency divider factor.
961961
* Only available to LP UART instance
962962
*/
963-
uint32_t sclk_div_num:8;
963+
uint32_t sclk_div_num:8; /* UART0/1 instance have this field reserved, configure in corresponding PCR registers */
964964
uint32_t reserved_20:4;
965965
/** tx_sclk_en : R/W; bitpos: [24]; default: 1;
966966
* Configures whether or not to enable UART TX clock.\\
@@ -1308,7 +1308,7 @@ typedef union {
13081308
} uart_id_reg_t;
13091309

13101310

1311-
typedef struct {
1311+
typedef struct uart_dev_s {
13121312
volatile uart_fifo_reg_t fifo;
13131313
volatile uart_int_raw_reg_t int_raw;
13141314
volatile uart_int_st_reg_t int_st;

components/soc/esp32c6/register/soc/lp_uart_reg.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -1256,27 +1256,6 @@ extern "C" {
12561256
#define LP_UART_SCLK_DIV_NUM_M (LP_UART_SCLK_DIV_NUM_V << LP_UART_SCLK_DIV_NUM_S)
12571257
#define LP_UART_SCLK_DIV_NUM_V 0x000000FFU
12581258
#define LP_UART_SCLK_DIV_NUM_S 12
1259-
/** LP_UART_SCLK_SEL : R/W; bitpos: [21:20]; default: 3;
1260-
* UART clock source select. 1: 80Mhz. 2: 8Mhz. 3: XTAL.
1261-
*/
1262-
#define LP_UART_SCLK_SEL 0x00000003U
1263-
#define LP_UART_SCLK_SEL_M (LP_UART_SCLK_SEL_V << LP_UART_SCLK_SEL_S)
1264-
#define LP_UART_SCLK_SEL_V 0x00000003U
1265-
#define LP_UART_SCLK_SEL_S 20
1266-
/** LP_UART_SCLK_EN : R/W; bitpos: [22]; default: 1;
1267-
* Set this bit to enable UART Tx/Rx clock.
1268-
*/
1269-
#define LP_UART_SCLK_EN (BIT(22))
1270-
#define LP_UART_SCLK_EN_M (LP_UART_SCLK_EN_V << LP_UART_SCLK_EN_S)
1271-
#define LP_UART_SCLK_EN_V 0x00000001U
1272-
#define LP_UART_SCLK_EN_S 22
1273-
/** LP_UART_RST_CORE : R/W; bitpos: [23]; default: 0;
1274-
* Write 1 then write 0 to this bit to reset UART Tx/Rx.
1275-
*/
1276-
#define LP_UART_RST_CORE (BIT(23))
1277-
#define LP_UART_RST_CORE_M (LP_UART_RST_CORE_V << LP_UART_RST_CORE_S)
1278-
#define LP_UART_RST_CORE_V 0x00000001U
1279-
#define LP_UART_RST_CORE_S 23
12801259
/** LP_UART_TX_SCLK_EN : R/W; bitpos: [24]; default: 1;
12811260
* Set this bit to enable UART Tx clock.
12821261
*/

components/soc/esp32c6/register/soc/uart_reg.h

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -1471,6 +1471,39 @@ extern "C" {
14711471
#define UART_RXD_EDGE_CNT_V 0x000003FFU
14721472
#define UART_RXD_EDGE_CNT_S 0
14731473

1474+
/** UART_CLK_CONF_REG register
1475+
* UART core clock configuration
1476+
*/
1477+
#define UART_CLK_CONF_REG(i) (REG_UART_BASE(i) + 0x88)
1478+
/** UART_TX_SCLK_EN : R/W; bitpos: [24]; default: 1;
1479+
* Set this bit to enable UART Tx clock.
1480+
*/
1481+
#define UART_TX_SCLK_EN (BIT(24))
1482+
#define UART_TX_SCLK_EN_M (UART_TX_SCLK_EN_V << UART_TX_SCLK_EN_S)
1483+
#define UART_TX_SCLK_EN_V 0x00000001U
1484+
#define UART_TX_SCLK_EN_S 24
1485+
/** UART_RX_SCLK_EN : R/W; bitpos: [25]; default: 1;
1486+
* Set this bit to enable UART Rx clock.
1487+
*/
1488+
#define UART_RX_SCLK_EN (BIT(25))
1489+
#define UART_RX_SCLK_EN_M (UART_RX_SCLK_EN_V << UART_RX_SCLK_EN_S)
1490+
#define UART_RX_SCLK_EN_V 0x00000001U
1491+
#define UART_RX_SCLK_EN_S 25
1492+
/** UART_TX_RST_CORE : R/W; bitpos: [26]; default: 0;
1493+
* Write 1 then write 0 to this bit to reset UART Tx.
1494+
*/
1495+
#define UART_TX_RST_CORE (BIT(26))
1496+
#define UART_TX_RST_CORE_M (UART_TX_RST_CORE_V << UART_TX_RST_CORE_S)
1497+
#define UART_TX_RST_CORE_V 0x00000001U
1498+
#define UART_TX_RST_CORE_S 26
1499+
/** UART_RX_RST_CORE : R/W; bitpos: [27]; default: 0;
1500+
* Write 1 then write 0 to this bit to reset UART Rx.
1501+
*/
1502+
#define UART_RX_RST_CORE (BIT(27))
1503+
#define UART_RX_RST_CORE_M (UART_RX_RST_CORE_V << UART_RX_RST_CORE_S)
1504+
#define UART_RX_RST_CORE_V 0x00000001U
1505+
#define UART_RX_RST_CORE_S 27
1506+
14741507
/** UART_DATE_REG register
14751508
* UART Version register
14761509
*/

components/soc/esp32c6/register/soc/uart_struct.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -883,27 +883,16 @@ typedef union {
883883
/** sclk_div_b : R/W; bitpos: [5:0]; default: 0;
884884
* The denominator of the frequency divider factor.
885885
*/
886-
uint32_t sclk_div_b:6;
886+
uint32_t sclk_div_b:6; /* UART0/1 instance have this field reserved, configure in corresponding PCR registers */
887887
/** sclk_div_a : R/W; bitpos: [11:6]; default: 0;
888888
* The numerator of the frequency divider factor.
889889
*/
890-
uint32_t sclk_div_a:6;
890+
uint32_t sclk_div_a:6; /* UART0/1 instance have this field reserved, configure in corresponding PCR registers */
891891
/** sclk_div_num : R/W; bitpos: [19:12]; default: 1;
892892
* The integral part of the frequency divider factor.
893893
*/
894-
uint32_t sclk_div_num:8;
895-
/** sclk_sel : R/W; bitpos: [21:20]; default: 3;
896-
* UART clock source select. 1: 80Mhz. 2: 8Mhz. 3: XTAL.
897-
*/
898-
uint32_t sclk_sel:2;
899-
/** sclk_en : R/W; bitpos: [22]; default: 1;
900-
* Set this bit to enable UART Tx/Rx clock.
901-
*/
902-
uint32_t sclk_en:1;
903-
/** rst_core : R/W; bitpos: [23]; default: 0;
904-
* Write 1 then write 0 to this bit to reset UART Tx/Rx.
905-
*/
906-
uint32_t rst_core:1;
894+
uint32_t sclk_div_num:8; /* UART0/1 instance have this field reserved, configure in corresponding PCR registers */
895+
uint32_t reserved_20:4;
907896
/** tx_sclk_en : R/W; bitpos: [24]; default: 1;
908897
* Set this bit to enable UART Tx clock.
909898
*/
@@ -1273,7 +1262,7 @@ typedef struct uart_dev_s {
12731262
volatile uart_lowpulse_reg_t lowpulse; /* LP_UART instance has this register reserved */
12741263
volatile uart_highpulse_reg_t highpulse; /* LP_UART instance has this register reserved */
12751264
volatile uart_rxd_cnt_reg_t rxd_cnt; /* LP_UART instance has this register reserved */
1276-
volatile uart_clk_conf_reg_t clk_conf; /* UART0/1 instance have this register reserved, configure in corresponding PCR registers */
1265+
volatile uart_clk_conf_reg_t clk_conf;
12771266
volatile uart_date_reg_t date;
12781267
volatile uart_afifo_status_reg_t afifo_status;
12791268
uint32_t reserved_094;

components/soc/esp32c6/uart_periph.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ const uart_signal_conn_t uart_periph_signal[SOC_UART_NUM] = {
124124
* UART_HWFC_CONF_SYNC_REG, UART_SLEEP_CONF0_REG, UART_SLEEP_CONF1_REG, UART_SLEEP_CONF2_REG,
125125
* UART_SWFC_CONF0_SYNC_REG, UART_SWFC_CONF1_REG, UART_TXBRK_CONF_SYNC_REG, UART_IDLE_CONF_SYNC_REG,
126126
* UART_RS485_CONF_SYNC_REG, UART_AT_CMD_PRECNT_SYNC_REG, UART_AT_CMD_POSTCNT_SYNC_REG, UART_AT_CMD_GAPTOUT_SYNC_REG,
127-
* UART_AT_CMD_CHAR_SYNC_REG, UART_MEM_CONF_REG, UART_TOUT_CONF_SYNC_REG, UART_ID_REG
127+
* UART_AT_CMD_CHAR_SYNC_REG, UART_MEM_CONF_REG, UART_TOUT_CONF_SYNC_REG, UART_CLK_CONF_REG, UART_ID_REG
128128
*/
129-
#define UART_RETENTION_ADDR_MAP_REGS_CNT 21
129+
#define UART_RETENTION_ADDR_MAP_REGS_CNT 22
130130
#define UART_RETENTION_REGS_BASE(i) UART_INT_ENA_REG(i)
131-
static const uint32_t uart_regs_map[4] = {0x7fff6d, 0x10, 0x0, 0x0};
131+
static const uint32_t uart_regs_map[4] = {0x807fff6d, 0x10, 0x0, 0x0};
132132
#define UART_SLEEP_RETENTION_ENTRIES(uart_num) { \
133133
[0] = {.config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_UART_LINK(0x00), \
134134
UART_RETENTION_REGS_BASE(uart_num), UART_RETENTION_REGS_BASE(uart_num), \

components/soc/esp32c61/include/soc/retention_periph_defs.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ typedef enum periph_retention_module {
3434
SLEEP_RETENTION_MODULE_I2C0 = 12,
3535
SLEEP_RETENTION_MODULE_UART0 = 14,
3636
SLEEP_RETENTION_MODULE_UART1 = 15,
37-
SLEEP_RETENTION_MODULE_ETM0 = 16,
38-
SLEEP_RETENTION_MODULE_GPSPI2 = 17,
39-
SLEEP_RETENTION_MODULE_LEDC = 18,
40-
SLEEP_RETENTION_MODULE_I2S0 = 19,
41-
SLEEP_RETENTION_MODULE_TEMP_SENSOR = 20,
37+
SLEEP_RETENTION_MODULE_UART2 = 16,
38+
SLEEP_RETENTION_MODULE_ETM0 = 17,
39+
SLEEP_RETENTION_MODULE_GPSPI2 = 18,
40+
SLEEP_RETENTION_MODULE_LEDC = 19,
41+
SLEEP_RETENTION_MODULE_I2S0 = 20,
42+
SLEEP_RETENTION_MODULE_TEMP_SENSOR = 21,
4243

4344
/* Modem module, which includes WiFi, BLE and 802.15.4 */
4445
SLEEP_RETENTION_MODULE_WIFI_MAC = 26,
@@ -63,6 +64,7 @@ typedef enum periph_retention_module {
6364
: ((m) == SLEEP_RETENTION_MODULE_I2C0) ? true \
6465
: ((m) == SLEEP_RETENTION_MODULE_UART0) ? true \
6566
: ((m) == SLEEP_RETENTION_MODULE_UART1) ? true \
67+
: ((m) == SLEEP_RETENTION_MODULE_UART2) ? true \
6668
: ((m) == SLEEP_RETENTION_MODULE_ETM0) ? true \
6769
: ((m) == SLEEP_RETENTION_MODULE_GPSPI2) ? true \
6870
: ((m) == SLEEP_RETENTION_MODULE_LEDC) ? true \

components/soc/esp32c61/include/soc/soc_caps.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@
407407
#define SOC_UART_SUPPORT_RTC_CLK (1) /*!< Support RTC clock as the clock source */
408408
#define SOC_UART_SUPPORT_XTAL_CLK (1) /*!< Support XTAL clock as the clock source */
409409
#define SOC_UART_SUPPORT_WAKEUP_INT (1) /*!< Support UART wakeup interrupt */
410-
#define SOC_UART_SUPPORT_SLEEP_RETENTION (1)
410+
#define SOC_UART_SUPPORT_SLEEP_RETENTION (1) /*!< Support back up registers before sleep */
411+
411412
// UART has an extra TX_WAIT_SEND state when the FIFO is not empty and XOFF is enabled
412413
#define SOC_UART_SUPPORT_FSM_TX_WAIT_SEND (1)
413414

0 commit comments

Comments
 (0)