From e20eae418b4adfd8e1cfa4c07bb241eb44d81f2d Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 22 Aug 2024 18:19:40 +0530 Subject: [PATCH] drivers: wifi: Add a workaround for read failures In some scenarios like reading WDOG status, it was observed that multiple retries are needed for the (Q)SPI read to be successful, so, add a retry support. Signed-off-by: Chaitanya Tata --- nrf_wifi/hw_if/hal/src/hal_interrupt.c | 32 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/nrf_wifi/hw_if/hal/src/hal_interrupt.c b/nrf_wifi/hw_if/hal/src/hal_interrupt.c index 22419b7cd9..5c4f9b07f1 100644 --- a/nrf_wifi/hw_if/hal/src/hal_interrupt.c +++ b/nrf_wifi/hw_if/hal/src/hal_interrupt.c @@ -134,15 +134,35 @@ static bool hal_rpu_irq_wdog_chk(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx) enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; unsigned int val = 0; bool ret = false; + unsigned int i, max_read_retries = 10; - status = hal_rpu_reg_read(hal_dev_ctx, - &val, - RPU_REG_MIPS_MCU_UCCP_INT_STATUS); + for (i = 0; i < max_read_retries; i++) { + status = hal_rpu_reg_read(hal_dev_ctx, + &val, + RPU_REG_MIPS_MCU_UCCP_INT_STATUS); - if (status != NRF_WIFI_STATUS_SUCCESS) { + if (status != NRF_WIFI_STATUS_SUCCESS) { + nrf_wifi_osal_log_err(hal_dev_ctx->hpriv->opriv, + "%s: Reading from interrupt status register failed\n", + __func__); + goto out; + } + + if (val != 0xAAAAAAAA) { + break; + } else { + nrf_wifi_osal_log_err(hal_dev_ctx->hpriv->opriv, + "%s: Reading from interrupt status register failed 0x%x \n", + __func__, + val); + } + } + + if (i == max_read_retries) { nrf_wifi_osal_log_err(hal_dev_ctx->hpriv->opriv, - "%s: Reading from interrupt status register failed", - __func__); + "%s: Reading from interrupt status register failed 0x%x \n", + __func__, + val); goto out; }