@@ -63,48 +63,8 @@ const esp_efuse_range_addr_t range_write_addr_blocks[] = {
63
63
// Update Efuse timing configuration
64
64
static esp_err_t esp_efuse_set_timing (void )
65
65
{
66
- uint32_t clock = esp_clk_apb_freq ();
67
- // ets_efuse_set_timing(clock);
68
- uint32_t clk_div , power_on ;
69
- //uint32_t power_off; // Support for 7.2.3 chip
70
- uint32_t tsup_a = 1 , thp_a = 1 , tpgm , tpgm_inact ;
71
- uint32_t tsur_a = 1 , thr_a = 1 , trd ;
72
- if (clock == 20000000 || clock == 5000000 || clock == 10000000 ) {
73
- clk_div = 0x28 ;
74
- power_on = 0x2880 ;
75
- //power_off = 0x40;
76
- tpgm = 0xc8 ;
77
- tpgm_inact = 1 ;
78
- trd = 1 ;
79
- } else if (clock == 40000000 ) {
80
- clk_div = 0x50 ;
81
- power_on = 0x5100 ;
82
- //power_off = 0x80;
83
- tpgm = 0x190 ;
84
- tpgm_inact = 2 ;
85
- trd = 2 ;
86
- } else if (clock == 80000000 ) {
87
- clk_div = 0xa0 ;
88
- power_on = 0xa200 ;
89
- //power_off = 0x100;
90
- tpgm = 0x320 ;
91
- tpgm_inact = 3 ;
92
- trd = 3 ;
93
- } else {
94
- ESP_LOGE (TAG , "Efuse does not support this %d Hz APB clock" , clock );
95
- return ESP_ERR_NOT_SUPPORTED ;
96
- }
97
- REG_SET_FIELD (EFUSE_DAC_CONF_REG , EFUSE_DAC_CLK_DIV , clk_div );
98
- REG_SET_FIELD (EFUSE_WR_TIM_CONF0_REG , EFUSE_TPGM , tpgm );
99
- REG_SET_FIELD (EFUSE_WR_TIM_CONF0_REG , EFUSE_TPGM_INACTIVE , tpgm_inact );
100
- REG_SET_FIELD (EFUSE_WR_TIM_CONF0_REG , EFUSE_THP_A , thp_a );
101
- REG_SET_FIELD (EFUSE_WR_TIM_CONF1_REG , EFUSE_PWR_ON_NUM , power_on );
102
- REG_SET_FIELD (EFUSE_WR_TIM_CONF1_REG , EFUSE_TSUP_A , tsup_a );
103
- //REG_SET_FIELD(EFUSE_WR_TIM_CONF2_REG, EFUSE_PWR_OFF_NUM, power_off);
104
- REG_SET_FIELD (EFUSE_RD_TIM_CONF_REG , EFUSE_TSUR_A , tsur_a );
105
- REG_SET_FIELD (EFUSE_RD_TIM_CONF_REG , EFUSE_TRD , trd );
106
- REG_SET_FIELD (EFUSE_RD_TIM_CONF_REG , EFUSE_THR_A , thr_a );
107
- return ESP_OK ;
66
+ uint32_t clock_hz = esp_clk_apb_freq ();
67
+ return ets_efuse_set_timing (clock_hz ) ? ESP_FAIL : ESP_OK ;
108
68
}
109
69
#endif // ifndef CONFIG_EFUSE_VIRTUAL
110
70
0 commit comments