fix(st-crypto): do not set IPRST if BUSY flag is present

An issue appear when a IPRST is set when BUSY flag is still set.
Put the IP reset under condition solve this issue.

Signed-off-by: Maxime Méré <maxime.mere@foss.st.com>
Change-Id: Ibb096c1a362b8077285812e1ffca749c7fc93a03
diff --git a/drivers/st/crypto/stm32_saes.c b/drivers/st/crypto/stm32_saes.c
index f4da571..547ff89 100644
--- a/drivers/st/crypto/stm32_saes.c
+++ b/drivers/st/crypto/stm32_saes.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, STMicroelectronics - All Rights Reserved
+ * Copyright (c) 2022-2025, STMicroelectronics - All Rights Reserved
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -211,9 +211,11 @@
 	uint64_t timeout;
 
 	/* Reset IP */
-	mmio_setbits_32(ctx->base + _SAES_CR, _SAES_CR_IPRST);
-	udelay(SAES_RESET_DELAY);
-	mmio_clrbits_32(ctx->base + _SAES_CR, _SAES_CR_IPRST);
+	if ((mmio_read_32(ctx->base + _SAES_SR) & _SAES_SR_BUSY) != _SAES_SR_BUSY) {
+		mmio_setbits_32(ctx->base + _SAES_CR, _SAES_CR_IPRST);
+		udelay(SAES_RESET_DELAY);
+		mmio_clrbits_32(ctx->base + _SAES_CR, _SAES_CR_IPRST);
+	}
 
 	timeout = timeout_init_us(SAES_TIMEOUT_US);
 	while ((mmio_read_32(ctx->base + _SAES_SR) & _SAES_SR_BUSY) == _SAES_SR_BUSY) {