Skip to content

modules: nrf_wifi: Fix bustest QSPI crash #93303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ enum {
NUM_MEM_BLOCKS
};

/* Keeping it higher to avoid changing it ofter, but modify this value
* if rpu_7002_memmap is changed.
*/
#define NRF_WIFI_QSPI_SLAVE_MAX_LATENCY 4

extern char blk_name[][15];
extern uint32_t rpu_7002_memmap[][3];

Expand Down
15 changes: 6 additions & 9 deletions modules/nrf_wifi/bus/qspi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <hal/nrf_clock.h>
#include <hal/nrf_gpio.h>

#include <zephyr/drivers/wifi/nrf_wifi/bus/rpu_hw_if.h>
#include "spi_nor.h"
#include "osal_api.h"

/* The QSPI bus node which the NRF70 is on */
#define QSPI_IF_BUS_NODE DT_NODELABEL(qspi)
Expand Down Expand Up @@ -1290,15 +1290,14 @@ int qspi_read(unsigned int addr, void *data, int len)
int qspi_hl_readw(unsigned int addr, void *data)
{
int status;
uint8_t *rxb = NULL;
uint32_t len = 4;
uint8_t rxb[4 + (NRF_WIFI_QSPI_SLAVE_MAX_LATENCY * 4)];

len = len + (4 * qspi_cfg->qspi_slave_latency);
len += (4 * qspi_cfg->qspi_slave_latency);

rxb = nrf_wifi_osal_mem_alloc(len);

if (rxb == NULL) {
LOG_ERR("%s: ERROR ENOMEM line %d", __func__, __LINE__);
if (len > sizeof(rxb)) {
LOG_ERR("%s: len exceeded, check NRF_WIFI_QSPI_SLAVE_MAX_LATENCY (len=%u, rxb=%zu)",
__func__, (unsigned int)len, sizeof(rxb));
return -ENOMEM;
}

Expand All @@ -1314,8 +1313,6 @@ int qspi_hl_readw(unsigned int addr, void *data)

*(uint32_t *)data = *(uint32_t *)(rxb + (len - 4));

nrf_wifi_osal_mem_free(rxb);

return status;
}

Expand Down