mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	rtc: fixed 8MD256 can't be used as RTC slow src on ESP32
Sync configuration from other chips Closes: https://github.com/espressif/esp-idf/issues/8007, https://github.com/espressif/esp-idf/pull/8089
This commit is contained in:
		@@ -251,8 +251,7 @@ void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (clk_8m_en) {
 | 
					    if (clk_8m_en) {
 | 
				
			||||||
        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
					        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
				
			||||||
        /* no need to wait once enabled by software */
 | 
					        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
				
			||||||
        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, 1);
 | 
					 | 
				
			||||||
        if (d256_en) {
 | 
					        if (d256_en) {
 | 
				
			||||||
            CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M_DIV);
 | 
					            CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M_DIV);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,7 +96,6 @@ void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (clk_8m_en) {
 | 
					    if (clk_8m_en) {
 | 
				
			||||||
        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
					        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
				
			||||||
        /* no need to wait once enabled by software */
 | 
					 | 
				
			||||||
        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
					        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
				
			||||||
        esp_rom_delay_us(DELAY_8M_ENABLE);
 | 
					        esp_rom_delay_us(DELAY_8M_ENABLE);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,6 @@ void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (clk_8m_en) {
 | 
					    if (clk_8m_en) {
 | 
				
			||||||
        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
					        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
				
			||||||
        /* no need to wait once enabled by software */
 | 
					 | 
				
			||||||
        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
					        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
				
			||||||
        esp_rom_delay_us(DELAY_8M_ENABLE);
 | 
					        esp_rom_delay_us(DELAY_8M_ENABLE);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,6 @@ void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (clk_8m_en) {
 | 
					    if (clk_8m_en) {
 | 
				
			||||||
        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
					        CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
 | 
				
			||||||
        /* no need to wait once enabled by software */
 | 
					 | 
				
			||||||
        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
					        REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
 | 
				
			||||||
        esp_rom_delay_us(DELAY_8M_ENABLE);
 | 
					        esp_rom_delay_us(DELAY_8M_ENABLE);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -563,6 +563,9 @@ typedef struct rtc_sleep_config_s {
 | 
				
			|||||||
#define RTC_CNTL_OTHER_BLOCKS_WAIT_CYCLES       (1)
 | 
					#define RTC_CNTL_OTHER_BLOCKS_WAIT_CYCLES       (1)
 | 
				
			||||||
#define RTC_CNTL_MIN_SLP_VAL_MIN            (128)
 | 
					#define RTC_CNTL_MIN_SLP_VAL_MIN            (128)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RTC_CNTL_CK8M_WAIT_DEFAULT          20
 | 
				
			||||||
 | 
					#define RTC_CK8M_ENABLE_WAIT_DEFAULT        5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Prepare the chip to enter sleep mode
 | 
					 * @brief Prepare the chip to enter sleep mode
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,8 @@
 | 
				
			|||||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
 | 
					/*
 | 
				
			||||||
//
 | 
					 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | 
				
			||||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
					 *
 | 
				
			||||||
// you may not use this file except in compliance with the License.
 | 
					 * SPDX-License-Identifier: Apache-2.0
 | 
				
			||||||
// You may obtain a copy of the License at
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
//     http://www.apache.org/licenses/LICENSE-2.0
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Unless required by applicable law or agreed to in writing, software
 | 
					 | 
				
			||||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
					 | 
				
			||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					 | 
				
			||||||
// See the License for the specific language governing permissions and
 | 
					 | 
				
			||||||
// limitations under the License.
 | 
					 | 
				
			||||||
#ifndef _SOC_RTC_CNTL_REG_H_
 | 
					#ifndef _SOC_RTC_CNTL_REG_H_
 | 
				
			||||||
#define _SOC_RTC_CNTL_REG_H_
 | 
					#define _SOC_RTC_CNTL_REG_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -341,7 +333,6 @@
 | 
				
			|||||||
#define RTC_CNTL_CK8M_WAIT_M  ((RTC_CNTL_CK8M_WAIT_V)<<(RTC_CNTL_CK8M_WAIT_S))
 | 
					#define RTC_CNTL_CK8M_WAIT_M  ((RTC_CNTL_CK8M_WAIT_V)<<(RTC_CNTL_CK8M_WAIT_S))
 | 
				
			||||||
#define RTC_CNTL_CK8M_WAIT_V  0xFF
 | 
					#define RTC_CNTL_CK8M_WAIT_V  0xFF
 | 
				
			||||||
#define RTC_CNTL_CK8M_WAIT_S  6
 | 
					#define RTC_CNTL_CK8M_WAIT_S  6
 | 
				
			||||||
#define RTC_CNTL_CK8M_WAIT_DEFAULT  20
 | 
					 | 
				
			||||||
/* RTC_CNTL_CPU_STALL_WAIT : R/W ;bitpos:[5:1] ;default: 5'd1 ; */
 | 
					/* RTC_CNTL_CPU_STALL_WAIT : R/W ;bitpos:[5:1] ;default: 5'd1 ; */
 | 
				
			||||||
/*description: CPU stall wait cycles in fast_clk_rtc*/
 | 
					/*description: CPU stall wait cycles in fast_clk_rtc*/
 | 
				
			||||||
#define RTC_CNTL_CPU_STALL_WAIT  0x0000001F
 | 
					#define RTC_CNTL_CPU_STALL_WAIT  0x0000001F
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -308,7 +308,6 @@ extern "C" {
 | 
				
			|||||||
#define RTC_CNTL_CK8M_WAIT_M  ((RTC_CNTL_CK8M_WAIT_V)<<(RTC_CNTL_CK8M_WAIT_S))
 | 
					#define RTC_CNTL_CK8M_WAIT_M  ((RTC_CNTL_CK8M_WAIT_V)<<(RTC_CNTL_CK8M_WAIT_S))
 | 
				
			||||||
#define RTC_CNTL_CK8M_WAIT_V  0xFF
 | 
					#define RTC_CNTL_CK8M_WAIT_V  0xFF
 | 
				
			||||||
#define RTC_CNTL_CK8M_WAIT_S  6
 | 
					#define RTC_CNTL_CK8M_WAIT_S  6
 | 
				
			||||||
#define RTC_CNTL_CK8M_WAIT_DEFAULT  20
 | 
					 | 
				
			||||||
/* RTC_CNTL_CPU_STALL_WAIT : R/W ;bitpos:[5:1] ;default: 5'd1 ; */
 | 
					/* RTC_CNTL_CPU_STALL_WAIT : R/W ;bitpos:[5:1] ;default: 5'd1 ; */
 | 
				
			||||||
/*description: CPU stall wait cycles in fast_clk_rtc*/
 | 
					/*description: CPU stall wait cycles in fast_clk_rtc*/
 | 
				
			||||||
#define RTC_CNTL_CPU_STALL_WAIT  0x0000001F
 | 
					#define RTC_CNTL_CPU_STALL_WAIT  0x0000001F
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user