1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2009-2012 Realtek Corporation.*/ 3 4 #ifndef __RTL92D__FW__H__ 5 #define __RTL92D__FW__H__ 6 7 #define FW_8192D_START_ADDRESS 0x1000 8 #define FW_8192D_PAGE_SIZE 4096 9 #define FW_8192D_POLLING_TIMEOUT_COUNT 1000 10 11 #define IS_FW_HEADER_EXIST(_pfwhdr) \ 12 ((GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFF0) == 0x92C0 || \ 13 (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFF0) == 0x88C0 || \ 14 (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D0 || \ 15 (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D1 || \ 16 (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D2 || \ 17 (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D3) 18 19 /* Firmware Header(8-byte alinment required) */ 20 /* --- LONG WORD 0 ---- */ 21 #define GET_FIRMWARE_HDR_SIGNATURE(__fwhdr) \ 22 le32_get_bits(*(__le32 *)__fwhdr, GENMASK(15, 0)) 23 #define GET_FIRMWARE_HDR_VERSION(__fwhdr) \ 24 le32_get_bits(*(__le32 *)(__fwhdr + 4), GENMASK(15, 0)) 25 #define GET_FIRMWARE_HDR_SUB_VER(__fwhdr) \ 26 le32_get_bits(*(__le32 *)(__fwhdr + 4), GENMASK(23, 16)) 27 28 #define pagenum_128(_len) \ 29 (u32)(((_len) >> 7) + ((_len) & 0x7F ? 1 : 0)) 30 31 #define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ 32 *(u8 *)__ph2ccmd = __val; 33 #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ 34 *(u8 *)__ph2ccmd = __val; 35 #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ 36 *(u8 *)(__ph2ccmd + 1) = __val; 37 #define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ 38 *(u8 *)(__ph2ccmd + 2) = __val; 39 40 int rtl92d_download_fw(struct ieee80211_hw *hw); 41 void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, 42 u32 cmd_len, u8 *p_cmdbuffer); 43 void rtl92d_firmware_selfreset(struct ieee80211_hw *hw); 44 void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); 45 void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); 46 47 #endif 48