1 /* SPDX-License-Identifier: ISC */
2 /* Copyright (C) 2019 MediaTek Inc. */
4 #ifndef __MT7615_EEPROM_H
5 #define __MT7615_EEPROM_H
9 enum mt7615_eeprom_field
{
10 MT_EE_CHIP_ID
= 0x000,
11 MT_EE_VERSION
= 0x002,
12 MT_EE_MAC_ADDR
= 0x004,
13 MT_EE_NIC_CONF_0
= 0x034,
14 MT_EE_NIC_CONF_1
= 0x036,
15 MT_EE_WIFI_CONF
= 0x03e,
16 MT_EE_TX0_2G_TARGET_POWER
= 0x058,
17 MT_EE_TX0_5G_G0_TARGET_POWER
= 0x070,
18 MT_EE_TX1_5G_G0_TARGET_POWER
= 0x098,
19 MT_EE_EXT_PA_2G_TARGET_POWER
= 0x0f2,
20 MT_EE_EXT_PA_5G_TARGET_POWER
= 0x0f3,
21 MT_EE_TX2_5G_G0_TARGET_POWER
= 0x142,
22 MT_EE_TX3_5G_G0_TARGET_POWER
= 0x16a,
27 #define MT_EE_NIC_CONF_TX_MASK GENMASK(7, 4)
28 #define MT_EE_NIC_CONF_RX_MASK GENMASK(3, 0)
30 #define MT_EE_NIC_CONF_TSSI_2G BIT(5)
31 #define MT_EE_NIC_CONF_TSSI_5G BIT(6)
33 #define MT_EE_NIC_WIFI_CONF_BAND_SEL GENMASK(5, 4)
34 enum mt7615_eeprom_band
{
41 enum mt7615_channel_group
{
53 static inline enum mt7615_channel_group
54 mt7615_get_channel_group(int channel
)
56 if (channel
>= 184 && channel
<= 196)
57 return MT_CH_5G_JAPAN
;
59 return MT_CH_5G_UNII_1
;
61 return MT_CH_5G_UNII_2A
;
63 return MT_CH_5G_UNII_2E_1
;
65 return MT_CH_5G_UNII_2E_2
;
67 return MT_CH_5G_UNII_2E_3
;
68 return MT_CH_5G_UNII_3
;
72 mt7615_ext_pa_enabled(struct mt7615_dev
*dev
, enum nl80211_band band
)
74 u8
*eep
= dev
->mt76
.eeprom
.data
;
76 if (band
== NL80211_BAND_5GHZ
)
77 return !(eep
[MT_EE_NIC_CONF_1
+ 1] & MT_EE_NIC_CONF_TSSI_5G
);
79 return !(eep
[MT_EE_NIC_CONF_1
+ 1] & MT_EE_NIC_CONF_TSSI_2G
);