1*b44febedSLarry Finger /* SPDX-License-Identifier: GPL-2.0 */
2*b44febedSLarry Finger /* Copyright(c) 2009-2012  Realtek Corporation.*/
3f1d2b4d3SLarry Finger 
4f1d2b4d3SLarry Finger #ifndef __RTL92C_MAC_H__
5f1d2b4d3SLarry Finger #define __RTL92C_MAC_H__
6f1d2b4d3SLarry Finger 
7f1d2b4d3SLarry Finger #define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER		255
8f1d2b4d3SLarry Finger #define DRIVER_EARLY_INT_TIME					0x05
9f1d2b4d3SLarry Finger #define BCN_DMA_ATIME_INT_TIME				0x02
10f1d2b4d3SLarry Finger 
11f1d2b4d3SLarry Finger void rtl92c_read_chip_version(struct ieee80211_hw *hw);
12f1d2b4d3SLarry Finger bool rtl92c_llt_write(struct ieee80211_hw *hw, u32 address, u32 data);
13f1d2b4d3SLarry Finger bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary);
14f1d2b4d3SLarry Finger void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index,
15f1d2b4d3SLarry Finger 		     u8 *p_macaddr, bool is_group, u8 enc_algo,
16f1d2b4d3SLarry Finger 		     bool is_wepkey, bool clear_all);
17f1d2b4d3SLarry Finger void rtl92c_enable_interrupt(struct ieee80211_hw *hw);
18f1d2b4d3SLarry Finger void rtl92c_disable_interrupt(struct ieee80211_hw *hw);
19f1d2b4d3SLarry Finger void rtl92c_set_qos(struct ieee80211_hw *hw, int aci);
20f1d2b4d3SLarry Finger 
21f1d2b4d3SLarry Finger /*---------------------------------------------------------------
22f1d2b4d3SLarry Finger  *	Hardware init functions
23f1d2b4d3SLarry Finger  *---------------------------------------------------------------*/
24f1d2b4d3SLarry Finger void rtl92c_init_interrupt(struct ieee80211_hw *hw);
25f1d2b4d3SLarry Finger void rtl92c_init_driver_info_size(struct ieee80211_hw *hw, u8 size);
26f1d2b4d3SLarry Finger 
27f1d2b4d3SLarry Finger int rtl92c_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type);
28f1d2b4d3SLarry Finger void rtl92c_init_network_type(struct ieee80211_hw *hw);
29f1d2b4d3SLarry Finger void rtl92c_init_adaptive_ctrl(struct ieee80211_hw *hw);
30f1d2b4d3SLarry Finger void rtl92c_init_rate_fallback(struct ieee80211_hw *hw);
31f1d2b4d3SLarry Finger 
32f1d2b4d3SLarry Finger void rtl92c_init_edca_param(struct ieee80211_hw *hw,
33f1d2b4d3SLarry Finger 							u16 queue,
34f1d2b4d3SLarry Finger 							u16 txop,
35f1d2b4d3SLarry Finger 							u8 ecwmax,
36f1d2b4d3SLarry Finger 							u8 ecwmin,
37f1d2b4d3SLarry Finger 							u8 aifs);
38f1d2b4d3SLarry Finger 
39f1d2b4d3SLarry Finger void rtl92c_init_edca(struct ieee80211_hw *hw);
40f1d2b4d3SLarry Finger void rtl92c_init_ampdu_aggregation(struct ieee80211_hw *hw);
41f1d2b4d3SLarry Finger void rtl92c_init_beacon_max_error(struct ieee80211_hw *hw);
42f1d2b4d3SLarry Finger void rtl92c_init_rdg_setting(struct ieee80211_hw *hw);
43f1d2b4d3SLarry Finger void rtl92c_init_retry_function(struct ieee80211_hw *hw);
44f1d2b4d3SLarry Finger 
45f1d2b4d3SLarry Finger void rtl92c_disable_fast_edca(struct ieee80211_hw *hw);
46f1d2b4d3SLarry Finger void rtl92c_set_min_space(struct ieee80211_hw *hw, bool is2T);
47f1d2b4d3SLarry Finger 
48f1d2b4d3SLarry Finger u32 rtl92c_get_txdma_status(struct ieee80211_hw *hw);
49f1d2b4d3SLarry Finger 
50f1d2b4d3SLarry Finger struct rx_fwinfo_92c {
51f1d2b4d3SLarry Finger 	u8 gain_trsw[4];
52f1d2b4d3SLarry Finger 	u8 pwdb_all;
53f1d2b4d3SLarry Finger 	u8 cfosho[4];
54f1d2b4d3SLarry Finger 	u8 cfotail[4];
5508aba42fSArnd Bergmann 	s8 rxevm[2];
5608aba42fSArnd Bergmann 	s8 rxsnr[4];
57f1d2b4d3SLarry Finger 	u8 pdsnr[2];
58f1d2b4d3SLarry Finger 	u8 csi_current[2];
59f1d2b4d3SLarry Finger 	u8 csi_target[2];
60f1d2b4d3SLarry Finger 	u8 sigevm;
61f1d2b4d3SLarry Finger 	u8 max_ex_pwr;
62f1d2b4d3SLarry Finger 	u8 ex_intf_flag:1;
63f1d2b4d3SLarry Finger 	u8 sgi_en:1;
64f1d2b4d3SLarry Finger 	u8 rxsc:2;
65f1d2b4d3SLarry Finger 	u8 reserve:4;
66f1d2b4d3SLarry Finger } __packed;
67f1d2b4d3SLarry Finger 
68f1d2b4d3SLarry Finger struct rx_desc_92c {
69f1d2b4d3SLarry Finger 	u32 length:14;
70f1d2b4d3SLarry Finger 	u32 crc32:1;
71f1d2b4d3SLarry Finger 	u32 icverror:1;
72f1d2b4d3SLarry Finger 	u32 drv_infosize:4;
73f1d2b4d3SLarry Finger 	u32 security:3;
74f1d2b4d3SLarry Finger 	u32 qos:1;
75f1d2b4d3SLarry Finger 	u32 shift:2;
76f1d2b4d3SLarry Finger 	u32 phystatus:1;
77f1d2b4d3SLarry Finger 	u32 swdec:1;
78f1d2b4d3SLarry Finger 	u32 lastseg:1;
79f1d2b4d3SLarry Finger 	u32 firstseg:1;
80f1d2b4d3SLarry Finger 	u32 eor:1;
81f1d2b4d3SLarry Finger 	u32 own:1;
82f1d2b4d3SLarry Finger 	u32 macid:5;	/* word 1 */
83f1d2b4d3SLarry Finger 	u32 tid:4;
84f1d2b4d3SLarry Finger 	u32 hwrsvd:5;
85f1d2b4d3SLarry Finger 	u32 paggr:1;
86f1d2b4d3SLarry Finger 	u32 faggr:1;
87f1d2b4d3SLarry Finger 	u32 a1_fit:4;
88f1d2b4d3SLarry Finger 	u32 a2_fit:4;
89f1d2b4d3SLarry Finger 	u32 pam:1;
90f1d2b4d3SLarry Finger 	u32 pwr:1;
91f1d2b4d3SLarry Finger 	u32 moredata:1;
92f1d2b4d3SLarry Finger 	u32 morefrag:1;
93f1d2b4d3SLarry Finger 	u32 type:2;
94f1d2b4d3SLarry Finger 	u32 mc:1;
95f1d2b4d3SLarry Finger 	u32 bc:1;
96f1d2b4d3SLarry Finger 	u32 seq:12;	/* word 2 */
97f1d2b4d3SLarry Finger 	u32 frag:4;
98f1d2b4d3SLarry Finger 	u32 nextpktlen:14;
99f1d2b4d3SLarry Finger 	u32 nextind:1;
100f1d2b4d3SLarry Finger 	u32 rsvd:1;
101f1d2b4d3SLarry Finger 	u32 rxmcs:6;	/* word 3 */
102f1d2b4d3SLarry Finger 	u32 rxht:1;
103f1d2b4d3SLarry Finger 	u32 amsdu:1;
104f1d2b4d3SLarry Finger 	u32 splcp:1;
105f1d2b4d3SLarry Finger 	u32 bandwidth:1;
106f1d2b4d3SLarry Finger 	u32 htc:1;
107f1d2b4d3SLarry Finger 	u32 tcpchk_rpt:1;
108f1d2b4d3SLarry Finger 	u32 ipcchk_rpt:1;
109f1d2b4d3SLarry Finger 	u32 tcpchk_valid:1;
110f1d2b4d3SLarry Finger 	u32 hwpcerr:1;
111f1d2b4d3SLarry Finger 	u32 hwpcind:1;
112f1d2b4d3SLarry Finger 	u32 iv0:16;
113f1d2b4d3SLarry Finger 	u32 iv1;	/* word 4 */
114f1d2b4d3SLarry Finger 	u32 tsfl;	/* word 5 */
115f1d2b4d3SLarry Finger 	u32 bufferaddress;	/* word 6 */
116f1d2b4d3SLarry Finger 	u32 bufferaddress64;	/* word 7 */
117f1d2b4d3SLarry Finger } __packed;
118f1d2b4d3SLarry Finger 
119f1d2b4d3SLarry Finger enum rtl_desc_qsel rtl92c_map_hwqueue_to_fwqueue(u16 fc,
120f1d2b4d3SLarry Finger 							  unsigned int
121f1d2b4d3SLarry Finger 							  skb_queue);
122f1d2b4d3SLarry Finger void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw,
123f1d2b4d3SLarry Finger 				      struct sk_buff *skb,
124f1d2b4d3SLarry Finger 				      struct rtl_stats *pstats,
125f1d2b4d3SLarry Finger 				      struct rx_desc_92c *pdesc,
126f1d2b4d3SLarry Finger 				      struct rx_fwinfo_92c *p_drvinfo);
127f1d2b4d3SLarry Finger 
128f1d2b4d3SLarry Finger /*---------------------------------------------------------------
129f1d2b4d3SLarry Finger  *	Card disable functions
130f1d2b4d3SLarry Finger  *---------------------------------------------------------------*/
131f1d2b4d3SLarry Finger 
132f1d2b4d3SLarry Finger #endif
133