Skip to content
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

wifi: Fix de-initialization sequence #15602

Merged
merged 6 commits into from
Jun 4, 2024
Merged
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
2 changes: 2 additions & 0 deletions drivers/wifi/nrf700x/src/qspi/inc/spi_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

int spim_init(struct qspi_config *config);

int spim_deinit(void);

int spim_write(unsigned int addr, const void *data, int len);

int spim_read(unsigned int addr, void *data, int len);
Expand Down
22 changes: 14 additions & 8 deletions drivers/wifi/nrf700x/src/qspi/src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@
static struct qspi_config config;

#if defined(CONFIG_NRF700X_ON_QSPI)
static struct qspi_dev qspi = { .init = qspi_init,
.read = qspi_read,
.write = qspi_write,
.hl_read = qspi_hl_read};
static struct qspi_dev qspi = {
.init = qspi_init,
.deinit = qspi_deinit,
.read = qspi_read,
.write = qspi_write,
.hl_read = qspi_hl_read
};
#else
static struct qspi_dev spim = { .init = spim_init,
.read = spim_read,
.write = spim_write,
.hl_read = spim_hl_read};
static struct qspi_dev spim = {
.init = spim_init,
.deinit = spim_deinit,
.read = spim_read,
.write = spim_write,
.hl_read = spim_hl_read
};
#endif

struct qspi_config *qspi_defconfig(void)
Expand Down
7 changes: 7 additions & 0 deletions drivers/wifi/nrf700x/src/qspi/src/spi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ int spim_init(struct qspi_config *config)
return 0;
}

int spim_deinit(void)
{
LOG_DBG("TODO : %s", __func__);

return 0;
}

static void spim_addr_check(unsigned int addr, const void *data, unsigned int len)
{
if ((addr % 4 != 0) || (((unsigned int)data) % 4 != 0) || (len % 4 != 0)) {
Expand Down
31 changes: 19 additions & 12 deletions drivers/wifi/nrf700x/src/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,19 +633,18 @@ static enum nrf_wifi_status zep_shim_bus_qspi_dev_init(void *os_qspi_dev_ctx)
return NRF_WIFI_STATUS_SUCCESS;
}

static void zep_shim_bus_qspi_dev_deinit(void *os_qspi_dev_ctx)
static void zep_shim_bus_qspi_dev_deinit(void *priv)
{
struct qspi_dev *dev = NULL;

dev = os_qspi_dev_ctx;
struct zep_shim_bus_qspi_priv *qspi_priv = priv;
volatile struct qspi_dev *dev = qspi_priv->qspi_dev;

dev->deinit();
}

static void *zep_shim_bus_qspi_dev_add(void *os_qspi_priv, void *osal_qspi_dev_ctx)
{
struct zep_shim_bus_qspi_priv *zep_qspi_priv = os_qspi_priv;
struct qspi_dev *qdev = qspi_dev();
struct qspi_dev *dev = qspi_dev();
int ret;
enum nrf_wifi_status status;

Expand All @@ -655,7 +654,7 @@ static void *zep_shim_bus_qspi_dev_add(void *os_qspi_priv, void *osal_qspi_dev_c
return NULL;
}

status = qdev->init(qspi_defconfig());
status = dev->init(qspi_defconfig());
if (status != NRF_WIFI_STATUS_SUCCESS) {
LOG_ERR("%s: QSPI device init failed", __func__);
return NULL;
Expand All @@ -666,17 +665,18 @@ static void *zep_shim_bus_qspi_dev_add(void *os_qspi_priv, void *osal_qspi_dev_c
LOG_ERR("%s: RPU enable failed with error %d", __func__, ret);
return NULL;
}
zep_qspi_priv->qspi_dev = qdev;
zep_qspi_priv->qspi_dev = dev;
zep_qspi_priv->dev_added = true;

return zep_qspi_priv;
}

static void zep_shim_bus_qspi_dev_rem(void *os_qspi_dev_ctx)
static void zep_shim_bus_qspi_dev_rem(void *priv)
{
struct qspi_dev *dev = NULL;
struct zep_shim_bus_qspi_priv *qspi_priv = priv;
struct qspi_dev *dev = qspi_priv->qspi_dev;

dev = os_qspi_dev_ctx;
ARG_UNUSED(dev);

/* TODO: Make qspi_dev a dynamic instance and remove it here */
rpu_disable();
Expand Down Expand Up @@ -796,11 +796,18 @@ static enum nrf_wifi_status zep_shim_bus_qspi_intr_reg(void *os_dev_ctx, void *c

static void zep_shim_bus_qspi_intr_unreg(void *os_qspi_dev_ctx)
{
struct k_work_sync sync;
int ret;

ARG_UNUSED(os_qspi_dev_ctx);

k_work_cancel_delayable(&intr_priv->work);
ret = rpu_irq_remove(&intr_priv->gpio_cb_data);
if (ret) {
LOG_ERR("%s: rpu_irq_remove failed", __func__);
return;
}

rpu_irq_remove(&intr_priv->gpio_cb_data);
k_work_cancel_delayable_sync(&intr_priv->work, &sync);

k_free(intr_priv);
intr_priv = NULL;
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ manifest:
- name: nrfxlib
repo-path: sdk-nrfxlib
path: nrfxlib
revision: 9837d3bfacabf06d888ac12765c3868c251a58c2
revision: 589238f61085c510a603245428d136b36110cfb4
- name: trusted-firmware-m
repo-path: sdk-trusted-firmware-m
path: modules/tee/tf-m/trusted-firmware-m
Expand Down
Loading