linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: nbd@nbd.name
Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org,
	sean.wang@mediatek.com, ryder.lee@mediatek.com
Subject: [PATCH 6/8] mt76: mt7615: introduce mt7615_eeprom_parse_hw_band_cap routine
Date: Fri, 21 Feb 2020 01:07:33 +0100	[thread overview]
Message-ID: <11c3f562ee4b39244f7b40f2abd6378c4595e89d.1582243031.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1582243031.git.lorenzo@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 <lorenzo@kernel.org>
---
 .../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);
-- 
2.24.1


  parent reply	other threads:[~2020-02-21  0:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21  0:07 [PATCH 0/8] Introduce mt7663e support to mt7615 driver Lorenzo Bianconi
2020-02-21  0:07 ` [PATCH 1/8] mt76: mt7615: introduce mt7615_register_map Lorenzo Bianconi
2020-02-21  0:07 ` [PATCH 2/8] mt76: mt7615: add mt7663e support to mt7615_reg_map Lorenzo Bianconi
2020-02-21  0:07 ` [PATCH 3/8] mt76: mt7615: add mt7663 support to mt7615_mcu_set_tx_ba Lorenzo Bianconi
2020-02-21  0:07 ` [PATCH 4/8] mt76: mt7615: add mt7663e support to mt7615_{driver,firmware}_own Lorenzo Bianconi
2020-02-21  0:07 ` [PATCH 5/8] mt76: mt7615: add mt7663e support to mt7615_mcu_set_eeprom Lorenzo Bianconi
2020-02-21  0:07 ` Lorenzo Bianconi [this message]
2020-02-21  0:07 ` [PATCH 7/8] mt76: mt7615: introduce mt7615_init_mac_chain routine Lorenzo Bianconi
2020-02-21  0:07 ` [PATCH 8/8] mt76: mt7615: introduce mt7663e support Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11c3f562ee4b39244f7b40f2abd6378c4595e89d.1582243031.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).