eeprom.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Atheros AR9170 driver
  3. *
  4. * EEPROM layout
  5. *
  6. * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; see the file COPYING. If not, see
  20. * http://www.gnu.org/licenses/.
  21. *
  22. * This file incorporates work covered by the following copyright and
  23. * permission notice:
  24. * Copyright (c) 2007-2008 Atheros Communications, Inc.
  25. *
  26. * Permission to use, copy, modify, and/or distribute this software for any
  27. * purpose with or without fee is hereby granted, provided that the above
  28. * copyright notice and this permission notice appear in all copies.
  29. *
  30. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  31. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  32. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  33. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  34. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  35. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  36. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  37. */
  38. #ifndef __AR9170_EEPROM_H
  39. #define __AR9170_EEPROM_H
  40. #define AR5416_MAX_CHAINS 2
  41. #define AR5416_MODAL_SPURS 5
  42. struct ar9170_eeprom_modal {
  43. __le32 antCtrlChain[AR5416_MAX_CHAINS];
  44. __le32 antCtrlCommon;
  45. s8 antennaGainCh[AR5416_MAX_CHAINS];
  46. u8 switchSettling;
  47. u8 txRxAttenCh[AR5416_MAX_CHAINS];
  48. u8 rxTxMarginCh[AR5416_MAX_CHAINS];
  49. s8 adcDesiredSize;
  50. s8 pgaDesiredSize;
  51. u8 xlnaGainCh[AR5416_MAX_CHAINS];
  52. u8 txEndToXpaOff;
  53. u8 txEndToRxOn;
  54. u8 txFrameToXpaOn;
  55. u8 thresh62;
  56. s8 noiseFloorThreshCh[AR5416_MAX_CHAINS];
  57. u8 xpdGain;
  58. u8 xpd;
  59. s8 iqCalICh[AR5416_MAX_CHAINS];
  60. s8 iqCalQCh[AR5416_MAX_CHAINS];
  61. u8 pdGainOverlap;
  62. u8 ob;
  63. u8 db;
  64. u8 xpaBiasLvl;
  65. u8 pwrDecreaseFor2Chain;
  66. u8 pwrDecreaseFor3Chain;
  67. u8 txFrameToDataStart;
  68. u8 txFrameToPaOn;
  69. u8 ht40PowerIncForPdadc;
  70. u8 bswAtten[AR5416_MAX_CHAINS];
  71. u8 bswMargin[AR5416_MAX_CHAINS];
  72. u8 swSettleHt40;
  73. u8 reserved[22];
  74. struct spur_channel {
  75. __le16 spurChan;
  76. u8 spurRangeLow;
  77. u8 spurRangeHigh;
  78. } __packed spur_channels[AR5416_MODAL_SPURS];
  79. } __packed;
  80. #define AR5416_NUM_PD_GAINS 4
  81. #define AR5416_PD_GAIN_ICEPTS 5
  82. struct ar9170_calibration_data_per_freq {
  83. u8 pwr_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
  84. u8 vpd_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
  85. } __packed;
  86. #define AR5416_NUM_5G_CAL_PIERS 8
  87. #define AR5416_NUM_2G_CAL_PIERS 4
  88. #define AR5416_NUM_5G_TARGET_PWRS 8
  89. #define AR5416_NUM_2G_CCK_TARGET_PWRS 3
  90. #define AR5416_NUM_2G_OFDM_TARGET_PWRS 4
  91. #define AR5416_MAX_NUM_TGT_PWRS 8
  92. struct ar9170_calibration_target_power_legacy {
  93. u8 freq;
  94. u8 power[4];
  95. } __packed;
  96. struct ar9170_calibration_target_power_ht {
  97. u8 freq;
  98. u8 power[8];
  99. } __packed;
  100. #define AR5416_NUM_CTLS 24
  101. struct ar9170_calctl_edges {
  102. u8 channel;
  103. #define AR9170_CALCTL_EDGE_FLAGS 0xC0
  104. u8 power_flags;
  105. } __packed;
  106. #define AR5416_NUM_BAND_EDGES 8
  107. struct ar9170_calctl_data {
  108. struct ar9170_calctl_edges
  109. control_edges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
  110. } __packed;
  111. struct ar9170_eeprom {
  112. __le16 length;
  113. __le16 checksum;
  114. __le16 version;
  115. u8 operating_flags;
  116. #define AR9170_OPFLAG_5GHZ 1
  117. #define AR9170_OPFLAG_2GHZ 2
  118. u8 misc;
  119. __le16 reg_domain[2];
  120. u8 mac_address[6];
  121. u8 rx_mask;
  122. u8 tx_mask;
  123. __le16 rf_silent;
  124. __le16 bluetooth_options;
  125. __le16 device_capabilities;
  126. __le32 build_number;
  127. u8 deviceType;
  128. u8 reserved[33];
  129. u8 customer_data[64];
  130. struct ar9170_eeprom_modal
  131. modal_header[2];
  132. u8 cal_freq_pier_5G[AR5416_NUM_5G_CAL_PIERS];
  133. u8 cal_freq_pier_2G[AR5416_NUM_2G_CAL_PIERS];
  134. struct ar9170_calibration_data_per_freq
  135. cal_pier_data_5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS],
  136. cal_pier_data_2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
  137. /* power calibration data */
  138. struct ar9170_calibration_target_power_legacy
  139. cal_tgt_pwr_5G[AR5416_NUM_5G_TARGET_PWRS];
  140. struct ar9170_calibration_target_power_ht
  141. cal_tgt_pwr_5G_ht20[AR5416_NUM_5G_TARGET_PWRS],
  142. cal_tgt_pwr_5G_ht40[AR5416_NUM_5G_TARGET_PWRS];
  143. struct ar9170_calibration_target_power_legacy
  144. cal_tgt_pwr_2G_cck[AR5416_NUM_2G_CCK_TARGET_PWRS],
  145. cal_tgt_pwr_2G_ofdm[AR5416_NUM_2G_OFDM_TARGET_PWRS];
  146. struct ar9170_calibration_target_power_ht
  147. cal_tgt_pwr_2G_ht20[AR5416_NUM_2G_OFDM_TARGET_PWRS],
  148. cal_tgt_pwr_2G_ht40[AR5416_NUM_2G_OFDM_TARGET_PWRS];
  149. /* conformance testing limits */
  150. u8 ctl_index[AR5416_NUM_CTLS];
  151. struct ar9170_calctl_data
  152. ctl_data[AR5416_NUM_CTLS];
  153. u8 pad;
  154. __le16 subsystem_id;
  155. } __packed;
  156. #endif /* __AR9170_EEPROM_H */