Skip to content

Commit 5d0dc14

Browse files
Marek Matejkartben
authored andcommitted
drivers: clock_control: limit APPCPU clock setup
Update init function so APPCPU could not altere the clock setup. Fix build in case if no inter-cpu module is selected. Signed-off-by: Marek Matej <marek.matej@espressif.com>
1 parent a4904cc commit 5d0dc14

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/clock_control/clock_control_esp32.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,14 @@ static void esp32_clock_perip_init(void)
161161
}
162162
}
163163
#else
164+
#if !defined(CONFIG_SOC_ESP32_APPCPU) && !defined(CONFIG_SOC_ESP32S3_APPCPU)
164165
static void esp32_clock_perip_init(void)
165166
{
166167
uint32_t common_perip_clk;
167168
uint32_t hwcrypto_perip_clk;
168169
uint32_t wifi_bt_sdio_clk;
169170
#if !defined(CONFIG_SOC_SERIES_ESP32)
170171
uint32_t common_perip_clk1;
171-
#endif
172-
/* Avoid APPCPU to mess with the clocks. */
173-
#if defined(CONFIG_SOC_ESP32_APPCPU) || defined(CONFIG_SOC_ESP32S3_APPCPU)
174-
return;
175172
#endif
176173
/* For reason that only reset CPU, do not disable the clocks
177174
* that have been enabled before reset.
@@ -487,6 +484,7 @@ static void esp32_clock_perip_init(void)
487484
#endif
488485
}
489486
#endif
487+
#endif
490488

491489
static enum clock_control_status clock_control_esp32_get_status(const struct device *dev,
492490
clock_control_subsys_t sys)
@@ -782,6 +780,8 @@ static int clock_control_esp32_init(const struct device *dev)
782780
return ret;
783781
}
784782

783+
/* Prevent APPCPU from interfering with the clock setup */
784+
#if !defined(CONFIG_SOC_ESP32_APPCPU) && !defined(CONFIG_SOC_ESP32S3_APPCPU)
785785
rtc_clk_fast_src_set(cfg->rtc.rtc_fast_clock_src);
786786

787787
ret = esp32_select_rtc_slow_clk(cfg->rtc.rtc_slow_clock_src);
@@ -791,6 +791,7 @@ static int clock_control_esp32_init(const struct device *dev)
791791
}
792792

793793
esp32_clock_perip_init();
794+
#endif
794795

795796
return 0;
796797
}

0 commit comments

Comments
 (0)