ini.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 2010 Nokia Corporation
  5. *
  6. * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #ifndef __INI_H__
  24. #define __INI_H__
  25. #define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
  26. struct wl1271_ini_general_params {
  27. u8 ref_clock;
  28. u8 settling_time;
  29. u8 clk_valid_on_wakeup;
  30. u8 dc2dc_mode;
  31. u8 dual_mode_select;
  32. u8 tx_bip_fem_auto_detect;
  33. u8 tx_bip_fem_manufacturer;
  34. u8 general_settings;
  35. u8 sr_state;
  36. u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  37. u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  38. u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  39. } __packed;
  40. #define WL128X_INI_MAX_SETTINGS_PARAM 4
  41. struct wl128x_ini_general_params {
  42. u8 ref_clock;
  43. u8 settling_time;
  44. u8 clk_valid_on_wakeup;
  45. u8 tcxo_ref_clock;
  46. u8 tcxo_settling_time;
  47. u8 tcxo_valid_on_wakeup;
  48. u8 tcxo_ldo_voltage;
  49. u8 xtal_itrim_val;
  50. u8 platform_conf;
  51. u8 dual_mode_select;
  52. u8 tx_bip_fem_auto_detect;
  53. u8 tx_bip_fem_manufacturer;
  54. u8 general_settings[WL128X_INI_MAX_SETTINGS_PARAM];
  55. u8 sr_state;
  56. u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  57. u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  58. u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  59. } __packed;
  60. #define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
  61. struct wl1271_ini_band_params_2 {
  62. u8 rx_trace_insertion_loss;
  63. u8 tx_trace_loss;
  64. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  65. } __packed;
  66. #define WL1271_INI_CHANNEL_COUNT_2 14
  67. struct wl128x_ini_band_params_2 {
  68. u8 rx_trace_insertion_loss;
  69. u8 tx_trace_loss[WL1271_INI_CHANNEL_COUNT_2];
  70. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  71. } __packed;
  72. #define WL1271_INI_RATE_GROUP_COUNT 6
  73. struct wl1271_ini_fem_params_2 {
  74. __le16 tx_bip_ref_pd_voltage;
  75. u8 tx_bip_ref_power;
  76. u8 tx_bip_ref_offset;
  77. u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
  78. u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
  79. u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
  80. u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
  81. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
  82. u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
  83. u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
  84. u8 rx_fem_insertion_loss;
  85. u8 degraded_low_to_normal_thr;
  86. u8 normal_to_degraded_high_thr;
  87. } __packed;
  88. #define WL128X_INI_RATE_GROUP_COUNT 7
  89. /* low and high temperatures */
  90. #define WL128X_INI_PD_VS_TEMPERATURE_RANGES 2
  91. struct wl128x_ini_fem_params_2 {
  92. __le16 tx_bip_ref_pd_voltage;
  93. u8 tx_bip_ref_power;
  94. u8 tx_bip_ref_offset;
  95. u8 tx_per_rate_pwr_limits_normal[WL128X_INI_RATE_GROUP_COUNT];
  96. u8 tx_per_rate_pwr_limits_degraded[WL128X_INI_RATE_GROUP_COUNT];
  97. u8 tx_per_rate_pwr_limits_extreme[WL128X_INI_RATE_GROUP_COUNT];
  98. u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
  99. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
  100. u8 tx_pd_vs_rate_offsets[WL128X_INI_RATE_GROUP_COUNT];
  101. u8 tx_ibias[WL128X_INI_RATE_GROUP_COUNT + 1];
  102. u8 tx_pd_vs_chan_offsets[WL1271_INI_CHANNEL_COUNT_2];
  103. u8 tx_pd_vs_temperature[WL128X_INI_PD_VS_TEMPERATURE_RANGES];
  104. u8 rx_fem_insertion_loss;
  105. u8 degraded_low_to_normal_thr;
  106. u8 normal_to_degraded_high_thr;
  107. } __packed;
  108. #define WL1271_INI_CHANNEL_COUNT_5 35
  109. #define WL1271_INI_SUB_BAND_COUNT_5 7
  110. struct wl1271_ini_band_params_5 {
  111. u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  112. u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5];
  113. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  114. } __packed;
  115. struct wl128x_ini_band_params_5 {
  116. u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  117. u8 tx_trace_loss[WL1271_INI_CHANNEL_COUNT_5];
  118. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  119. } __packed;
  120. struct wl1271_ini_fem_params_5 {
  121. __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
  122. u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
  123. u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
  124. u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
  125. u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
  126. u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
  127. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
  128. u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
  129. u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
  130. u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  131. u8 degraded_low_to_normal_thr;
  132. u8 normal_to_degraded_high_thr;
  133. } __packed;
  134. struct wl128x_ini_fem_params_5 {
  135. __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
  136. u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
  137. u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
  138. u8 tx_per_rate_pwr_limits_normal[WL128X_INI_RATE_GROUP_COUNT];
  139. u8 tx_per_rate_pwr_limits_degraded[WL128X_INI_RATE_GROUP_COUNT];
  140. u8 tx_per_rate_pwr_limits_extreme[WL128X_INI_RATE_GROUP_COUNT];
  141. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
  142. u8 tx_pd_vs_rate_offsets[WL128X_INI_RATE_GROUP_COUNT];
  143. u8 tx_ibias[WL128X_INI_RATE_GROUP_COUNT];
  144. u8 tx_pd_vs_chan_offsets[WL1271_INI_CHANNEL_COUNT_5];
  145. u8 tx_pd_vs_temperature[WL1271_INI_SUB_BAND_COUNT_5 *
  146. WL128X_INI_PD_VS_TEMPERATURE_RANGES];
  147. u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  148. u8 degraded_low_to_normal_thr;
  149. u8 normal_to_degraded_high_thr;
  150. } __packed;
  151. /* NVS data structure */
  152. #define WL1271_INI_NVS_SECTION_SIZE 468
  153. #define WL1271_INI_FEM_MODULE_COUNT 2
  154. #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800
  155. struct wl1271_nvs_file {
  156. /* NVS section - must be first! */
  157. u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
  158. /* INI section */
  159. struct wl1271_ini_general_params general_params;
  160. u8 padding1;
  161. struct wl1271_ini_band_params_2 stat_radio_params_2;
  162. u8 padding2;
  163. struct {
  164. struct wl1271_ini_fem_params_2 params;
  165. u8 padding;
  166. } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
  167. struct wl1271_ini_band_params_5 stat_radio_params_5;
  168. u8 padding3;
  169. struct {
  170. struct wl1271_ini_fem_params_5 params;
  171. u8 padding;
  172. } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
  173. } __packed;
  174. struct wl128x_nvs_file {
  175. /* NVS section - must be first! */
  176. u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
  177. /* INI section */
  178. struct wl128x_ini_general_params general_params;
  179. u8 fem_vendor_and_options;
  180. struct wl128x_ini_band_params_2 stat_radio_params_2;
  181. u8 padding2;
  182. struct {
  183. struct wl128x_ini_fem_params_2 params;
  184. u8 padding;
  185. } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
  186. struct wl128x_ini_band_params_5 stat_radio_params_5;
  187. u8 padding3;
  188. struct {
  189. struct wl128x_ini_fem_params_5 params;
  190. u8 padding;
  191. } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
  192. } __packed;
  193. #endif