Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5384210ybi; Wed, 12 Jun 2019 01:25:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlPlRTTUaRQvNlhcWcXptM/WkTj/znlRfOltdNU4lGc4R5IeWKeMn2rpCrvdSoGoMI7tcB X-Received: by 2002:a17:90a:1b4a:: with SMTP id q68mr31508456pjq.61.1560327924748; Wed, 12 Jun 2019 01:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560327924; cv=none; d=google.com; s=arc-20160816; b=ZlE+X4ltIuUSpG3jTIcpGWFskM6r3qsTJF1zdD9s5tbr5gNoYao9rOybO69EH9Vgwn HBsHQQbOwq5Ms7/V+S0GCoJOPn5Ug429fjYtBA1pppSEJYgSmjA2RzPLPoptKhmixqQv OWoPJlz/S6hufeWsDsT1uZwgkkOFx7FfThqPnJqjDb+YbTY5JR4VkaseJcRx8wc5+s58 f1tEEq8QFPegsM+u5WOLJ8xZhlxVSCLrFiwVBlOYXRQWAo38P4CAReARNtV1ENGuzHfG 7kZBUeVngSnW9z/g1+hespviJazrSfVcsogbtNgMYOoipJ07AwifieJf1yNm4CGYRyH3 I6ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=NWYSFo47IAOH7SHbIf8XHvUv6EXAuWFWLRb3It6AcZI=; b=wduGIxoHHlW8zHIyKexeSst1iYqEK7OyfnNEpUuna9ckAMaWRLWzo7zT9CX99m8lEj ACR2bNS96p1w6sw/Vs1cvc9fPPo6ugjvZ5cA+L4Nl8cZG6sBwy2f+VT4no9fXOMWl03O VVyvFPvkH/5MMgm0cuftKT8b1EOPQR4PzgPNJl/vCj4W8N4wl1pK06GoYIn7p58HR0ml KIKhWM6gEk/rD6azixhybqjumZDz9PpONuC2N0pWn0SpxPZh9vjtzC8KYW5Atzf2lSfn SUvIUPuVFu5l6T4CxWitLgfXzCr84jF8TL1XX5mq+UmCwhIm6J9j675TfauUdK4xX3sH ydNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si16023371plf.250.2019.06.12.01.25.09; Wed, 12 Jun 2019 01:25:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731233AbfFLGpf (ORCPT + 99 others); Wed, 12 Jun 2019 02:45:35 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:51304 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731217AbfFLGpe (ORCPT ); Wed, 12 Jun 2019 02:45:34 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5C6jVbS004368, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x5C6jVbS004368 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 12 Jun 2019 14:45:31 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.439.0; Wed, 12 Jun 2019 14:45:30 +0800 From: To: CC: Subject: [PATCH 06/11] rtw88: 8822c: disable rx clock gating before counter reset Date: Wed, 12 Jun 2019 14:45:12 +0800 Message-ID: <1560321917-17751-7-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560321917-17751-1-git-send-email-yhchuang@realtek.com> References: <1560321917-17751-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang Driver Could fail to reset counter if rx clock gating is not disabled. So we need to disable rx clock gating before resetting counters. Otherwise counters may increase unexpected. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 4 ++++ drivers/net/wireless/realtek/rtw88/rtw8822c.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c index 86acf60..b9185b2 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -1508,8 +1508,12 @@ static void rtw8822c_false_alarm_statistics(struct rtw_dev *rtwdev) rtw_write32_mask(rtwdev, REG_CCANRX, BIT_CCK_FA_RST, 2); rtw_write32_mask(rtwdev, REG_CCANRX, BIT_OFDM_FA_RST, 0); rtw_write32_mask(rtwdev, REG_CCANRX, BIT_OFDM_FA_RST, 2); + + /* disable rx clk gating to reset counters */ + rtw_write32_clr(rtwdev, REG_RX_BREAK, BIT_COM_RX_GCK_EN); rtw_write32_set(rtwdev, REG_CNT_CTRL, BIT_ALL_CNT_RST); rtw_write32_clr(rtwdev, REG_CNT_CTRL, BIT_ALL_CNT_RST); + rtw_write32_set(rtwdev, REG_RX_BREAK, BIT_COM_RX_GCK_EN); } static void rtw8822c_do_iqk(struct rtw_dev *rtwdev) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h b/drivers/net/wireless/realtek/rtw88/rtw8822c.h index 5fe6acb..bf41359 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h @@ -176,6 +176,8 @@ struct rtw8822c_efuse { #define BIT_CCK_BLK_EN BIT(1) #define BIT_CCK_OFDM_BLK_EN (BIT(0) | BIT(1)) #define REG_CCAMSK 0x1c80 +#define REG_RX_BREAK 0x1d2c +#define BIT_COM_RX_GCK_EN BIT(31) #define REG_RXFNCTL 0x1d30 #define REG_RXIGI 0x1d70 #define REG_ENFN 0x1e24 -- 2.7.4