net: wireless: rockchip: add rtl8822be pcie wifi driver
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8822be / hal / rtl8822b / rtl8822b.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2015 - 2016 Realtek Corporation. All rights reserved.
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  *
19  ******************************************************************************/
20 #ifndef _RTL8822B_H_
21 #define _RTL8822B_H_
22
23 #include <drv_types.h>          /* PADAPTER */
24 #include <rtw_rf.h>             /* CHANNEL_WIDTH */
25 #include <rtw_xmit.h>           /* struct pkt_attrib, struct xmit_frame */
26 #include <rtw_recv.h>           /* struct recv_frame */
27 #include <hal_intf.h>           /* HAL_DEF_VARIABLE */
28
29 #define DRIVER_EARLY_INT_TIME_8822B     0x05
30 #define BCN_DMA_ATIME_INT_TIME_8822B    0x02
31
32 struct hw_port_reg {
33         u32 net_type;   /*reg_offset*/
34         u8 net_type_shift;
35         u32 macaddr;    /*reg_offset*/
36         u32 bssid;      /*reg_offset*/
37         u32 bcn_ctl;                    /*reg_offset*/
38         u32 tsf_rst;                    /*reg_offset*/
39         u8 tsf_rst_bit;
40         u32 bcn_space;          /*reg_offset*/
41         u8 bcn_space_shift;
42         u16 bcn_space_mask;
43 };
44
45 /* rtl8822b_halinit.c */
46 void rtl8822b_init_hal_spec(PADAPTER);
47 u32 rtl8822b_power_on(PADAPTER);
48 void rtl8822b_power_off(PADAPTER);
49 u8 rtl8822b_hal_init(PADAPTER);
50 u8 rtl8822b_mac_verify(PADAPTER);
51 void rtl8822b_init_misc(PADAPTER padapter);
52 u32 rtl8822b_init(PADAPTER);
53 u32 rtl8822b_deinit(PADAPTER);
54 void rtl8822b_init_default_value(PADAPTER);
55
56 /* rtl8822b_mac.c */
57 u8 rtl8822b_rcr_config(PADAPTER, u32 rcr);
58 u8 rtl8822b_rcr_get(PADAPTER, u32 *rcr);
59 u8 rtl8822b_rcr_check(PADAPTER, u32 check_bit);
60 u8 rtl8822b_rcr_add(PADAPTER, u32 add);
61 u8 rtl8822b_rcr_clear(PADAPTER, u32 clear);
62 u8 rtl8822b_rx_ba_ssn_appended(PADAPTER);
63 u8 rtl8822b_rx_fcs_append_switch(PADAPTER, u8 enable);
64 u8 rtl8822b_rx_fcs_appended(PADAPTER);
65 u8 rtl8822b_rx_tsf_addr_filter_config(PADAPTER, u8 config);
66 s32 rtl8822b_fw_dl(PADAPTER, u8 wowlan);
67
68 /* rtl8822b_ops.c */
69 u8 rtl8822b_read_efuse(PADAPTER);
70 void rtl8822b_run_thread(PADAPTER);
71 void rtl8822b_cancel_thread(PADAPTER);
72 void rtl8822b_sethwreg(PADAPTER, u8 variable, u8 *pval);
73 void rtl8822b_gethwreg(PADAPTER, u8 variable, u8 *pval);
74 void rtl8822b_sethwregwithbuf(PADAPTER, u8 variable, u8 *pbuf, int len);
75 u8 rtl8822b_sethaldefvar(PADAPTER, HAL_DEF_VARIABLE, void *pval);
76 u8 rtl8822b_gethaldefvar(PADAPTER, HAL_DEF_VARIABLE, void *pval);
77 void rtl8822b_set_hal_ops(PADAPTER);
78 void rtl8822b_resume_tx_beacon(PADAPTER);
79 void rtl8822b_stop_tx_beacon(PADAPTER);
80
81 /* tx */
82 void rtl8822b_fill_txdesc_sectype(struct pkt_attrib *, u8 *ptxdesc);
83 void rtl8822b_fill_txdesc_vcs(PADAPTER, struct pkt_attrib *, u8 *ptxdesc);
84 void rtl8822b_fill_txdesc_phy(PADAPTER, struct pkt_attrib *, u8 *ptxdesc);
85 void rtl8822b_fill_txdesc_force_bmc_camid(struct pkt_attrib *, u8 *ptxdesc);
86 u8 rtl8822b_bw_mapping(PADAPTER, struct pkt_attrib *);
87 u8 rtl8822b_sc_mapping(PADAPTER, struct pkt_attrib *);
88 void rtl8822b_cal_txdesc_chksum(PADAPTER, u8 *ptxdesc);
89 void rtl8822b_update_txdesc(struct xmit_frame *, u8 *pbuf);
90 void rtl8822b_dbg_dump_tx_desc(PADAPTER, int frame_tag, u8 *ptxdesc);
91
92 /* rx */
93 void rtl8822b_rxdesc2attribute(struct rx_pkt_attrib *a, u8 *desc);
94 void rtl8822b_query_rx_desc(union recv_frame *, u8 *pdesc);
95
96 /* rtl8822b_cmd.c */
97 s32 rtl8822b_fillh2ccmd(PADAPTER, u8 id, u32 buf_len, u8 *pbuf);
98 void rtl8822b_set_FwMediaStatusRpt_cmd(PADAPTER, u8 mstatus, u8 macid);
99 void rtl8822b_set_FwMacIdConfig_cmd(PADAPTER , u64 bitmap, u8 *arg);
100 void rtl8822b_set_FwRssiSetting_cmd(PADAPTER, u8 *param);
101 void rtl8822b_set_FwPwrMode_cmd(PADAPTER, u8 psmode);
102 void rtl8822b_req_txrpt_cmd(PADAPTER, u8 macid);
103 #ifdef CONFIG_P2P
104 void rtl8822b_set_p2p_ps_offload_cmd(PADAPTER, u8 p2p_ps_state);
105 #endif
106 void rtl8822b_fw_update_beacon_cmd(PADAPTER);
107 void rtl8822b_c2h_handler(PADAPTER, u8 *pbuf, u16 length);
108 void rtl8822b_c2h_handler_no_io(PADAPTER, u8 *pbuf, u16 length);
109
110 #ifdef CONFIG_BT_COEXIST
111 void rtl8822b_download_BTCoex_AP_mode_rsvd_page(PADAPTER);
112 #endif /* CONFIG_BT_COEXIST */
113
114 /* rtl8822b_phy.c */
115 u8 rtl8822b_phy_init_mac_register(PADAPTER);
116 u8 rtl8822b_phy_init(PADAPTER);
117 void rtl8822b_phy_init_dm_priv(PADAPTER);
118 void rtl8822b_phy_deinit_dm_priv(PADAPTER);
119 void rtl8822b_phy_init_haldm(PADAPTER);
120 void rtl8822b_phy_haldm_watchdog(PADAPTER);
121 void rtl8822b_phy_haldm_in_lps(PADAPTER);
122 void rtl8822b_phy_haldm_watchdog_in_lps(PADAPTER);
123 u32 rtl8822b_read_bb_reg(PADAPTER, u32 addr, u32 mask);
124 void rtl8822b_write_bb_reg(PADAPTER, u32 addr, u32 mask, u32 val);
125 u32 rtl8822b_read_rf_reg(PADAPTER, u8 path, u32 addr, u32 mask);
126 void rtl8822b_write_rf_reg(PADAPTER, u8 path, u32 addr, u32 mask, u32 val);
127 void rtl8822b_set_channel_bw(PADAPTER, u8 center_ch, CHANNEL_WIDTH, u8 offset40, u8 offset80);
128 void rtl8822b_set_channel(PADAPTER, u8 center_ch);
129 void rtl8822b_set_bw_mode(PADAPTER, CHANNEL_WIDTH, u8 offset);
130 void rtl8822b_set_tx_power_level(PADAPTER, u8 channel);
131 void rtl8822b_get_tx_power_level(PADAPTER, s32 *power);
132 void rtl8822b_set_tx_power_index(PADAPTER, u32 powerindex, u8 rfpath, u8 rate);
133 u8 rtl8822b_get_tx_power_index(PADAPTER, u8 rfpath, u8 rate, u8 bandwidth, u8 channel);
134 void rtl8822b_notch_filter_switch(PADAPTER, bool enable);
135 #ifdef CONFIG_BEAMFORMING
136 void rtl8822b_phy_init_beamforming(PADAPTER);
137 void rtl8822b_phy_sounding_enter(PADAPTER, struct sta_info*);
138 void rtl8822b_phy_sounding_leave(PADAPTER, u8 *addr);
139 void rtl8822b_phy_sounding_set_gid_table(PADAPTER, struct beamformer_entry*);
140 #endif /* CONFIG_BEAMFORMING */
141 s32 c2h_id_filter_ccx_8822b(u8 *buf);
142
143 #endif /* _RTL8822B_H_ */