mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(hal): Fix Key Manager clock changes
This commit is contained in:
parent
afbed25c6f
commit
3ffb811d18
@ -74,6 +74,7 @@ static void esp_key_mgr_acquire_hardware(void)
|
|||||||
// Reset the Key Manager Clock
|
// Reset the Key Manager Clock
|
||||||
KEY_MANAGER_RCC_ATOMIC() {
|
KEY_MANAGER_RCC_ATOMIC() {
|
||||||
key_mgr_ll_enable_bus_clock(true);
|
key_mgr_ll_enable_bus_clock(true);
|
||||||
|
key_mgr_ll_enable_peripheral_clock(true);
|
||||||
key_mgr_ll_reset_register();
|
key_mgr_ll_reset_register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,6 +84,7 @@ static void esp_key_mgr_release_hardware(void)
|
|||||||
esp_crypto_key_manager_lock_release();
|
esp_crypto_key_manager_lock_release();
|
||||||
// Reset the Key Manager Clock
|
// Reset the Key Manager Clock
|
||||||
KEY_MANAGER_RCC_ATOMIC() {
|
KEY_MANAGER_RCC_ATOMIC() {
|
||||||
|
key_mgr_ll_enable_peripheral_clock(false);
|
||||||
key_mgr_ll_enable_bus_clock(false);
|
key_mgr_ll_enable_bus_clock(false);
|
||||||
key_mgr_ll_reset_register();
|
key_mgr_ll_reset_register();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -41,12 +41,24 @@ static inline void key_mgr_ll_enable_bus_clock(bool enable)
|
|||||||
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
||||||
#define key_mgr_ll_enable_bus_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; key_mgr_ll_enable_bus_clock(__VA_ARGS__)
|
#define key_mgr_ll_enable_bus_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; key_mgr_ll_enable_bus_clock(__VA_ARGS__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the peripheral clock for Key Manager
|
||||||
|
*
|
||||||
|
* @param true to enable, false to disable
|
||||||
|
*/
|
||||||
|
static inline void key_mgr_ll_enable_peripheral_clock(bool enable)
|
||||||
|
{
|
||||||
|
HP_SYS_CLKRST.peri_clk_ctrl25.reg_crypto_km_clk_en = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define key_mgr_ll_enable_peripheral_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; key_mgr_ll_enable_bus_clock(__VA_ARGS__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the Key Manager peripheral */
|
* @brief Reset the Key Manager peripheral */
|
||||||
static inline void key_mgr_ll_reset_register(void)
|
static inline void key_mgr_ll_reset_register(void)
|
||||||
{
|
{
|
||||||
HP_SYS_CLKRST.peri_clk_ctrl25.reg_crypto_km_clk_en = 1;
|
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_km = 1;
|
||||||
HP_SYS_CLKRST.peri_clk_ctrl25.reg_crypto_km_clk_en = 0;
|
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_km = 0;
|
||||||
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
|
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
|
||||||
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
|
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user