Commit 69676b1c authored by Andreas Fenkart's avatar Andreas Fenkart Committed by Gustavo Padovan

Bluetooth: btmrvl: report error if verify_fw_download times out

FW does the synchronization of the different modules during init.
It will report different modules, that it is ready at different times.
The fw download 'winner' will be reported fw ready first. Without this
patch, btmrvl was already continuing before the FW told it too. Probably
on behalf of the 'winner' which then never sees FW ready and times out.
Signed-off-by: default avatarAndreas Fenkart <andreas.fenkart@streamunlimited.com>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent c1c999e2
...@@ -228,9 +228,8 @@ static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card *card, u8 bits) ...@@ -228,9 +228,8 @@ static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card *card, u8 bits)
static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card, static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
int pollnum) int pollnum)
{ {
int ret = -ETIMEDOUT;
u16 firmwarestat; u16 firmwarestat;
unsigned int tries; int tries, ret;
/* Wait for firmware to become ready */ /* Wait for firmware to become ready */
for (tries = 0; tries < pollnum; tries++) { for (tries = 0; tries < pollnum; tries++) {
...@@ -240,15 +239,13 @@ static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card, ...@@ -240,15 +239,13 @@ static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
if (ret < 0) if (ret < 0)
continue; continue;
if (firmwarestat == FIRMWARE_READY) { if (firmwarestat == FIRMWARE_READY)
ret = 0; return 0;
break;
} else { msleep(10);
msleep(10);
}
} }
return ret; return -ETIMEDOUT;
} }
static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card) static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card)
...@@ -924,6 +921,10 @@ static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card *card) ...@@ -924,6 +921,10 @@ static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card *card)
sdio_release_host(card->func); sdio_release_host(card->func);
/*
* winner or not, with this test the FW synchronizes when the
* module can continue its initialization
*/
if (btmrvl_sdio_verify_fw_download(card, pollnum)) { if (btmrvl_sdio_verify_fw_download(card, pollnum)) {
BT_ERR("FW failed to be active in time!"); BT_ERR("FW failed to be active in time!");
return -ETIMEDOUT; return -ETIMEDOUT;
...@@ -995,8 +996,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func, ...@@ -995,8 +996,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
goto unreg_dev; goto unreg_dev;
} }
msleep(100);
btmrvl_sdio_enable_host_int(card); btmrvl_sdio_enable_host_int(card);
priv = btmrvl_add_card(card); priv = btmrvl_add_card(card);
......
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