Skip to content

Commit 74be1dd

Browse files
ajaykathatnoglitch
authored andcommitted
wilc1000: changes for SPI communication stall issue found with Iperf
Added retry mechanism to ensure VMM enable bit is set during the block transfer of data between host and WILC FW. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
1 parent d5bccd7 commit 74be1dd

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

  • drivers/staging/wilc1000

drivers/staging/wilc1000/spi.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static u8 wilc_get_crc7(u8 *buffer, u32 len)
4747

4848
#define SPI_RESP_RETRY_COUNT (10)
4949
#define SPI_RETRY_COUNT (10)
50+
#define SPI_ENABLE_VMM_RETRY_LIMIT 2
5051
#define DATA_PKT_SZ_256 256
5152
#define DATA_PKT_SZ_512 512
5253
#define DATA_PKT_SZ_1K 1024
@@ -1172,8 +1173,26 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status)
11721173

11731174
static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val)
11741175
{
1175-
return spi_internal_write(wilc,
1176-
WILC_SPI_INT_CLEAR - WILC_SPI_REG_BASE, val);
1176+
int ret;
1177+
int retry = SPI_ENABLE_VMM_RETRY_LIMIT;
1178+
u32 check;
1179+
1180+
while (retry) {
1181+
ret = spi_internal_write(wilc,
1182+
WILC_SPI_INT_CLEAR - WILC_SPI_REG_BASE,
1183+
val);
1184+
if (ret)
1185+
break;
1186+
1187+
ret = spi_internal_read(wilc,
1188+
WILC_SPI_INT_CLEAR - WILC_SPI_REG_BASE,
1189+
&check);
1190+
if (ret || ((check & EN_VMM) == (val & EN_VMM)))
1191+
break;
1192+
1193+
retry--;
1194+
}
1195+
return ret;
11771196
}
11781197

11791198
static int wilc_spi_sync_ext(struct wilc *wilc, int nint)

0 commit comments

Comments
 (0)