diff --git a/nrf_wifi/bus_if/bus/qspi/src/qspi.c b/nrf_wifi/bus_if/bus/qspi/src/qspi.c index 6999bfaa27..6889d52901 100644 --- a/nrf_wifi/bus_if/bus/qspi/src/qspi.c +++ b/nrf_wifi/bus_if/bus/qspi/src/qspi.c @@ -32,7 +32,6 @@ static int nrf_wifi_bus_qspi_irq_handler(void *data) static void *nrf_wifi_bus_qspi_dev_add(void *bus_priv, void *bal_dev_ctx) { - enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; struct nrf_wifi_bus_qspi_priv *qspi_priv = NULL; struct nrf_wifi_bus_qspi_dev_ctx *qspi_dev_ctx = NULL; struct nrf_wifi_osal_host_map host_map; @@ -76,30 +75,6 @@ static void *nrf_wifi_bus_qspi_dev_add(void *bus_priv, qspi_dev_ctx->addr_pktram_base = qspi_dev_ctx->host_addr_base + qspi_priv->cfg_params.addr_pktram_base; - status = nrf_wifi_osal_bus_qspi_dev_intr_reg(qspi_dev_ctx->qspi_priv->opriv, - qspi_dev_ctx->os_qspi_dev_ctx, - qspi_dev_ctx, - &nrf_wifi_bus_qspi_irq_handler); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - nrf_wifi_osal_log_err(qspi_dev_ctx->qspi_priv->opriv, - "%s: Unable to register interrupt to the OS", - __func__); - - nrf_wifi_osal_bus_qspi_dev_intr_unreg(qspi_dev_ctx->qspi_priv->opriv, - qspi_dev_ctx->os_qspi_dev_ctx); - - nrf_wifi_osal_bus_qspi_dev_rem(qspi_dev_ctx->qspi_priv->opriv, - qspi_dev_ctx->os_qspi_dev_ctx); - - nrf_wifi_osal_mem_free(qspi_priv->opriv, - qspi_dev_ctx); - - qspi_dev_ctx = NULL; - - goto out; - } - out: return qspi_dev_ctx; } @@ -111,9 +86,6 @@ static void nrf_wifi_bus_qspi_dev_rem(void *bus_dev_ctx) qspi_dev_ctx = bus_dev_ctx; - nrf_wifi_osal_bus_qspi_dev_intr_unreg(qspi_dev_ctx->qspi_priv->opriv, - qspi_dev_ctx->os_qspi_dev_ctx); - nrf_wifi_osal_bus_qspi_dev_rem(qspi_dev_ctx->qspi_priv->opriv, qspi_dev_ctx->os_qspi_dev_ctx); @@ -129,6 +101,21 @@ static enum nrf_wifi_status nrf_wifi_bus_qspi_dev_init(void *bus_dev_ctx) qspi_dev_ctx = bus_dev_ctx; + + status = nrf_wifi_osal_bus_qspi_dev_intr_reg(qspi_dev_ctx->qspi_priv->opriv, + qspi_dev_ctx->os_qspi_dev_ctx, + qspi_dev_ctx, + &nrf_wifi_bus_qspi_irq_handler); + + if (status != NRF_WIFI_STATUS_SUCCESS) { + nrf_wifi_osal_log_err(qspi_dev_ctx->qspi_priv->opriv, + "%s: Unable to register interrupt to the OS", + __func__); + qspi_dev_ctx = NULL; + + goto out; + } + status = nrf_wifi_osal_bus_qspi_dev_init(qspi_dev_ctx->qspi_priv->opriv, qspi_dev_ctx->os_qspi_dev_ctx); @@ -136,6 +123,8 @@ static enum nrf_wifi_status nrf_wifi_bus_qspi_dev_init(void *bus_dev_ctx) nrf_wifi_osal_log_err(qspi_dev_ctx->qspi_priv->opriv, "%s: nrf_wifi_osal_qspi_dev_init failed", __func__); + nrf_wifi_osal_bus_qspi_dev_intr_unreg(qspi_dev_ctx->qspi_priv->opriv, + qspi_dev_ctx->os_qspi_dev_ctx); goto out; } out: @@ -149,6 +138,9 @@ static void nrf_wifi_bus_qspi_dev_deinit(void *bus_dev_ctx) qspi_dev_ctx = bus_dev_ctx; + nrf_wifi_osal_bus_qspi_dev_intr_unreg(qspi_dev_ctx->qspi_priv->opriv, + qspi_dev_ctx->os_qspi_dev_ctx); + nrf_wifi_osal_bus_qspi_dev_deinit(qspi_dev_ctx->qspi_priv->opriv, qspi_dev_ctx->os_qspi_dev_ctx); } diff --git a/nrf_wifi/bus_if/bus/spi/src/spi.c b/nrf_wifi/bus_if/bus/spi/src/spi.c index bc47c82c81..d2da21eb95 100644 --- a/nrf_wifi/bus_if/bus/spi/src/spi.c +++ b/nrf_wifi/bus_if/bus/spi/src/spi.c @@ -76,30 +76,6 @@ static void *nrf_wifi_bus_spi_dev_add(void *bus_priv, spi_dev_ctx->addr_pktram_base = spi_dev_ctx->host_addr_base + spi_priv->cfg_params.addr_pktram_base; - status = nrf_wifi_osal_bus_spi_dev_intr_reg(spi_dev_ctx->spi_priv->opriv, - spi_dev_ctx->os_spi_dev_ctx, - spi_dev_ctx, - &nrf_wifi_bus_spi_irq_handler); - - if (status != NRF_WIFI_STATUS_SUCCESS) { - nrf_wifi_osal_log_err(spi_dev_ctx->spi_priv->opriv, - "%s: Unable to register interrupt to the OS", - __func__); - - nrf_wifi_osal_bus_spi_dev_intr_unreg(spi_dev_ctx->spi_priv->opriv, - spi_dev_ctx->os_spi_dev_ctx); - - nrf_wifi_osal_bus_spi_dev_rem(spi_dev_ctx->spi_priv->opriv, - spi_dev_ctx->os_spi_dev_ctx); - - nrf_wifi_osal_mem_free(spi_priv->opriv, - spi_dev_ctx); - - spi_dev_ctx = NULL; - - goto out; - } - out: return spi_dev_ctx; } @@ -111,9 +87,6 @@ static void nrf_wifi_bus_spi_dev_rem(void *bus_dev_ctx) spi_dev_ctx = bus_dev_ctx; - nrf_wifi_osal_bus_spi_dev_intr_unreg(spi_dev_ctx->spi_priv->opriv, - spi_dev_ctx->os_spi_dev_ctx); - nrf_wifi_osal_mem_free(spi_dev_ctx->spi_priv->opriv, spi_dev_ctx); } @@ -126,6 +99,19 @@ static enum nrf_wifi_status nrf_wifi_bus_spi_dev_init(void *bus_dev_ctx) spi_dev_ctx = bus_dev_ctx; + + status = nrf_wifi_osal_bus_spi_dev_intr_reg(spi_dev_ctx->spi_priv->opriv, + spi_dev_ctx->os_spi_dev_ctx, + spi_dev_ctx, + &nrf_wifi_bus_spi_irq_handler); + + if (status != NRF_WIFI_STATUS_SUCCESS) { + nrf_wifi_osal_log_err(spi_dev_ctx->spi_priv->opriv, + "%s: Unable to register interrupt to the OS", + __func__); + goto out; + } + status = nrf_wifi_osal_bus_spi_dev_init(spi_dev_ctx->spi_priv->opriv, spi_dev_ctx->os_spi_dev_ctx); @@ -133,6 +119,8 @@ static enum nrf_wifi_status nrf_wifi_bus_spi_dev_init(void *bus_dev_ctx) nrf_wifi_osal_log_err(spi_dev_ctx->spi_priv->opriv, "%s: nrf_wifi_osal_spi_dev_init failed", __func__); + nrf_wifi_osal_bus_spi_dev_intr_unreg(spi_dev_ctx->spi_priv->opriv, + spi_dev_ctx->os_spi_dev_ctx); goto out; } out: @@ -146,6 +134,9 @@ static void nrf_wifi_bus_spi_dev_deinit(void *bus_dev_ctx) spi_dev_ctx = bus_dev_ctx; + nrf_wifi_osal_bus_spi_dev_intr_unreg(spi_dev_ctx->spi_priv->opriv, + spi_dev_ctx->os_spi_dev_ctx); + nrf_wifi_osal_bus_spi_dev_deinit(spi_dev_ctx->spi_priv->opriv, spi_dev_ctx->os_spi_dev_ctx); } diff --git a/nrf_wifi/fw_if/umac_if/src/default/fmac_api.c b/nrf_wifi/fw_if/umac_if/src/default/fmac_api.c index 6f43e07e2f..0f32979b61 100644 --- a/nrf_wifi/fw_if/umac_if/src/default/fmac_api.c +++ b/nrf_wifi/fw_if/umac_if/src/default/fmac_api.c @@ -433,11 +433,10 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_init(struct nrf_wifi_fmac_dev_ctx *fmac_d void nrf_wifi_fmac_dev_deinit(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx) { - nrf_wifi_hal_lock_rx(fmac_dev_ctx->hal_dev_ctx); + nrf_wifi_hal_dev_deinit(fmac_dev_ctx->hal_dev_ctx); nrf_wifi_fmac_fw_deinit(fmac_dev_ctx); nrf_wifi_osal_mem_free(fmac_dev_ctx->fpriv->opriv, fmac_dev_ctx->tx_pwr_ceil_params); - nrf_wifi_hal_unlock_rx(fmac_dev_ctx->hal_dev_ctx); } #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY @@ -2257,6 +2256,10 @@ enum nrf_wifi_status nrf_wifi_fmac_chg_vif(void *dev_ctx, def_dev_ctx = wifi_dev_priv(fmac_dev_ctx); + nrf_wifi_fmac_vif_update_if_type(fmac_dev_ctx, + if_idx, + vif_info->iftype); + def_dev_ctx->vif_ctx[if_idx]->if_type = vif_info->iftype; } diff --git a/nrf_wifi/hw_if/hal/src/hal_api.c b/nrf_wifi/hw_if/hal/src/hal_api.c index 9d774de53c..141887a452 100644 --- a/nrf_wifi/hw_if/hal/src/hal_api.c +++ b/nrf_wifi/hw_if/hal/src/hal_api.c @@ -1060,14 +1060,6 @@ void hal_rpu_eventq_drain(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx) hal_dev_ctx->lock_rx, &flags); - if (hal_dev_ctx->hal_status != NRF_WIFI_HAL_STATUS_ENABLED) { - /* Ignore the interrupt if the HAL is not enabled */ - nrf_wifi_osal_spinlock_irq_rel(hal_dev_ctx->hpriv->opriv, - hal_dev_ctx->lock_rx, - &flags); - goto out; - } - event = nrf_wifi_utils_q_dequeue(hal_dev_ctx->hpriv->opriv, hal_dev_ctx->event_q); @@ -1305,8 +1297,6 @@ void nrf_wifi_hal_dev_rem(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx) nrf_wifi_osal_tasklet_kill(hal_dev_ctx->hpriv->opriv, hal_dev_ctx->event_tasklet); - hal_rpu_eventq_drain(hal_dev_ctx); - nrf_wifi_osal_tasklet_free(hal_dev_ctx->hpriv->opriv, hal_dev_ctx->event_tasklet); @@ -1388,6 +1378,7 @@ enum nrf_wifi_status nrf_wifi_hal_dev_init(struct nrf_wifi_hal_dev_ctx *hal_dev_ } hal_dev_ctx->rpu_info.tx_cmd_base = RPU_MEM_TX_CMD_BASE; + nrf_wifi_hal_enable(hal_dev_ctx); out: return status; } @@ -1395,7 +1386,9 @@ enum nrf_wifi_status nrf_wifi_hal_dev_init(struct nrf_wifi_hal_dev_ctx *hal_dev_ void nrf_wifi_hal_dev_deinit(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx) { + nrf_wifi_hal_disable(hal_dev_ctx); nrf_wifi_bal_dev_deinit(hal_dev_ctx->bal_dev_ctx); + hal_rpu_eventq_drain(hal_dev_ctx); }