Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp99387pxb; Fri, 15 Oct 2021 01:18:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkejEN2qwmtTSIUgYlsuF3+dOjer3Euv5meKBVxBVhw6FMRydf7XRnghTsYTCfHSzEFMwT X-Received: by 2002:a63:1a1b:: with SMTP id a27mr8060999pga.220.1634285900166; Fri, 15 Oct 2021 01:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634285900; cv=none; d=google.com; s=arc-20160816; b=vorxURP489r3W30CAezOgKh50jgltWoXgn4ItAtdZaCost6CaIMFQB/cpb8tXGDBj1 sVWGmtZhL1DdnWKhXzai9hVbUlflth23VRoYZSnn+koFGTYEM8Uq4NC5dphZ9KBM2HJu X6hLws8AFTT0lUuWxxnwaN2Jqo0DdmpaQX2BRBBO4z5MBIGnQnFIZDQzNjWZuE4COV/Z kcBBInA+5Cv7uy+nS9Fn1zz3DJSjM79+chsP/ZFIa8o8HoLYMKhkz6Mzdb2yJS+eLkkx 0KsCtnGbxYVvk7suRknSeiUsaAsFdkHuAbwXJ6B3P5HD/L1ely7hqwnDAPYV6cnAKmiV afDw== 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=MnPNaufodaWRJru35/AV0sP5C504JkWO7+JW5CJmm08=; b=fo3B7Xr8F+3eDyoV+Pjpe++0YHewGBQrDEyn9uQChVXsr+/4cLB3fLbA5oYXbk0B/a ykkLCTjvGX3By56egmGYu/rkbfsiL3Ys89E1BBLYkLo4KQaq5iZspydCPk5fN7oAoEqr W6AsWuJWCA7Bp7/PXQFfry+tMvayv8llB8aMnVr4GS1n0ZzTR+/Nk/lBhQq0Ijwo9YRI 8pBGj7rkyUnu6lvrlTrBdtttkSVDky3OurmuQfaJZOl5WpKYXEzb/pKNpPj743fRmkjN vhI7BWV+lsipld7JIITrjrjOjMNSXhkvYtPk7icKK0S+M/wvYkdBxztE4zIyPrBizKxI r+lg== 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 h5si6247857pfn.202.2021.10.15.01.17.41; Fri, 15 Oct 2021 01:18:20 -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 S234303AbhJODc6 (ORCPT + 63 others); Thu, 14 Oct 2021 23:32:58 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:58070 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S234202AbhJODcv (ORCPT ); Thu, 14 Oct 2021 23:32:51 -0400 X-UUID: 943390881a414ee28b7b2e3652ce8dad-20211015 X-UUID: 943390881a414ee28b7b2e3652ce8dad-20211015 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1027759181; Fri, 15 Oct 2021 11:30:41 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 Oct 2021 11:30:40 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 15 Oct 2021 11:30:40 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek , Shayne Chen Subject: [PATCH v6 8/8] mt76: mt7915: set muru platform type Date: Fri, 15 Oct 2021 11:29:38 +0800 Message-ID: <20211015032938.7493-8-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20211015032938.7493-1-shayne.chen@mediatek.com> References: <20211015032938.7493-1-shayne.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Set muru platform type by mcu cmd to notify fw to init corresponding algorithm. Suggested-by: Money Wang Reviewed-by: Ryder Lee Signed-off-by: Shayne Chen --- v3: - fix endianess - rework muru ctrl function v4: use put_unaligned_le32() to get rid of undefined behavior v5: rebase to staging tree --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 20 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7915/mcu.h | 10 ++++++++++ .../wireless/mediatek/mt76/mt7915/mt7915.h | 1 + .../wireless/mediatek/mt76/mt7915/testmode.c | 16 +++++---------- .../wireless/mediatek/mt76/mt7915/testmode.h | 4 ---- 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 9ad7e8e..92e4f9d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2907,6 +2907,21 @@ static int mt7915_mcu_set_mwds(struct mt7915_dev *dev, bool enabled) sizeof(req), false); } +int mt7915_mcu_set_muru_ctrl(struct mt7915_dev *dev, u32 cmd, u32 val) +{ + struct { + __le32 cmd; + u8 val[4]; + } __packed req = { + .cmd = cpu_to_le32(cmd), + }; + + put_unaligned_le32(val, req.val); + + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL), &req, + sizeof(req), false); +} + int mt7915_mcu_init(struct mt7915_dev *dev) { static const struct mt76_mcu_ops mt7915_mcu_ops = { @@ -2936,6 +2951,11 @@ int mt7915_mcu_init(struct mt7915_dev *dev) if (ret) return ret; + ret = mt7915_mcu_set_muru_ctrl(dev, MURU_SET_PLATFORM_TYPE, + MURU_PLATFORM_TYPE_PERF_LEVEL_2); + if (ret) + return ret; + return mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET), MCU_WA_PARAM_RED, 0, 0); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h index 012b959..bc9f350 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h @@ -1092,6 +1092,16 @@ enum { MT_BF_MODULE_UPDATE = 25 }; +enum { + MURU_SET_ARB_OP_MODE = 14, + MURU_SET_PLATFORM_TYPE = 25, +}; + +enum { + MURU_PLATFORM_TYPE_PERF_LEVEL_1 = 1, + MURU_PLATFORM_TYPE_PERF_LEVEL_2, +}; + #define MT7915_WTBL_UPDATE_MAX_SIZE (sizeof(struct wtbl_req_hdr) + \ sizeof(struct wtbl_generic) + \ sizeof(struct wtbl_rx) + \ diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index 78c0896..bb8ef60 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -443,6 +443,7 @@ int mt7915_mcu_set_pulse_th(struct mt7915_dev *dev, const struct mt7915_dfs_pulse *pulse); int mt7915_mcu_set_radar_th(struct mt7915_dev *dev, int index, const struct mt7915_dfs_pattern *pattern); +int mt7915_mcu_set_muru_ctrl(struct mt7915_dev *dev, u32 cmd, u32 val); int mt7915_mcu_apply_group_cal(struct mt7915_dev *dev); int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy); int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c index 00dcc46..89aae32 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c @@ -169,22 +169,16 @@ static int mt7915_tm_set_tam_arb(struct mt7915_phy *phy, bool enable, bool mu) { struct mt7915_dev *dev = phy->dev; - struct { - __le32 cmd; - u8 op_mode; - } __packed req = { - .cmd = cpu_to_le32(MURU_SET_ARB_OP_MODE), - }; + u32 op_mode; if (!enable) - req.op_mode = TAM_ARB_OP_MODE_NORMAL; + op_mode = TAM_ARB_OP_MODE_NORMAL; else if (mu) - req.op_mode = TAM_ARB_OP_MODE_TEST; + op_mode = TAM_ARB_OP_MODE_TEST; else - req.op_mode = TAM_ARB_OP_MODE_FORCE_SU; + op_mode = TAM_ARB_OP_MODE_FORCE_SU; - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(MURU_CTRL), &req, - sizeof(req), false); + return mt7915_mcu_set_muru_ctrl(dev, MURU_SET_ARB_OP_MODE, op_mode); } static int diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h index 107f0cf..5573ac3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.h @@ -102,8 +102,4 @@ enum { TAM_ARB_OP_MODE_FORCE_SU = 5, }; -enum { - MURU_SET_ARB_OP_MODE = 14, -}; - #endif -- 2.25.1