Commit 1c5d463c authored by David Lin's avatar David Lin Committed by Kalle Valo

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: default avatarDavid Lin <yu-hao.lin@nxp.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: default avatarBrian Norris <briannorris@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # Verdin AM62 (IW416)
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231208234029.2197-1-yu-hao.lin@nxp.com
parent cc6bbfe8
...@@ -331,6 +331,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { ...@@ -331,6 +331,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
.can_dump_fw = false, .can_dump_fw = false,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = false, .can_ext_scan = false,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
...@@ -346,6 +347,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { ...@@ -346,6 +347,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
.can_dump_fw = false, .can_dump_fw = false,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
...@@ -361,6 +363,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { ...@@ -361,6 +363,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
.can_dump_fw = false, .can_dump_fw = false,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
...@@ -376,6 +379,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { ...@@ -376,6 +379,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
.can_dump_fw = true, .can_dump_fw = true,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
...@@ -392,6 +396,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = { ...@@ -392,6 +396,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
.fw_dump_enh = true, .fw_dump_enh = true,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
...@@ -408,6 +413,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = { ...@@ -408,6 +413,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8978 = {
.fw_dump_enh = true, .fw_dump_enh = true,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = true,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
...@@ -425,6 +431,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = { ...@@ -425,6 +431,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
.fw_dump_enh = true, .fw_dump_enh = true,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
...@@ -440,6 +447,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = { ...@@ -440,6 +447,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
.can_dump_fw = false, .can_dump_fw = false,
.can_auto_tdls = true, .can_auto_tdls = true,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
...@@ -456,6 +464,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = { ...@@ -456,6 +464,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
.fw_dump_enh = true, .fw_dump_enh = true,
.can_auto_tdls = true, .can_auto_tdls = true,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
...@@ -471,6 +480,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = { ...@@ -471,6 +480,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
.can_dump_fw = false, .can_dump_fw = false,
.can_auto_tdls = false, .can_auto_tdls = false,
.can_ext_scan = true, .can_ext_scan = true,
.fw_ready_extra_delay = false,
}; };
static struct memory_type_mapping generic_mem_type_map[] = { 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) ...@@ -563,6 +573,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
card->fw_dump_enh = data->fw_dump_enh; card->fw_dump_enh = data->fw_dump_enh;
card->can_auto_tdls = data->can_auto_tdls; card->can_auto_tdls = data->can_auto_tdls;
card->can_ext_scan = data->can_ext_scan; card->can_ext_scan = data->can_ext_scan;
card->fw_ready_extra_delay = data->fw_ready_extra_delay;
INIT_WORK(&card->work, mwifiex_sdio_work); INIT_WORK(&card->work, mwifiex_sdio_work);
} }
...@@ -766,6 +777,7 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) ...@@ -766,6 +777,7 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat)
static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter,
u32 poll_num) u32 poll_num)
{ {
struct sdio_mmc_card *card = adapter->card;
int ret = 0; int ret = 0;
u16 firmware_stat; u16 firmware_stat;
u32 tries; u32 tries;
...@@ -783,6 +795,13 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, ...@@ -783,6 +795,13 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter,
ret = -1; ret = -1;
} }
if (card->fw_ready_extra_delay &&
firmware_stat == FIRMWARE_READY_SDIO)
/* firmware might pretend to be ready, when it's not.
* Wait a little bit more as a workaround.
*/
msleep(100);
return ret; return ret;
} }
......
...@@ -255,6 +255,7 @@ struct sdio_mmc_card { ...@@ -255,6 +255,7 @@ struct sdio_mmc_card {
bool fw_dump_enh; bool fw_dump_enh;
bool can_auto_tdls; bool can_auto_tdls;
bool can_ext_scan; bool can_ext_scan;
bool fw_ready_extra_delay;
struct mwifiex_sdio_mpa_tx mpa_tx; struct mwifiex_sdio_mpa_tx mpa_tx;
struct mwifiex_sdio_mpa_rx mpa_rx; struct mwifiex_sdio_mpa_rx mpa_rx;
...@@ -278,6 +279,7 @@ struct mwifiex_sdio_device { ...@@ -278,6 +279,7 @@ struct mwifiex_sdio_device {
bool fw_dump_enh; bool fw_dump_enh;
bool can_auto_tdls; bool can_auto_tdls;
bool can_ext_scan; bool can_ext_scan;
bool fw_ready_extra_delay;
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment