Skip to content

Commit 63868d2

Browse files
ajaykathatnoglitch
authored andcommitted
wilc1000: modified recovery code to handle SPI bus error
For SPI command failure, the recovery handler was not working for few scenario so added flow to clear 'is_init' flag to ensure that WILC_SPI_PROTOCOL_OFFSET register is reconfigured. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
1 parent cc5fe06 commit 63868d2

4 files changed

Lines changed: 29 additions & 0 deletions

File tree

drivers/net/wireless/microchip/wilc1000/netdev.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ static int debug_thread(void *arg)
8585
vif->restart = 1;
8686
}
8787
}
88+
89+
/* For Spi, clear 'is_init' flag so that protocol offset
90+
* register can be send to FW to setup required crc mode after
91+
* chip reset
92+
*/
93+
if (wl->io_type == WILC_HIF_SPI)
94+
wl->hif_func->hif_clear_init(wl);
95+
8896
//TODO://Need to find way to call them in reverse
8997
i = 0;
9098
list_for_each_entry_rcu(vif, &wl->vif_list, list) {

drivers/net/wireless/microchip/wilc1000/sdio.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,15 @@ static bool wilc_sdio_is_init(struct wilc *wilc)
253253
return sdio_priv->isinit;
254254
}
255255

256+
static int wilc_sdio_clear_init(struct wilc *wilc)
257+
{
258+
struct wilc_sdio *sdio_priv = wilc->bus_data;
259+
260+
sdio_priv->isinit = false;
261+
262+
return 0;
263+
}
264+
256265
static int wilc_sdio_suspend(struct device *dev)
257266
{
258267
struct sdio_func *func = dev_to_sdio_func(dev);
@@ -1065,6 +1074,7 @@ static const struct wilc_hif_func wilc_hif_sdio = {
10651074
.disable_interrupt = wilc_sdio_disable_interrupt,
10661075
.hif_reset = wilc_sdio_reset,
10671076
.hif_is_init = wilc_sdio_is_init,
1077+
.hif_clear_init = wilc_sdio_clear_init,
10681078
};
10691079

10701080
static int wilc_sdio_resume(struct device *dev)

drivers/net/wireless/microchip/wilc1000/spi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,15 @@ static int wilc_spi_deinit(struct wilc *wilc)
11641164
return 0;
11651165
}
11661166

1167+
static int wilc_spi_clear_init(struct wilc *wilc)
1168+
{
1169+
struct wilc_spi *spi_priv = wilc->bus_data;
1170+
1171+
spi_priv->isinit = false;
1172+
1173+
return 0;
1174+
}
1175+
11671176
static int wilc_spi_init(struct wilc *wilc, bool resume)
11681177
{
11691178
struct spi_device *spi = to_spi_device(wilc->dev);
@@ -1387,4 +1396,5 @@ static const struct wilc_hif_func wilc_hif_spi = {
13871396
.hif_sync_ext = wilc_spi_sync_ext,
13881397
.hif_reset = wilc_spi_reset,
13891398
.hif_is_init = wilc_spi_is_init,
1399+
.hif_clear_init = wilc_spi_clear_init,
13901400
};

drivers/net/wireless/microchip/wilc1000/wlan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ struct wilc_hif_func {
413413
void (*disable_interrupt)(struct wilc *nic);
414414
int (*hif_reset)(struct wilc *wilc);
415415
bool (*hif_is_init)(struct wilc *wilc);
416+
int (*hif_clear_init)(struct wilc *wilc);
416417
};
417418

418419
#define WILC_MAX_CFG_FRAME_SIZE 1468

0 commit comments

Comments
 (0)