fw_common.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2014 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. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. #ifndef __FW_COMMON_H__
  26. #define __FW_COMMON_H__
  27. #define REG_SYS_FUNC_EN 0x0002
  28. #define REG_MCUFWDL 0x0080
  29. #define FW_8192C_START_ADDRESS 0x1000
  30. #define FW_8192C_PAGE_SIZE 4096
  31. #define FW_8192C_POLLING_TIMEOUT_COUNT 6000
  32. #define FW_8192C_POLLING_DELAY 5
  33. #define MCUFWDL_RDY BIT(1)
  34. #define FWDL_CHKSUM_RPT BIT(2)
  35. #define WINTINI_RDY BIT(6)
  36. #define REG_RSV_CTRL 0x001C
  37. #define REG_HMETFR 0x01CC
  38. enum version_8723e {
  39. VERSION_TEST_UMC_CHIP_8723 = 0x0081,
  40. VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT = 0x0089,
  41. VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT = 0x1089,
  42. VERSION_TEST_CHIP_1T1R_8723B = 0x0106,
  43. VERSION_NORMAL_SMIC_CHIP_1T1R_8723B = 0x010E,
  44. VERSION_UNKNOWN = 0xFF,
  45. };
  46. enum rtl8723ae_h2c_cmd {
  47. H2C_AP_OFFLOAD = 0,
  48. H2C_SETPWRMODE = 1,
  49. H2C_JOINBSSRPT = 2,
  50. H2C_RSVDPAGE = 3,
  51. H2C_RSSI_REPORT = 4,
  52. H2C_P2P_PS_CTW_CMD = 5,
  53. H2C_P2P_PS_OFFLOAD = 6,
  54. H2C_RA_MASK = 7,
  55. MAX_H2CCMD
  56. };
  57. enum rtl8723be_cmd {
  58. H2C_8723BE_RSVDPAGE = 0,
  59. H2C_8723BE_JOINBSSRPT = 1,
  60. H2C_8723BE_SCAN = 2,
  61. H2C_8723BE_KEEP_ALIVE_CTRL = 3,
  62. H2C_8723BE_DISCONNECT_DECISION = 4,
  63. H2C_8723BE_INIT_OFFLOAD = 6,
  64. H2C_8723BE_AP_OFFLOAD = 8,
  65. H2C_8723BE_BCN_RSVDPAGE = 9,
  66. H2C_8723BE_PROBERSP_RSVDPAGE = 10,
  67. H2C_8723BE_SETPWRMODE = 0x20,
  68. H2C_8723BE_PS_TUNING_PARA = 0x21,
  69. H2C_8723BE_PS_TUNING_PARA2 = 0x22,
  70. H2C_8723BE_PS_LPS_PARA = 0x23,
  71. H2C_8723BE_P2P_PS_OFFLOAD = 0x24,
  72. H2C_8723BE_WO_WLAN = 0x80,
  73. H2C_8723BE_REMOTE_WAKE_CTRL = 0x81,
  74. H2C_8723BE_AOAC_GLOBAL_INFO = 0x82,
  75. H2C_8723BE_AOAC_RSVDPAGE = 0x83,
  76. H2C_8723BE_RSSI_REPORT = 0x42,
  77. H2C_8723BE_RA_MASK = 0x40,
  78. H2C_8723BE_SELECTIVE_SUSPEND_ROF_CMD,
  79. H2C_8723BE_P2P_PS_MODE,
  80. H2C_8723BE_PSD_RESULT,
  81. /*Not defined CTW CMD for P2P yet*/
  82. H2C_8723BE_P2P_PS_CTW_CMD,
  83. MAX_8723BE_H2CCMD
  84. };
  85. struct rtl92c_firmware_header {
  86. u16 signature;
  87. u8 category;
  88. u8 function;
  89. u16 version;
  90. u8 subversion;
  91. u8 rsvd1;
  92. u8 month;
  93. u8 date;
  94. u8 hour;
  95. u8 minute;
  96. u16 ramcodesize;
  97. u16 rsvd2;
  98. u32 svnindex;
  99. u32 rsvd3;
  100. u32 rsvd4;
  101. u32 rsvd5;
  102. };
  103. void rtl8723ae_firmware_selfreset(struct ieee80211_hw *hw);
  104. void rtl8723be_firmware_selfreset(struct ieee80211_hw *hw);
  105. void rtl8723_enable_fw_download(struct ieee80211_hw *hw, bool enable);
  106. void rtl8723_fw_block_write(struct ieee80211_hw *hw,
  107. const u8 *buffer, u32 size);
  108. void rtl8723_fw_page_write(struct ieee80211_hw *hw,
  109. u32 page, const u8 *buffer, u32 size);
  110. void rtl8723_write_fw(struct ieee80211_hw *hw,
  111. enum version_8723e version,
  112. u8 *buffer, u32 size);
  113. int rtl8723_fw_free_to_go(struct ieee80211_hw *hw, bool is_8723be);
  114. int rtl8723_download_fw(struct ieee80211_hw *hw, bool is_8723be);
  115. #endif