1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2018-2019  Realtek Corporation
3  */
4 
5 #ifndef __RTW_SEC_H_
6 #define __RTW_SEC_H_
7 
8 #define RTW_SEC_CMD_REG			0x670
9 #define RTW_SEC_WRITE_REG		0x674
10 #define RTW_SEC_READ_REG		0x678
11 #define RTW_SEC_CONFIG			0x680
12 
13 #define RTW_SEC_CAM_ENTRY_SHIFT		3
14 #define RTW_SEC_DEFAULT_KEY_NUM		4
15 #define RTW_SEC_CMD_WRITE_ENABLE	BIT(16)
16 #define RTW_SEC_CMD_CLEAR		BIT(30)
17 #define RTW_SEC_CMD_POLLING		BIT(31)
18 
19 #define RTW_SEC_TX_UNI_USE_DK		BIT(0)
20 #define RTW_SEC_RX_UNI_USE_DK		BIT(1)
21 #define RTW_SEC_TX_DEC_EN		BIT(2)
22 #define RTW_SEC_RX_DEC_EN		BIT(3)
23 #define RTW_SEC_TX_BC_USE_DK		BIT(6)
24 #define RTW_SEC_RX_BC_USE_DK		BIT(7)
25 
26 #define RTW_SEC_ENGINE_EN		BIT(9)
27 
28 int rtw_sec_get_free_cam(struct rtw_sec_desc *sec);
29 void rtw_sec_write_cam(struct rtw_dev *rtwdev,
30 		       struct rtw_sec_desc *sec,
31 		       struct ieee80211_sta *sta,
32 		       struct ieee80211_key_conf *key,
33 		       u8 hw_key_type, u8 hw_key_idx);
34 void rtw_sec_clear_cam(struct rtw_dev *rtwdev,
35 		       struct rtw_sec_desc *sec,
36 		       u8 hw_key_idx);
37 void rtw_sec_enable_sec_engine(struct rtw_dev *rtwdev);
38 
39 #endif
40