if_bwn_phy_n_tables.h revision 300016
1/* 2 3 Broadcom B43 wireless driver 4 IEEE 802.11n PHY data tables 5 6 Copyright (c) 2008 Michael Buesch <m@bues.ch> 7 Copyright (c) 2010 Rafa�� Mi��ecki <zajec5@gmail.com> 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; see the file COPYING. If not, write to 21 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, 22 Boston, MA 02110-1301, USA. 23 24*/ 25 26/* 27 * $FreeBSD: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.h 300016 2016-05-17 07:09:24Z adrian $ 28 */ 29 30#ifndef __IF_BWN_TABLES_NPHY_H__ 31#define __IF_BWN_TABLES_NPHY_H__ 32 33struct bwn_phy_n_sfo_cfg { 34 uint16_t phy_bw1a; 35 uint16_t phy_bw2; 36 uint16_t phy_bw3; 37 uint16_t phy_bw4; 38 uint16_t phy_bw5; 39 uint16_t phy_bw6; 40}; 41 42struct bwn_mac; 43 44struct bwn_nphy_txiqcal_ladder { 45 uint8_t percent; 46 uint8_t g_env; 47}; 48 49struct bwn_nphy_rf_control_override_rev2 { 50 uint8_t addr0; 51 uint8_t addr1; 52 uint16_t bmask; 53 uint8_t shift; 54}; 55 56struct bwn_nphy_rf_control_override_rev3 { 57 uint16_t val_mask; 58 uint8_t val_shift; 59 uint8_t en_addr0; 60 uint8_t val_addr0; 61 uint8_t en_addr1; 62 uint8_t val_addr1; 63}; 64 65struct bwn_nphy_rf_control_override_rev7 { 66 uint16_t field; 67 uint16_t val_addr_core0; 68 uint16_t val_addr_core1; 69 uint16_t val_mask; 70 uint8_t val_shift; 71}; 72 73struct bwn_nphy_gain_ctl_workaround_entry { 74 int8_t lna1_gain[4]; 75 int8_t lna2_gain[4]; 76 uint8_t gain_db[10]; 77 uint8_t gain_bits[10]; 78 79 uint16_t init_gain; 80 uint16_t rfseq_init[4]; 81 82 uint16_t cliphi_gain; 83 uint16_t clipmd_gain; 84 uint16_t cliplo_gain; 85 86 uint16_t crsmin; 87 uint16_t crsminl; 88 uint16_t crsminu; 89 90 uint16_t nbclip; 91 uint16_t wlclip; 92}; 93 94/* Get entry with workaround values for gain ctl. Does not return NULL. */ 95struct bwn_nphy_gain_ctl_workaround_entry *bwn_nphy_get_gain_ctl_workaround_ent( 96 struct bwn_mac *mac, bool ghz5, bool ext_lna); 97 98 99/* The N-PHY tables. */ 100#define BWN_NTAB_TYPEMASK 0xF0000000 101#define BWN_NTAB_8BIT 0x10000000 102#define BWN_NTAB_16BIT 0x20000000 103#define BWN_NTAB_32BIT 0x30000000 104#define BWN_NTAB8(table, offset) (((table) << 10) | (offset) | BWN_NTAB_8BIT) 105#define BWN_NTAB16(table, offset) (((table) << 10) | (offset) | BWN_NTAB_16BIT) 106#define BWN_NTAB32(table, offset) (((table) << 10) | (offset) | BWN_NTAB_32BIT) 107 108/* Static N-PHY tables */ 109#define BWN_NTAB_FRAMESTRUCT BWN_NTAB32(0x0A, 0x000) /* Frame Struct Table */ 110#define BWN_NTAB_FRAMESTRUCT_SIZE 832 111#define BWN_NTAB_FRAMELT BWN_NTAB8 (0x18, 0x000) /* Frame Lookup Table */ 112#define BWN_NTAB_FRAMELT_SIZE 32 113#define BWN_NTAB_TMAP BWN_NTAB32(0x0C, 0x000) /* T Map Table */ 114#define BWN_NTAB_TMAP_SIZE 448 115#define BWN_NTAB_TDTRN BWN_NTAB32(0x0E, 0x000) /* TDTRN Table */ 116#define BWN_NTAB_TDTRN_SIZE 704 117#define BWN_NTAB_INTLEVEL BWN_NTAB32(0x0D, 0x000) /* Int Level Table */ 118#define BWN_NTAB_INTLEVEL_SIZE 7 119#define BWN_NTAB_PILOT BWN_NTAB16(0x0B, 0x000) /* Pilot Table */ 120#define BWN_NTAB_PILOT_SIZE 88 121#define BWN_NTAB_PILOTLT BWN_NTAB32(0x14, 0x000) /* Pilot Lookup Table */ 122#define BWN_NTAB_PILOTLT_SIZE 6 123#define BWN_NTAB_TDI20A0 BWN_NTAB32(0x13, 0x080) /* TDI Table 20 Antenna 0 */ 124#define BWN_NTAB_TDI20A0_SIZE 55 125#define BWN_NTAB_TDI20A1 BWN_NTAB32(0x13, 0x100) /* TDI Table 20 Antenna 1 */ 126#define BWN_NTAB_TDI20A1_SIZE 55 127#define BWN_NTAB_TDI40A0 BWN_NTAB32(0x13, 0x280) /* TDI Table 40 Antenna 0 */ 128#define BWN_NTAB_TDI40A0_SIZE 110 129#define BWN_NTAB_TDI40A1 BWN_NTAB32(0x13, 0x300) /* TDI Table 40 Antenna 1 */ 130#define BWN_NTAB_TDI40A1_SIZE 110 131#define BWN_NTAB_BDI BWN_NTAB16(0x15, 0x000) /* BDI Table */ 132#define BWN_NTAB_BDI_SIZE 6 133#define BWN_NTAB_CHANEST BWN_NTAB32(0x16, 0x000) /* Channel Estimate Table */ 134#define BWN_NTAB_CHANEST_SIZE 96 135#define BWN_NTAB_MCS BWN_NTAB8 (0x12, 0x000) /* MCS Table */ 136#define BWN_NTAB_MCS_SIZE 128 137 138/* Volatile N-PHY tables */ 139#define BWN_NTAB_NOISEVAR10 BWN_NTAB32(0x10, 0x000) /* Noise Var Table 10 */ 140#define BWN_NTAB_NOISEVAR10_SIZE 256 141#define BWN_NTAB_NOISEVAR11 BWN_NTAB32(0x10, 0x080) /* Noise Var Table 11 */ 142#define BWN_NTAB_NOISEVAR11_SIZE 256 143#define BWN_NTAB_C0_ESTPLT BWN_NTAB8 (0x1A, 0x000) /* Estimate Power Lookup Table Core 0 */ 144#define BWN_NTAB_C0_ESTPLT_SIZE 64 145#define BWN_NTAB_C0_ADJPLT BWN_NTAB8 (0x1A, 0x040) /* Adjust Power Lookup Table Core 0 */ 146#define BWN_NTAB_C0_ADJPLT_SIZE 128 147#define BWN_NTAB_C0_GAINCTL BWN_NTAB32(0x1A, 0x0C0) /* Gain Control Lookup Table Core 0 */ 148#define BWN_NTAB_C0_GAINCTL_SIZE 128 149#define BWN_NTAB_C0_IQLT BWN_NTAB32(0x1A, 0x140) /* IQ Lookup Table Core 0 */ 150#define BWN_NTAB_C0_IQLT_SIZE 128 151#define BWN_NTAB_C0_LOFEEDTH BWN_NTAB16(0x1A, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 0 */ 152#define BWN_NTAB_C0_LOFEEDTH_SIZE 128 153#define BWN_NTAB_C1_ESTPLT BWN_NTAB8 (0x1B, 0x000) /* Estimate Power Lookup Table Core 1 */ 154#define BWN_NTAB_C1_ESTPLT_SIZE 64 155#define BWN_NTAB_C1_ADJPLT BWN_NTAB8 (0x1B, 0x040) /* Adjust Power Lookup Table Core 1 */ 156#define BWN_NTAB_C1_ADJPLT_SIZE 128 157#define BWN_NTAB_C1_GAINCTL BWN_NTAB32(0x1B, 0x0C0) /* Gain Control Lookup Table Core 1 */ 158#define BWN_NTAB_C1_GAINCTL_SIZE 128 159#define BWN_NTAB_C1_IQLT BWN_NTAB32(0x1B, 0x140) /* IQ Lookup Table Core 1 */ 160#define BWN_NTAB_C1_IQLT_SIZE 128 161#define BWN_NTAB_C1_LOFEEDTH BWN_NTAB16(0x1B, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 1 */ 162#define BWN_NTAB_C1_LOFEEDTH_SIZE 128 163 164/* Volatile N-PHY tables, PHY revision >= 3 */ 165#define BWN_NTAB_ANT_SW_CTL_R3 BWN_NTAB16( 9, 0) /* antenna software control */ 166 167/* Static N-PHY tables, PHY revision >= 3 */ 168#define BWN_NTAB_FRAMESTRUCT_R3 BWN_NTAB32(10, 0) /* frame struct */ 169#define BWN_NTAB_PILOT_R3 BWN_NTAB16(11, 0) /* pilot */ 170#define BWN_NTAB_TMAP_R3 BWN_NTAB32(12, 0) /* TM AP */ 171#define BWN_NTAB_INTLEVEL_R3 BWN_NTAB32(13, 0) /* INT LV */ 172#define BWN_NTAB_TDTRN_R3 BWN_NTAB32(14, 0) /* TD TRN */ 173#define BWN_NTAB_NOISEVAR_R3 BWN_NTAB32(16, 0) /* noise variance */ 174#define BWN_NTAB_MCS_R3 BWN_NTAB16(18, 0) /* MCS */ 175#define BWN_NTAB_TDI20A0_R3 BWN_NTAB32(19, 128) /* TDI 20/0 */ 176#define BWN_NTAB_TDI20A1_R3 BWN_NTAB32(19, 256) /* TDI 20/1 */ 177#define BWN_NTAB_TDI40A0_R3 BWN_NTAB32(19, 640) /* TDI 40/0 */ 178#define BWN_NTAB_TDI40A1_R3 BWN_NTAB32(19, 768) /* TDI 40/1 */ 179#define BWN_NTAB_PILOTLT_R3 BWN_NTAB32(20, 0) /* PLT lookup */ 180#define BWN_NTAB_CHANEST_R3 BWN_NTAB32(22, 0) /* channel estimate */ 181#define BWN_NTAB_FRAMELT_R3 BWN_NTAB8(24, 0) /* frame lookup */ 182#define BWN_NTAB_C0_ESTPLT_R3 BWN_NTAB8(26, 0) /* estimated power lookup 0 */ 183#define BWN_NTAB_C0_ADJPLT_R3 BWN_NTAB8(26, 64) /* adjusted power lookup 0 */ 184#define BWN_NTAB_C0_GAINCTL_R3 BWN_NTAB32(26, 192) /* gain control lookup 0 */ 185#define BWN_NTAB_C0_IQLT_R3 BWN_NTAB32(26, 320) /* I/Q lookup 0 */ 186#define BWN_NTAB_C0_LOFEEDTH_R3 BWN_NTAB16(26, 448) /* Local Oscillator Feed Through lookup 0 */ 187#define BWN_NTAB_C0_PAPD_COMP_R3 BWN_NTAB16(26, 576) 188#define BWN_NTAB_C1_ESTPLT_R3 BWN_NTAB8(27, 0) /* estimated power lookup 1 */ 189#define BWN_NTAB_C1_ADJPLT_R3 BWN_NTAB8(27, 64) /* adjusted power lookup 1 */ 190#define BWN_NTAB_C1_GAINCTL_R3 BWN_NTAB32(27, 192) /* gain control lookup 1 */ 191#define BWN_NTAB_C1_IQLT_R3 BWN_NTAB32(27, 320) /* I/Q lookup 1 */ 192#define BWN_NTAB_C1_LOFEEDTH_R3 BWN_NTAB16(27, 448) /* Local Oscillator Feed Through lookup 1 */ 193#define BWN_NTAB_C1_PAPD_COMP_R3 BWN_NTAB16(27, 576) 194 195/* Static N-PHY tables, PHY revision >= 7 */ 196#define BWN_NTAB_TMAP_R7 BWN_NTAB32(12, 0) /* TM AP */ 197#define BWN_NTAB_NOISEVAR_R7 BWN_NTAB32(16, 0) /* noise variance */ 198 199#define BWN_NTAB_TX_IQLO_CAL_LOFT_LADDER_40_SIZE 18 200#define BWN_NTAB_TX_IQLO_CAL_LOFT_LADDER_20_SIZE 18 201#define BWN_NTAB_TX_IQLO_CAL_IQIMB_LADDER_40_SIZE 18 202#define BWN_NTAB_TX_IQLO_CAL_IQIMB_LADDER_20_SIZE 18 203#define BWN_NTAB_TX_IQLO_CAL_STARTCOEFS_REV3 11 204#define BWN_NTAB_TX_IQLO_CAL_STARTCOEFS 9 205#define BWN_NTAB_TX_IQLO_CAL_CMDS_RECAL_REV3 12 206#define BWN_NTAB_TX_IQLO_CAL_CMDS_RECAL 10 207#define BWN_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10 208#define BWN_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12 209 210uint32_t bwn_ntab_read(struct bwn_mac *mac, uint32_t offset); 211void bwn_ntab_read_bulk(struct bwn_mac *mac, uint32_t offset, 212 unsigned int nr_elements, void *_data); 213void bwn_ntab_write(struct bwn_mac *mac, uint32_t offset, uint32_t value); 214void bwn_ntab_write_bulk(struct bwn_mac *mac, uint32_t offset, 215 unsigned int nr_elements, const void *_data); 216 217void bwn_nphy_tables_init(struct bwn_mac *mac); 218 219const uint32_t *bwn_nphy_get_tx_gain_table(struct bwn_mac *mac); 220 221const int16_t *bwn_ntab_get_rf_pwr_offset_table(struct bwn_mac *mac); 222 223extern const int8_t bwn_ntab_papd_pga_gain_delta_ipa_2g[]; 224 225extern const uint16_t tbl_iqcal_gainparams[2][9][8]; 226extern const struct bwn_nphy_txiqcal_ladder ladder_lo[]; 227extern const struct bwn_nphy_txiqcal_ladder ladder_iq[]; 228extern const uint16_t loscale[]; 229 230extern const uint16_t tbl_tx_iqlo_cal_loft_ladder_40[]; 231extern const uint16_t tbl_tx_iqlo_cal_loft_ladder_20[]; 232extern const uint16_t tbl_tx_iqlo_cal_iqimb_ladder_40[]; 233extern const uint16_t tbl_tx_iqlo_cal_iqimb_ladder_20[]; 234extern const uint16_t tbl_tx_iqlo_cal_startcoefs_nphyrev3[]; 235extern const uint16_t tbl_tx_iqlo_cal_startcoefs[]; 236extern const uint16_t tbl_tx_iqlo_cal_cmds_recal_nphyrev3[]; 237extern const uint16_t tbl_tx_iqlo_cal_cmds_recal[]; 238extern const uint16_t tbl_tx_iqlo_cal_cmds_fullcal[]; 239extern const uint16_t tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[]; 240extern const int16_t tbl_tx_filter_coef_rev4[7][15]; 241 242extern const struct bwn_nphy_rf_control_override_rev2 243 tbl_rf_control_override_rev2[]; 244extern const struct bwn_nphy_rf_control_override_rev3 245 tbl_rf_control_override_rev3[]; 246const struct bwn_nphy_rf_control_override_rev7 *bwn_nphy_get_rf_ctl_over_rev7( 247 struct bwn_mac *mac, uint16_t field, uint8_t override); 248 249#endif /* __IF_BWN_PHY_TABLES_N_H__ */ 250