Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5383678ybi; Wed, 12 Jun 2019 01:24:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUeFmfRbh8TxkWZZqah3BDtiXtOeBAzAs+qn6nDJx5KchiDPNgdWEjN5bfkdIA2nTVblxj X-Received: by 2002:aa7:8b17:: with SMTP id f23mr49885231pfd.194.1560327878279; Wed, 12 Jun 2019 01:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560327878; cv=none; d=google.com; s=arc-20160816; b=mfsqrYbqMDZtP80BLPtQO46aK29rZjUxfVNklwXlox9YO1QGs34RO+jYnWS/DstqvJ M0gOKLk/X2K625IQLsNW/9/Xd7Q4sIQr9HKIM+zA6mbiH/YY+K4tTrFZfc4PtLVomgrD sD+4k9rkPFNxWyLJBGcTj8r0fiQfgFevPjPeao6zNm8TLKtShypgMw3W8y1y9v6fZJl+ xQ5u6kWPv704keVTWGvEVOGPkfDWrb5mEl+LmonOkMHipCnLf5O4N4j+Vd/5Ryozc2T0 Mkriz0rFOUiYrYyc+XsoUNqngrnanI0/ywZFe7k+u+basUdlD5PFtHSclVd/a9yg37T2 KS8Q== 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=tEQE1vj9EYACiVDq/0ngnW7yjDGRD+XMYxecntE5kN8=; b=RKpl4uMvB87jeL55z2tBx+HuMSg17P3DOvd8hJiG8p/lfBseGV8CQY2P/pntzzn1Dr zwYIbUDUhQdatB4cqxeFStk33GIkYb9PZTAf+iHOtg08CuvbBHR6Mmh8h8MXhUB49biT L4hHm81Ds0nSPZPKQaSTqmOjwsff4kjfvYH6GCO6TL9luXfMY1vR+yBf4zz21HXN31oE /fqOsjgf5rCGz9a0GkhtBYbQvmBVHphKGjIFqm7c7CpuczY+tWpDtTJXljdypIbYSa+S lJdBU/9SK2PUNxZwReIkwPUrfsOztIWGX6nIp91CpNWPtkYLeY+FppC+OXVC9pYUSaVj AFgA== 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 144si16022262pfw.63.2019.06.12.01.24.22; Wed, 12 Jun 2019 01:24:38 -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 S1731244AbfFLGpg (ORCPT + 99 others); Wed, 12 Jun 2019 02:45:36 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:51299 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbfFLGpd (ORCPT ); Wed, 12 Jun 2019 02:45:33 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5C6jTj2004356, 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 x5C6jTj2004356 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 12 Jun 2019 14:45:29 +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:29 +0800 From: To: CC: Subject: [PATCH 04/11] rtw88: 8822c: add rf write protection when switching channel Date: Wed, 12 Jun 2019 14:45:10 +0800 Message-ID: <1560321917-17751-5-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: Chien-Hsun Liao Collision of writing rf registers could occur if the driver writes rf registers by direct write while the hardware is writing other rf registers by pi write simultaneously. Hardware pi write can be triggered by rf calibrations sometimes, so the driver can not always write rf registers by direct write protection. Direct write protection can make sure that there is no hardware pi write during the direct write. According to some experiments, if we add direct write protection when switching channel, the performance of rf calibration will not be affected. Signed-off-by: Chien-Hsun Liao Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/phy.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c index 4381b36..580f310 100644 --- a/drivers/net/wireless/realtek/rtw88/phy.c +++ b/drivers/net/wireless/realtek/rtw88/phy.c @@ -596,14 +596,19 @@ bool rtw_phy_write_rf_reg(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path, direct_addr = base_addr[rf_path] + (addr << 2); mask &= RFREG_MASK; - rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, DISABLE_PI); - rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, DISABLE_PI); + if (addr == RF_CFGCH) { + rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, DISABLE_PI); + rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, DISABLE_PI); + } + rtw_write32_mask(rtwdev, direct_addr, mask, data); udelay(1); - rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, ENABLE_PI); - rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, ENABLE_PI); + if (addr == RF_CFGCH) { + rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, ENABLE_PI); + rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, ENABLE_PI); + } return true; } -- 2.7.4