1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2007 - 2011 Realtek Corporation. */
3 
4 #ifndef __RTW_IOL_H_
5 #define __RTW_IOL_H_
6 
7 #include "osdep_service.h"
8 #include "drv_types.h"
9 
10 #define IOREG_CMD_END_LEN	4
11 
12 struct ioreg_cfg {
13 	u8	length;
14 	u8	cmd_id;
15 	__le16	address;
16 	__le32	data;
17 	__le32  mask;
18 };
19 
20 enum ioreg_cmd {
21 	IOREG_CMD_LLT		= 0x01,
22 	IOREG_CMD_REFUSE	= 0x02,
23 	IOREG_CMD_EFUSE_PATH	= 0x03,
24 	IOREG_CMD_WB_REG	= 0x04,
25 	IOREG_CMD_WW_REG	= 0x05,
26 	IOREG_CMD_WD_REG	= 0x06,
27 	IOREG_CMD_W_RF		= 0x07,
28 	IOREG_CMD_DELAY_US	= 0x10,
29 	IOREG_CMD_DELAY_MS	= 0x11,
30 	IOREG_CMD_END		= 0xFF,
31 };
32 
33 struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter);
34 int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds,
35 			u32 cmd_len);
36 bool rtw_IOL_applied(struct adapter  *adapter);
37 int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);
38 int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);
39 int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
40 
41 void read_efuse_from_txpktbuf(struct adapter *adapter, int bcnhead,
42 			      u8 *content, u16 *size);
43 
44 int rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr,
45 			  u8 value, u8 mask);
46 int rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr,
47 			  u16 value, u16 mask);
48 int rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr,
49 			  u32 value, u32 mask);
50 int rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path,
51 			   u16 addr, u32 value, u32 mask);
52 
53 u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);
54 
55 #endif /* __RTW_IOL_H_ */
56