From f8ea3c2d4df592767767e2581d1a96eaa613fdec 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 --- .../osal/hw_if/hal/src/hal_interrupt.c | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/wifi/nrf700x/osal/hw_if/hal/src/hal_interrupt.c b/drivers/wifi/nrf700x/osal/hw_if/hal/src/hal_interrupt.c index 288ac9523868..8e81f2b3a62f 100644 --- a/drivers/wifi/nrf700x/osal/hw_if/hal/src/hal_interrupt.c +++ b/drivers/wifi/nrf700x/osal/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\n", - __func__); + "%s: Reading from interrupt status register failed 0x%x \n", + __func__, + val); goto out; }