Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp635228ybi; Fri, 14 Jun 2019 00:25:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1FrzfWNH2G441YCkZGk5dtEsTv0HUza0vjMPzbKS2iKiIzqmjIex8LqiQZHU4Sbvw3U0/ X-Received: by 2002:a62:b40a:: with SMTP id h10mr98450697pfn.216.1560497131542; Fri, 14 Jun 2019 00:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560497131; cv=none; d=google.com; s=arc-20160816; b=tIfPtB8VUccJuxnEdHdtMBEo8Xx/+KUUT7DXz1vXqAqFSsKD278EMu17BCZv3TEXg8 +6I4/SpeU1haZAAW9nzLdKlhi+mAfXIjH04aG1WOg8Y4ZAUlPO2FO6td9CoNb2fAX73E J+s6L0jA9Sbronn95Z1Wf5y73K9fuoPIu4wa8y4cJUhvq0+Znx5lpn3FFaMXOWUBoeZ2 OemiyCdhc8sD/0TagUobncnw6manUVfKI1io+PKXFnaLsg4UfuNzBnFS3VB8RgQE+V6i W/61dOU2ySBrkH72FGRjuPVYJ+UaUqDwE1SeVWPQ/3EC+e+NJkYba9L+VwOQwobHqeXg WOlA== 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=I7jRPQR9ivpUhpwemYQXYrcPvQds8pNvwJlzECQQha5rAnqMRO+X5HqPJ202CaW0jy vCnLFJulIY2LmXu6Jq281uiO9dWj4w+GcTB7xlzA5OiqxmZSnFM0LnwpwN7OUM/JOz5Z oc7KWnFJCrF+UbYIyrR66eWRbd8qa0RuZ8lHR8mZmgkSGoYtdhWYBHU97RMq1fFoC9St yzTeP0a/+YFkHXHkxb3jqwDP/YrHHDrV2U4isANWs359UH8afFuE/UfgruNwqgAFbRzN fXkESLwf8jPtYS9WgwnAg2RrKKKc5GdUCOhsoznvKCd6LWPfzgxwtbosh67GFq9teVmX NZOQ== 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 o6si1588629pje.1.2019.06.14.00.25.15; Fri, 14 Jun 2019 00:25:31 -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 S1726519AbfFNHY0 (ORCPT + 99 others); Fri, 14 Jun 2019 03:24:26 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:48164 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbfFNHYZ (ORCPT ); Fri, 14 Jun 2019 03:24:25 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5E7OLsV024924, 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 x5E7OLsV024924 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 14 Jun 2019 15:24:21 +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; Fri, 14 Jun 2019 15:24:21 +0800 From: To: CC: Subject: [PATCH v2 04/11] rtw88: 8822c: add rf write protection when switching channel Date: Fri, 14 Jun 2019 15:24:08 +0800 Message-ID: <1560497055-17197-5-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> References: <1560497055-17197-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