Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp333222pxb; Sat, 18 Sep 2021 04:17:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGS04e0UhRABYDHhw+1dTr6vXyEMiJn6wO40GwjAJjjHYiDWxj3889+1mptJhb8oQTgV1e X-Received: by 2002:a6b:6d09:: with SMTP id a9mr4572798iod.70.1631963845497; Sat, 18 Sep 2021 04:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631963845; cv=none; d=google.com; s=arc-20160816; b=tGdvdiHaqzwMYF700a4ibCK8tHVjJqnrzmOB7+/81VLFzI+QS8YhWCuY9e+EiKUbUy wjQje/5T0+ulmP/bNhZiwHrx0obNmFpyBEP75WwQpOMFF2XlAqxrtHfnOY7FaXu16U+W Pz5sm/yNRABIx8tAxXDbURGO+CZAXi2d6mzZwRuI8VdtR55NrdOhyx6tX9ZPf6c6vYJ8 vx9ozSvq4IgOXAukOt55IIbdNA1RIpL6IsOuaZ7mH3MvgM3vDsc/sbzPfatNu/DdPQGF zIDCM+7L9Xhcnsh9sZdGD2Akl9MI25bdEmeBs+Qp/9Phw1cECnJlCjrciJsxnCPQM7dV RR2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=4nMrOkuBhYNKxJkdfucGS/bp/gzcyZ53u2BXkcRVm7k=; b=AWAWgDBWSK4a9C8nYLtf6xUnz2GmdSK2970Fch6HLrS5kUsjs/ywJo99TjNFVenEfY FIjM2DEzUcgVzJvraL/wqVOO4HSypP+vNcEJrDTF9HVuri3+I+bVwbiBL9/PGnmkiiuF Z+6RaQOeTd9xhg29OVhVREIYIR/Do/oUUh9ZZdrgz/by8j+C8Y89JDYFjjbhTVES8zsO gCVgzSNehn7+PBBclorud+ZQWrWjMiDphnwcybhWTgaFy7Et8UM1LiJ7bob2FY6UIdm/ gucBuFvsis3BOonKEQ3FEtv78JSm+2Xy7ZBcciX5B4adudmO5+WhHvKgrAzI3sb2FBDT oYrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si7759444jaf.0.2021.09.18.04.16.39; Sat, 18 Sep 2021 04:17:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345012AbhIRALJ (ORCPT + 78 others); Fri, 17 Sep 2021 20:11:09 -0400 Received: from mailgw01.mediatek.com ([216.200.240.184]:63455 "EHLO mailgw01.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245751AbhIRALI (ORCPT ); Fri, 17 Sep 2021 20:11:08 -0400 X-UUID: 150523e431e1447c9ab37c444ab30b9f-20210917 X-UUID: 150523e431e1447c9ab37c444ab30b9f-20210917 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1977057194; Fri, 17 Sep 2021 17:09:45 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 17 Sep 2021 17:00:03 -0700 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 18 Sep 2021 08:00:03 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module Date: Sat, 18 Sep 2021 07:59:22 +0800 Message-ID: <42112d6b7b1c09bcdfa37d4417e55ef45c09ceff.1631918993.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Move mcu reg access shared between mt7663s and mt7921s in mt76_connac_lib module. Tested-by: Deren Wu Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index ae692052de97..a53f6344a184 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2406,6 +2406,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac, } EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter); +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset) +{ + struct { + __le32 addr; + __le32 val; + } __packed req = { + .addr = cpu_to_le32(offset), + }; + + return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req), + true); +} +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr); + +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val) +{ + struct { + __le32 addr; + __le32 val; + } __packed req = { + .addr = cpu_to_le32(offset), + .val = cpu_to_le32(val), + }; + + mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false); +} +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr); #endif /* CONFIG_PM */ MODULE_AUTHOR("Lorenzo Bianconi "); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index ea46dde364e1..6c410c4a8d6e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1111,4 +1111,6 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb, int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset); +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val); #endif /* __MT76_CONNAC_MCU_H */ -- 2.25.1