Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5204042rwr; Sun, 23 Apr 2023 23:58:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CHXBIFvRhc/QfdAHYfyoLGAktLsFoJUbBMB1gNxknIamx7gkmqKTVsMma+N5wy+NkE4Gq X-Received: by 2002:a17:902:ea02:b0:1a9:7bf4:17c0 with SMTP id s2-20020a170902ea0200b001a97bf417c0mr1698829plg.4.1682319502966; Sun, 23 Apr 2023 23:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682319502; cv=none; d=google.com; s=arc-20160816; b=YDSOztDjFSDhl0KwTT1NyKPt/tQe6YJhQrsxRxZoNqNug8tchKzUttcZunly2HDkmj dZlUXPIP3YwF/gdz93oMwrg/N+TcEo+9Lx1I2WDIFRn8yQCjnRk+ePcrwFF22Xe5DNoS YQZw7mApowbf1IjbLyaSWNpViZsJW6xO9OD3/LmQxGqqL1sBN77qaC46AR5dkEv+O4zt Kt+pbkFIq7L2Xc+Uen5ekPfsh2KWoYP52yBe68GBZeE0APqRKyAFBTwbxlWT6hb4pkvN OKkwdgnWkzQuQEZfXb53desx6ByJHKq0osgAb3NsxMP/NBkD8f8oThJMg8and+kQ8KZ1 FVFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :authenticated-by; bh=py5yZPthr6zUS6rbFbQxJgP1qBj9U+BVQlQSGCk3kE8=; b=RZdLQyJYHg83ZaA2G01hfnyOKq1iJIF+o9UesS9y5QM8xNkWpIAwN64ffSzyQRRF9n 5AEMj8XvAd9KahIr9BkYa/LMPEUUgNiQLCiVi70YBLZGJE94J9YcRQq2l0V9iAh3XdGr tdQq2CtUk+trLUxKgwA/KeX+/5mnU3jMo6WxII98F4+CfEgpsFANGPOZEqMcJz37ru+H Y4Et91EN6wGAYnI9TbAf3sfVeJxM+SUC8z+mw8HEg0Czeqn6KmJDODz0ZvyhBrihB/Bx GPzms2lIiIk83/siYpk6sLKZ9Wl1QVGcO+SbbBjFgZU9pVrWb0AsQs6tYCK39Zft28b0 tMEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u13-20020a170902e80d00b0019ca7d69673si12112480plg.196.2023.04.23.23.58.14; Sun, 23 Apr 2023 23:58:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231180AbjDXGxV (ORCPT + 62 others); Mon, 24 Apr 2023 02:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbjDXGxS (ORCPT ); Mon, 24 Apr 2023 02:53:18 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE4DD1700 for ; Sun, 23 Apr 2023 23:53:16 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33O6r9Al9029980, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33O6r9Al9029980 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Mon, 24 Apr 2023 14:53:09 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Mon, 24 Apr 2023 14:53:10 +0800 Received: from [127.0.1.1] (172.21.69.188) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 24 Apr 2023 14:53:10 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH 3/5] wifi: rtw89: 8851b: rfk: add RCK Date: Mon, 24 Apr 2023 14:52:40 +0800 Message-ID: <20230424065242.17477-4-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230424065242.17477-1-pkshih@realtek.com> References: <20230424065242.17477-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.188] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org RCK is synchronize RC calibration. Driver triggers this calibration and sets the result to register. This calibration is needed once when interface is going to up. Signed-off-by: Ping-Ke Shih --- .../net/wireless/realtek/rtw89/rtw8851b_rfk.c | 40 +++++++++++++++++++ .../net/wireless/realtek/rtw89/rtw8851b_rfk.h | 1 + 2 files changed, 41 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c index 471ed1a634765..7f454f68d08d8 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c @@ -17,6 +17,41 @@ static u8 _kpath(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) return RF_A; } +static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path) +{ + u32 rf_reg5; + u32 rck_val; + u32 val; + int ret; + + rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] ====== S%d RCK ======\n", path); + + rf_reg5 = rtw89_read_rf(rtwdev, path, RR_RSV1, RFREG_MASK); + + rtw89_write_rf(rtwdev, path, RR_RSV1, RR_RSV1_RST, 0x0); + rtw89_write_rf(rtwdev, path, RR_MOD, RR_MOD_MASK, RR_MOD_V_RX); + + rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] RF0x00 = 0x%05x\n", + rtw89_read_rf(rtwdev, path, RR_MOD, RFREG_MASK)); + + /* RCK trigger */ + rtw89_write_rf(rtwdev, path, RR_RCKC, RFREG_MASK, 0x00240); + + ret = read_poll_timeout_atomic(rtw89_read_rf, val, val, 2, 30, + false, rtwdev, path, RR_RCKS, BIT(3)); + + rck_val = rtw89_read_rf(rtwdev, path, RR_RCKC, RR_RCKC_CA); + + rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] rck_val = 0x%x, ret = %d\n", + rck_val, ret); + + rtw89_write_rf(rtwdev, path, RR_RCKC, RFREG_MASK, rck_val); + rtw89_write_rf(rtwdev, path, RR_RSV1, RFREG_MASK, rf_reg5); + + rtw89_debug(rtwdev, RTW89_DBG_RFK, "[RCK] RF 0x1b = 0x%x\n", + rtw89_read_rf(rtwdev, path, RR_RCKC, RFREG_MASK)); +} + void rtw8851b_aack(struct rtw89_dev *rtwdev) { u32 tmp05, ib[4]; @@ -59,6 +94,11 @@ void rtw8851b_aack(struct rtw89_dev *rtwdev) rtw89_write_rf(rtwdev, RF_PATH_A, RR_RSV1, RFREG_MASK, tmp05); } +void rtw8851b_rck(struct rtw89_dev *rtwdev) +{ + _rck(rtwdev, RF_PATH_A); +} + static void _bw_setting(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, enum rtw89_bandwidth bw, bool dav) { diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.h index cd38d9ed1ff39..9f67a8c3b9d90 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.h +++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.h @@ -8,6 +8,7 @@ #include "core.h" void rtw8851b_aack(struct rtw89_dev *rtwdev); +void rtw8851b_rck(struct rtw89_dev *rtwdev); void rtw8851b_set_channel_rf(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan, enum rtw89_phy_idx phy_idx); -- 2.25.1