162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright(c) 2009-2012 Realtek Corporation.*/ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef __RTL92D__FW__H__ 562306a36Sopenharmony_ci#define __RTL92D__FW__H__ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define FW_8192D_START_ADDRESS 0x1000 862306a36Sopenharmony_ci#define FW_8192D_PAGE_SIZE 4096 962306a36Sopenharmony_ci#define FW_8192D_POLLING_TIMEOUT_COUNT 1000 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#define IS_FW_HEADER_EXIST(_pfwhdr) \ 1262306a36Sopenharmony_ci ((GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFF0) == 0x92C0 || \ 1362306a36Sopenharmony_ci (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFF0) == 0x88C0 || \ 1462306a36Sopenharmony_ci (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D0 || \ 1562306a36Sopenharmony_ci (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D1 || \ 1662306a36Sopenharmony_ci (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D2 || \ 1762306a36Sopenharmony_ci (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D3) 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* Firmware Header(8-byte alinment required) */ 2062306a36Sopenharmony_ci/* --- LONG WORD 0 ---- */ 2162306a36Sopenharmony_ci#define GET_FIRMWARE_HDR_SIGNATURE(__fwhdr) \ 2262306a36Sopenharmony_ci le32_get_bits(*(__le32 *)__fwhdr, GENMASK(15, 0)) 2362306a36Sopenharmony_ci#define GET_FIRMWARE_HDR_VERSION(__fwhdr) \ 2462306a36Sopenharmony_ci le32_get_bits(*(__le32 *)(__fwhdr + 4), GENMASK(15, 0)) 2562306a36Sopenharmony_ci#define GET_FIRMWARE_HDR_SUB_VER(__fwhdr) \ 2662306a36Sopenharmony_ci le32_get_bits(*(__le32 *)(__fwhdr + 4), GENMASK(23, 16)) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define pagenum_128(_len) \ 2962306a36Sopenharmony_ci (u32)(((_len) >> 7) + ((_len) & 0x7F ? 1 : 0)) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ 3262306a36Sopenharmony_ci *(u8 *)__ph2ccmd = __val; 3362306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ 3462306a36Sopenharmony_ci *(u8 *)__ph2ccmd = __val; 3562306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ 3662306a36Sopenharmony_ci *(u8 *)(__ph2ccmd + 1) = __val; 3762306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ 3862306a36Sopenharmony_ci *(u8 *)(__ph2ccmd + 2) = __val; 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ciint rtl92d_download_fw(struct ieee80211_hw *hw); 4162306a36Sopenharmony_civoid rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, 4262306a36Sopenharmony_ci u32 cmd_len, u8 *p_cmdbuffer); 4362306a36Sopenharmony_civoid rtl92d_firmware_selfreset(struct ieee80211_hw *hw); 4462306a36Sopenharmony_civoid rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); 4562306a36Sopenharmony_civoid rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#endif 48