1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
4  *
5  * Contact Information: wlanfae <wlanfae@realtek.com>
6  */
7 #ifndef R8190P_DEF_H
8 #define R8190P_DEF_H
9 
10 #include <linux/types.h>
11 
12 #define		MAX_SILENT_RESET_RX_SLOT_NUM	10
13 
14 #define RX_MPDU_QUEUE				0
15 
16 enum rtl819x_loopback {
17 	RTL819X_NO_LOOPBACK = 0,
18 	RTL819X_MAC_LOOPBACK = 1,
19 	RTL819X_DMA_LOOPBACK = 2,
20 	RTL819X_CCK_LOOPBACK = 3,
21 };
22 
23 #define DESC90_RATE1M				0x00
24 #define DESC90_RATE2M				0x01
25 #define DESC90_RATE5_5M				0x02
26 #define DESC90_RATE11M				0x03
27 #define DESC90_RATE6M				0x04
28 #define DESC90_RATE9M				0x05
29 #define DESC90_RATE12M				0x06
30 #define DESC90_RATE18M				0x07
31 #define DESC90_RATE24M				0x08
32 #define DESC90_RATE36M				0x09
33 #define DESC90_RATE48M				0x0a
34 #define DESC90_RATE54M				0x0b
35 #define DESC90_RATEMCS0				0x00
36 #define DESC90_RATEMCS1				0x01
37 #define DESC90_RATEMCS2				0x02
38 #define DESC90_RATEMCS3				0x03
39 #define DESC90_RATEMCS4				0x04
40 #define DESC90_RATEMCS5				0x05
41 #define DESC90_RATEMCS6				0x06
42 #define DESC90_RATEMCS7				0x07
43 #define DESC90_RATEMCS8				0x08
44 #define DESC90_RATEMCS9				0x09
45 #define DESC90_RATEMCS10			0x0a
46 #define DESC90_RATEMCS11			0x0b
47 #define DESC90_RATEMCS12			0x0c
48 #define DESC90_RATEMCS13			0x0d
49 #define DESC90_RATEMCS14			0x0e
50 #define DESC90_RATEMCS15			0x0f
51 #define DESC90_RATEMCS32			0x20
52 
53 #define SHORT_SLOT_TIME				9
54 #define NON_SHORT_SLOT_TIME		20
55 
56 #define	RX_SMOOTH				20
57 
58 #define QSLT_BK					0x1
59 #define QSLT_BE					0x0
60 #define QSLT_VI					0x4
61 #define QSLT_VO					0x6
62 #define	QSLT_BEACON			0x10
63 #define	QSLT_HIGH				0x11
64 #define	QSLT_MGNT				0x12
65 #define	QSLT_CMD				0x13
66 
67 #define NUM_OF_PAGE_IN_FW_QUEUE_BK		0x007
68 #define NUM_OF_PAGE_IN_FW_QUEUE_BE		0x0aa
69 #define NUM_OF_PAGE_IN_FW_QUEUE_VI		0x024
70 #define NUM_OF_PAGE_IN_FW_QUEUE_VO		0x007
71 #define NUM_OF_PAGE_IN_FW_QUEUE_MGNT		0x10
72 #define NUM_OF_PAGE_IN_FW_QUEUE_BCN		0x4
73 #define NUM_OF_PAGE_IN_FW_QUEUE_PUB		0xd
74 
75 #define APPLIED_RESERVED_QUEUE_IN_FW		0x80000000
76 #define RSVD_FW_QUEUE_PAGE_BK_SHIFT		0x00
77 #define RSVD_FW_QUEUE_PAGE_BE_SHIFT		0x08
78 #define RSVD_FW_QUEUE_PAGE_VI_SHIFT		0x10
79 #define RSVD_FW_QUEUE_PAGE_VO_SHIFT		0x18
80 #define RSVD_FW_QUEUE_PAGE_MGNT_SHIFT	0x10
81 #define RSVD_FW_QUEUE_PAGE_BCN_SHIFT		0x00
82 #define RSVD_FW_QUEUE_PAGE_PUB_SHIFT		0x08
83 
84 #define HAL_PRIME_CHNL_OFFSET_DONT_CARE	0
85 #define HAL_PRIME_CHNL_OFFSET_LOWER		1
86 #define HAL_PRIME_CHNL_OFFSET_UPPER		2
87 
88 enum version_8190_loopback {
89 	VERSION_8190_BD = 0x3,
90 	VERSION_8190_BE
91 };
92 
93 #define IC_VersionCut_C	0x2
94 #define IC_VersionCut_D	0x3
95 #define IC_VersionCut_E	0x4
96 
97 enum rf_optype {
98 	RF_OP_By_SW_3wire = 0,
99 	RF_OP_By_FW,
100 	RF_OP_MAX
101 };
102 
103 struct bb_reg_definition {
104 	u32 rfintfs;
105 	u32 rfintfo;
106 	u32 rfintfe;
107 	u32 rf3wireOffset;
108 	u32 rfHSSIPara2;
109 	u32 rfLSSIReadBack;
110 	u32 rfLSSIReadBackPi;
111 };
112 
113 struct tx_fwinfo_8190pci {
114 	u8			TxRate:7;
115 	u8			CtsEnable:1;
116 	u8			RtsRate:7;
117 	u8			RtsEnable:1;
118 	u8			TxHT:1;
119 	u8			Short:1;
120 	u8			TxBandwidth:1;
121 	u8			TxSubCarrier:2;
122 	u8			STBC:2;
123 	u8			AllowAggregation:1;
124 	u8			RtsHT:1;
125 	u8			RtsShort:1;
126 	u8			RtsBandwidth:1;
127 	u8			RtsSubcarrier:2;
128 	u8			RtsSTBC:2;
129 	u8			EnableCPUDur:1;
130 
131 	u32			RxMF:2;
132 	u32			RxAMD:3;
133 	u32			TxPerPktInfoFeedback:1;
134 	u32			Reserved1:2;
135 	u32			TxAGCOffset:4;
136 	u32			TxAGCSign:1;
137 	u32			RAW_TXD:1;
138 	u32			Retry_Limit:4;
139 	u32			Reserved2:1;
140 	u32			PacketID:13;
141 };
142 
143 struct phy_ofdm_rx_status_rxsc_sgien_exintfflag {
144 	u8			reserved:4;
145 	u8			rxsc:2;
146 	u8			sgi_en:1;
147 	u8			ex_intf_flag:1;
148 };
149 
150 struct phy_sts_ofdm_819xpci {
151 	u8	trsw_gain_X[4];
152 	u8	pwdb_all;
153 	u8	cfosho_X[4];
154 	u8	cfotail_X[4];
155 	u8	rxevm_X[2];
156 	u8	rxsnr_X[4];
157 	u8	pdsnr_X[2];
158 	u8	csi_current_X[2];
159 	u8	csi_target_X[2];
160 	u8	sigevm;
161 	u8	max_ex_pwr;
162 	u8	sgi_en;
163 	u8	rxsc_sgien_exflg;
164 };
165 
166 struct phy_sts_cck_819xpci {
167 	u8	adc_pwdb_X[4];
168 	u8	sq_rpt;
169 	u8	cck_agc_rpt;
170 };
171 
172 #define		PHY_RSSI_SLID_WIN_MAX				100
173 #define		PHY_Beacon_RSSI_SLID_WIN_MAX		10
174 
175 struct tx_desc {
176 	u16	PktSize;
177 	u8	Offset;
178 	u8	Reserved1:3;
179 	u8	CmdInit:1;
180 	u8	LastSeg:1;
181 	u8	FirstSeg:1;
182 	u8	LINIP:1;
183 	u8	OWN:1;
184 
185 	u8	TxFWInfoSize;
186 	u8	RATid:3;
187 	u8	DISFB:1;
188 	u8	USERATE:1;
189 	u8	MOREFRAG:1;
190 	u8	NoEnc:1;
191 	u8	PIFS:1;
192 	u8	QueueSelect:5;
193 	u8	NoACM:1;
194 	u8	Resv:2;
195 	u8	SecCAMID:5;
196 	u8	SecDescAssign:1;
197 	u8	SecType:2;
198 
199 	u16	TxBufferSize;
200 	u8	PktId:7;
201 	u8	Resv1:1;
202 	u8	Reserved2;
203 
204 	u32	TxBuffAddr;
205 
206 	u32	NextDescAddress;
207 
208 	u32	Reserved5;
209 	u32	Reserved6;
210 	u32	Reserved7;
211 };
212 
213 struct tx_desc_cmd {
214 	u16	PktSize;
215 	u8	Reserved1;
216 	u8	CmdType:3;
217 	u8	CmdInit:1;
218 	u8	LastSeg:1;
219 	u8	FirstSeg:1;
220 	u8	LINIP:1;
221 	u8	OWN:1;
222 
223 	u16	ElementReport;
224 	u16	Reserved2;
225 
226 	u16	TxBufferSize;
227 	u16	Reserved3;
228 
229 	u32	TxBuffAddr;
230 	u32	NextDescAddress;
231 	u32	Reserved4;
232 	u32	Reserved5;
233 	u32	Reserved6;
234 };
235 
236 struct rx_desc {
237 	u16			Length:14;
238 	u16			CRC32:1;
239 	u16			ICV:1;
240 	u8			RxDrvInfoSize;
241 	u8			Shift:2;
242 	u8			PHYStatus:1;
243 	u8			SWDec:1;
244 	u8			LastSeg:1;
245 	u8			FirstSeg:1;
246 	u8			EOR:1;
247 	u8			OWN:1;
248 
249 	u32			Reserved2;
250 
251 	u32			Reserved3;
252 
253 	u32	BufferAddress;
254 };
255 
256 struct rx_fwinfo {
257 	u16			Reserved1:12;
258 	u16			PartAggr:1;
259 	u16			FirstAGGR:1;
260 	u16			Reserved2:2;
261 
262 	u8			RxRate:7;
263 	u8			RxHT:1;
264 
265 	u8			BW:1;
266 	u8			SPLCP:1;
267 	u8			Reserved3:2;
268 	u8			PAM:1;
269 	u8			Mcast:1;
270 	u8			Bcast:1;
271 	u8			Reserved4:1;
272 
273 	u32			TSFL;
274 };
275 
276 #endif
277