This source file includes following definitions.
- cti_init
- cti_map_trigger
- cti_enable
- cti_disable
- cti_irq_ack
- cti_unlock
- cti_lock
1
2 #ifndef __ASMARM_CTI_H
3 #define __ASMARM_CTI_H
4
5 #include <asm/io.h>
6 #include <asm/hardware/coresight.h>
7
8
9
10
11 #define CTICONTROL 0x000
12 #define CTISTATUS 0x004
13 #define CTILOCK 0x008
14 #define CTIPROTECTION 0x00C
15 #define CTIINTACK 0x010
16 #define CTIAPPSET 0x014
17 #define CTIAPPCLEAR 0x018
18 #define CTIAPPPULSE 0x01c
19 #define CTIINEN 0x020
20 #define CTIOUTEN 0x0A0
21 #define CTITRIGINSTATUS 0x130
22 #define CTITRIGOUTSTATUS 0x134
23 #define CTICHINSTATUS 0x138
24 #define CTICHOUTSTATUS 0x13c
25 #define CTIPERIPHID0 0xFE0
26 #define CTIPERIPHID1 0xFE4
27 #define CTIPERIPHID2 0xFE8
28 #define CTIPERIPHID3 0xFEC
29 #define CTIPCELLID0 0xFF0
30 #define CTIPCELLID1 0xFF4
31 #define CTIPCELLID2 0xFF8
32 #define CTIPCELLID3 0xFFC
33
34
35
36
37 #define LOCKACCESS 0xFB0
38 #define LOCKSTATUS 0xFB4
39
40
41
42
43
44
45
46
47
48
49 struct cti {
50 void __iomem *base;
51 int irq;
52 int trig_out_for_irq;
53 };
54
55
56
57
58
59
60
61
62
63
64
65
66 static inline void cti_init(struct cti *cti,
67 void __iomem *base, int irq, int trig_out)
68 {
69 cti->base = base;
70 cti->irq = irq;
71 cti->trig_out_for_irq = trig_out;
72 }
73
74
75
76
77
78
79
80
81
82
83
84 static inline void cti_map_trigger(struct cti *cti,
85 int trig_in, int trig_out, int chan)
86 {
87 void __iomem *base = cti->base;
88 unsigned long val;
89
90 val = __raw_readl(base + CTIINEN + trig_in * 4);
91 val |= BIT(chan);
92 __raw_writel(val, base + CTIINEN + trig_in * 4);
93
94 val = __raw_readl(base + CTIOUTEN + trig_out * 4);
95 val |= BIT(chan);
96 __raw_writel(val, base + CTIOUTEN + trig_out * 4);
97 }
98
99
100
101
102
103
104
105 static inline void cti_enable(struct cti *cti)
106 {
107 __raw_writel(0x1, cti->base + CTICONTROL);
108 }
109
110
111
112
113
114
115
116 static inline void cti_disable(struct cti *cti)
117 {
118 __raw_writel(0, cti->base + CTICONTROL);
119 }
120
121
122
123
124
125
126
127 static inline void cti_irq_ack(struct cti *cti)
128 {
129 void __iomem *base = cti->base;
130 unsigned long val;
131
132 val = __raw_readl(base + CTIINTACK);
133 val |= BIT(cti->trig_out_for_irq);
134 __raw_writel(val, base + CTIINTACK);
135 }
136
137
138
139
140
141
142
143
144 static inline void cti_unlock(struct cti *cti)
145 {
146 __raw_writel(CS_LAR_KEY, cti->base + LOCKACCESS);
147 }
148
149
150
151
152
153
154
155
156 static inline void cti_lock(struct cti *cti)
157 {
158 __raw_writel(~CS_LAR_KEY, cti->base + LOCKACCESS);
159 }
160 #endif