18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2018-2019  Realtek Corporation
38c2ecf20Sopenharmony_ci */
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifndef __RTW_SEC_H_
68c2ecf20Sopenharmony_ci#define __RTW_SEC_H_
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define RTW_SEC_CMD_REG			0x670
98c2ecf20Sopenharmony_ci#define RTW_SEC_WRITE_REG		0x674
108c2ecf20Sopenharmony_ci#define RTW_SEC_READ_REG		0x678
118c2ecf20Sopenharmony_ci#define RTW_SEC_CONFIG			0x680
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define RTW_SEC_CAM_ENTRY_SHIFT		3
148c2ecf20Sopenharmony_ci#define RTW_SEC_DEFAULT_KEY_NUM		4
158c2ecf20Sopenharmony_ci#define RTW_SEC_CMD_WRITE_ENABLE	BIT(16)
168c2ecf20Sopenharmony_ci#define RTW_SEC_CMD_CLEAR		BIT(30)
178c2ecf20Sopenharmony_ci#define RTW_SEC_CMD_POLLING		BIT(31)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define RTW_SEC_TX_UNI_USE_DK		BIT(0)
208c2ecf20Sopenharmony_ci#define RTW_SEC_RX_UNI_USE_DK		BIT(1)
218c2ecf20Sopenharmony_ci#define RTW_SEC_TX_DEC_EN		BIT(2)
228c2ecf20Sopenharmony_ci#define RTW_SEC_RX_DEC_EN		BIT(3)
238c2ecf20Sopenharmony_ci#define RTW_SEC_TX_BC_USE_DK		BIT(6)
248c2ecf20Sopenharmony_ci#define RTW_SEC_RX_BC_USE_DK		BIT(7)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define RTW_SEC_ENGINE_EN		BIT(9)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciint rtw_sec_get_free_cam(struct rtw_sec_desc *sec);
298c2ecf20Sopenharmony_civoid rtw_sec_write_cam(struct rtw_dev *rtwdev,
308c2ecf20Sopenharmony_ci		       struct rtw_sec_desc *sec,
318c2ecf20Sopenharmony_ci		       struct ieee80211_sta *sta,
328c2ecf20Sopenharmony_ci		       struct ieee80211_key_conf *key,
338c2ecf20Sopenharmony_ci		       u8 hw_key_type, u8 hw_key_idx);
348c2ecf20Sopenharmony_civoid rtw_sec_clear_cam(struct rtw_dev *rtwdev,
358c2ecf20Sopenharmony_ci		       struct rtw_sec_desc *sec,
368c2ecf20Sopenharmony_ci		       u8 hw_key_idx);
378c2ecf20Sopenharmony_ciu8 rtw_sec_cam_pg_backup(struct rtw_dev *rtwdev, u8 *used_cam);
388c2ecf20Sopenharmony_civoid rtw_sec_enable_sec_engine(struct rtw_dev *rtwdev);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif
41