File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed
drivers/net/wireless/mediatek/mt76/mt7615 Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ static int mt7615_check_eeprom(struct mt76_dev *dev)
9393static void mt7615_eeprom_parse_hw_cap (struct mt7615_dev * dev )
9494{
9595 u8 val , * eeprom = dev -> mt76 .eeprom .data ;
96+ u8 tx_mask , rx_mask , max_nss ;
9697
9798 val = FIELD_GET (MT_EE_NIC_WIFI_CONF_BAND_SEL ,
9899 eeprom [MT_EE_WIFI_CONF ]);
@@ -108,6 +109,23 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
108109 dev -> mt76 .cap .has_5ghz = true;
109110 break ;
110111 }
112+
113+ /* read tx-rx mask from eeprom */
114+ val = mt76_rr (dev , MT_TOP_STRAP_STA );
115+ max_nss = val & MT_TOP_3NSS ? 3 : 4 ;
116+
117+ rx_mask = FIELD_GET (MT_EE_NIC_CONF_RX_MASK ,
118+ eeprom [MT_EE_NIC_CONF_0 ]);
119+ if (!rx_mask || rx_mask > max_nss )
120+ rx_mask = max_nss ;
121+
122+ tx_mask = FIELD_GET (MT_EE_NIC_CONF_TX_MASK ,
123+ eeprom [MT_EE_NIC_CONF_0 ]);
124+ if (!tx_mask || tx_mask > max_nss )
125+ tx_mask = max_nss ;
126+
127+ dev -> mt76 .chainmask = tx_mask << 8 | rx_mask ;
128+ dev -> mt76 .antenna_mask = BIT (tx_mask ) - 1 ;
111129}
112130
113131int mt7615_eeprom_get_power_index (struct mt7615_dev * dev ,
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ enum mt7615_eeprom_field {
2424 __MT_EE_MAX = 0x3bf
2525};
2626
27+ #define MT_EE_NIC_CONF_TX_MASK GENMASK(7, 4)
28+ #define MT_EE_NIC_CONF_RX_MASK GENMASK(3, 0)
29+
2730#define MT_EE_NIC_CONF_TSSI_2G BIT(5)
2831#define MT_EE_NIC_CONF_TSSI_5G BIT(6)
2932
Original file line number Diff line number Diff line change @@ -303,8 +303,6 @@ int mt7615_register_device(struct mt7615_dev *dev)
303303 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
304304 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
305305 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ ;
306- dev -> mt76 .chainmask = 0x404 ;
307- dev -> mt76 .antenna_mask = 0xf ;
308306 dev -> dfs_state = -1 ;
309307
310308 ret = mt76_register_device (& dev -> mt76 , true, mt7615_rates ,
Original file line number Diff line number Diff line change 66
77#define MT_HW_REV 0x1000
88#define MT_HW_CHIPID 0x1008
9+ #define MT_TOP_STRAP_STA 0x1010
10+ #define MT_TOP_3NSS BIT(24)
911#define MT_TOP_MISC2 0x1134
1012#define MT_TOP_MISC2_FW_STATE GENMASK(2, 0)
1113
You can’t perform that action at this time.
0 commit comments