Skip to content

Commit e84f8b3

Browse files
committed
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 64a0b4c commit e84f8b3

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
@@ -260,6 +260,15 @@ static bool wilc_sdio_is_init(struct wilc *wilc)
260260
return sdio_priv->is_init;
261261
}
262262

263+
static int wilc_sdio_clear_init(struct wilc *wilc)
264+
{
265+
struct wilc_sdio *sdio_priv = wilc->bus_data;
266+
267+
sdio_priv->is_init = false;
268+
269+
return 0;
270+
}
271+
263272
static int wilc_sdio_suspend(struct device *dev)
264273
{
265274
struct sdio_func *func = dev_to_sdio_func(dev);
@@ -1072,6 +1081,7 @@ static const struct wilc_hif_func wilc_hif_sdio = {
10721081
.disable_interrupt = wilc_sdio_disable_interrupt,
10731082
.hif_reset = wilc_sdio_reset,
10741083
.hif_is_init = wilc_sdio_is_init,
1084+
.hif_clear_init = wilc_sdio_clear_init,
10751085
};
10761086

10771087
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
@@ -1172,6 +1172,15 @@ static int wilc_spi_deinit(struct wilc *wilc)
11721172
return 0;
11731173
}
11741174

1175+
static int wilc_spi_clear_init(struct wilc *wilc)
1176+
{
1177+
struct wilc_spi *spi_priv = wilc->bus_data;
1178+
1179+
spi_priv->is_init = false;
1180+
1181+
return 0;
1182+
}
1183+
11751184
static int wilc_spi_init(struct wilc *wilc, bool resume)
11761185
{
11771186
struct spi_device *spi = to_spi_device(wilc->dev);
@@ -1394,4 +1403,5 @@ static const struct wilc_hif_func wilc_hif_spi = {
13941403
.hif_sync_ext = wilc_spi_sync_ext,
13951404
.hif_reset = wilc_spi_reset,
13961405
.hif_is_init = wilc_spi_is_init,
1406+
.hif_clear_init = wilc_spi_clear_init,
13971407
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ struct wilc_hif_func {
418418
void (*disable_interrupt)(struct wilc *nic);
419419
int (*hif_reset)(struct wilc *wilc);
420420
bool (*hif_is_init)(struct wilc *wilc);
421+
int (*hif_clear_init)(struct wilc *wilc);
421422
};
422423

423424
#define WILC_MAX_CFG_FRAME_SIZE 1468

0 commit comments

Comments
 (0)