Skip to content

Commit

Permalink
drivers: wifi: Fix QSPI initialiation
Browse files Browse the repository at this point in the history
QSPI initialization reads QSPI slave registers, and if RPU isn't powered
on this causes undefined behaviour (works on DK, but doesn't work on
customer board with different QSPI).

Fix this by dividing the RPU configuration into init and enable, init
doesn't use QSPI, and both QSPI init and RPU enable use QSPI.

Fixes SHEL-2375.

Signed-off-by: Chaitanya Tata <[email protected]>
  • Loading branch information
krish2718 authored and rlubos committed Jan 16, 2024
1 parent 598abe0 commit d72eccd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions drivers/wifi/nrf700x/src/qspi/inc/rpu_hw_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ int rpu_rdsr2(void);
int rpu_rdsr1(void);
int rpu_clks_on(void);

int rpu_init(void);
int rpu_enable(void);
int rpu_disable(void);

Expand Down
22 changes: 15 additions & 7 deletions drivers/wifi/nrf700x/src/qspi/src/rpu_hw_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ int rpu_clks_on(void)
} \
} while (0)

int rpu_enable(void)
int rpu_init(void)
{
int ret;

Expand All @@ -487,6 +487,20 @@ int rpu_enable(void)
goto ble_gpio_remove;
}

return 0;

ble_gpio_remove:
ble_gpio_remove();
rpu_gpio_remove:
rpu_gpio_remove();
out:
return ret;
}

int rpu_enable(void)
{
int ret;

ret = rpu_wakeup();
if (ret) {
goto rpu_pwroff;
Expand All @@ -498,14 +512,8 @@ int rpu_enable(void)
}

return 0;

rpu_pwroff:
rpu_pwroff();
ble_gpio_remove:
ble_gpio_remove();
rpu_gpio_remove:
rpu_gpio_remove();
out:
return ret;
}

Expand Down
6 changes: 6 additions & 0 deletions drivers/wifi/nrf700x/src/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,12 @@ static void *zep_shim_bus_qspi_dev_add(void *os_qspi_priv, void *osal_qspi_dev_c
int ret;
enum nrf_wifi_status status;

ret = rpu_init();
if (ret) {
LOG_ERR("%s: RPU init failed with error %d", __func__, ret);
return NULL;
}

status = qdev->init(qspi_defconfig());
if (status != NRF_WIFI_STATUS_SUCCESS) {
LOG_ERR("%s: QSPI device init failed", __func__);
Expand Down

0 comments on commit d72eccd

Please sign in to comment.