iwl-eeprom.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU Geeral Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * 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; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * James P. Ketrenos <ipw2100-admin@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __iwl_eeprom_h__
  64. #define __iwl_eeprom_h__
  65. /*
  66. * This file defines EEPROM related constants, enums, and inline functions.
  67. *
  68. */
  69. #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */
  70. #define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */
  71. /* EEPROM field values */
  72. #define ANTENNA_SWITCH_NORMAL 0
  73. #define ANTENNA_SWITCH_INVERSE 1
  74. enum {
  75. EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */
  76. EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */
  77. /* Bit 2 Reserved */
  78. EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */
  79. EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */
  80. EEPROM_CHANNEL_WIDE = (1 << 5),
  81. EEPROM_CHANNEL_NARROW = (1 << 6),
  82. EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */
  83. };
  84. /* EEPROM field lengths */
  85. #define EEPROM_BOARD_PBA_NUMBER_LENGTH 11
  86. /* EEPROM field lengths */
  87. #define EEPROM_BOARD_PBA_NUMBER_LENGTH 11
  88. #define EEPROM_REGULATORY_SKU_ID_LENGTH 4
  89. #define EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH 14
  90. #define EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH 13
  91. #define EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH 12
  92. #define EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH 11
  93. #define EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH 6
  94. #if IWL == 3945
  95. #define EEPROM_REGULATORY_CHANNELS_LENGTH ( \
  96. EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \
  97. EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \
  98. EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \
  99. EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \
  100. EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH)
  101. #elif IWL == 4965
  102. #define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH 7
  103. #define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH 11
  104. #define EEPROM_REGULATORY_CHANNELS_LENGTH ( \
  105. EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \
  106. EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \
  107. EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \
  108. EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \
  109. EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH + \
  110. EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH + \
  111. EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH)
  112. #endif
  113. #define EEPROM_REGULATORY_NUMBER_OF_BANDS 5
  114. /* SKU Capabilities */
  115. #define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0)
  116. #define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1)
  117. #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
  118. /* *regulatory* channel data from eeprom, one for each channel */
  119. struct iwl_eeprom_channel {
  120. u8 flags; /* flags copied from EEPROM */
  121. s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
  122. } __attribute__ ((packed));
  123. /*
  124. * Mapping of a Tx power level, at factory calibration temperature,
  125. * to a radio/DSP gain table index.
  126. * One for each of 5 "sample" power levels in each band.
  127. * v_det is measured at the factory, using the 3945's built-in power amplifier
  128. * (PA) output voltage detector. This same detector is used during Tx of
  129. * long packets in normal operation to provide feedback as to proper output
  130. * level.
  131. * Data copied from EEPROM.
  132. */
  133. struct iwl_eeprom_txpower_sample {
  134. u8 gain_index; /* index into power (gain) setup table ... */
  135. s8 power; /* ... for this pwr level for this chnl group */
  136. u16 v_det; /* PA output voltage */
  137. } __attribute__ ((packed));
  138. /*
  139. * Mappings of Tx power levels -> nominal radio/DSP gain table indexes.
  140. * One for each channel group (a.k.a. "band") (1 for BG, 4 for A).
  141. * Tx power setup code interpolates between the 5 "sample" power levels
  142. * to determine the nominal setup for a requested power level.
  143. * Data copied from EEPROM.
  144. * DO NOT ALTER THIS STRUCTURE!!!
  145. */
  146. struct iwl_eeprom_txpower_group {
  147. struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */
  148. s32 a, b, c, d, e; /* coefficients for voltage->power
  149. * formula (signed) */
  150. s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
  151. * frequency (signed) */
  152. s8 saturation_power; /* highest power possible by h/w in this
  153. * band */
  154. u8 group_channel; /* "representative" channel # in this band */
  155. s16 temperature; /* h/w temperature at factory calib this band
  156. * (signed) */
  157. } __attribute__ ((packed));
  158. /*
  159. * Temperature-based Tx-power compensation data, not band-specific.
  160. * These coefficients are use to modify a/b/c/d/e coeffs based on
  161. * difference between current temperature and factory calib temperature.
  162. * Data copied from EEPROM.
  163. */
  164. struct iwl_eeprom_temperature_corr {
  165. u32 Ta;
  166. u32 Tb;
  167. u32 Tc;
  168. u32 Td;
  169. u32 Te;
  170. } __attribute__ ((packed));
  171. #if IWL == 4965
  172. #define EEPROM_TX_POWER_TX_CHAINS (2)
  173. #define EEPROM_TX_POWER_BANDS (8)
  174. #define EEPROM_TX_POWER_MEASUREMENTS (3)
  175. #define EEPROM_TX_POWER_VERSION (2)
  176. #define EEPROM_TX_POWER_VERSION_NEW (5)
  177. struct iwl_eeprom_calib_measure {
  178. u8 temperature;
  179. u8 gain_idx;
  180. u8 actual_pow;
  181. s8 pa_det;
  182. } __attribute__ ((packed));
  183. struct iwl_eeprom_calib_ch_info {
  184. u8 ch_num;
  185. struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS]
  186. [EEPROM_TX_POWER_MEASUREMENTS];
  187. } __attribute__ ((packed));
  188. struct iwl_eeprom_calib_subband_info {
  189. u8 ch_from;
  190. u8 ch_to;
  191. struct iwl_eeprom_calib_ch_info ch1;
  192. struct iwl_eeprom_calib_ch_info ch2;
  193. } __attribute__ ((packed));
  194. struct iwl_eeprom_calib_info {
  195. u8 saturation_power24;
  196. u8 saturation_power52;
  197. s16 voltage; /* signed */
  198. struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS];
  199. } __attribute__ ((packed));
  200. #endif
  201. struct iwl_eeprom {
  202. u8 reserved0[16];
  203. #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
  204. u16 device_id; /* abs.ofs: 16 */
  205. u8 reserved1[2];
  206. #define EEPROM_PMC (2*0x0A) /* 2 bytes */
  207. u16 pmc; /* abs.ofs: 20 */
  208. u8 reserved2[20];
  209. #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
  210. u8 mac_address[6]; /* abs.ofs: 42 */
  211. u8 reserved3[58];
  212. #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
  213. u16 board_revision; /* abs.ofs: 106 */
  214. u8 reserved4[11];
  215. #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
  216. u8 board_pba_number[9]; /* abs.ofs: 119 */
  217. u8 reserved5[8];
  218. #define EEPROM_VERSION (2*0x44) /* 2 bytes */
  219. u16 version; /* abs.ofs: 136 */
  220. #define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
  221. u8 sku_cap; /* abs.ofs: 138 */
  222. #define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
  223. u8 leds_mode; /* abs.ofs: 139 */
  224. #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
  225. u16 oem_mode;
  226. #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
  227. u16 wowlan_mode; /* abs.ofs: 142 */
  228. #define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
  229. u16 leds_time_interval; /* abs.ofs: 144 */
  230. #define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
  231. u8 leds_off_time; /* abs.ofs: 146 */
  232. #define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
  233. u8 leds_on_time; /* abs.ofs: 147 */
  234. #define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
  235. u8 almgor_m_version; /* abs.ofs: 148 */
  236. #define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
  237. u8 antenna_switch_type; /* abs.ofs: 149 */
  238. #if IWL == 3945
  239. u8 reserved6[42];
  240. #else
  241. u8 reserved6[8];
  242. #define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */
  243. u16 board_revision_4965; /* abs.ofs: 158 */
  244. u8 reserved7[13];
  245. #define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */
  246. u8 board_pba_number_4965[9]; /* abs.ofs: 173 */
  247. u8 reserved8[10];
  248. #endif
  249. #define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
  250. u8 sku_id[4]; /* abs.ofs: 192 */
  251. #define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
  252. u16 band_1_count; /* abs.ofs: 196 */
  253. #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
  254. struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
  255. #define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
  256. u16 band_2_count; /* abs.ofs: 226 */
  257. #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
  258. struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
  259. #define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
  260. u16 band_3_count; /* abs.ofs: 254 */
  261. #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
  262. struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
  263. #define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
  264. u16 band_4_count; /* abs.ofs: 280 */
  265. #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
  266. struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
  267. #define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
  268. u16 band_5_count; /* abs.ofs: 304 */
  269. #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
  270. struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
  271. /* From here on out the EEPROM diverges between the 4965 and the 3945 */
  272. #if IWL == 3945
  273. u8 reserved9[194];
  274. #define EEPROM_TXPOWER_CALIB_GROUP0 0x200
  275. #define EEPROM_TXPOWER_CALIB_GROUP1 0x240
  276. #define EEPROM_TXPOWER_CALIB_GROUP2 0x280
  277. #define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0
  278. #define EEPROM_TXPOWER_CALIB_GROUP4 0x300
  279. #define IWL_NUM_TX_CALIB_GROUPS 5
  280. struct iwl_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
  281. /* abs.ofs: 512 */
  282. #define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340
  283. struct iwl_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
  284. u8 reserved16[172]; /* fill out to full 1024 byte block */
  285. /* 4965AGN adds fat channel support */
  286. #elif IWL == 4965
  287. u8 reserved10[2];
  288. #define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */
  289. struct iwl_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
  290. u8 reserved11[2];
  291. #define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */
  292. struct iwl_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
  293. u8 reserved12[6];
  294. #define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
  295. u16 calib_version; /* abs.ofs: 364 */
  296. u8 reserved13[2];
  297. #define EEPROM_SATURATION_POWER_OFFSET (2*0xB8) /* 2 bytes */
  298. u16 satruation_power; /* abs.ofs: 368 */
  299. u8 reserved14[94];
  300. #define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
  301. struct iwl_eeprom_calib_info calib_info; /* abs.ofs: 464 */
  302. u8 reserved16[140]; /* fill out to full 1024 byte block */
  303. #endif
  304. } __attribute__ ((packed));
  305. #define IWL_EEPROM_IMAGE_SIZE 1024
  306. #endif