diff mbox

mt76x2: add a polling delay in mt76x2_mac_stop routine

Message ID e7c7fcf87f42a137472b8dfd1460a8d41a295bfa.1525960967.git.lorenzo.bianconi@redhat.com (mailing list archive)
State Accepted
Commit 6823dc0d91e5d238ca14a252228a5121d41eb517
Delegated to: Kalle Valo
Headers show

Commit Message

Lorenzo Bianconi May 10, 2018, 2:06 p.m. UTC
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>
---
 drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Felix Fietkau May 10, 2018, 4:28 p.m. UTC | #1
On 2018-05-10 16:06, Lorenzo Bianconi wrote:
> 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>
Kalle Valo May 12, 2018, 8:54 a.m. UTC | #2
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> 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>

Patch applied to wireless-drivers-next.git, thanks.

6823dc0d91e5 mt76x2: add a polling delay in mt76x2_mac_stop routine
diff mbox

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
index d21e4a7c1bb9..dd4c1127797e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c
@@ -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;