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_CLS_H_ |
| 9 | #define _PCE_CLS_H_ |
| 10 | |
| 11 | #include <linux/platform_device.h> |
| 12 | |
| 13 | #include "pce/pce.h" |
| 14 | |
developer | 1966afb | 2023-08-08 16:02:18 +0800 | [diff] [blame] | 15 | #define CLS_DESC_MASK_DATA(cdesc, field, mask, data) \ |
| 16 | do { \ |
| 17 | (cdesc)->field ## _m = (mask); \ |
| 18 | (cdesc)->field = (data); \ |
| 19 | } while (0) |
| 20 | #define CLS_DESC_DATA(cdesc, field, data) \ |
| 21 | (cdesc)->field = (data) |
| 22 | |
| 23 | struct cls_entry { |
developer | 5cca2e4 | 2023-08-24 17:39:15 +0800 | [diff] [blame^] | 24 | u32 idx; |
developer | 1966afb | 2023-08-08 16:02:18 +0800 | [diff] [blame] | 25 | struct cls_desc cdesc; |
| 26 | }; |
| 27 | |
| 28 | int mtk_pce_cls_enable(void); |
| 29 | void mtk_pce_cls_disable(void); |
| 30 | |
| 31 | int mtk_pce_cls_init(struct platform_device *pdev); |
| 32 | void mtk_pce_cls_deinit(struct platform_device *pdev); |
| 33 | |
developer | 5cca2e4 | 2023-08-24 17:39:15 +0800 | [diff] [blame^] | 34 | int mtk_pce_cls_desc_read(struct cls_desc *cdesc, u32 idx); |
| 35 | int mtk_pce_cls_desc_write(struct cls_desc *cdesc, u32 idx); |
| 36 | |
| 37 | int mtk_pce_cls_entry_write(struct cls_entry *cls); |
developer | 1966afb | 2023-08-08 16:02:18 +0800 | [diff] [blame] | 38 | |
developer | 5cca2e4 | 2023-08-24 17:39:15 +0800 | [diff] [blame^] | 39 | struct cls_entry *mtk_pce_cls_entry_alloc(void); |
| 40 | void mtk_pce_cls_entry_free(struct cls_entry *cls); |
developer | 1966afb | 2023-08-08 16:02:18 +0800 | [diff] [blame] | 41 | #endif /* _PCE_CLS_H_ */ |