PageRenderTime 29ms CodeModel.GetById 6ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/b43/tables_nphy.h

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C Header | 217 lines | 183 code | 27 blank | 7 comment | 0 complexity | d05b4dfed110d79b5a689a69434625e0 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. #ifndef B43_TABLES_NPHY_H_
  2. #define B43_TABLES_NPHY_H_
  3. #include <linux/types.h>
  4. struct b43_phy_n_sfo_cfg {
  5. u16 phy_bw1a;
  6. u16 phy_bw2;
  7. u16 phy_bw3;
  8. u16 phy_bw4;
  9. u16 phy_bw5;
  10. u16 phy_bw6;
  11. };
  12. struct b43_wldev;
  13. struct nphy_txiqcal_ladder {
  14. u8 percent;
  15. u8 g_env;
  16. };
  17. struct nphy_rf_control_override_rev2 {
  18. u8 addr0;
  19. u8 addr1;
  20. u16 bmask;
  21. u8 shift;
  22. };
  23. struct nphy_rf_control_override_rev3 {
  24. u16 val_mask;
  25. u8 val_shift;
  26. u8 en_addr0;
  27. u8 val_addr0;
  28. u8 en_addr1;
  29. u8 val_addr1;
  30. };
  31. struct nphy_gain_ctl_workaround_entry {
  32. s8 lna1_gain[4];
  33. s8 lna2_gain[4];
  34. u8 gain_db[10];
  35. u8 gain_bits[10];
  36. u16 init_gain;
  37. u16 rfseq_init[4];
  38. u16 cliphi_gain;
  39. u16 clipmd_gain;
  40. u16 cliplo_gain;
  41. u16 crsmin;
  42. u16 crsminl;
  43. u16 crsminu;
  44. u16 nbclip;
  45. u16 wlclip;
  46. };
  47. /* Get entry with workaround values for gain ctl. Does not return NULL. */
  48. struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
  49. struct b43_wldev *dev, bool ghz5, bool ext_lna);
  50. /* Get the NPHY Channel Switch Table entry for a channel.
  51. * Returns NULL on failure to find an entry. */
  52. const struct b43_nphy_channeltab_entry_rev2 *
  53. b43_nphy_get_chantabent_rev2(struct b43_wldev *dev, u8 channel);
  54. const struct b43_nphy_channeltab_entry_rev3 *
  55. b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq);
  56. /* The N-PHY tables. */
  57. #define B43_NTAB_TYPEMASK 0xF0000000
  58. #define B43_NTAB_8BIT 0x10000000
  59. #define B43_NTAB_16BIT 0x20000000
  60. #define B43_NTAB_32BIT 0x30000000
  61. #define B43_NTAB8(table, offset) (((table) << 10) | (offset) | B43_NTAB_8BIT)
  62. #define B43_NTAB16(table, offset) (((table) << 10) | (offset) | B43_NTAB_16BIT)
  63. #define B43_NTAB32(table, offset) (((table) << 10) | (offset) | B43_NTAB_32BIT)
  64. /* Static N-PHY tables */
  65. #define B43_NTAB_FRAMESTRUCT B43_NTAB32(0x0A, 0x000) /* Frame Struct Table */
  66. #define B43_NTAB_FRAMESTRUCT_SIZE 832
  67. #define B43_NTAB_FRAMELT B43_NTAB8 (0x18, 0x000) /* Frame Lookup Table */
  68. #define B43_NTAB_FRAMELT_SIZE 32
  69. #define B43_NTAB_TMAP B43_NTAB32(0x0C, 0x000) /* T Map Table */
  70. #define B43_NTAB_TMAP_SIZE 448
  71. #define B43_NTAB_TDTRN B43_NTAB32(0x0E, 0x000) /* TDTRN Table */
  72. #define B43_NTAB_TDTRN_SIZE 704
  73. #define B43_NTAB_INTLEVEL B43_NTAB32(0x0D, 0x000) /* Int Level Table */
  74. #define B43_NTAB_INTLEVEL_SIZE 7
  75. #define B43_NTAB_PILOT B43_NTAB16(0x0B, 0x000) /* Pilot Table */
  76. #define B43_NTAB_PILOT_SIZE 88
  77. #define B43_NTAB_PILOTLT B43_NTAB32(0x14, 0x000) /* Pilot Lookup Table */
  78. #define B43_NTAB_PILOTLT_SIZE 6
  79. #define B43_NTAB_TDI20A0 B43_NTAB32(0x13, 0x080) /* TDI Table 20 Antenna 0 */
  80. #define B43_NTAB_TDI20A0_SIZE 55
  81. #define B43_NTAB_TDI20A1 B43_NTAB32(0x13, 0x100) /* TDI Table 20 Antenna 1 */
  82. #define B43_NTAB_TDI20A1_SIZE 55
  83. #define B43_NTAB_TDI40A0 B43_NTAB32(0x13, 0x280) /* TDI Table 40 Antenna 0 */
  84. #define B43_NTAB_TDI40A0_SIZE 110
  85. #define B43_NTAB_TDI40A1 B43_NTAB32(0x13, 0x300) /* TDI Table 40 Antenna 1 */
  86. #define B43_NTAB_TDI40A1_SIZE 110
  87. #define B43_NTAB_BDI B43_NTAB16(0x15, 0x000) /* BDI Table */
  88. #define B43_NTAB_BDI_SIZE 6
  89. #define B43_NTAB_CHANEST B43_NTAB32(0x16, 0x000) /* Channel Estimate Table */
  90. #define B43_NTAB_CHANEST_SIZE 96
  91. #define B43_NTAB_MCS B43_NTAB8 (0x12, 0x000) /* MCS Table */
  92. #define B43_NTAB_MCS_SIZE 128
  93. /* Volatile N-PHY tables */
  94. #define B43_NTAB_NOISEVAR10 B43_NTAB32(0x10, 0x000) /* Noise Var Table 10 */
  95. #define B43_NTAB_NOISEVAR10_SIZE 256
  96. #define B43_NTAB_NOISEVAR11 B43_NTAB32(0x10, 0x080) /* Noise Var Table 11 */
  97. #define B43_NTAB_NOISEVAR11_SIZE 256
  98. #define B43_NTAB_C0_ESTPLT B43_NTAB8 (0x1A, 0x000) /* Estimate Power Lookup Table Core 0 */
  99. #define B43_NTAB_C0_ESTPLT_SIZE 64
  100. #define B43_NTAB_C1_ESTPLT B43_NTAB8 (0x1B, 0x000) /* Estimate Power Lookup Table Core 1 */
  101. #define B43_NTAB_C1_ESTPLT_SIZE 64
  102. #define B43_NTAB_C0_ADJPLT B43_NTAB8 (0x1A, 0x040) /* Adjust Power Lookup Table Core 0 */
  103. #define B43_NTAB_C0_ADJPLT_SIZE 128
  104. #define B43_NTAB_C1_ADJPLT B43_NTAB8 (0x1B, 0x040) /* Adjust Power Lookup Table Core 1 */
  105. #define B43_NTAB_C1_ADJPLT_SIZE 128
  106. #define B43_NTAB_C0_GAINCTL B43_NTAB32(0x1A, 0x0C0) /* Gain Control Lookup Table Core 0 */
  107. #define B43_NTAB_C0_GAINCTL_SIZE 128
  108. #define B43_NTAB_C1_GAINCTL B43_NTAB32(0x1B, 0x0C0) /* Gain Control Lookup Table Core 1 */
  109. #define B43_NTAB_C1_GAINCTL_SIZE 128
  110. #define B43_NTAB_C0_IQLT B43_NTAB32(0x1A, 0x140) /* IQ Lookup Table Core 0 */
  111. #define B43_NTAB_C0_IQLT_SIZE 128
  112. #define B43_NTAB_C1_IQLT B43_NTAB32(0x1B, 0x140) /* IQ Lookup Table Core 1 */
  113. #define B43_NTAB_C1_IQLT_SIZE 128
  114. #define B43_NTAB_C0_LOFEEDTH B43_NTAB16(0x1A, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 0 */
  115. #define B43_NTAB_C0_LOFEEDTH_SIZE 128
  116. #define B43_NTAB_C1_LOFEEDTH B43_NTAB16(0x1B, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 1 */
  117. #define B43_NTAB_C1_LOFEEDTH_SIZE 128
  118. /* Static N-PHY tables, PHY revision >= 3 */
  119. #define B43_NTAB_FRAMESTRUCT_R3 B43_NTAB32(10, 000) /* frame struct */
  120. #define B43_NTAB_PILOT_R3 B43_NTAB16(11, 000) /* pilot */
  121. #define B43_NTAB_TMAP_R3 B43_NTAB32(12, 000) /* TM AP */
  122. #define B43_NTAB_INTLEVEL_R3 B43_NTAB32(13, 000) /* INT LV */
  123. #define B43_NTAB_TDTRN_R3 B43_NTAB32(14, 000) /* TD TRN */
  124. #define B43_NTAB_NOISEVAR0_R3 B43_NTAB32(16, 000) /* noise variance 0 */
  125. #define B43_NTAB_NOISEVAR1_R3 B43_NTAB32(16, 128) /* noise variance 1 */
  126. #define B43_NTAB_MCS_R3 B43_NTAB16(18, 000) /* MCS */
  127. #define B43_NTAB_TDI20A0_R3 B43_NTAB32(19, 128) /* TDI 20/0 */
  128. #define B43_NTAB_TDI20A1_R3 B43_NTAB32(19, 256) /* TDI 20/1 */
  129. #define B43_NTAB_TDI40A0_R3 B43_NTAB32(19, 640) /* TDI 40/0 */
  130. #define B43_NTAB_TDI40A1_R3 B43_NTAB32(19, 768) /* TDI 40/1 */
  131. #define B43_NTAB_PILOTLT_R3 B43_NTAB32(20, 000) /* PLT lookup */
  132. #define B43_NTAB_CHANEST_R3 B43_NTAB32(22, 000) /* channel estimate */
  133. #define B43_NTAB_FRAMELT_R3 B43_NTAB8 (24, 000) /* frame lookup */
  134. #define B43_NTAB_C0_ESTPLT_R3 B43_NTAB8 (26, 000) /* estimated power lookup 0 */
  135. #define B43_NTAB_C1_ESTPLT_R3 B43_NTAB8 (27, 000) /* estimated power lookup 1 */
  136. #define B43_NTAB_C0_ADJPLT_R3 B43_NTAB8 (26, 064) /* adjusted power lookup 0 */
  137. #define B43_NTAB_C1_ADJPLT_R3 B43_NTAB8 (27, 064) /* adjusted power lookup 1 */
  138. #define B43_NTAB_C0_GAINCTL_R3 B43_NTAB32(26, 192) /* gain control lookup 0 */
  139. #define B43_NTAB_C1_GAINCTL_R3 B43_NTAB32(27, 192) /* gain control lookup 1 */
  140. #define B43_NTAB_C0_IQLT_R3 B43_NTAB32(26, 320) /* I/Q lookup 0 */
  141. #define B43_NTAB_C1_IQLT_R3 B43_NTAB32(27, 320) /* I/Q lookup 1 */
  142. #define B43_NTAB_C0_LOFEEDTH_R3 B43_NTAB16(26, 448) /* Local Oscillator Feed Through lookup 0 */
  143. #define B43_NTAB_C1_LOFEEDTH_R3 B43_NTAB16(27, 448) /* Local Oscillator Feed Through lookup 1 */
  144. #define B43_NTAB_TX_IQLO_CAL_LOFT_LADDER_40_SIZE 18
  145. #define B43_NTAB_TX_IQLO_CAL_LOFT_LADDER_20_SIZE 18
  146. #define B43_NTAB_TX_IQLO_CAL_IQIMB_LADDER_40_SIZE 18
  147. #define B43_NTAB_TX_IQLO_CAL_IQIMB_LADDER_20_SIZE 18
  148. #define B43_NTAB_TX_IQLO_CAL_STARTCOEFS_REV3 11
  149. #define B43_NTAB_TX_IQLO_CAL_STARTCOEFS 9
  150. #define B43_NTAB_TX_IQLO_CAL_CMDS_RECAL_REV3 12
  151. #define B43_NTAB_TX_IQLO_CAL_CMDS_RECAL 10
  152. #define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10
  153. #define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12
  154. u32 b43_ntab_read(struct b43_wldev *dev, u32 offset);
  155. void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset,
  156. unsigned int nr_elements, void *_data);
  157. void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value);
  158. void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,
  159. unsigned int nr_elements, const void *_data);
  160. void b43_nphy_rev0_1_2_tables_init(struct b43_wldev *dev);
  161. void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev);
  162. extern const u32 b43_ntab_tx_gain_rev0_1_2[];
  163. extern const u32 b43_ntab_tx_gain_rev3plus_2ghz[];
  164. extern const u32 b43_ntab_tx_gain_rev3_5ghz[];
  165. extern const u32 b43_ntab_tx_gain_rev4_5ghz[];
  166. extern const u32 b43_ntab_tx_gain_rev5plus_5ghz[];
  167. extern const u32 txpwrctrl_tx_gain_ipa[];
  168. extern const u32 txpwrctrl_tx_gain_ipa_rev5[];
  169. extern const u32 txpwrctrl_tx_gain_ipa_rev6[];
  170. extern const u32 txpwrctrl_tx_gain_ipa_5g[];
  171. extern const u16 tbl_iqcal_gainparams[2][9][8];
  172. extern const struct nphy_txiqcal_ladder ladder_lo[];
  173. extern const struct nphy_txiqcal_ladder ladder_iq[];
  174. extern const u16 loscale[];
  175. extern const u16 tbl_tx_iqlo_cal_loft_ladder_40[];
  176. extern const u16 tbl_tx_iqlo_cal_loft_ladder_20[];
  177. extern const u16 tbl_tx_iqlo_cal_iqimb_ladder_40[];
  178. extern const u16 tbl_tx_iqlo_cal_iqimb_ladder_20[];
  179. extern const u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[];
  180. extern const u16 tbl_tx_iqlo_cal_startcoefs[];
  181. extern const u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[];
  182. extern const u16 tbl_tx_iqlo_cal_cmds_recal[];
  183. extern const u16 tbl_tx_iqlo_cal_cmds_fullcal[];
  184. extern const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[];
  185. extern const s16 tbl_tx_filter_coef_rev4[7][15];
  186. extern const struct nphy_rf_control_override_rev2
  187. tbl_rf_control_override_rev2[];
  188. extern const struct nphy_rf_control_override_rev3
  189. tbl_rf_control_override_rev3[];
  190. #endif /* B43_TABLES_NPHY_H_ */