]>
Commit | Line | Data |
---|---|---|
04b8e659 RL |
1 | /* SPDX-License-Identifier: ISC */ |
2 | /* Copyright (C) 2019 MediaTek Inc. */ | |
3 | ||
4 | #ifndef __MT7615_EEPROM_H | |
5 | #define __MT7615_EEPROM_H | |
6 | ||
7 | #include "mt7615.h" | |
8 | ||
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, | |
16a2f8e2 | 14 | MT_EE_NIC_CONF_1 = 0x036, |
c988a77f | 15 | MT_EE_WIFI_CONF = 0x03e, |
61d36824 LB |
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, | |
16a2f8e2 LB |
19 | MT_EE_EXT_PA_2G_TARGET_POWER = 0x0f2, |
20 | MT_EE_EXT_PA_5G_TARGET_POWER = 0x0f3, | |
61d36824 LB |
21 | MT_EE_TX2_5G_G0_TARGET_POWER = 0x142, |
22 | MT_EE_TX3_5G_G0_TARGET_POWER = 0x16a, | |
04b8e659 RL |
23 | |
24 | __MT_EE_MAX = 0x3bf | |
25 | }; | |
26 | ||
acf5457f LB |
27 | #define MT_EE_NIC_CONF_TX_MASK GENMASK(7, 4) |
28 | #define MT_EE_NIC_CONF_RX_MASK GENMASK(3, 0) | |
29 | ||
16a2f8e2 LB |
30 | #define MT_EE_NIC_CONF_TSSI_2G BIT(5) |
31 | #define MT_EE_NIC_CONF_TSSI_5G BIT(6) | |
32 | ||
c988a77f LB |
33 | #define MT_EE_NIC_WIFI_CONF_BAND_SEL GENMASK(5, 4) |
34 | enum mt7615_eeprom_band { | |
35 | MT_EE_DUAL_BAND, | |
36 | MT_EE_5GHZ, | |
37 | MT_EE_2GHZ, | |
38 | MT_EE_DBDC, | |
39 | }; | |
40 | ||
61d36824 LB |
41 | enum mt7615_channel_group { |
42 | MT_CH_5G_JAPAN, | |
43 | MT_CH_5G_UNII_1, | |
44 | MT_CH_5G_UNII_2A, | |
45 | MT_CH_5G_UNII_2B, | |
46 | MT_CH_5G_UNII_2E_1, | |
47 | MT_CH_5G_UNII_2E_2, | |
48 | MT_CH_5G_UNII_2E_3, | |
49 | MT_CH_5G_UNII_3, | |
50 | __MT_CH_MAX | |
51 | }; | |
52 | ||
53 | static inline enum mt7615_channel_group | |
54 | mt7615_get_channel_group(int channel) | |
55 | { | |
56 | if (channel >= 184 && channel <= 196) | |
57 | return MT_CH_5G_JAPAN; | |
58 | if (channel <= 48) | |
59 | return MT_CH_5G_UNII_1; | |
60 | if (channel <= 64) | |
61 | return MT_CH_5G_UNII_2A; | |
62 | if (channel <= 114) | |
63 | return MT_CH_5G_UNII_2E_1; | |
64 | if (channel <= 144) | |
65 | return MT_CH_5G_UNII_2E_2; | |
66 | if (channel <= 161) | |
67 | return MT_CH_5G_UNII_2E_3; | |
68 | return MT_CH_5G_UNII_3; | |
69 | } | |
70 | ||
16a2f8e2 LB |
71 | static inline bool |
72 | mt7615_ext_pa_enabled(struct mt7615_dev *dev, enum nl80211_band band) | |
73 | { | |
74 | u8 *eep = dev->mt76.eeprom.data; | |
75 | ||
76 | if (band == NL80211_BAND_5GHZ) | |
77 | return !(eep[MT_EE_NIC_CONF_1 + 1] & MT_EE_NIC_CONF_TSSI_5G); | |
78 | else | |
79 | return !(eep[MT_EE_NIC_CONF_1 + 1] & MT_EE_NIC_CONF_TSSI_2G); | |
80 | } | |
81 | ||
04b8e659 | 82 | #endif |