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