Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2009-2012  Realtek Corporation.*/
0003 
0004 #ifndef __RTL92C__FW__COMMON__H__
0005 #define __RTL92C__FW__COMMON__H__
0006 
0007 #define FW_8192C_SIZE               0x3000
0008 #define FW_8192C_START_ADDRESS          0x1000
0009 #define FW_8192C_END_ADDRESS            0x1FFF
0010 #define FW_8192C_PAGE_SIZE          4096
0011 #define FW_8192C_POLLING_DELAY          5
0012 #define FW_8192C_POLLING_TIMEOUT_COUNT      100
0013 #define NORMAL_CHIP             BIT(4)
0014 #define H2C_92C_KEEP_ALIVE_CTRL         48
0015 
0016 #define IS_FW_HEADER_EXIST(_pfwhdr) \
0017     ((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\
0018     (le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x88C0)
0019 
0020 #define CUT_VERSION_MASK        (BIT(6)|BIT(7))
0021 #define CHIP_VENDOR_UMC         BIT(5)
0022 #define CHIP_VENDOR_UMC_B_CUT       BIT(6) /* Chip version for ECO */
0023 #define IS_CHIP_VER_B(version)  ((version & CHIP_VER_B) ? true : false)
0024 #define RF_TYPE_MASK            (BIT(0)|BIT(1))
0025 #define GET_CVID_RF_TYPE(version)   \
0026     ((version) & RF_TYPE_MASK)
0027 #define GET_CVID_CUT_VERSION(version) \
0028     ((version) & CUT_VERSION_MASK)
0029 #define IS_NORMAL_CHIP(version) \
0030     ((version & NORMAL_CHIP) ? true : false)
0031 #define IS_2T2R(version) \
0032     (((GET_CVID_RF_TYPE(version)) == \
0033     CHIP_92C_BITMASK) ? true : false)
0034 #define IS_92C_SERIAL(version) \
0035     ((IS_2T2R(version)) ? true : false)
0036 #define IS_CHIP_VENDOR_UMC(version) \
0037     ((version & CHIP_VENDOR_UMC) ? true : false)
0038 #define IS_VENDOR_UMC_A_CUT(version) \
0039     ((IS_CHIP_VENDOR_UMC(version)) ? \
0040     ((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
0041 #define IS_81XXC_VENDOR_UMC_B_CUT(version)  \
0042     ((IS_CHIP_VENDOR_UMC(version)) ? \
0043     ((GET_CVID_CUT_VERSION(version) == \
0044         CHIP_VENDOR_UMC_B_CUT) ? true : false) : false)
0045 
0046 #define pagenum_128(_len)   (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
0047 
0048 #define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val)          \
0049     *(u8 *)(__ph2ccmd) = __val
0050 #define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val)      \
0051     *(u8 *)(__ph2ccmd + 1) = __val
0052 #define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \
0053     *(u8 *)(__ph2ccmd + 2) = __val
0054 #define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val)     \
0055     *(u8 *)(__ph2ccmd) = __val
0056 #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val)     \
0057     *(u8 *)(__ph2ccmd) = __val
0058 #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val)        \
0059     *(u8 *)(__ph2ccmd + 1) = __val
0060 #define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val)     \
0061     *(u8 *)(__ph2ccmd + 2) = __val
0062 
0063 int rtl92c_download_fw(struct ieee80211_hw *hw);
0064 void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
0065              u32 cmd_len, u8 *p_cmdbuffer);
0066 void rtl92c_firmware_selfreset(struct ieee80211_hw *hw);
0067 void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
0068 void rtl92c_set_fw_rsvdpagepkt
0069     (struct ieee80211_hw *hw,
0070      bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *));
0071 void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
0072 void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len);
0073 void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
0074 
0075 #endif