blob: ee9e343eeb296f64f637b7bdcf05c68548dd4e69 [file] [log] [blame]
developere5e687d2023-08-08 16:05:33 +08001/* 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 _TOPS_HWSPIN_LOCK_H_
9#define _TOPS_HWSPIN_LOCK_H_
10
11#include <linux/types.h>
12
13#include "mbox.h"
14
15#define HWSPINLOCK_SLOT_MAX 16
16
17#define HWSPINLOCK_TOP_BASE 0x10100
18#define HWSPINLOCK_CLUST_BASE 0x880000
19
20enum hwspinlock_group {
21 HWSPINLOCK_GROUP_TOP,
22 HWSPINLOCK_GROUP_CLUST,
23
24 __HWSPINLOCK_GROUP_MAX,
25};
26
27enum hwspinlock_top_slot {
28 HWSPINLOCK_TOP_SLOT_HPDMA_LOCK,
29 HWSPINLOCK_TOP_SLOT_HPDMA_PCH0,
30 HWSPINLOCK_TOP_SLOT_HPDMA_PCH1,
31 HWSPINLOCK_TOP_SLOT_HPDMA_PCH2,
32 HWSPINLOCK_TOP_SLOT_HPDMA_PCH3,
33 HWSPINLOCK_TOP_SLOT_5,
34 HWSPINLOCK_TOP_SLOT_6,
35 HWSPINLOCK_TOP_SLOT_7,
36 HWSPINLOCK_TOP_SLOT_8,
37 HWSPINLOCK_TOP_SLOT_9,
38 HWSPINLOCK_TOP_SLOT_10,
39 HWSPINLOCK_TOP_SLOT_11,
40 HWSPINLOCK_TOP_SLOT_12,
41 HWSPINLOCK_TOP_SLOT_13,
42 HWSPINLOCK_TOP_SLOT_14,
43 HWSPINLOCK_TOP_SLOT_15,
44
45 __HWSPINLOCK_TOP_MAX = HWSPINLOCK_SLOT_MAX,
46};
47
48enum hwspinlock_clust_slot {
49 HWSPINLOCK_CLUST_SLOT_PRINTF,
50 HWSPINLOCK_CLUST_SLOT_HPDMA_LOCK,
51 HWSPINLOCK_CLUST_SLOT_HPDMA_PCH0,
52 HWSPINLOCK_CLUST_SLOT_HPDMA_PCH1,
53 HWSPINLOCK_CLUST_SLOT_HPDMA_PCH2,
54 HWSPINLOCK_CLUST_SLOT_HPDMA_PCH3,
55 HWSPINLOCK_CLUST_SLOT_6,
56 HWSPINLOCK_CLUST_SLOT_7,
57 HWSPINLOCK_CLUST_SLOT_8,
58 HWSPINLOCK_CLUST_SLOT_9,
59 HWSPINLOCK_CLUST_SLOT_10,
60 HWSPINLOCK_CLUST_SLOT_11,
61 HWSPINLOCK_CLUST_SLOT_12,
62 HWSPINLOCK_CLUST_SLOT_13,
63 HWSPINLOCK_CLUST_SLOT_14,
64 HWSPINLOCK_CLUST_SLOT_15,
65
66 __HWSPINLOCK_CLUST_MAX = HWSPINLOCK_SLOT_MAX,
67};
68
69int mtk_tops_hwspin_try_lock(enum hwspinlock_group grp, u32 slot);
70void mtk_tops_hwspin_lock(enum hwspinlock_group grp, u32 slot);
71void mtk_tops_hwspin_unlock(enum hwspinlock_group grp, u32 slot);
72int mtk_tops_hwspinlock_init(struct platform_device *pdev);
73#endif /* _TOPS_HWSPIN_LOCK_H_ */