mt76x2: add a polling delay in mt76x2_mac_stop routine
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Thu, 10 May 2018 14:06:09 +0000 (16:06 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 12 May 2018 08:54:02 +0000 (11:54 +0300)
Add a usleep_range in mt76x2_mac_stop routine in order to add
a polling delay checking values of MT_MAC_STATUS and IBI_R12 registers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt76/mt76x2_init.c

index d21e4a7c1bb93bd5e9667f93935cc5c87de36b23..dd4c1127797efcf4b557c8bad3843cdcac776278 100644 (file)
@@ -370,12 +370,12 @@ void mt76x2_mac_stop(struct mt76x2_dev *dev, bool force)
 
        /* Wait for MAC to become idle */
        for (i = 0; i < 300; i++) {
-               if (mt76_rr(dev, MT_MAC_STATUS) &
-                   (MT_MAC_STATUS_RX | MT_MAC_STATUS_TX))
-                       continue;
-
-               if (mt76_rr(dev, MT_BBP(IBI, 12)))
+               if ((mt76_rr(dev, MT_MAC_STATUS) &
+                    (MT_MAC_STATUS_RX | MT_MAC_STATUS_TX)) ||
+                   mt76_rr(dev, MT_BBP(IBI, 12))) {
+                       usleep_range(10, 20);
                        continue;
+               }
 
                stopped = true;
                break;