Skip to content

Commit 1c5d463

Browse files
nxptestKalle Valo
authored andcommitted
wifi: mwifiex: add extra delay for firmware ready
For SDIO IW416, due to a bug, FW may return ready before complete full initialization. Command timeout may occur at driver load after reboot. Workaround by adding 100ms delay at checking FW status. Signed-off-by: David Lin <[email protected]> Cc: [email protected] Reviewed-by: Francesco Dolcini <[email protected]> Acked-by: Brian Norris <[email protected]> Tested-by: Marcel Ziswiler <[email protected]> # Verdin AM62 (IW416) Signed-off-by: Kalle Valo <[email protected]> Link: https://msgid.link/[email protected]
1 parent cc6bbfe commit 1c5d463

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

drivers/net/wireless/marvell/mwifiex/sdio.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
331331
.can_dump_fw = false,
332332
.can_auto_tdls = false,
333333
.can_ext_scan = false,
334+
.fw_ready_extra_delay = false,
334335
};
335336

336337
static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
@@ -346,6 +347,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
346347
.can_dump_fw = false,
347348
.can_auto_tdls = false,
348349
.can_ext_scan = true,
350+
.fw_ready_extra_delay = false,
349351
};
350352

351353
static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
@@ -361,6 +363,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
361363
.can_dump_fw = false,
362364
.can_auto_tdls = false,
363365
.can_ext_scan = true,
366+
.fw_ready_extra_delay = false,
364367
};
365368

366369
static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
@@ -376,6 +379,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
376379
.can_dump_fw = true,
377380
.can_auto_tdls = false,
378381
.can_ext_scan = true,
382+
.fw_ready_extra_delay = false,
379383
};
380384

381385
static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
@@ -392,6 +396,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
392396
.fw_dump_enh = true,
393397
.can_auto_tdls = false,
394398
.can_ext_scan = true,
399+
.fw_ready_extra_delay = false,
395400
};
396401

397402
static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
@@ -408,6 +413,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
408413
.fw_dump_enh = true,
409414
.can_auto_tdls = false,
410415
.can_ext_scan = true,
416+
.fw_ready_extra_delay = true,
411417
};
412418

413419
static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
@@ -425,6 +431,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
425431
.fw_dump_enh = true,
426432
.can_auto_tdls = false,
427433
.can_ext_scan = true,
434+
.fw_ready_extra_delay = false,
428435
};
429436

430437
static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
@@ -440,6 +447,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
440447
.can_dump_fw = false,
441448
.can_auto_tdls = true,
442449
.can_ext_scan = true,
450+
.fw_ready_extra_delay = false,
443451
};
444452

445453
static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
@@ -456,6 +464,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
456464
.fw_dump_enh = true,
457465
.can_auto_tdls = true,
458466
.can_ext_scan = true,
467+
.fw_ready_extra_delay = false,
459468
};
460469

461470
static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
@@ -471,6 +480,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
471480
.can_dump_fw = false,
472481
.can_auto_tdls = false,
473482
.can_ext_scan = true,
483+
.fw_ready_extra_delay = false,
474484
};
475485

476486
static struct memory_type_mapping generic_mem_type_map[] = {
@@ -563,6 +573,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
563573
card->fw_dump_enh = data->fw_dump_enh;
564574
card->can_auto_tdls = data->can_auto_tdls;
565575
card->can_ext_scan = data->can_ext_scan;
576+
card->fw_ready_extra_delay = data->fw_ready_extra_delay;
566577
INIT_WORK(&card->work, mwifiex_sdio_work);
567578
}
568579

@@ -766,6 +777,7 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat)
766777
static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter,
767778
u32 poll_num)
768779
{
780+
struct sdio_mmc_card *card = adapter->card;
769781
int ret = 0;
770782
u16 firmware_stat;
771783
u32 tries;
@@ -783,6 +795,13 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter,
783795
ret = -1;
784796
}
785797

798+
if (card->fw_ready_extra_delay &&
799+
firmware_stat == FIRMWARE_READY_SDIO)
800+
/* firmware might pretend to be ready, when it's not.
801+
* Wait a little bit more as a workaround.
802+
*/
803+
msleep(100);
804+
786805
return ret;
787806
}
788807

drivers/net/wireless/marvell/mwifiex/sdio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ struct sdio_mmc_card {
255255
bool fw_dump_enh;
256256
bool can_auto_tdls;
257257
bool can_ext_scan;
258+
bool fw_ready_extra_delay;
258259

259260
struct mwifiex_sdio_mpa_tx mpa_tx;
260261
struct mwifiex_sdio_mpa_rx mpa_rx;
@@ -278,6 +279,7 @@ struct mwifiex_sdio_device {
278279
bool fw_dump_enh;
279280
bool can_auto_tdls;
280281
bool can_ext_scan;
282+
bool fw_ready_extra_delay;
281283
};
282284

283285
/*

0 commit comments

Comments
 (0)