Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1218824pxb; Thu, 23 Sep 2021 22:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcm4Ub+o2HAXnMY/AZEFYygbZ5UhMj40OW1DuLZcdCJ/f3UchQn8OuhtVeHx8F/AvTmvAG X-Received: by 2002:a17:907:20cb:: with SMTP id qq11mr9081972ejb.488.1632461639655; Thu, 23 Sep 2021 22:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632461639; cv=none; d=google.com; s=arc-20160816; b=ZTqiXW3yoiAvk86Qczn98eaOihsAjP6jzHXtq0+3zgKvKJ6QVCq/nNgmpohYFV2NIE 794cQjLwqTB/3GqPTyYrB4NswTJ7Kyl72WbAIXyvuMzBPWyVcZC/jgg1QNW1lBf+NCqT S6xLb9sfIg7x+JinwTHp9Q/r2hPB7TiUNDOdBOKqRn1VtENgr2K5gJjcOxae/3EbucKy RuAhSMloI6ofAF4qFzdL9cbw0PUdB0FGyRIVCSNinZU+MPDFKgEvOyK5O0+zSsAYiPKu 2cPrmEHaOU4oR2GhF63uSbgIdd6YlsWFCg0SHnvn9C5MFRX8Lt1eBd1d/DCRoyvFLKYE HQ0A== 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=MyvPt9cgXwfrMfJwWAoz5q9WLb4hBAOlX+ict7diR/g=; b=TOAcrzFv49sKvA6a/sSP/w1fRjLjNUbgLne3n+dZwPYW8t1H/EYflWnIZha70DkQ0e evw59IsEQtMaZ9IPMdla6udIP7elDbVJmMvhVrOe/W3SFqJaKgE3/lmpKQbfZhcFonuk 5jJVoiIHcSh8JrLn++uVJXKYpEIf2rYC9k4nJ/qvO4vAZBYeq8Q4mHps4ZTXJ3oCmtMS I4sOYh13BtBA/yoOIj8Ko+L3U07jPmIeCZy730qIf3lalDeoTo4jDAKfXqgHXMMg1Pha Ji+ysaVBVw7YpfVBN9UhxkNP3xrTLr3XvfbB3Tf1um3hE/zJCIvZnK0XAtJT2xF0lA2w MRvw== 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 p14si7999515ejn.499.2021.09.23.22.33.31; Thu, 23 Sep 2021 22:33:59 -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 S244123AbhIXFcs (ORCPT + 78 others); Fri, 24 Sep 2021 01:32:48 -0400 Received: from mailgw01.mediatek.com ([216.200.240.184]:18352 "EHLO mailgw01.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244118AbhIXFcs (ORCPT ); Fri, 24 Sep 2021 01:32:48 -0400 X-UUID: 7210a01ae8884473ac83a4c5d449a5af-20210923 X-UUID: 7210a01ae8884473ac83a4c5d449a5af-20210923 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 2056894484; Thu, 23 Sep 2021 22:31:13 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 22:30:01 -0700 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 24 Sep 2021 13:30:00 +0800 From: To: CC: , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v2 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module Date: Fri, 24 Sep 2021 13:30:00 +0800 Message-ID: <1632461400-8440-1-git-send-email-sean.wang@mediatek.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 >> 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); > >It seems quite a common code, does it worth to move them in mcu.c? (mt76 module) My understanding would be mt76/mcu.c only provides the framework that handle the pure software stuff and shouldn't contain any firmware or device related logic. So I prefer to add those commands MCU_CMD_REG_READ and MCU_CMD_REG_WRITE to mt76_connac_mcu.c like the other commands we have added there. > >Regards, >Lorenzo > >> + >> +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 >>