tables_nphy.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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_nphy_channeltab_entry_rev2 {
  13. /* The channel number */
  14. u8 channel;
  15. /* The channel frequency in MHz */
  16. u16 freq;
  17. /* An unknown value */
  18. u16 unk2;
  19. /* Radio register values on channelswitch */
  20. u8 radio_pll_ref;
  21. u8 radio_rf_pllmod0;
  22. u8 radio_rf_pllmod1;
  23. u8 radio_vco_captail;
  24. u8 radio_vco_cal1;
  25. u8 radio_vco_cal2;
  26. u8 radio_pll_lfc1;
  27. u8 radio_pll_lfr1;
  28. u8 radio_pll_lfc2;
  29. u8 radio_lgbuf_cenbuf;
  30. u8 radio_lgen_tune1;
  31. u8 radio_lgen_tune2;
  32. u8 radio_c1_lgbuf_atune;
  33. u8 radio_c1_lgbuf_gtune;
  34. u8 radio_c1_rx_rfr1;
  35. u8 radio_c1_tx_pgapadtn;
  36. u8 radio_c1_tx_mxbgtrim;
  37. u8 radio_c2_lgbuf_atune;
  38. u8 radio_c2_lgbuf_gtune;
  39. u8 radio_c2_rx_rfr1;
  40. u8 radio_c2_tx_pgapadtn;
  41. u8 radio_c2_tx_mxbgtrim;
  42. /* PHY register values on channelswitch */
  43. struct b43_phy_n_sfo_cfg phy_regs;
  44. };
  45. struct b43_nphy_channeltab_entry_rev3 {
  46. /* The channel number */
  47. u8 channel;
  48. /* The channel frequency in MHz */
  49. u16 freq;
  50. /* Radio register values on channelswitch */
  51. /* TODO */
  52. /* PHY register values on channelswitch */
  53. struct b43_phy_n_sfo_cfg phy_regs;
  54. };
  55. struct b43_wldev;
  56. struct nphy_txiqcal_ladder {
  57. u8 percent;
  58. u8 g_env;
  59. };
  60. struct nphy_rf_control_override_rev2 {
  61. u8 addr0;
  62. u8 addr1;
  63. u16 bmask;
  64. u8 shift;
  65. };
  66. struct nphy_rf_control_override_rev3 {
  67. u16 val_mask;
  68. u8 val_shift;
  69. u8 en_addr0;
  70. u8 val_addr0;
  71. u8 en_addr1;
  72. u8 val_addr1;
  73. };
  74. /* Upload the default register value table.
  75. * If "ghz5" is true, we upload the 5Ghz table. Otherwise the 2.4Ghz
  76. * table is uploaded. If "ignore_uploadflag" is true, we upload any value
  77. * and ignore the "UPLOAD" flag. */
  78. void b2055_upload_inittab(struct b43_wldev *dev,
  79. bool ghz5, bool ignore_uploadflag);
  80. /* Get the NPHY Channel Switch Table entry for a channel number.
  81. * Returns NULL on failure to find an entry. */
  82. const struct b43_nphy_channeltab_entry_rev2 *
  83. b43_nphy_get_chantabent_rev2(struct b43_wldev *dev, u8 channel);
  84. /* The N-PHY tables. */
  85. #define B43_NTAB_TYPEMASK 0xF0000000
  86. #define B43_NTAB_8BIT 0x10000000
  87. #define B43_NTAB_16BIT 0x20000000
  88. #define B43_NTAB_32BIT 0x30000000
  89. #define B43_NTAB8(table, offset) (((table) << 10) | (offset) | B43_NTAB_8BIT)
  90. #define B43_NTAB16(table, offset) (((table) << 10) | (offset) | B43_NTAB_16BIT)
  91. #define B43_NTAB32(table, offset) (((table) << 10) | (offset) | B43_NTAB_32BIT)
  92. /* Static N-PHY tables */
  93. #define B43_NTAB_FRAMESTRUCT B43_NTAB32(0x0A, 0x000) /* Frame Struct Table */
  94. #define B43_NTAB_FRAMESTRUCT_SIZE 832
  95. #define B43_NTAB_FRAMELT B43_NTAB8 (0x18, 0x000) /* Frame Lookup Table */
  96. #define B43_NTAB_FRAMELT_SIZE 32
  97. #define B43_NTAB_TMAP B43_NTAB32(0x0C, 0x000) /* T Map Table */
  98. #define B43_NTAB_TMAP_SIZE 448
  99. #define B43_NTAB_TDTRN B43_NTAB32(0x0E, 0x000) /* TDTRN Table */
  100. #define B43_NTAB_TDTRN_SIZE 704
  101. #define B43_NTAB_INTLEVEL B43_NTAB32(0x0D, 0x000) /* Int Level Table */
  102. #define B43_NTAB_INTLEVEL_SIZE 7
  103. #define B43_NTAB_PILOT B43_NTAB16(0x0B, 0x000) /* Pilot Table */
  104. #define B43_NTAB_PILOT_SIZE 88
  105. #define B43_NTAB_PILOTLT B43_NTAB32(0x14, 0x000) /* Pilot Lookup Table */
  106. #define B43_NTAB_PILOTLT_SIZE 6
  107. #define B43_NTAB_TDI20A0 B43_NTAB32(0x13, 0x080) /* TDI Table 20 Antenna 0 */
  108. #define B43_NTAB_TDI20A0_SIZE 55
  109. #define B43_NTAB_TDI20A1 B43_NTAB32(0x13, 0x100) /* TDI Table 20 Antenna 1 */
  110. #define B43_NTAB_TDI20A1_SIZE 55
  111. #define B43_NTAB_TDI40A0 B43_NTAB32(0x13, 0x280) /* TDI Table 40 Antenna 0 */
  112. #define B43_NTAB_TDI40A0_SIZE 110
  113. #define B43_NTAB_TDI40A1 B43_NTAB32(0x13, 0x300) /* TDI Table 40 Antenna 1 */
  114. #define B43_NTAB_TDI40A1_SIZE 110
  115. #define B43_NTAB_BDI B43_NTAB16(0x15, 0x000) /* BDI Table */
  116. #define B43_NTAB_BDI_SIZE 6
  117. #define B43_NTAB_CHANEST B43_NTAB32(0x16, 0x000) /* Channel Estimate Table */
  118. #define B43_NTAB_CHANEST_SIZE 96
  119. #define B43_NTAB_MCS B43_NTAB8 (0x12, 0x000) /* MCS Table */
  120. #define B43_NTAB_MCS_SIZE 128
  121. /* Volatile N-PHY tables */
  122. #define B43_NTAB_NOISEVAR10 B43_NTAB32(0x10, 0x000) /* Noise Var Table 10 */
  123. #define B43_NTAB_NOISEVAR10_SIZE 256
  124. #define B43_NTAB_NOISEVAR11 B43_NTAB32(0x10, 0x080) /* Noise Var Table 11 */
  125. #define B43_NTAB_NOISEVAR11_SIZE 256
  126. #define B43_NTAB_C0_ESTPLT B43_NTAB8 (0x1A, 0x000) /* Estimate Power Lookup Table Core 0 */
  127. #define B43_NTAB_C0_ESTPLT_SIZE 64
  128. #define B43_NTAB_C1_ESTPLT B43_NTAB8 (0x1B, 0x000) /* Estimate Power Lookup Table Core 1 */
  129. #define B43_NTAB_C1_ESTPLT_SIZE 64
  130. #define B43_NTAB_C0_ADJPLT B43_NTAB8 (0x1A, 0x040) /* Adjust Power Lookup Table Core 0 */
  131. #define B43_NTAB_C0_ADJPLT_SIZE 128
  132. #define B43_NTAB_C1_ADJPLT B43_NTAB8 (0x1B, 0x040) /* Adjust Power Lookup Table Core 1 */
  133. #define B43_NTAB_C1_ADJPLT_SIZE 128
  134. #define B43_NTAB_C0_GAINCTL B43_NTAB32(0x1A, 0x0C0) /* Gain Control Lookup Table Core 0 */
  135. #define B43_NTAB_C0_GAINCTL_SIZE 128
  136. #define B43_NTAB_C1_GAINCTL B43_NTAB32(0x1B, 0x0C0) /* Gain Control Lookup Table Core 1 */
  137. #define B43_NTAB_C1_GAINCTL_SIZE 128
  138. #define B43_NTAB_C0_IQLT B43_NTAB32(0x1A, 0x140) /* IQ Lookup Table Core 0 */
  139. #define B43_NTAB_C0_IQLT_SIZE 128
  140. #define B43_NTAB_C1_IQLT B43_NTAB32(0x1B, 0x140) /* IQ Lookup Table Core 1 */
  141. #define B43_NTAB_C1_IQLT_SIZE 128
  142. #define B43_NTAB_C0_LOFEEDTH B43_NTAB16(0x1A, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 0 */
  143. #define B43_NTAB_C0_LOFEEDTH_SIZE 128
  144. #define B43_NTAB_C1_LOFEEDTH B43_NTAB16(0x1B, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 1 */
  145. #define B43_NTAB_C1_LOFEEDTH_SIZE 128
  146. #define B43_NTAB_TX_IQLO_CAL_LOFT_LADDER_40_SIZE 18
  147. #define B43_NTAB_TX_IQLO_CAL_LOFT_LADDER_20_SIZE 18
  148. #define B43_NTAB_TX_IQLO_CAL_IQIMB_LADDER_40_SIZE 18
  149. #define B43_NTAB_TX_IQLO_CAL_IQIMB_LADDER_20_SIZE 18
  150. #define B43_NTAB_TX_IQLO_CAL_STARTCOEFS_REV3 11
  151. #define B43_NTAB_TX_IQLO_CAL_STARTCOEFS 9
  152. #define B43_NTAB_TX_IQLO_CAL_CMDS_RECAL_REV3 12
  153. #define B43_NTAB_TX_IQLO_CAL_CMDS_RECAL 10
  154. #define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10
  155. #define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12
  156. u32 b43_ntab_read(struct b43_wldev *dev, u32 offset);
  157. void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset,
  158. unsigned int nr_elements, void *_data);
  159. void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value);
  160. void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,
  161. unsigned int nr_elements, const void *_data);
  162. void b43_nphy_rev0_1_2_tables_init(struct b43_wldev *dev);
  163. void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev);
  164. extern const u32 b43_ntab_tx_gain_rev0_1_2[];
  165. extern const u32 b43_ntab_tx_gain_rev3plus_2ghz[];
  166. extern const u32 b43_ntab_tx_gain_rev3_5ghz[];
  167. extern const u32 b43_ntab_tx_gain_rev4_5ghz[];
  168. extern const u32 b43_ntab_tx_gain_rev5plus_5ghz[];
  169. extern const u32 txpwrctrl_tx_gain_ipa[];
  170. extern const u32 txpwrctrl_tx_gain_ipa_rev5[];
  171. extern const u32 txpwrctrl_tx_gain_ipa_rev6[];
  172. extern const u32 txpwrctrl_tx_gain_ipa_5g[];
  173. extern const u16 tbl_iqcal_gainparams[2][9][8];
  174. extern const struct nphy_txiqcal_ladder ladder_lo[];
  175. extern const struct nphy_txiqcal_ladder ladder_iq[];
  176. extern const u16 loscale[];
  177. extern const u16 tbl_tx_iqlo_cal_loft_ladder_40[];
  178. extern const u16 tbl_tx_iqlo_cal_loft_ladder_20[];
  179. extern const u16 tbl_tx_iqlo_cal_iqimb_ladder_40[];
  180. extern const u16 tbl_tx_iqlo_cal_iqimb_ladder_20[];
  181. extern const u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[];
  182. extern const u16 tbl_tx_iqlo_cal_startcoefs[];
  183. extern const u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[];
  184. extern const u16 tbl_tx_iqlo_cal_cmds_recal[];
  185. extern const u16 tbl_tx_iqlo_cal_cmds_fullcal[];
  186. extern const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[];
  187. extern const s16 tbl_tx_filter_coef_rev4[7][15];
  188. extern const struct nphy_rf_control_override_rev2
  189. tbl_rf_control_override_rev2[];
  190. extern const struct nphy_rf_control_override_rev3
  191. tbl_rf_control_override_rev3[];
  192. #endif /* B43_TABLES_NPHY_H_ */