From patchwork Tue Mar 17 16:41:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 216265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A7B4C18E5B for ; Tue, 17 Mar 2020 16:42:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D6E120752 for ; Tue, 17 Mar 2020 16:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584463352; bh=F6pU+evzRGxGg+nHIpDJ8bNvdVFnMVeGCf8+3esDiY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uhSdA5p/2TIwbd69fEfU9fI+YCiPINIn3I2HILACnpruuCPz+2VLuAtq1Q8d9b7UH 4F2eSC5Gi6tNeOrC6zwR8jzk81EMfH0PRyd4q1V6uPbWEsr/pMmAnnjZxtwGVoIFgD 8yua2QIzEE5Zd6L77gr0YnRYsXZgdrUIcBSVuoq0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbgCQQmb (ORCPT ); Tue, 17 Mar 2020 12:42:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:47632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbgCQQma (ORCPT ); Tue, 17 Mar 2020 12:42:30 -0400 Received: from lore-desk-wlan.redhat.com (unknown [151.48.128.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A376520735; Tue, 17 Mar 2020 16:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584463346; bh=F6pU+evzRGxGg+nHIpDJ8bNvdVFnMVeGCf8+3esDiY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FQTcDObZEKCU/B/qQs5XrejOyLepKAbVf32t0tPrLQ7V2Wnfakor0rZDjHVOankLS kBPyHMeMX0DJ28FkJOcP0Zzzenz1a4kqUUlFZ8iH9B02P0vI+N352kfADOsZRbXS4F ZBjqYvJBJcjNQei7tOk6N7KPVgQcFBqI3q8c/ojo= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, sean.wang@mediatek.com, ryder.lee@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 18/25] mt76: mt7615: introduce mt7615_eeprom_parse_hw_band_cap routine Date: Tue, 17 Mar 2020 17:41:25 +0100 Message-Id: <6906c64480364bf220fed1b348c3a2c64fcfd358.1584463004.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce mt7615_eeprom_parse_hw_band_cap routine in order to configure supported band for mt7663e and mt7622 devices since they do not rely on eeprom data to enable 2GHz/5GHz bands Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt7615/eeprom.c | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c index 5220c18e711f..b1091694569e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c @@ -91,11 +91,23 @@ static int mt7615_check_eeprom(struct mt76_dev *dev) } } -static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) +static void +mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev) { - u8 *eeprom = dev->mt76.eeprom.data; - u8 tx_mask, max_nss; - u32 val; + u8 val, *eeprom = dev->mt76.eeprom.data; + + if (is_mt7663(&dev->mt76)) { + /* dual band */ + dev->mt76.cap.has_2ghz = true; + dev->mt76.cap.has_5ghz = true; + return; + } + + if (is_mt7622(&dev->mt76)) { + /* 2GHz only */ + dev->mt76.cap.has_2ghz = true; + return; + } val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL, eeprom[MT_EE_WIFI_CONF]); @@ -111,9 +123,15 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) dev->mt76.cap.has_5ghz = true; break; } +} + +static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) +{ + u8 *eeprom = dev->mt76.eeprom.data; + u8 tx_mask, max_nss; + u32 val; - if (is_mt7622(&dev->mt76)) - dev->mt76.cap.has_5ghz = false; + mt7615_eeprom_parse_hw_band_cap(dev); /* read tx-rx mask from eeprom */ val = mt76_rr(dev, MT_TOP_STRAP_STA);