From 816913b24a24ae4821546a730c70ddace977624c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 29 Feb 2024 00:34:16 +0530 Subject: [PATCH] nrf_wifi: Decrease MCU boot timeout If MCU isn't ready in 1s then there is not much use in waiting longer, so, decrease the timeout to 1s and also rejig the code to make it readable. Fixes SHEL-2480 partially. Signed-off-by: Chaitanya Tata --- nrf_wifi/hw_if/hal/src/hal_api.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nrf_wifi/hw_if/hal/src/hal_api.c b/nrf_wifi/hw_if/hal/src/hal_api.c index 1631a47272..ae44a90fd2 100644 --- a/nrf_wifi/hw_if/hal/src/hal_api.c +++ b/nrf_wifi/hw_if/hal/src/hal_api.c @@ -1599,7 +1599,7 @@ enum nrf_wifi_status nrf_wifi_hal_proc_reset(struct nrf_wifi_hal_dev_ctx *hal_de return status; } - +#define MCU_FW_BOOT_TIMEOUT_MS 1000 enum nrf_wifi_status nrf_wifi_hal_fw_chk_boot(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx, enum RPU_PROC_TYPE rpu_proc) { @@ -1607,7 +1607,7 @@ enum nrf_wifi_status nrf_wifi_hal_fw_chk_boot(struct nrf_wifi_hal_dev_ctx *hal_d unsigned int addr = 0; unsigned int val = 0; unsigned int exp_val = 0; - unsigned int i = 0; + unsigned int mcu_ready_wait_count = MCU_FW_BOOT_TIMEOUT_MS / 10; if (rpu_proc == RPU_PROC_TYPE_MCU_LMAC) { addr = RPU_MEM_LMAC_BOOT_SIG; @@ -1624,7 +1624,7 @@ enum nrf_wifi_status nrf_wifi_hal_fw_chk_boot(struct nrf_wifi_hal_dev_ctx *hal_d hal_dev_ctx->curr_proc = rpu_proc; - while (i < 1000) { + while (mcu_ready_wait_count-- > 0) { status = hal_rpu_mem_read(hal_dev_ctx, (unsigned char *)&val, addr, @@ -1644,12 +1644,9 @@ enum nrf_wifi_status nrf_wifi_hal_fw_chk_boot(struct nrf_wifi_hal_dev_ctx *hal_d /* Sleep for 10 ms */ nrf_wifi_osal_sleep_ms(hal_dev_ctx->hpriv->opriv, 10); - - i++; - }; - if (i == 1000) { + if (mcu_ready_wait_count <= 0) { nrf_wifi_osal_log_err(hal_dev_ctx->hpriv->opriv, "%s: Boot_sig check failed for RPU(%d), " "Expected: 0x%X, Actual: 0x%X",