efuse.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2010 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * wlanfae <wlanfae@realtek.com>
  23. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  24. * Hsinchu 300, Taiwan.
  25. *
  26. * Larry Finger <Larry.Finger@lwfinger.net>
  27. *
  28. *****************************************************************************/
  29. #ifndef __RTL_EFUSE_H_
  30. #define __RTL_EFUSE_H_
  31. #define EFUSE_REAL_CONTENT_LEN 512
  32. #define EFUSE_MAP_LEN 128
  33. #define EFUSE_MAX_SECTION 16
  34. #define EFUSE_MAX_WORD_UNIT 4
  35. #define EFUSE_INIT_MAP 0
  36. #define EFUSE_MODIFY_MAP 1
  37. #define PG_STATE_HEADER 0x01
  38. #define PG_STATE_WORD_0 0x02
  39. #define PG_STATE_WORD_1 0x04
  40. #define PG_STATE_WORD_2 0x08
  41. #define PG_STATE_WORD_3 0x10
  42. #define PG_STATE_DATA 0x20
  43. #define PG_SWBYTE_H 0x01
  44. #define PG_SWBYTE_L 0x02
  45. #define _POWERON_DELAY_
  46. #define _PRE_EXECUTE_READ_CMD_
  47. #define EFUSE_REPEAT_THRESHOLD_ 3
  48. struct efuse_map {
  49. u8 offset;
  50. u8 word_start;
  51. u8 byte_start;
  52. u8 byte_cnts;
  53. };
  54. struct pgpkt_struct {
  55. u8 offset;
  56. u8 word_en;
  57. u8 data[8];
  58. };
  59. enum efuse_data_item {
  60. EFUSE_CHIP_ID = 0,
  61. EFUSE_LDO_SETTING,
  62. EFUSE_CLK_SETTING,
  63. EFUSE_SDIO_SETTING,
  64. EFUSE_CCCR,
  65. EFUSE_SDIO_MODE,
  66. EFUSE_OCR,
  67. EFUSE_F0CIS,
  68. EFUSE_F1CIS,
  69. EFUSE_MAC_ADDR,
  70. EFUSE_EEPROM_VER,
  71. EFUSE_CHAN_PLAN,
  72. EFUSE_TXPW_TAB
  73. };
  74. enum {
  75. VOLTAGE_V25 = 0x03,
  76. LDOE25_SHIFT = 28,
  77. };
  78. struct efuse_priv {
  79. u8 id[2];
  80. u8 ldo_setting[2];
  81. u8 clk_setting[2];
  82. u8 cccr;
  83. u8 sdio_mode;
  84. u8 ocr[3];
  85. u8 cis0[17];
  86. u8 cis1[48];
  87. u8 mac_addr[6];
  88. u8 eeprom_verno;
  89. u8 channel_plan;
  90. u8 tx_power_b[14];
  91. u8 tx_power_g[14];
  92. };
  93. extern void efuse_initialize(struct ieee80211_hw *hw);
  94. extern u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address);
  95. extern void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value);
  96. extern void read_efuse(struct ieee80211_hw *hw, u16 _offset,
  97. u16 _size_byte, u8 *pbuf);
  98. extern void efuse_shadow_read(struct ieee80211_hw *hw, u8 type,
  99. u16 offset, u32 *value);
  100. extern void efuse_shadow_write(struct ieee80211_hw *hw, u8 type,
  101. u16 offset, u32 value);
  102. extern bool efuse_shadow_update(struct ieee80211_hw *hw);
  103. extern bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
  104. extern void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
  105. extern void efuse_force_write_vendor_Id(struct ieee80211_hw *hw);
  106. extern void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
  107. extern bool efuse_program_map(struct ieee80211_hw *hw,
  108. char *p_filename, u8 tabletype);
  109. extern void efuse_reset_loader(struct ieee80211_hw *hw);
  110. #endif