Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp48328pxb; Tue, 14 Sep 2021 18:17:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5G2Tqt+kDtxrVF/7meDmOVqegC6geCnK/L7LGWRaQqAt9ioqIv/xrd89aZWvACn1oiNZh X-Received: by 2002:a2e:b001:: with SMTP id y1mr18040549ljk.360.1631668636270; Tue, 14 Sep 2021 18:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631668636; cv=none; d=google.com; s=arc-20160816; b=PS0exisJGTX/pgOi3CIMZ5d5Xmt72/d5OOCbxVWwDB46pG8alRZpGBoClETCtvh2wN UQH97v5Qul2Pcvk4y/UAkrz65M+G0wS01BNkvV5f0ZBJe/zF3F7/N10LMR1SlKUvzda6 xYhevgJzx4/a8T/iLVudSEeTjgLuEASVv7jgRldvukPRR10eoXsuUDIgUu00q1D/Uh9K amMj0+9O/eLKOSVJz4GiG7lQczSwt3DY/x4Vw4adNW/NFQXTh+eaV7hs+udQi5sEj+vY yGLRfRoj9PH9mbSFNGYp6lxYKpUyFcOMtlu37MES9D1Qc95DpZ6NLoJh9UG7/DWbTVNF l3sA== 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=nIWRjefcqkqA9TW/5zVZB/jvgPznfCkiSHPKNIxXdxM=; b=Wx2cf8m3A4kznfZcsPKU7QjBoiBybjaRxb70UvwKkGS7L4UTuc6pXTf3qpAOoVOMAy eueI0riVqjXKsQuUxrBEWJr4xAramDipEzUtezAib/rePz66BujR9H7n1rsFc2zTd9jF GAyLQIGQAqtDg0lCQSVtks4IdMNxoHrxovHQTaCTLZB+rnHldQyEXy3sbLq+QotY4bxV A/VFTW+x2cThIDBt8iOxcN31pagx4ZX52bHHF8NpCUckS758BtXHXlgXcdtmgP4BmLro qj/MQW/q3piGLvqbnZGPsgvKEws1U0JEW3Ogo6V8vsIR0b4olKv06JoW+s3/6K81NSNC S0Rw== 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 z24si12185117lfq.188.2021.09.14.18.16.49; Tue, 14 Sep 2021 18:17:16 -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 S230510AbhIOBRP (ORCPT + 99 others); Tue, 14 Sep 2021 21:17:15 -0400 Received: from mailgw02.mediatek.com ([216.200.240.185]:43938 "EHLO mailgw02.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbhIOBRO (ORCPT ); Tue, 14 Sep 2021 21:17:14 -0400 X-UUID: 9487fd7751e448ecae90e6315b535d06-20210914 X-UUID: 9487fd7751e448ecae90e6315b535d06-20210914 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 343346203; Tue, 14 Sep 2021 18:15:48 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 14 Sep 2021 18:15:46 -0700 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 15 Sep 2021 09:15:45 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v1 12/16] mt76: connac: extend mcu_get_nic_capability Date: Wed, 15 Sep 2021 09:14:45 +0800 Message-ID: <37e505a9ff2f24b594ab1162e6eb7f0aa30be1d1.1631667941.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 Extend mcu_get_nic_capability to obtain tx resource for SDIO device, MAC address, and PHY capability. Tested-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + .../wireless/mediatek/mt76/mt76_connac_mcu.c | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 58fd0c7831f4..3062cda2e770 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -512,6 +512,7 @@ struct mt76_sdio { int pse_data_quota; int ple_data_quota; int pse_mcu_quota; + int pse_page_size; int deficit; } sched; }; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index a53f6344a184..cee17b48b296 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1716,6 +1716,61 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb, } EXPORT_SYMBOL_GPL(mt76_connac_mcu_coredump_event); +static void mt76_connac_mcu_parse_tx_resource(struct mt76_dev *dev, + struct sk_buff *skb) +{ + struct mt76_sdio *sdio = &dev->sdio; + struct mt76_connac_tx_resource { + __le32 version; + __le32 pse_data_quota; + __le32 pse_mcu_quota; + __le32 ple_data_quota; + __le32 ple_mcu_quota; + __le16 pse_page_size; + __le16 ple_page_size; + u8 pp_padding; + u8 pad[3]; + } __packed * tx_res; + + tx_res = (struct mt76_connac_tx_resource *)skb->data; + sdio->sched.pse_data_quota = le32_to_cpu(tx_res->pse_data_quota); + sdio->sched.pse_mcu_quota = le32_to_cpu(tx_res->pse_mcu_quota); + sdio->sched.ple_data_quota = le32_to_cpu(tx_res->ple_data_quota); + sdio->sched.pse_page_size = le32_to_cpu(tx_res->pse_page_size); + sdio->sched.deficit = tx_res->pp_padding; +} + +static void mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev, + struct sk_buff *skb) +{ + struct mt76_connac_phy_cap { + u8 ht; + u8 vht; + u8 _5g; + u8 max_bw; + u8 nss; + u8 dbdc; + u8 tx_ldpc; + u8 rx_ldpc; + u8 tx_stbc; + u8 rx_stbc; + u8 hw_path; + u8 he; + } __packed * cap; + + enum { + WF0_24G, + WF0_5G + }; + + cap = (struct mt76_connac_phy_cap *)skb->data; + + dev->phy.antenna_mask = BIT(cap->nss) - 1; + dev->phy.chainmask = dev->phy.antenna_mask; + dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G); + dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G); +} + int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy) { struct mt76_connac_cap_hdr { @@ -1758,6 +1813,17 @@ int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy) case MT_NIC_CAP_6G: phy->cap.has_6ghz = skb->data[0]; break; + case MT_NIC_CAP_MAC_ADDR: + memcpy(phy->macaddr, (void *)skb->data, ETH_ALEN); + break; + case MT_NIC_CAP_PHY: + mt76_connac_mcu_parse_phy_cap(phy->dev, skb); + break; + case MT_NIC_CAP_TX_RESOURCE: + if (mt76_is_sdio(phy->dev)) + mt76_connac_mcu_parse_tx_resource(phy->dev, + skb); + break; default: break; } -- 2.25.1