fix(hal/crypto): Do not reset parent crypto clk when resetting a crypto peripheral

This commit is contained in:
harshal.patil 2024-03-05 15:06:39 +05:30
parent c8651c1041
commit 2b6f12ba51
No known key found for this signature in database
GPG Key ID: 5B5EC97C35B9A2E5
7 changed files with 8 additions and 20 deletions

View File

@ -67,40 +67,40 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en
case PERIPH_SARADC_MODULE:
return HP_SYS_CLKRST_REG_RST_EN_ADC;
case PERIPH_AES_MODULE:
ret = HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_AES;
ret = HP_SYS_CLKRST_REG_RST_EN_AES;
if (enable == true) {
// Clear reset on digital signature, otherwise AES unit is held in reset
ret |= HP_SYS_CLKRST_REG_RST_EN_DS;
}
return ret;
case PERIPH_DS_MODULE:
return HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_DS;
return HP_SYS_CLKRST_REG_RST_EN_DS;
case PERIPH_ECC_MODULE:
ret = HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_ECC;
ret = HP_SYS_CLKRST_REG_RST_EN_ECC;
if (enable == true) {
ret |= HP_SYS_CLKRST_REG_RST_EN_ECDSA;
}
return ret;
case PERIPH_HMAC_MODULE:
return HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_HMAC;
return HP_SYS_CLKRST_REG_RST_EN_HMAC;
case PERIPH_RSA_MODULE:
ret = HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_RSA;
ret = HP_SYS_CLKRST_REG_RST_EN_RSA;
if (enable == true) {
// Clear reset on digital signature, and ECDSA, otherwise RSA is held in reset
ret |= HP_SYS_CLKRST_REG_RST_EN_DS | HP_SYS_CLKRST_REG_RST_EN_ECDSA;
}
return ret;
case PERIPH_SEC_MODULE:
return HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_SEC;
return HP_SYS_CLKRST_REG_RST_EN_SEC;
case PERIPH_SHA_MODULE:
ret = HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_SHA;
ret = HP_SYS_CLKRST_REG_RST_EN_SHA;
if (enable == true) {
// Clear reset on digital signature, HMAC and ECDSA, otherwise SHA is held in reset
ret |= (HP_SYS_CLKRST_REG_RST_EN_HMAC | HP_SYS_CLKRST_REG_RST_EN_DS | HP_SYS_CLKRST_REG_RST_EN_ECDSA);
}
return ret;
case PERIPH_ECDSA_MODULE:
return HP_SYS_CLKRST_REG_RST_EN_CRYPTO | HP_SYS_CLKRST_REG_RST_EN_ECDSA;
return HP_SYS_CLKRST_REG_RST_EN_ECDSA;
case PERIPH_EMAC_MODULE:
return LP_CLKRST_RST_EN_EMAC;
default:

View File

@ -46,8 +46,6 @@ static inline void ds_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section

View File

@ -46,8 +46,6 @@ static inline void ecc_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecc = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecc = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
// Clear reset on ECDSA, otherwise ECC is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 0;

View File

@ -91,8 +91,6 @@ static inline void ecdsa_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/**

View File

@ -53,8 +53,6 @@ static inline void hmac_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_hmac = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_hmac = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section

View File

@ -59,8 +59,6 @@ static inline void key_mgr_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_km = 1;
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 = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section

View File

@ -39,8 +39,6 @@ static inline void mpi_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_rsa = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_rsa = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
// Clear reset on digital signature and ECDSA, otherwise RSA is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 0;