ath10k: don't wait for device init if it crashed
authorMichal Kazior <michal.kazior@tieto.com>
Wed, 23 Apr 2014 16:30:04 +0000 (19:30 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 24 Apr 2014 06:20:50 +0000 (09:20 +0300)
When warm resetting it's possible for device to
crash during initialization. Instead of waiting 3
seconds just return failure as soon as
FW_IND_EVENT_PENDING is set.

This speeds up device bootup and recovery in some
cases.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/pci.c

index cd3b00cbc920e2b21a9257158a29a6772db2c676..66b1f3017f2b4a616da98cf61010987b9a7beb72 100644 (file)
@@ -2452,6 +2452,10 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
                if (val == 0xffffffff)
                        continue;
 
+               /* the device has crashed so don't bother trying anymore */
+               if (val & FW_IND_EVENT_PENDING)
+                       break;
+
                if (val & FW_IND_INITIALIZED)
                        break;
 
@@ -2470,6 +2474,12 @@ static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
                goto out;
        }
 
+       if (val & FW_IND_EVENT_PENDING) {
+               ath10k_warn("device has crashed during init\n");
+               ret = -ECOMM;
+               goto out;
+       }
+
        if (!(val & FW_IND_INITIALIZED)) {
                ath10k_err("failed to receive initialized event from target: %08x\n",
                           val);