Lines Matching +full:0 +full:- +full:1
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
19 #include <linux/soc/qcom/llcc-qcom.h>
21 #define ACTIVATE BIT(0)
22 #define DEACTIVATE BIT(1)
23 #define ACT_CLEAR BIT(0)
25 #define ACT_CTRL_OPCODE_ACTIVATE BIT(0)
26 #define ACT_CTRL_OPCODE_DEACTIVATE BIT(1)
27 #define ACT_CTRL_ACT_TRIG BIT(0)
28 #define ACT_CTRL_OPCODE_SHIFT 0x01
29 #define ATTR1_PROBE_TARGET_WAYS_SHIFT 0x02
30 #define ATTR1_FIXED_SIZE_SHIFT 0x03
31 #define ATTR1_PRIORITY_SHIFT 0x04
32 #define ATTR1_MAX_CAP_SHIFT 0x10
33 #define ATTR0_RES_WAYS_MASK GENMASK(15, 0)
35 #define ATTR0_BONUS_WAYS_SHIFT 0x10
47 #define LLCC_TRP_ATTR0_CFGn(n) (0x21000 + SZ_8 * n)
48 #define LLCC_TRP_ATTR1_CFGn(n) (0x21004 + SZ_8 * n)
49 #define LLCC_TRP_ATTR2_CFGn(n) (0x21100 + SZ_4 * n)
51 #define LLCC_TRP_SCID_DIS_CAP_ALLOC 0x21f00
52 #define LLCC_TRP_PCB_ACT 0x21f04
53 #define LLCC_TRP_ALGO_CFG1 0x21f0c
54 #define LLCC_TRP_ALGO_CFG2 0x21f10
55 #define LLCC_TRP_ALGO_CFG3 0x21f14
56 #define LLCC_TRP_ALGO_CFG4 0x21f18
57 #define LLCC_TRP_ALGO_CFG5 0x21f1c
58 #define LLCC_TRP_WRSC_EN 0x21f20
59 #define LLCC_TRP_ALGO_CFG6 0x21f24
60 #define LLCC_TRP_ALGO_CFG7 0x21f28
61 #define LLCC_TRP_WRSC_CACHEABLE_EN 0x21f2c
62 #define LLCC_TRP_ALGO_CFG8 0x21f30
64 #define LLCC_VERSION_2_0_0_0 0x02000000
65 #define LLCC_VERSION_2_1_0_0 0x02010000
66 #define LLCC_VERSION_4_1_0_0 0x04010000
69 * struct llcc_slice_config - Data associated with the llcc slice
84 * configured to 1 only bonus and reserved ways are probed.
85 * When configured to 0 all ways in llcc are probed.
135 { LLCC_CPUSS, 1, 256, 1, 0, 0xf, 0x0, 0, 0, 0, 1, 1 },
136 { LLCC_MDM, 8, 128, 1, 0, 0xf, 0x0, 0, 0, 0, 1, 0 },
137 { LLCC_GPUHTW, 11, 128, 1, 0, 0xf, 0x0, 0, 0, 0, 1, 0 },
138 { LLCC_GPU, 12, 128, 1, 0, 0xf, 0x0, 0, 0, 0, 1, 0 },
142 { LLCC_CPUSS, 1, 768, 1, 0, 0x3f, 0x0, 0, 0, 0, 1, 1, 0},
143 { LLCC_MDMHPGRW, 7, 512, 2, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
144 { LLCC_CMPT, 10, 768, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
145 { LLCC_GPUHTW, 11, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
146 { LLCC_GPU, 12, 512, 1, 0, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
147 { LLCC_MMUHWT, 13, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 0, 1, 0},
148 { LLCC_MDMPNG, 21, 768, 0, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
149 { LLCC_WLHW, 24, 256, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
150 { LLCC_MODPE, 29, 64, 1, 1, 0x3f, 0x0, 0, 0, 0, 1, 0, 0},
154 { LLCC_CPUSS, 1, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 1 },
155 { LLCC_VIDSC0, 2, 512, 2, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
156 { LLCC_VIDSC1, 3, 512, 2, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
157 { LLCC_AUDIO, 6, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
158 { LLCC_MDMHPGRW, 7, 3072, 1, 1, 0x3ff, 0xc00, 0, 0, 0, 1, 0 },
159 { LLCC_MDM, 8, 3072, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
160 { LLCC_MODHW, 9, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
161 { LLCC_CMPT, 10, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
162 { LLCC_GPUHTW, 11, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
163 { LLCC_GPU, 12, 5120, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
164 { LLCC_MMUHWT, 13, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1 },
165 { LLCC_CMPTDMA, 15, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
166 { LLCC_DISP, 16, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
167 { LLCC_VIDFW, 17, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
168 { LLCC_MDMHPFX, 20, 1024, 2, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
169 { LLCC_MDMPNG, 21, 1024, 0, 1, 0xc, 0x0, 0, 0, 0, 1, 0 },
170 { LLCC_AUDHW, 22, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
171 { LLCC_NPU, 23, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
172 { LLCC_WLHW, 24, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0 },
173 { LLCC_MODPE, 29, 512, 1, 1, 0xc, 0x0, 0, 0, 0, 1, 0 },
174 { LLCC_APTCM, 30, 512, 3, 1, 0x0, 0x1, 1, 0, 0, 1, 0 },
175 { LLCC_WRCACHE, 31, 128, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0 },
179 { LLCC_CPUSS, 1, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 1, 0 },
180 { LLCC_VIDSC0, 2, 512, 3, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
181 { LLCC_AUDIO, 6, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0, 0 },
182 { LLCC_CMPT, 10, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0, 0 },
183 { LLCC_GPUHTW, 11, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
184 { LLCC_GPU, 12, 4096, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 1 },
185 { LLCC_MMUHWT, 13, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
186 { LLCC_DISP, 16, 6144, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
187 { LLCC_AUDHW, 22, 2048, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
188 { LLCC_DRE, 26, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
189 { LLCC_CVP, 28, 512, 3, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
190 { LLCC_APTCM, 30, 1024, 3, 1, 0x0, 0x1, 1, 0, 0, 1, 0, 0 },
191 { LLCC_WRCACHE, 31, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
192 { LLCC_CVPFW, 17, 512, 1, 0, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
193 { LLCC_CPUSS1, 3, 2048, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
194 { LLCC_CPUHWT, 5, 512, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
198 { LLCC_CPUSS, 1, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 1 },
199 { LLCC_VIDSC0, 2, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0 },
200 { LLCC_VIDSC1, 3, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0 },
201 { LLCC_ROTATOR, 4, 563, 2, 1, 0x0, 0x00e, 2, 0, 1, 1, 0 },
202 { LLCC_VOICE, 5, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
203 { LLCC_AUDIO, 6, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
204 { LLCC_MDMHPGRW, 7, 1024, 2, 0, 0xfc, 0xf00, 0, 0, 1, 1, 0 },
205 { LLCC_MDM, 8, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
206 { LLCC_CMPT, 10, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
207 { LLCC_GPUHTW, 11, 512, 1, 1, 0xc, 0x0, 0, 0, 1, 1, 0 },
208 { LLCC_GPU, 12, 2304, 1, 0, 0xff0, 0x2, 0, 0, 1, 1, 0 },
209 { LLCC_MMUHWT, 13, 256, 2, 0, 0x0, 0x1, 0, 0, 1, 0, 1 },
210 { LLCC_CMPTDMA, 15, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
211 { LLCC_DISP, 16, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
212 { LLCC_VIDFW, 17, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
213 { LLCC_MDMHPFX, 20, 1024, 2, 1, 0x0, 0xf00, 0, 0, 1, 1, 0 },
214 { LLCC_MDMPNG, 21, 1024, 0, 1, 0x1e, 0x0, 0, 0, 1, 1, 0 },
215 { LLCC_AUDHW, 22, 1024, 1, 1, 0xffc, 0x2, 0, 0, 1, 1, 0 },
219 { LLCC_CPUSS, 1, 768, 1, 0, 0xFFF, 0x0, 0, 0, 0, 0, 1, 1 },
220 { LLCC_MDM, 8, 512, 2, 0, 0xFFF, 0x0, 0, 0, 0, 0, 1, 0 },
221 { LLCC_GPUHTW, 11, 256, 1, 0, 0xFFF, 0x0, 0, 0, 0, 0, 1, 0 },
222 { LLCC_GPU, 12, 512, 1, 0, 0xFFF, 0x0, 0, 0, 0, 0, 1, 0 },
223 { LLCC_MDMPNG, 21, 768, 0, 1, 0xFFF, 0x0, 0, 0, 0, 0, 1, 0 },
224 { LLCC_NPU, 23, 768, 1, 0, 0xFFF, 0x0, 0, 0, 0, 0, 1, 0 },
225 { LLCC_MODPE, 29, 64, 1, 1, 0xFFF, 0x0, 0, 0, 0, 0, 1, 0 },
229 { LLCC_CPUSS, 1, 512, 1, 0, 0xF, 0x0, 0, 0, 0, 1, 1 },
230 { LLCC_MDM, 8, 128, 2, 0, 0xF, 0x0, 0, 0, 0, 1, 0 },
231 { LLCC_GPUHTW, 11, 256, 1, 1, 0xF, 0x0, 0, 0, 0, 1, 0 },
232 { LLCC_GPU, 12, 256, 1, 1, 0xF, 0x0, 0, 0, 0, 1, 0 },
233 { LLCC_NPU, 23, 512, 1, 0, 0xF, 0x0, 0, 0, 0, 1, 0 },
237 { LLCC_CPUSS, 1, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 1 },
238 { LLCC_VIDSC0, 2, 512, 2, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
239 { LLCC_VIDSC1, 3, 512, 2, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
240 { LLCC_AUDIO, 6, 1024, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
241 { LLCC_MDMHPGRW, 7, 3072, 1, 0, 0xFF, 0xF00, 0, 0, 0, 1, 0 },
242 { LLCC_MDM, 8, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
243 { LLCC_MODHW, 9, 1024, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
244 { LLCC_CMPT, 10, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
245 { LLCC_GPUHTW , 11, 512, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
246 { LLCC_GPU, 12, 2560, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
247 { LLCC_MMUHWT, 13, 1024, 1, 1, 0xFFF, 0x0, 0, 0, 0, 0, 1 },
248 { LLCC_CMPTDMA, 15, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
249 { LLCC_DISP, 16, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
250 { LLCC_MDMHPFX, 20, 1024, 2, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
251 { LLCC_MDMHPFX, 21, 1024, 0, 1, 0xF, 0x0, 0, 0, 0, 1, 0 },
252 { LLCC_AUDHW, 22, 1024, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
253 { LLCC_NPU, 23, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
254 { LLCC_WLHW, 24, 3072, 1, 1, 0xFFF, 0x0, 0, 0, 0, 1, 0 },
255 { LLCC_MODPE, 29, 256, 1, 1, 0xF, 0x0, 0, 0, 0, 1, 0 },
256 { LLCC_APTCM, 30, 256, 3, 1, 0x0, 0x1, 1, 0, 0, 1, 0 },
257 { LLCC_WRCACHE, 31, 128, 1, 1, 0xFFF, 0x0, 0, 0, 0, 0, 0 },
261 { LLCC_CPUSS, 1, 3072, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 1, 0 },
262 { LLCC_VIDSC0, 2, 512, 3, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
263 { LLCC_AUDIO, 6, 1024, 1, 0, 0xfff, 0x0, 0, 0, 0, 0, 0, 0 },
264 { LLCC_CMPT, 10, 1024, 1, 0, 0xfff, 0x0, 0, 0, 0, 0, 0, 0 },
265 { LLCC_GPUHTW, 11, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
266 { LLCC_GPU, 12, 1024, 1, 0, 0xfff, 0x0, 0, 0, 0, 1, 0, 1 },
267 { LLCC_MMUHWT, 13, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
268 { LLCC_CMPTDMA, 15, 1024, 1, 0, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
269 { LLCC_DISP, 16, 3072, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
270 { LLCC_VIDFW, 17, 512, 1, 0, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
271 { LLCC_AUDHW, 22, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
272 { LLCC_NPU, 23, 3072, 1, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
273 { LLCC_WLHW, 24, 1024, 1, 0, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
274 { LLCC_CVP, 28, 256, 3, 1, 0xfff, 0x0, 0, 0, 0, 1, 0, 0 },
275 { LLCC_APTCM, 30, 128, 3, 0, 0x0, 0x3, 1, 0, 0, 1, 0, 0 },
276 { LLCC_WRCACHE, 31, 256, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
280 { LLCC_CPUSS, 1, 3072, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 1 },
281 { LLCC_VIDSC0, 2, 512, 3, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
282 { LLCC_AUDIO, 6, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0, 0 },
283 { LLCC_MDMHPGRW, 7, 1024, 3, 0, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
284 { LLCC_MODHW, 9, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
285 { LLCC_CMPT, 10, 3072, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
286 { LLCC_GPUHTW, 11, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
287 { LLCC_GPU, 12, 1024, 1, 0, 0xfff, 0x0, 0, 0, 0, 1, 1, 0 },
288 { LLCC_MMUHWT, 13, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0, 1 },
289 { LLCC_DISP, 16, 3072, 2, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
290 { LLCC_MDMPNG, 21, 1024, 0, 1, 0xf, 0x0, 0, 0, 0, 0, 1, 0 },
291 { LLCC_AUDHW, 22, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
292 { LLCC_CVP, 28, 512, 3, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
293 { LLCC_MODPE, 29, 256, 1, 1, 0xf, 0x0, 0, 0, 0, 0, 1, 0 },
294 { LLCC_APTCM, 30, 1024, 3, 1, 0x0, 0x1, 1, 0, 0, 0, 1, 0 },
295 { LLCC_WRCACHE, 31, 512, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0, 1 },
296 { LLCC_CVPFW, 17, 512, 1, 0, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
297 { LLCC_CPUSS1, 3, 1024, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 1, 0 },
298 { LLCC_CPUHWT, 5, 512, 1, 1, 0xfff, 0x0, 0, 0, 0, 0, 0, 1 },
302 {LLCC_CPUSS, 1, 3072, 1, 0, 0xFFFF, 0x0, 0, 0, 0, 1, 1, 0, 0 },
303 {LLCC_VIDSC0, 2, 512, 3, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
304 {LLCC_AUDIO, 6, 1024, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 0, 0, 0, 0 },
305 {LLCC_MDMHPGRW, 7, 1024, 3, 0, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
306 {LLCC_MODHW, 9, 1024, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
307 {LLCC_CMPT, 10, 4096, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
308 {LLCC_GPUHTW, 11, 512, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
309 {LLCC_GPU, 12, 2048, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 1, 0 },
310 {LLCC_MMUHWT, 13, 768, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 0, 1, 0, 0 },
311 {LLCC_DISP, 16, 4096, 2, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
312 {LLCC_MDMPNG, 21, 1024, 1, 1, 0xF000, 0x0, 0, 0, 0, 1, 0, 0, 0 },
313 {LLCC_AUDHW, 22, 1024, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 0, 0, 0, 0 },
314 {LLCC_CVP, 28, 256, 3, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
315 {LLCC_MODPE, 29, 64, 1, 1, 0xF000, 0x0, 0, 0, 0, 1, 0, 0, 0 },
316 {LLCC_APTCM, 30, 1024, 3, 1, 0x0, 0xF0, 1, 0, 0, 1, 0, 0, 0 },
317 {LLCC_WRCACHE, 31, 512, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 0, 1, 0, 0 },
318 {LLCC_CVPFW, 17, 512, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
319 {LLCC_CPUSS1, 3, 1024, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
320 {LLCC_CAMEXP0, 4, 256, 3, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
321 {LLCC_CPUMTE, 23, 256, 1, 1, 0x0FFF, 0x0, 0, 0, 0, 0, 1, 0, 0 },
322 {LLCC_CPUHWT, 5, 512, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 1, 0, 0 },
323 {LLCC_CAMEXP1, 27, 256, 3, 1, 0xFFFF, 0x0, 0, 0, 0, 1, 0, 0, 0 },
324 {LLCC_AENPU, 8, 2048, 1, 1, 0xFFFF, 0x0, 0, 0, 0, 0, 0, 0, 0 },
328 {LLCC_CPUSS, 1, 5120, 1, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
352 {LLCC_CAMEXP3, 20, 3200, 2, 1, 0xFFFFF0, 0x0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
353 {LLCC_CAMEXP4, 21, 3200, 2, 1, 0xFFFFF0, 0x0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
354 {LLCC_DISP_WB, 23, 1024, 4, 1, 0xFFFFFF, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
355 {LLCC_DISP_1, 24, 6144, 1, 1, 0xFFFFFF, 0x0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
356 {LLCC_VIDVSP, 28, 256, 4, 1, 0xFFFFFF, 0x0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
360 .trp_ecc_error_status0 = 0x20344,
361 .trp_ecc_error_status1 = 0x20348,
362 .trp_ecc_sb_err_syn0 = 0x2304c,
363 .trp_ecc_db_err_syn0 = 0x20370,
364 .trp_ecc_error_cntr_clear = 0x20440,
365 .trp_interrupt_0_status = 0x20480,
366 .trp_interrupt_0_clear = 0x20484,
367 .trp_interrupt_0_enable = 0x20488,
370 .cmn_status0 = 0x3000c,
371 .cmn_interrupt_0_enable = 0x3001c,
372 .cmn_interrupt_2_enable = 0x3003c,
375 .drp_ecc_error_cfg = 0x40000,
376 .drp_ecc_error_cntr_clear = 0x40004,
377 .drp_interrupt_status = 0x41000,
378 .drp_interrupt_clear = 0x41008,
379 .drp_interrupt_enable = 0x4100c,
380 .drp_ecc_error_status0 = 0x42044,
381 .drp_ecc_error_status1 = 0x42048,
382 .drp_ecc_sb_err_syn0 = 0x4204c,
383 .drp_ecc_db_err_syn0 = 0x42070,
387 .trp_ecc_error_status0 = 0x20344,
388 .trp_ecc_error_status1 = 0x20348,
389 .trp_ecc_sb_err_syn0 = 0x2034c,
390 .trp_ecc_db_err_syn0 = 0x20370,
391 .trp_ecc_error_cntr_clear = 0x20440,
392 .trp_interrupt_0_status = 0x20480,
393 .trp_interrupt_0_clear = 0x20484,
394 .trp_interrupt_0_enable = 0x20488,
397 .cmn_status0 = 0x3400c,
398 .cmn_interrupt_0_enable = 0x3401c,
399 .cmn_interrupt_2_enable = 0x3403c,
402 .drp_ecc_error_cfg = 0x50000,
403 .drp_ecc_error_cntr_clear = 0x50004,
404 .drp_interrupt_status = 0x50020,
405 .drp_interrupt_clear = 0x50028,
406 .drp_interrupt_enable = 0x5002c,
407 .drp_ecc_error_status0 = 0x520f4,
408 .drp_ecc_error_status1 = 0x520f8,
409 .drp_ecc_sb_err_syn0 = 0x520fc,
410 .drp_ecc_db_err_syn0 = 0x52120,
415 [LLCC_COMMON_HW_INFO] = 0x00030000,
416 [LLCC_COMMON_STATUS0] = 0x0003000c,
421 [LLCC_COMMON_HW_INFO] = 0x00034000,
422 [LLCC_COMMON_STATUS0] = 0x0003400c,
522 static struct llcc_drv_data *drv_data = (void *) -EPROBE_DEFER;
525 * llcc_slice_getd - get llcc slice descriptor
540 cfg = drv_data->cfg; in llcc_slice_getd()
541 sz = drv_data->cfg_size; in llcc_slice_getd()
543 for (count = 0; cfg && count < sz; count++, cfg++) in llcc_slice_getd()
544 if (cfg->usecase_id == uid) in llcc_slice_getd()
548 return ERR_PTR(-ENODEV); in llcc_slice_getd()
552 return ERR_PTR(-ENOMEM); in llcc_slice_getd()
554 desc->slice_id = cfg->slice_id; in llcc_slice_getd()
555 desc->slice_size = cfg->max_cap; in llcc_slice_getd()
562 * llcc_slice_putd - llcc slice descritpor
590 ret = regmap_write(drv_data->bcast_regmap, act_ctrl_reg, in llcc_update_act_ctrl()
597 ret = regmap_write(drv_data->bcast_regmap, act_ctrl_reg, in llcc_update_act_ctrl()
602 if (drv_data->version >= LLCC_VERSION_4_1_0_0) { in llcc_update_act_ctrl()
603 ret = regmap_read_poll_timeout(drv_data->bcast_regmap, status_reg, in llcc_update_act_ctrl()
605 0, LLCC_STATUS_READ_DELAY); in llcc_update_act_ctrl()
610 ret = regmap_read_poll_timeout(drv_data->bcast_regmap, status_reg, in llcc_update_act_ctrl()
612 0, LLCC_STATUS_READ_DELAY); in llcc_update_act_ctrl()
616 if (drv_data->version >= LLCC_VERSION_4_1_0_0) in llcc_update_act_ctrl()
617 ret = regmap_write(drv_data->bcast_regmap, act_clear_reg, in llcc_update_act_ctrl()
624 * llcc_slice_activate - Activate the llcc slice
639 return -EINVAL; in llcc_slice_activate()
641 mutex_lock(&drv_data->lock); in llcc_slice_activate()
642 if (test_bit(desc->slice_id, drv_data->bitmap)) { in llcc_slice_activate()
643 mutex_unlock(&drv_data->lock); in llcc_slice_activate()
644 return 0; in llcc_slice_activate()
649 ret = llcc_update_act_ctrl(desc->slice_id, act_ctrl_val, in llcc_slice_activate()
652 mutex_unlock(&drv_data->lock); in llcc_slice_activate()
656 __set_bit(desc->slice_id, drv_data->bitmap); in llcc_slice_activate()
657 mutex_unlock(&drv_data->lock); in llcc_slice_activate()
664 * llcc_slice_deactivate - Deactivate the llcc slice
679 return -EINVAL; in llcc_slice_deactivate()
681 mutex_lock(&drv_data->lock); in llcc_slice_deactivate()
682 if (!test_bit(desc->slice_id, drv_data->bitmap)) { in llcc_slice_deactivate()
683 mutex_unlock(&drv_data->lock); in llcc_slice_deactivate()
684 return 0; in llcc_slice_deactivate()
688 ret = llcc_update_act_ctrl(desc->slice_id, act_ctrl_val, in llcc_slice_deactivate()
691 mutex_unlock(&drv_data->lock); in llcc_slice_deactivate()
695 __clear_bit(desc->slice_id, drv_data->bitmap); in llcc_slice_deactivate()
696 mutex_unlock(&drv_data->lock); in llcc_slice_deactivate()
703 * llcc_get_slice_id - return the slice id
709 return -EINVAL; in llcc_get_slice_id()
711 return desc->slice_id; in llcc_get_slice_id()
716 * llcc_get_slice_size - return the slice id
722 return 0; in llcc_get_slice_size()
724 return desc->slice_size; in llcc_get_slice_size()
741 attr1_val = config->cache_mode; in _qcom_llcc_cfg_program()
742 attr1_val |= config->probe_target_ways << ATTR1_PROBE_TARGET_WAYS_SHIFT; in _qcom_llcc_cfg_program()
743 attr1_val |= config->fixed_size << ATTR1_FIXED_SIZE_SHIFT; in _qcom_llcc_cfg_program()
744 attr1_val |= config->priority << ATTR1_PRIORITY_SHIFT; in _qcom_llcc_cfg_program()
746 max_cap_cacheline = MAX_CAP_TO_BYTES(config->max_cap); in _qcom_llcc_cfg_program()
755 max_cap_cacheline = max_cap_cacheline / drv_data->num_banks; in _qcom_llcc_cfg_program()
759 attr1_cfg = LLCC_TRP_ATTR1_CFGn(config->slice_id); in _qcom_llcc_cfg_program()
761 ret = regmap_write(drv_data->bcast_regmap, attr1_cfg, attr1_val); in _qcom_llcc_cfg_program()
765 if (drv_data->version >= LLCC_VERSION_4_1_0_0) { in _qcom_llcc_cfg_program()
766 attr2_cfg = LLCC_TRP_ATTR2_CFGn(config->slice_id); in _qcom_llcc_cfg_program()
767 attr0_val = config->res_ways; in _qcom_llcc_cfg_program()
768 attr2_val = config->bonus_ways; in _qcom_llcc_cfg_program()
770 attr0_val = config->res_ways & ATTR0_RES_WAYS_MASK; in _qcom_llcc_cfg_program()
771 attr0_val |= config->bonus_ways << ATTR0_BONUS_WAYS_SHIFT; in _qcom_llcc_cfg_program()
774 attr0_cfg = LLCC_TRP_ATTR0_CFGn(config->slice_id); in _qcom_llcc_cfg_program()
776 ret = regmap_write(drv_data->bcast_regmap, attr0_cfg, attr0_val); in _qcom_llcc_cfg_program()
780 if (drv_data->version >= LLCC_VERSION_4_1_0_0) { in _qcom_llcc_cfg_program()
781 ret = regmap_write(drv_data->bcast_regmap, attr2_cfg, attr2_val); in _qcom_llcc_cfg_program()
786 if (cfg->need_llcc_cfg) { in _qcom_llcc_cfg_program()
789 disable_cap_alloc = config->dis_cap_alloc << config->slice_id; in _qcom_llcc_cfg_program()
790 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_SCID_DIS_CAP_ALLOC, in _qcom_llcc_cfg_program()
791 BIT(config->slice_id), disable_cap_alloc); in _qcom_llcc_cfg_program()
795 if (drv_data->version < LLCC_VERSION_4_1_0_0) { in _qcom_llcc_cfg_program()
796 retain_pc = config->retain_on_pc << config->slice_id; in _qcom_llcc_cfg_program()
797 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_PCB_ACT, in _qcom_llcc_cfg_program()
798 BIT(config->slice_id), retain_pc); in _qcom_llcc_cfg_program()
804 if (drv_data->version >= LLCC_VERSION_2_0_0_0) { in _qcom_llcc_cfg_program()
807 wren = config->write_scid_en << config->slice_id; in _qcom_llcc_cfg_program()
808 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_WRSC_EN, in _qcom_llcc_cfg_program()
809 BIT(config->slice_id), wren); in _qcom_llcc_cfg_program()
814 if (drv_data->version >= LLCC_VERSION_2_1_0_0) { in _qcom_llcc_cfg_program()
817 wr_cache_en = config->write_scid_cacheable_en << config->slice_id; in _qcom_llcc_cfg_program()
818 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_WRSC_CACHEABLE_EN, in _qcom_llcc_cfg_program()
819 BIT(config->slice_id), wr_cache_en); in _qcom_llcc_cfg_program()
824 if (drv_data->version >= LLCC_VERSION_4_1_0_0) { in _qcom_llcc_cfg_program()
834 stale_en = config->stale_en << config->slice_id; in _qcom_llcc_cfg_program()
835 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG1, in _qcom_llcc_cfg_program()
836 BIT(config->slice_id), stale_en); in _qcom_llcc_cfg_program()
840 stale_cap_en = config->stale_cap_en << config->slice_id; in _qcom_llcc_cfg_program()
841 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG2, in _qcom_llcc_cfg_program()
842 BIT(config->slice_id), stale_cap_en); in _qcom_llcc_cfg_program()
846 mru_uncap_en = config->mru_uncap_en << config->slice_id; in _qcom_llcc_cfg_program()
847 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG3, in _qcom_llcc_cfg_program()
848 BIT(config->slice_id), mru_uncap_en); in _qcom_llcc_cfg_program()
852 mru_rollover = config->mru_rollover << config->slice_id; in _qcom_llcc_cfg_program()
853 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG4, in _qcom_llcc_cfg_program()
854 BIT(config->slice_id), mru_rollover); in _qcom_llcc_cfg_program()
858 alloc_oneway_en = config->alloc_oneway_en << config->slice_id; in _qcom_llcc_cfg_program()
859 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG5, in _qcom_llcc_cfg_program()
860 BIT(config->slice_id), alloc_oneway_en); in _qcom_llcc_cfg_program()
864 ovcap_en = config->ovcap_en << config->slice_id; in _qcom_llcc_cfg_program()
865 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG6, in _qcom_llcc_cfg_program()
866 BIT(config->slice_id), ovcap_en); in _qcom_llcc_cfg_program()
870 ovcap_prio = config->ovcap_prio << config->slice_id; in _qcom_llcc_cfg_program()
871 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG7, in _qcom_llcc_cfg_program()
872 BIT(config->slice_id), ovcap_prio); in _qcom_llcc_cfg_program()
876 vict_prio = config->vict_prio << config->slice_id; in _qcom_llcc_cfg_program()
877 ret = regmap_update_bits(drv_data->bcast_regmap, LLCC_TRP_ALGO_CFG8, in _qcom_llcc_cfg_program()
878 BIT(config->slice_id), vict_prio); in _qcom_llcc_cfg_program()
883 if (config->activate_on_init) { in _qcom_llcc_cfg_program()
884 desc.slice_id = config->slice_id; in _qcom_llcc_cfg_program()
896 int ret = 0; in qcom_llcc_cfg_program()
899 sz = drv_data->cfg_size; in qcom_llcc_cfg_program()
900 llcc_table = drv_data->cfg; in qcom_llcc_cfg_program()
902 for (i = 0; i < sz; i++) { in qcom_llcc_cfg_program()
914 drv_data = ERR_PTR(-ENODEV); in qcom_llcc_remove()
915 return 0; in qcom_llcc_remove()
934 return devm_regmap_init_mmio(&pdev->dev, base, &llcc_regmap_config); in qcom_llcc_init_mmio()
940 struct device *dev = &pdev->dev; in qcom_llcc_probe()
950 return -EBUSY; in qcom_llcc_probe()
954 ret = -ENOMEM; in qcom_llcc_probe()
959 regmap = qcom_llcc_init_mmio(pdev, 0, "llcc0_base"); in qcom_llcc_probe()
965 cfg = of_device_get_match_data(&pdev->dev); in qcom_llcc_probe()
967 ret = regmap_read(regmap, cfg->reg_offset[LLCC_COMMON_STATUS0], &num_banks); in qcom_llcc_probe()
973 drv_data->num_banks = num_banks; in qcom_llcc_probe()
975 drv_data->regmaps = devm_kcalloc(dev, num_banks, sizeof(*drv_data->regmaps), GFP_KERNEL); in qcom_llcc_probe()
976 if (!drv_data->regmaps) { in qcom_llcc_probe()
977 ret = -ENOMEM; in qcom_llcc_probe()
981 drv_data->regmaps[0] = regmap; in qcom_llcc_probe()
984 for (i = 1; i < num_banks; i++) { in qcom_llcc_probe()
987 drv_data->regmaps[i] = qcom_llcc_init_mmio(pdev, i, base); in qcom_llcc_probe()
988 if (IS_ERR(drv_data->regmaps[i])) { in qcom_llcc_probe()
989 ret = PTR_ERR(drv_data->regmaps[i]); in qcom_llcc_probe()
997 drv_data->bcast_regmap = qcom_llcc_init_mmio(pdev, i, "llcc_broadcast_base"); in qcom_llcc_probe()
998 if (IS_ERR(drv_data->bcast_regmap)) { in qcom_llcc_probe()
999 ret = PTR_ERR(drv_data->bcast_regmap); in qcom_llcc_probe()
1004 ret = regmap_read(drv_data->bcast_regmap, cfg->reg_offset[LLCC_COMMON_HW_INFO], in qcom_llcc_probe()
1009 drv_data->version = version; in qcom_llcc_probe()
1011 llcc_cfg = cfg->sct_data; in qcom_llcc_probe()
1012 sz = cfg->size; in qcom_llcc_probe()
1014 for (i = 0; i < sz; i++) in qcom_llcc_probe()
1015 if (llcc_cfg[i].slice_id > drv_data->max_slices) in qcom_llcc_probe()
1016 drv_data->max_slices = llcc_cfg[i].slice_id; in qcom_llcc_probe()
1018 drv_data->bitmap = devm_bitmap_zalloc(dev, drv_data->max_slices, in qcom_llcc_probe()
1020 if (!drv_data->bitmap) { in qcom_llcc_probe()
1021 ret = -ENOMEM; in qcom_llcc_probe()
1025 drv_data->cfg = llcc_cfg; in qcom_llcc_probe()
1026 drv_data->cfg_size = sz; in qcom_llcc_probe()
1027 drv_data->edac_reg_offset = cfg->edac_reg_offset; in qcom_llcc_probe()
1028 mutex_init(&drv_data->lock); in qcom_llcc_probe()
1035 drv_data->ecc_irq = platform_get_irq_optional(pdev, 0); in qcom_llcc_probe()
1043 if (!cfg->no_edac) { in qcom_llcc_probe()
1044 llcc_edac = platform_device_register_data(&pdev->dev, in qcom_llcc_probe()
1045 "qcom_llcc_edac", -1, drv_data, in qcom_llcc_probe()
1051 return 0; in qcom_llcc_probe()
1053 drv_data = ERR_PTR(-ENODEV); in qcom_llcc_probe()
1058 { .compatible = "qcom,sc7180-llcc", .data = &sc7180_cfg },
1059 { .compatible = "qcom,sc7280-llcc", .data = &sc7280_cfg },
1060 { .compatible = "qcom,sc8180x-llcc", .data = &sc8180x_cfg },
1061 { .compatible = "qcom,sc8280xp-llcc", .data = &sc8280xp_cfg },
1062 { .compatible = "qcom,sdm845-llcc", .data = &sdm845_cfg },
1063 { .compatible = "qcom,sm6350-llcc", .data = &sm6350_cfg },
1064 { .compatible = "qcom,sm7150-llcc", .data = &sm7150_cfg },
1065 { .compatible = "qcom,sm8150-llcc", .data = &sm8150_cfg },
1066 { .compatible = "qcom,sm8250-llcc", .data = &sm8250_cfg },
1067 { .compatible = "qcom,sm8350-llcc", .data = &sm8350_cfg },
1068 { .compatible = "qcom,sm8450-llcc", .data = &sm8450_cfg },
1069 { .compatible = "qcom,sm8550-llcc", .data = &sm8550_cfg },
1076 .name = "qcom-llcc",