From patchwork Sun Mar 8 22:08:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 216347 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 456CDC10DCE for ; Sun, 8 Mar 2020 22:09:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17D0A2084E for ; Sun, 8 Mar 2020 22:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583705378; bh=ClEtp1En2MFQuA84YM8YGq24ONE/Krkd5mLZB2J//C0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HHvzHWLr7v+NByeyxzVLGCqEZmhqGRdEzYh5ddtlE14W6Gwz7HhelgRPsNA/7kx3s xg8DhwcHhfxuwEk9+tLKCUh0HT9ewwKSE/IUGRArdt97h2wZuVZY/qgWfXfiEetbey c8EUCkwzOqLoc7H/n0s0tmQHYbbB3joFwuPshnxo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbgCHWJh (ORCPT ); Sun, 8 Mar 2020 18:09:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:39686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbgCHWJh (ORCPT ); Sun, 8 Mar 2020 18:09:37 -0400 Received: from localhost.localdomain (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 565FC206D5; Sun, 8 Mar 2020 22:09:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583705376; bh=ClEtp1En2MFQuA84YM8YGq24ONE/Krkd5mLZB2J//C0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hdzJ+wtnpzyxQlO/Bg4i95s0vOa44ndyUWwdLtACgMtWzOk5qXW9I7tyrhbfd2Gkj 418vrORU3vH1glYdPJrD5Chuw4BATY/3lfA+K4gXaRGxRDMr9bJfUAwzqdJQC+y7mz Zy5X8Z6PiLPLJmGcOOXlWkPCdBqmOL3KflSyB/4A= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, sean.wang@mediatek.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com Subject: [PATCH v2 18/25] mt76: mt7615: introduce mt7615_eeprom_parse_hw_band_cap routine Date: Sun, 8 Mar 2020 23:08:30 +0100 Message-Id: <0e2ba90afc633dd7834ed479c10dd69b17f447b1.1583705012.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.24.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);