Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp352529pxb; Wed, 8 Sep 2021 02:44:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYGwiRD43wQP30P1inb4jyhCIKvgn20hW+gd9gkPq9EYZd+2+ug16Yz0LgWlCIXszrPujd X-Received: by 2002:a17:906:56cc:: with SMTP id an12mr3143316ejc.456.1631094273606; Wed, 08 Sep 2021 02:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631094273; cv=none; d=google.com; s=arc-20160816; b=zAMoRCE5efUJb9AHLpSScjC/WtUcgPHkZ+pxXGVHtjA+MJmimf1l2LqrT2TW+2SrDJ fubpoEcU829ffIYQVJ1dlCgVgLnfuAEW1H/XruMKqL4bstOLd2PSqf88SKy8Hy5XPhaH rS5DutHcpcmz5IdjV5dnq/X67vF4lLjm1PmVhbNsIKJBJZlp/mMfZHMIKHY8GzmKtOD9 rVlYHK18FwYA/HQRBTdIUSrVTOHiRiI8JNE2zGWFzCfCdMFuBsMn3ianU5QHxqgSG7Ky /FQFtvvawRT/AKgtZU+SecfRFixpybZa0P2Jf453wW2fNmDGP82b1HxiK5VRbme4OOGe XYJg== 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=Tgng/hhdoRZh/xUh75/DwZPCheBzBScVPzL0NvxacZk=; b=tx+k1oTamVsS/Uqo7xbSnHKO2pw39Qa2e6L8sbMoUa2jwf2Qtf3Vjklb8S2pN5gsgS vZRnTuRIAJ39QCjns4X3ROcw+25KKbtT1HXOzTzIYKjnJLZeyOdsSMlzvxPygZ8BNeDV KAFR2+0jdA5O8w/Hv6fHCZF8fExnnx/OLkb5z+jJS0scEFoTEkuBHlhNVXO6c74uKMwj lBnGOdSgCxFaLPT7fHcMiZsXRQx3fBMDcKSpYeK8IVv5YsAFDH/pZqBMZ3h05GGrYlI0 muM6CxZfySblWy+1sHPmKpg7WP4HiGSddBzGJ2KH+d/oEVhXXBcRVERqFp6i3csK0wlb nJIw== 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 r21si1606469eds.571.2021.09.08.02.44.09; Wed, 08 Sep 2021 02:44:33 -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 S1348623AbhIHJoM (ORCPT + 99 others); Wed, 8 Sep 2021 05:44:12 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:47164 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1348449AbhIHJoI (ORCPT ); Wed, 8 Sep 2021 05:44:08 -0400 X-UUID: 24efcaf16cb54595b13af383a6d9c60b-20210908 X-UUID: 24efcaf16cb54595b13af383a6d9c60b-20210908 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1605883825; Wed, 08 Sep 2021 17:42:57 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 8 Sep 2021 17:42:55 +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; Wed, 8 Sep 2021 17:42:55 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek , Shayne Chen Subject: [PATCH v3 8/8] mt76: mt7915: set muru platform type Date: Wed, 8 Sep 2021 17:41:44 +0800 Message-ID: <20210908094144.25641-8-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210908094144.25641-1-shayne.chen@mediatek.com> References: <20210908094144.25641-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 --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 17 +++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt7915/mcu.h | 5 +++++ .../net/wireless/mediatek/mt76/mt7915/mt7915.h | 1 + .../wireless/mediatek/mt76/mt7915/testmode.c | 16 +++++----------- .../wireless/mediatek/mt76/mt7915/testmode.h | 4 ---- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 229ba3c469d1..afafc47264cd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2949,6 +2949,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, u8 *val) +{ + struct { + __le32 cmd; + u8 val[4]; + } __packed req = { + .cmd = cpu_to_le32(cmd), + }; + + memcpy(req.val, val, sizeof(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 = { @@ -2957,6 +2972,7 @@ int mt7915_mcu_init(struct mt7915_dev *dev) .mcu_parse_response = mt7915_mcu_parse_response, .mcu_restart = mt7915_mcu_restart, }; + u8 ptype = 2; int ret; dev->mt76.mcu_ops = &mt7915_mcu_ops; @@ -2973,6 +2989,7 @@ int mt7915_mcu_init(struct mt7915_dev *dev) mt7915_mcu_fw_log_2_host(dev, 0); mt7915_mcu_set_mwds(dev, 1); mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET), MCU_WA_PARAM_RED, 0, 0); + mt7915_mcu_set_muru_ctrl(dev, MURU_SET_PLATFORM_TYPE, &ptype); return 0; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h index 6344faf3f394..57be9262ec2a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h @@ -1086,6 +1086,11 @@ enum { MT_BF_MODULE_UPDATE = 25 }; +enum { + MURU_SET_ARB_OP_MODE = 14, + MURU_SET_PLATFORM_TYPE = 25, +}; + #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 f8f0bb3ca7cd..5bf1192bab36 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -351,6 +351,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, u8 *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 00dcc46b9082..4fc284cb3401 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), - }; + u8 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 107f0cf2505e..5573ac309363 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