Skip to content

Commit

Permalink
drivers: crypto: stm32_cryp: remove reset binding requirements
Browse files Browse the repository at this point in the history
Remove panic during probe when "resets" property is not found because
it's optional in most cases.

Signed-off-by: Thomas Bourgoin <thomas.bourgoin@foss.st.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
tbourgoi authored and jforissier committed Mar 25, 2024
1 parent a8cfcdf commit 1d8b118
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/drivers/crypto/stm32/stm32_cryp.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,11 @@ static TEE_Result __must_check read_block(struct stm32_cryp_context *ctx,
static void cryp_end(struct stm32_cryp_context *ctx, TEE_Result prev_error)
{
if (prev_error) {
if (rstctrl_assert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
if (cryp_pdata.reset &&
rstctrl_assert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
panic();
if (rstctrl_deassert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
if (cryp_pdata.reset &&
rstctrl_deassert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
panic();
}

Expand Down Expand Up @@ -1248,7 +1250,7 @@ static TEE_Result stm32_cryp_probe(const void *fdt, int node,
return res;

res = rstctrl_dt_get_by_index(fdt, node, 0, &rstctrl);
if (res)
if (res != TEE_SUCCESS && res != TEE_ERROR_ITEM_NOT_FOUND)
return res;

cryp_pdata.clock = clk;
Expand All @@ -1264,10 +1266,10 @@ static TEE_Result stm32_cryp_probe(const void *fdt, int node,
if (clk_enable(cryp_pdata.clock))
panic();

if (rstctrl_assert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
if (rstctrl && rstctrl_assert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
panic();

if (rstctrl_deassert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
if (rstctrl && rstctrl_deassert_to(cryp_pdata.reset, TIMEOUT_US_1MS))
panic();

if (IS_ENABLED(CFG_CRYPTO_DRV_AUTHENC)) {
Expand Down

0 comments on commit 1d8b118

Please sign in to comment.