Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1339714rdb; Fri, 19 Jan 2024 16:40:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy58LVtDhn9wyaiv3CIjg1Sod7arfRM0B0OxrnSSHoItP53YtrVej6JE6N/B53RlAgoukt X-Received: by 2002:a05:6a20:2d25:b0:199:b9ad:5ccb with SMTP id g37-20020a056a202d2500b00199b9ad5ccbmr1035957pzl.113.1705711230436; Fri, 19 Jan 2024 16:40:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705711230; cv=pass; d=google.com; s=arc-20160816; b=bvKqBcGPj3H8DfAARkr/cHI6iRVT8IwjX0OAT8cJIpv5lWrN2VCnnPKH9adm8jLNnr O3sCEKFw4b/LPu3OeYB9wB370VZzP9N7N4Zi9sg9CEK8jmDPQEvvLTII/LPid/Kh6FwN nno7L6s5iGAH8RcjA99SmDWcRwnZZB6oRhv7rp9t1O27wLOZ2UUZLz2YQUSd/8ydufey 6608DhOxM1hgBEfMv7MIFIelP6wU81h7IhimW9rXFHZHtK3nuk1mQc6YZjvD1zhhQsFu ZvUEivpKThD3cjCezT8pWqtQjOjroQ+PCSWICtUFzUInWvVZ0mPQYFbEPlFhG0fFICAt 4MgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=3gP3izjs822VjZWT73ZtQTOV3FJd+NF1spgjME1JT5Y=; fh=/r/x0QoRfbSwAsE/aR2TpjkkUWoXXV+YQraRc6pQAxA=; b=WpxO2gBTbNadyHQ57KQzHR6PR6/7rMpfXnICx+aOtzILVUlTbnoPUANJpxcw9iEYvo v9tY44vkVZqIrZSSu1By/H/64rF7lRKDb3Xm/b54TXgOi3JIe3S+uZkSyTUkmcP3t4SG VzgmS5p21N+3bKXOXfBS7fkDnU6LFv9JtdzuwqVERbcNAVrD8IoXAKuTROrV7Oc+eRlW XmMplQB+2YGrcD7ed2xmCdea9RpTofVxvHGGrM1bhq0e8qC/y9K6HY0jUXrXsvnwnsf5 loQ6/jTDDDq9V26Qbbr+kcTpgWYzPdIiSqemI5F8sAnplTC2/Z1Aj5Q+pNIeIesIVEtl TclA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-2283-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2283-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y2-20020a656c02000000b005ce17cdb6f3si4175405pgu.872.2024.01.19.16.40.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 16:40:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2283-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-2283-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2283-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AA353B20E49 for ; Sat, 20 Jan 2024 00:39:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3E62A52; Sat, 20 Jan 2024 00:39:12 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E2C9A4F for ; Sat, 20 Jan 2024 00:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705711152; cv=none; b=XExAcd0jaEZLszp/HD59/T+EDhzCQf5CK0nqb1eFVU2WD/C/sJSa7HGaasa9mljlEhqdszPYnNKxs5LNLAVQvJqZL82nlqZZr/Be79L4J2yT2lvrEJ7F6bfwP8oY4NlypKmmxIYz0DyEga9dEvwiFfBRvl+BLP2GBJdkrM16vHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705711152; c=relaxed/simple; bh=flaLGVl6FYREnVlg7hArwQSZH0KMBAZdcS0V7wtFWPo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PXcBKKDtnLC/ySF46955QGnSEGH/9n9tPnpws8UninKcUBrHTZwAK6xlE2M/ruDyvJbfHvT7r4OGtUGXLeJECs72vcLb+s2xOZTsRKPV6foDv62BQwW5w7c4rJ0Cc3lg9g5lNB+upT+0hnOCYDGHxApYMvAJAKGs94712Os0pZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 40K0d4meD2596467, 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.95/5.92) with ESMTPS id 40K0d4meD2596467 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 20 Jan 2024 08:39:04 +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_256_GCM_SHA384) id 15.1.2375.32; Sat, 20 Jan 2024 08:39:04 +0800 Received: from [127.0.1.1] (172.16.16.202) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sat, 20 Jan 2024 08:39:04 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH v3 2/6] wifi: rtw89: 8922a: add chip_ops::{enable,disable}_bb_rf Date: Sat, 20 Jan 2024 08:38:27 +0800 Message-ID: <20240120003831.7014-3-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240120003831.7014-1-pkshih@realtek.com> References: <20240120003831.7014-1-pkshih@realtek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) 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 When we are going to up interface to make connection, turn on BB and RF hardware power by enable_bb_rf ops. Oppositely, using disable_bb_rf to turn them off. Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/reg.h | 36 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/rtw8922a.c | 19 ++++++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h index b411bf726849..c4a9ddeb38e0 100644 --- a/drivers/net/wireless/realtek/rtw89/reg.h +++ b/drivers/net/wireless/realtek/rtw89/reg.h @@ -4488,6 +4488,42 @@ #define B_BE_RMAC_PPDU_HANG_CNT_MASK GENMASK(23, 16) #define B_BE_SER_L0_COUNTER_MASK GENMASK(8, 0) +#define R_BE_DMAC_SYS_CR32B 0x842C +#define B_BE_DMAC_BB_PHY1_MASK GENMASK(31, 16) +#define B_BE_DMAC_BB_PHY0_MASK GENMASK(15, 0) +#define B_BE_DMAC_BB_CTRL_39 BIT(31) +#define B_BE_DMAC_BB_CTRL_38 BIT(30) +#define B_BE_DMAC_BB_CTRL_37 BIT(29) +#define B_BE_DMAC_BB_CTRL_36 BIT(28) +#define B_BE_DMAC_BB_CTRL_35 BIT(27) +#define B_BE_DMAC_BB_CTRL_34 BIT(26) +#define B_BE_DMAC_BB_CTRL_33 BIT(25) +#define B_BE_DMAC_BB_CTRL_32 BIT(24) +#define B_BE_DMAC_BB_CTRL_31 BIT(23) +#define B_BE_DMAC_BB_CTRL_30 BIT(22) +#define B_BE_DMAC_BB_CTRL_29 BIT(21) +#define B_BE_DMAC_BB_CTRL_28 BIT(20) +#define B_BE_DMAC_BB_CTRL_27 BIT(19) +#define B_BE_DMAC_BB_CTRL_26 BIT(18) +#define B_BE_DMAC_BB_CTRL_25 BIT(17) +#define B_BE_DMAC_BB_CTRL_24 BIT(16) +#define B_BE_DMAC_BB_CTRL_23 BIT(15) +#define B_BE_DMAC_BB_CTRL_22 BIT(14) +#define B_BE_DMAC_BB_CTRL_21 BIT(13) +#define B_BE_DMAC_BB_CTRL_20 BIT(12) +#define B_BE_DMAC_BB_CTRL_19 BIT(11) +#define B_BE_DMAC_BB_CTRL_18 BIT(10) +#define B_BE_DMAC_BB_CTRL_17 BIT(9) +#define B_BE_DMAC_BB_CTRL_16 BIT(8) +#define B_BE_DMAC_BB_CTRL_15 BIT(7) +#define B_BE_DMAC_BB_CTRL_14 BIT(6) +#define B_BE_DMAC_BB_CTRL_13 BIT(5) +#define B_BE_DMAC_BB_CTRL_12 BIT(4) +#define B_BE_DMAC_BB_CTRL_11 BIT(3) +#define B_BE_DMAC_BB_CTRL_10 BIT(2) +#define B_BE_DMAC_BB_CTRL_9 BIT(1) +#define B_BE_DMAC_BB_CTRL_8 BIT(0) + #define R_BE_DLE_EMPTY0 0x8430 #define B_BE_PLE_EMPTY_QTA_DMAC_H2D BIT(27) #define B_BE_PLE_EMPTY_QTA_DMAC_CPUIO BIT(26) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922a.c b/drivers/net/wireless/realtek/rtw89/rtw8922a.c index 7ded6f431309..1ccaea3af4ae 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8922a.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8922a.c @@ -807,6 +807,23 @@ static void rtw8922a_set_channel(struct rtw89_dev *rtwdev, rtw8922a_set_channel_bb(rtwdev, chan, phy_idx); } +static int rtw8922a_mac_enable_bb_rf(struct rtw89_dev *rtwdev) +{ + rtw89_write8_set(rtwdev, R_BE_FEN_RST_ENABLE, + B_BE_FEN_BBPLAT_RSTB | B_BE_FEN_BB_IP_RSTN); + rtw89_write32(rtwdev, R_BE_DMAC_SYS_CR32B, 0x7FF97FF9); + + return 0; +} + +static int rtw8922a_mac_disable_bb_rf(struct rtw89_dev *rtwdev) +{ + rtw89_write8_clr(rtwdev, R_BE_FEN_RST_ENABLE, + B_BE_FEN_BBPLAT_RSTB | B_BE_FEN_BB_IP_RSTN); + + return 0; +} + #ifdef CONFIG_PM static const struct wiphy_wowlan_support rtw_wowlan_stub_8922a = { .flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT, @@ -817,6 +834,8 @@ static const struct wiphy_wowlan_support rtw_wowlan_stub_8922a = { #endif static const struct rtw89_chip_ops rtw8922a_chip_ops = { + .enable_bb_rf = rtw8922a_mac_enable_bb_rf, + .disable_bb_rf = rtw8922a_mac_disable_bb_rf, .set_channel = rtw8922a_set_channel, .read_efuse = rtw8922a_read_efuse, .read_phycap = rtw8922a_read_phycap, -- 2.25.1