summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2018-09-20 12:12:02 +0300
committerFelix Fietkau <nbd@nbd.name>2018-10-01 13:33:54 +0300
commit63cf8d1208f976b54050a39fc2fda5b477105329 (patch)
tree8e61cc11ce127bac8e1611df3ea8273a6bae54e9 /drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
parent77d0f465644973406f27e861e66c6e51ed0e7df1 (diff)
downloadlinux-63cf8d1208f976b54050a39fc2fda5b477105329.tar.xz
mt76: move mt76x02_eeprom_parse_hw_cap in mt76x02-lib module
Move mt76x02_eeprom_parse_hw_cap utility routine in mt76x02-lib module in order to be reused in mt76x0 driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
index 2377c758da5d..d3efeb8a72b7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
@@ -71,6 +71,25 @@ int mt76x02_get_efuse_data(struct mt76_dev *dev, u16 base, void *buf,
}
EXPORT_SYMBOL_GPL(mt76x02_get_efuse_data);
+void mt76x02_eeprom_parse_hw_cap(struct mt76_dev *dev)
+{
+ u16 val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_0);
+
+ switch (FIELD_GET(MT_EE_NIC_CONF_0_BOARD_TYPE, val)) {
+ case BOARD_TYPE_5GHZ:
+ dev->cap.has_5ghz = true;
+ break;
+ case BOARD_TYPE_2GHZ:
+ dev->cap.has_2ghz = true;
+ break;
+ default:
+ dev->cap.has_2ghz = true;
+ dev->cap.has_5ghz = true;
+ break;
+ }
+}
+EXPORT_SYMBOL_GPL(mt76x02_eeprom_parse_hw_cap);
+
bool mt76x02_ext_pa_enabled(struct mt76_dev *dev, enum nl80211_band band)
{
u16 conf0 = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_0);