162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/* Copyright(c) 2018-2019  Realtek Corporation
362306a36Sopenharmony_ci */
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __RTW_SEC_H_
662306a36Sopenharmony_ci#define __RTW_SEC_H_
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define RTW_SEC_CMD_REG			0x670
962306a36Sopenharmony_ci#define RTW_SEC_WRITE_REG		0x674
1062306a36Sopenharmony_ci#define RTW_SEC_READ_REG		0x678
1162306a36Sopenharmony_ci#define RTW_SEC_CONFIG			0x680
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define RTW_SEC_CAM_ENTRY_SHIFT		3
1462306a36Sopenharmony_ci#define RTW_SEC_DEFAULT_KEY_NUM		4
1562306a36Sopenharmony_ci#define RTW_SEC_CMD_WRITE_ENABLE	BIT(16)
1662306a36Sopenharmony_ci#define RTW_SEC_CMD_CLEAR		BIT(30)
1762306a36Sopenharmony_ci#define RTW_SEC_CMD_POLLING		BIT(31)
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define RTW_SEC_TX_UNI_USE_DK		BIT(0)
2062306a36Sopenharmony_ci#define RTW_SEC_RX_UNI_USE_DK		BIT(1)
2162306a36Sopenharmony_ci#define RTW_SEC_TX_DEC_EN		BIT(2)
2262306a36Sopenharmony_ci#define RTW_SEC_RX_DEC_EN		BIT(3)
2362306a36Sopenharmony_ci#define RTW_SEC_TX_BC_USE_DK		BIT(6)
2462306a36Sopenharmony_ci#define RTW_SEC_RX_BC_USE_DK		BIT(7)
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define RTW_SEC_ENGINE_EN		BIT(9)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciint rtw_sec_get_free_cam(struct rtw_sec_desc *sec);
2962306a36Sopenharmony_civoid rtw_sec_write_cam(struct rtw_dev *rtwdev,
3062306a36Sopenharmony_ci		       struct rtw_sec_desc *sec,
3162306a36Sopenharmony_ci		       struct ieee80211_sta *sta,
3262306a36Sopenharmony_ci		       struct ieee80211_key_conf *key,
3362306a36Sopenharmony_ci		       u8 hw_key_type, u8 hw_key_idx);
3462306a36Sopenharmony_civoid rtw_sec_clear_cam(struct rtw_dev *rtwdev,
3562306a36Sopenharmony_ci		       struct rtw_sec_desc *sec,
3662306a36Sopenharmony_ci		       u8 hw_key_idx);
3762306a36Sopenharmony_ciu8 rtw_sec_cam_pg_backup(struct rtw_dev *rtwdev, u8 *used_cam);
3862306a36Sopenharmony_civoid rtw_sec_enable_sec_engine(struct rtw_dev *rtwdev);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#endif
41