ini.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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 GENERAL_SETTINGS_DRPW_LPD 0xc0
  26. #define SCRATCH_ENABLE_LPD BIT(25)
  27. #define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
  28. struct wl1271_ini_general_params {
  29. u8 ref_clock;
  30. u8 settling_time;
  31. u8 clk_valid_on_wakeup;
  32. u8 dc2dc_mode;
  33. u8 dual_mode_select;
  34. u8 tx_bip_fem_auto_detect;
  35. u8 tx_bip_fem_manufacturer;
  36. u8 general_settings;
  37. u8 sr_state;
  38. u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  39. u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  40. u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  41. } __packed;
  42. #define WL128X_INI_MAX_SETTINGS_PARAM 4
  43. struct wl128x_ini_general_params {
  44. u8 ref_clock;
  45. u8 settling_time;
  46. u8 clk_valid_on_wakeup;
  47. u8 tcxo_ref_clock;
  48. u8 tcxo_settling_time;
  49. u8 tcxo_valid_on_wakeup;
  50. u8 tcxo_ldo_voltage;
  51. u8 xtal_itrim_val;
  52. u8 platform_conf;
  53. u8 dual_mode_select;
  54. u8 tx_bip_fem_auto_detect;
  55. u8 tx_bip_fem_manufacturer;
  56. u8 general_settings[WL128X_INI_MAX_SETTINGS_PARAM];
  57. u8 sr_state;
  58. u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  59. u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  60. u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
  61. } __packed;
  62. #define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
  63. struct wl1271_ini_band_params_2 {
  64. u8 rx_trace_insertion_loss;
  65. u8 tx_trace_loss;
  66. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  67. } __packed;
  68. #define WL1271_INI_CHANNEL_COUNT_2 14
  69. struct wl128x_ini_band_params_2 {
  70. u8 rx_trace_insertion_loss;
  71. u8 tx_trace_loss[WL1271_INI_CHANNEL_COUNT_2];
  72. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  73. } __packed;
  74. #define WL1271_INI_RATE_GROUP_COUNT 6
  75. struct wl1271_ini_fem_params_2 {
  76. __le16 tx_bip_ref_pd_voltage;
  77. u8 tx_bip_ref_power;
  78. u8 tx_bip_ref_offset;
  79. u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
  80. u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
  81. u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
  82. u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
  83. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
  84. u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
  85. u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
  86. u8 rx_fem_insertion_loss;
  87. u8 degraded_low_to_normal_thr;
  88. u8 normal_to_degraded_high_thr;
  89. } __packed;
  90. #define WL128X_INI_RATE_GROUP_COUNT 7
  91. /* low and high temperatures */
  92. #define WL128X_INI_PD_VS_TEMPERATURE_RANGES 2
  93. struct wl128x_ini_fem_params_2 {
  94. __le16 tx_bip_ref_pd_voltage;
  95. u8 tx_bip_ref_power;
  96. u8 tx_bip_ref_offset;
  97. u8 tx_per_rate_pwr_limits_normal[WL128X_INI_RATE_GROUP_COUNT];
  98. u8 tx_per_rate_pwr_limits_degraded[WL128X_INI_RATE_GROUP_COUNT];
  99. u8 tx_per_rate_pwr_limits_extreme[WL128X_INI_RATE_GROUP_COUNT];
  100. u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
  101. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
  102. u8 tx_pd_vs_rate_offsets[WL128X_INI_RATE_GROUP_COUNT];
  103. u8 tx_ibias[WL128X_INI_RATE_GROUP_COUNT + 1];
  104. u8 tx_pd_vs_chan_offsets[WL1271_INI_CHANNEL_COUNT_2];
  105. u8 tx_pd_vs_temperature[WL128X_INI_PD_VS_TEMPERATURE_RANGES];
  106. u8 rx_fem_insertion_loss;
  107. u8 degraded_low_to_normal_thr;
  108. u8 normal_to_degraded_high_thr;
  109. } __packed;
  110. #define WL1271_INI_CHANNEL_COUNT_5 35
  111. #define WL1271_INI_SUB_BAND_COUNT_5 7
  112. struct wl1271_ini_band_params_5 {
  113. u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  114. u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5];
  115. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  116. } __packed;
  117. struct wl128x_ini_band_params_5 {
  118. u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  119. u8 tx_trace_loss[WL1271_INI_CHANNEL_COUNT_5];
  120. u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
  121. } __packed;
  122. struct wl1271_ini_fem_params_5 {
  123. __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
  124. u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
  125. u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
  126. u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
  127. u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
  128. u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
  129. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
  130. u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
  131. u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
  132. u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  133. u8 degraded_low_to_normal_thr;
  134. u8 normal_to_degraded_high_thr;
  135. } __packed;
  136. struct wl128x_ini_fem_params_5 {
  137. __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
  138. u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
  139. u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
  140. u8 tx_per_rate_pwr_limits_normal[WL128X_INI_RATE_GROUP_COUNT];
  141. u8 tx_per_rate_pwr_limits_degraded[WL128X_INI_RATE_GROUP_COUNT];
  142. u8 tx_per_rate_pwr_limits_extreme[WL128X_INI_RATE_GROUP_COUNT];
  143. u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
  144. u8 tx_pd_vs_rate_offsets[WL128X_INI_RATE_GROUP_COUNT];
  145. u8 tx_ibias[WL128X_INI_RATE_GROUP_COUNT];
  146. u8 tx_pd_vs_chan_offsets[WL1271_INI_CHANNEL_COUNT_5];
  147. u8 tx_pd_vs_temperature[WL1271_INI_SUB_BAND_COUNT_5 *
  148. WL128X_INI_PD_VS_TEMPERATURE_RANGES];
  149. u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
  150. u8 degraded_low_to_normal_thr;
  151. u8 normal_to_degraded_high_thr;
  152. } __packed;
  153. /* NVS data structure */
  154. #define WL1271_INI_NVS_SECTION_SIZE 468
  155. #define WL1271_INI_FEM_MODULE_COUNT 2
  156. #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800
  157. struct wl1271_nvs_file {
  158. /* NVS section - must be first! */
  159. u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
  160. /* INI section */
  161. struct wl1271_ini_general_params general_params;
  162. u8 padding1;
  163. struct wl1271_ini_band_params_2 stat_radio_params_2;
  164. u8 padding2;
  165. struct {
  166. struct wl1271_ini_fem_params_2 params;
  167. u8 padding;
  168. } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
  169. struct wl1271_ini_band_params_5 stat_radio_params_5;
  170. u8 padding3;
  171. struct {
  172. struct wl1271_ini_fem_params_5 params;
  173. u8 padding;
  174. } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
  175. } __packed;
  176. struct wl128x_nvs_file {
  177. /* NVS section - must be first! */
  178. u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
  179. /* INI section */
  180. struct wl128x_ini_general_params general_params;
  181. u8 fem_vendor_and_options;
  182. struct wl128x_ini_band_params_2 stat_radio_params_2;
  183. u8 padding2;
  184. struct {
  185. struct wl128x_ini_fem_params_2 params;
  186. u8 padding;
  187. } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
  188. struct wl128x_ini_band_params_5 stat_radio_params_5;
  189. u8 padding3;
  190. struct {
  191. struct wl128x_ini_fem_params_5 params;
  192. u8 padding;
  193. } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
  194. } __packed;
  195. #endif