1 /* SPDX-License-Identifier: ISC */ 2 /* 3 * Copyright (C) 2022 MediaTek Inc. 4 */ 5 6 #ifndef __MT7996_EEPROM_H 7 #define __MT7996_EEPROM_H 8 9 #include "mt7996.h" 10 11 enum mt7996_eeprom_field { 12 MT_EE_CHIP_ID = 0x000, 13 MT_EE_VERSION = 0x002, 14 MT_EE_MAC_ADDR = 0x004, 15 MT_EE_MAC_ADDR2 = 0x00a, 16 MT_EE_WIFI_CONF = 0x190, 17 MT_EE_MAC_ADDR3 = 0x2c0, 18 MT_EE_RATE_DELTA_2G = 0x1400, 19 MT_EE_RATE_DELTA_5G = 0x147d, 20 MT_EE_RATE_DELTA_6G = 0x154a, 21 MT_EE_TX0_POWER_2G = 0x1300, 22 MT_EE_TX0_POWER_5G = 0x1301, 23 MT_EE_TX0_POWER_6G = 0x1310, 24 25 __MT_EE_MAX = 0x1dff, 26 }; 27 28 #define MT_EE_WIFI_CONF0_TX_PATH GENMASK(2, 0) 29 #define MT_EE_WIFI_CONF0_BAND_SEL GENMASK(2, 0) 30 #define MT_EE_WIFI_CONF1_BAND_SEL GENMASK(5, 3) 31 #define MT_EE_WIFI_CONF2_BAND_SEL GENMASK(2, 0) 32 33 #define MT_EE_WIFI_CONF1_TX_PATH_BAND0 GENMASK(5, 3) 34 #define MT_EE_WIFI_CONF2_TX_PATH_BAND1 GENMASK(2, 0) 35 #define MT_EE_WIFI_CONF2_TX_PATH_BAND2 GENMASK(5, 3) 36 #define MT_EE_WIFI_CONF3_RX_PATH_BAND0 GENMASK(2, 0) 37 #define MT_EE_WIFI_CONF3_RX_PATH_BAND1 GENMASK(5, 3) 38 #define MT_EE_WIFI_CONF4_RX_PATH_BAND2 GENMASK(2, 0) 39 #define MT_EE_WIFI_CONF4_STREAM_NUM_BAND0 GENMASK(5, 3) 40 #define MT_EE_WIFI_CONF5_STREAM_NUM_BAND1 GENMASK(2, 0) 41 #define MT_EE_WIFI_CONF5_STREAM_NUM_BAND2 GENMASK(5, 3) 42 43 #define MT_EE_RATE_DELTA_MASK GENMASK(5, 0) 44 #define MT_EE_RATE_DELTA_SIGN BIT(6) 45 #define MT_EE_RATE_DELTA_EN BIT(7) 46 47 enum mt7996_eeprom_band { 48 MT_EE_BAND_SEL_DEFAULT, 49 MT_EE_BAND_SEL_2GHZ, 50 MT_EE_BAND_SEL_5GHZ, 51 MT_EE_BAND_SEL_6GHZ, 52 }; 53 54 static inline int 55 mt7996_get_channel_group_5g(int channel) 56 { 57 if (channel <= 64) 58 return 0; 59 if (channel <= 96) 60 return 1; 61 if (channel <= 128) 62 return 2; 63 if (channel <= 144) 64 return 3; 65 return 4; 66 } 67 68 static inline int 69 mt7996_get_channel_group_6g(int channel) 70 { 71 if (channel <= 29) 72 return 0; 73 74 return DIV_ROUND_UP(channel - 29, 32); 75 } 76 77 #endif 78