aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorAndreas Fenkart <andreas.fenkart@streamunlimited.com>2013-04-22 05:10:23 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-04-23 19:55:55 -0400
commit69676b1c2af451bfe5cd36ff4973a484b5d5a86c (patch)
treef48fd51733e041e3ad4c04e69d3c5c182e246e9c /drivers/bluetooth
parentc1c999e27ce5681c5b43c7f82947030e7134f1d0 (diff)
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: Andreas Fenkart <andreas.fenkart@streamunlimited.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btmrvl_sdio.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 758d5ac81ecc..c63488c54f4a 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -228,9 +228,8 @@ failed:
228static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card, 228static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
229 int pollnum) 229 int pollnum)
230{ 230{
231 int ret = -ETIMEDOUT;
232 u16 firmwarestat; 231 u16 firmwarestat;
233 unsigned int tries; 232 int tries, ret;
234 233
235 /* Wait for firmware to become ready */ 234 /* Wait for firmware to become ready */
236 for (tries = 0; tries < pollnum; tries++) { 235 for (tries = 0; tries < pollnum; tries++) {
@@ -240,15 +239,13 @@ static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
240 if (ret < 0) 239 if (ret < 0)
241 continue; 240 continue;
242 241
243 if (firmwarestat == FIRMWARE_READY) { 242 if (firmwarestat == FIRMWARE_READY)
244 ret = 0; 243 return 0;
245 break; 244
246 } else { 245 msleep(10);
247 msleep(10);
248 }
249 } 246 }
250 247
251 return ret; 248 return -ETIMEDOUT;
252} 249}
253 250
254static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card) 251static 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 921
925 sdio_release_host(card->func); 922 sdio_release_host(card->func);
926 923
924 /*
925 * winner or not, with this test the FW synchronizes when the
926 * module can continue its initialization
927 */
927 if (btmrvl_sdio_verify_fw_download(card, pollnum)) { 928 if (btmrvl_sdio_verify_fw_download(card, pollnum)) {
928 BT_ERR("FW failed to be active in time!"); 929 BT_ERR("FW failed to be active in time!");
929 return -ETIMEDOUT; 930 return -ETIMEDOUT;
@@ -995,8 +996,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
995 goto unreg_dev; 996 goto unreg_dev;
996 } 997 }
997 998
998 msleep(100);
999
1000 btmrvl_sdio_enable_host_int(card); 999 btmrvl_sdio_enable_host_int(card);
1001 1000
1002 priv = btmrvl_add_card(card); 1001 priv = btmrvl_add_card(card);