2021-04-23 18:33:21

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 00/12] wilc1000: added chip wakeup support and few fixes

From: Ajay Singh <[email protected]>

The series contains following patches:
- added chip wakeup sequence support required for PS mode
- added WID to handle passing of wow info to FW
- added reset command support for WILC SPI bus
- few trivial fixes for WILC SPI

Ajay Singh (12):
wilc1000: move 'deinit_lock' lock init/destory inside module probe
wilc1000: fix possible memory leak in cfg_scan_result()
wilc1000: added new WID to pass WOW info to firmware
wilc1000: setup registers to support chip wakeup sequence
wilc1000: add reset/terminate/repeat command support for SPI bus
wilc1000: handle register read fail issue for SPI bus
wilc1000: ignore error response for SPI clockless registers
wilc1000: invoke chip reset register while FW download
wilc1000: avoid 'isinit' static by moving inside priv data
wilc1000: added initialized variable check before processing
wilc1000: use write command after read in wilc_spi_sync_ext()
wilc1000: increase WILC_CFG_PKTS_TIMEOUT timeout value

.../wireless/microchip/wilc1000/cfg80211.c | 11 +-
drivers/net/wireless/microchip/wilc1000/hif.c | 31 +++-
drivers/net/wireless/microchip/wilc1000/hif.h | 1 +
.../net/wireless/microchip/wilc1000/netdev.h | 2 -
.../net/wireless/microchip/wilc1000/sdio.c | 14 ++
drivers/net/wireless/microchip/wilc1000/spi.c | 113 +++++++++++++--
.../net/wireless/microchip/wilc1000/wlan.c | 136 +++++++++++-------
.../net/wireless/microchip/wilc1000/wlan.h | 6 +-
.../wireless/microchip/wilc1000/wlan_cfg.c | 1 +
.../net/wireless/microchip/wilc1000/wlan_if.h | 7 +-
10 files changed, 240 insertions(+), 82 deletions(-)

--
2.24.0


2021-04-23 18:33:22

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 09/12] wilc1000: avoid 'isinit' static by moving inside priv data

From: Ajay Singh <[email protected]>

Instead of using static variable(isinit) move to priv struct.
Added hif_is_init function to set is_init variable.

Signed-off-by: Ajay Singh <[email protected]>
---
.../net/wireless/microchip/wilc1000/sdio.c | 13 +++++++++++
drivers/net/wireless/microchip/wilc1000/spi.c | 22 +++++++++++++------
.../net/wireless/microchip/wilc1000/wlan.c | 2 +-
.../net/wireless/microchip/wilc1000/wlan.h | 1 +
4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c
index db490f449c27..9c9f46a171b3 100644
--- a/drivers/net/wireless/microchip/wilc1000/sdio.c
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -26,6 +26,7 @@ static const struct sdio_device_id wilc_sdio_ids[] = {
struct wilc_sdio {
bool irq_gpio;
u32 block_size;
+ bool is_init;
int has_thrpt_enh3;
};

@@ -188,6 +189,13 @@ static int wilc_sdio_reset(struct wilc *wilc)
return 0;
}

+static bool wilc_sdio_is_init(struct wilc *wilc)
+{
+ struct wilc_sdio *sdio_priv = wilc->bus_data;
+
+ return sdio_priv->is_init;
+}
+
static int wilc_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
@@ -576,6 +584,9 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)

static int wilc_sdio_deinit(struct wilc *wilc)
{
+ struct wilc_sdio *sdio_priv = wilc->bus_data;
+
+ sdio_priv->is_init = false;
return 0;
}

@@ -695,6 +706,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
sdio_priv->has_thrpt_enh3);
}

+ sdio_priv->is_init = true;
return 0;
}

@@ -976,6 +988,7 @@ static const struct wilc_hif_func wilc_hif_sdio = {
.enable_interrupt = wilc_sdio_enable_interrupt,
.disable_interrupt = wilc_sdio_disable_interrupt,
.hif_reset = wilc_sdio_reset,
+ .hif_is_init = wilc_sdio_is_init,
};

static int wilc_sdio_resume(struct device *dev)
diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c
index 4f5464170426..8e88986db9a4 100644
--- a/drivers/net/wireless/microchip/wilc1000/spi.c
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -42,6 +42,7 @@ struct wilc_spi {
bool probing_crc; /* true if we're probing chip's CRC config */
bool crc7_enabled; /* true if crc7 is currently enabled */
bool crc16_enabled; /* true if crc16 is currently enabled */
+ bool is_init;
};

static const struct wilc_hif_func wilc_hif_spi;
@@ -971,11 +972,19 @@ static int wilc_spi_reset(struct wilc *wilc)
return result;
}

+static bool wilc_spi_is_init(struct wilc *wilc)
+{
+ struct wilc_spi *spi_priv = wilc->bus_data;
+
+ return spi_priv->is_init;
+}
+
static int wilc_spi_deinit(struct wilc *wilc)
{
- /*
- * TODO:
- */
+ struct wilc_spi *spi_priv = wilc->bus_data;
+
+ spi_priv->is_init = false;
+
return 0;
}

@@ -985,10 +994,9 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
struct wilc_spi *spi_priv = wilc->bus_data;
u32 reg;
u32 chipid;
- static int isinit;
int ret, i;

- if (isinit) {
+ if (spi_priv->is_init) {
ret = wilc_spi_read_reg(wilc, WILC_CHIPID, &chipid);
if (ret)
dev_err(&spi->dev, "Fail cmd read chip id...\n");
@@ -1059,8 +1067,7 @@ static int wilc_spi_init(struct wilc *wilc, bool resume)
return ret;
}

- isinit = 1;
-
+ spi_priv->is_init = true;
return 0;
}

@@ -1189,4 +1196,5 @@ static const struct wilc_hif_func wilc_hif_spi = {
.hif_block_rx_ext = wilc_spi_read,
.hif_sync_ext = wilc_spi_sync_ext,
.hif_reset = wilc_spi_reset,
+ .hif_is_init = wilc_spi_is_init,
};
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 24e016a0dfa8..6ae5d82c6f99 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -1255,7 +1255,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
wilc->rx_buffer = NULL;
kfree(wilc->tx_buffer);
wilc->tx_buffer = NULL;
- wilc->hif_func->hif_deinit(NULL);
+ wilc->hif_func->hif_deinit(wilc);
}

static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h
index 150648b2c872..8b7c3d1034ec 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.h
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -374,6 +374,7 @@ struct wilc_hif_func {
int (*enable_interrupt)(struct wilc *nic);
void (*disable_interrupt)(struct wilc *nic);
int (*hif_reset)(struct wilc *wilc);
+ bool (*hif_is_init)(struct wilc *wilc);
};

#define WILC_MAX_CFG_FRAME_SIZE 1468
--
2.24.0