developer | 1966afb | 2023-08-08 16:02:18 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* |
| 3 | * Copyright (c) 2023 Mediatek Inc. All Rights Reserved. |
| 4 | * |
| 5 | * Author: Ren-Ting Wang <ren-ting.wang@mediatek.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef _PCE_CDRT_H_ |
| 9 | #define _PCE_CDRT_H_ |
| 10 | |
| 11 | #include <linux/platform_device.h> |
| 12 | |
| 13 | #include "pce/cls.h" |
| 14 | #include "pce/pce.h" |
| 15 | |
| 16 | enum cdrt_type { |
| 17 | CDRT_DECRYPT, |
| 18 | CDRT_ENCRYPT, |
| 19 | |
| 20 | __CDRT_TYPE_MAX, |
| 21 | }; |
| 22 | |
| 23 | struct cdrt_entry { |
| 24 | u32 idx; |
| 25 | enum cdrt_type type; |
| 26 | struct cdrt_desc desc; |
| 27 | struct cls_entry *cls; |
| 28 | int (*update_cls_rule)(struct cdrt_entry *cdrt); |
| 29 | }; |
| 30 | |
| 31 | int mtk_pce_cdrt_update_cls_rule(u32 cdrt_idx); |
| 32 | |
| 33 | int mtk_pce_cdrt_desc_write(struct cdrt_desc *desc, u32 idx); |
| 34 | int mtk_pce_cdrt_desc_read(struct cdrt_desc *desc, u32 idx); |
| 35 | |
| 36 | int mtk_pce_cdrt_entry_write(struct cdrt_entry *cdrt); |
| 37 | |
| 38 | struct cdrt_entry *mtk_pce_cdrt_entry_alloc(enum cdrt_type type); |
| 39 | void mtk_pce_cdrt_entry_free(struct cdrt_entry *cdrt); |
| 40 | |
| 41 | int mtk_pce_cdrt_enable(void); |
| 42 | void mtk_pce_cdrt_disable(void); |
| 43 | |
| 44 | int mtk_pce_cdrt_init(struct platform_device *pdev); |
| 45 | void mtk_pce_cdrt_deinit(struct platform_device *pdev); |
| 46 | #endif /* _PCE_CDRT_H_ */ |