From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 9/9] mt76: mt7603: check for single-stream EEPROM configuration
Date: Tue, 25 Aug 2020 07:29:09 +0200 [thread overview]
Message-ID: <20200825052909.36955-9-nbd@nbd.name> (raw)
In-Reply-To: <20200825052909.36955-1-nbd@nbd.name>
Some devices using MT7628 or MT7603 have only one antenna chain connected.
Detect these using the EEPROM rx/tx path settings
Reported-by: Qin Wei <me@vonger.cn>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h | 3 +++
drivers/net/wireless/mediatek/mt76/mt7603/init.c | 12 ++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h
index b893facfba48..4687d6dc00dc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h
@@ -85,4 +85,7 @@ enum mt7603_eeprom_source {
MT_EE_SRC_FLASH,
};
+#define MT_EE_NIC_CONF_0_RX_PATH GENMASK(3, 0)
+#define MT_EE_NIC_CONF_0_TX_PATH GENMASK(7, 4)
+
#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
index 94196599797e..43dbabccc083 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -510,11 +510,17 @@ mt7603_init_txpower(struct mt7603_dev *dev,
}
}
+static inline bool is_mt7688(struct mt7603_dev *dev)
+{
+ return mt76_rr(dev, MT_EFUSE_BASE + 0x64) & BIT(4);
+}
+
int mt7603_register_device(struct mt7603_dev *dev)
{
struct mt76_bus_ops *bus_ops;
struct ieee80211_hw *hw = mt76_hw(dev);
struct wiphy *wiphy = hw->wiphy;
+ u8 *eeprom = (u8 *)dev->mt76.eeprom.data;
int ret;
dev->bus_ops = dev->mt76.bus;
@@ -536,9 +542,11 @@ int mt7603_register_device(struct mt7603_dev *dev)
tasklet_init(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
(unsigned long)dev);
- /* Check for 7688, which only has 1SS */
+ /* Check for 1SS devices */
dev->mphy.antenna_mask = 3;
- if (mt76_rr(dev, MT_EFUSE_BASE + 0x64) & BIT(4))
+ if (FIELD_GET(MT_EE_NIC_CONF_0_RX_PATH, eeprom[MT_EE_NIC_CONF_0]) == 1 ||
+ FIELD_GET(MT_EE_NIC_CONF_0_TX_PATH, eeprom[MT_EE_NIC_CONF_0]) == 1 ||
+ is_mt7688(dev))
dev->mphy.antenna_mask = 1;
dev->slottime = 9;
--
2.28.0
next prev parent reply other threads:[~2020-08-25 5:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 5:29 [PATCH 1/9] mt76: mt7615: fix reading airtime statistics Felix Fietkau
2020-08-25 5:29 ` [PATCH 2/9] mt76: mt7915: optimize mt7915_mac_sta_poll Felix Fietkau
2020-08-25 5:29 ` [PATCH 3/9] mt76: dma: update q->queued immediately on cleanup Felix Fietkau
2020-08-25 5:29 ` [PATCH 4/9] mt76: mt7915: schedule tx tasklet in mt7915_mac_tx_free Felix Fietkau
2020-08-25 5:29 ` [PATCH 5/9] mt76: mt7915: significantly reduce interrupt load Felix Fietkau
2020-08-25 5:29 ` [PATCH 6/9] mt76: mt7615: " Felix Fietkau
2020-08-25 5:29 ` [PATCH 7/9] mt76: mt7915: add support for accessing mapped registers via bus ops Felix Fietkau
2020-08-25 5:29 ` [PATCH 8/9] mt76: add memory barrier to DMA queue kick Felix Fietkau
2020-08-25 5:29 ` Felix Fietkau [this message]
2020-08-25 11:42 ` [PATCH v2 9/9] mt76: mt7603: check for single-stream EEPROM configuration Felix Fietkau
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=20200825052909.36955-9-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/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