From patchwork Thu May 10 14:06:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10391839 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 264A66028E for ; Thu, 10 May 2018 14:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 160B52858A for ; Thu, 10 May 2018 14:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AA9D286CC; Thu, 10 May 2018 14:06:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBE7A2858A for ; Thu, 10 May 2018 14:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964968AbeEJOGT (ORCPT ); Thu, 10 May 2018 10:06:19 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37721 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632AbeEJOGT (ORCPT ); Thu, 10 May 2018 10:06:19 -0400 Received: by mail-wr0-f196.google.com with SMTP id h5-v6so2162328wrm.4 for ; Thu, 10 May 2018 07:06:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/8IknhbHjTkNyDSKu1tKBYZXaH4G4t1I+kaaEmTXq9c=; b=KJAT+Vh7NDKYfVc5yaAiAQmfKTkJBw1glJjnbdguofu6eecy65UpS4fm/os9Byu2Mt 1J6TA3o2S+4AkiDH1Zf5Ww+oDFcl3UNrJXVAuZAb/9qwigWPKg9UXNImsVo/oQr6oNCa NpFE4Xc7qz5ohBTB4oWF0H8Ev6MuZVlyqhvA8MvTz2Wwa5J0YAUrDiaVn9clkPaGNhO7 y31IWz9kAsZZ/X+y2VlQoev+c3lK7OS44fgXlxt96M5fIjq8MbCrWJS1F4yok/nORhI4 v9x9TgNtJcmskIcSKZ7rbyrqQ5h908YispYSFHqMWIAdpszyJVuR2LNMTbyEZhT5X5le 8uzg== X-Gm-Message-State: ALKqPwctQYEx6CzoFkgnt/sdpT4t3stc/DpPB+hXSjZtil4Dw5/WLCgi xlwe/idppAlfIf95jTuCaozEF5DB2Is= X-Google-Smtp-Source: AB8JxZpK/BFnPqSz4noa+YWsT+yMq8sDutN45aCxx4Hq20iiit3RMLZ4U6XQ3WePuXv5RNEHZiqPeg== X-Received: by 2002:adf:9466:: with SMTP id 93-v6mr1414776wrq.264.1525961177155; Thu, 10 May 2018 07:06:17 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id h133-v6sm1376614wmf.47.2018.05.10.07.06.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 07:06:16 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH] mt76x2: add a polling delay in mt76x2_mac_stop routine Date: Thu, 10 May 2018 16:06:09 +0200 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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;