1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
7 #include <linux/platform_device.h>
14 #define LLCC_ROTATOR 4
17 #define LLCC_MDMHPGRW 7
21 #define LLCC_GPUHTW 11
23 #define LLCC_MMUHWT 13
24 #define LLCC_CMPTDMA 15
27 #define LLCC_MDMHPFX 20
28 #define LLCC_MDMPNG 21
37 #define LLCC_WRCACHE 31
39 #define LLCC_CPUSS1 33
40 #define LLCC_CAMEXP0 34
41 #define LLCC_CPUMTE 35
42 #define LLCC_CPUHWT 36
43 #define LLCC_MDMCLAD2 37
44 #define LLCC_CAMEXP1 38
48 * struct llcc_slice_desc - Cache slice descriptor
49 * @slice_id: llcc slice id
50 * @slice_size: Size allocated for the llcc slice
52 struct llcc_slice_desc {
58 * struct llcc_edac_reg_data - llcc edac registers data for each error type
59 * @name: Name of the error
60 * @synd_reg: Syndrome register address
61 * @count_status_reg: Status register address to read the error count
62 * @ways_status_reg: Status register address to read the error ways
63 * @reg_cnt: Number of registers
64 * @count_mask: Mask value to get the error count
65 * @ways_mask: Mask value to get the error ways
66 * @count_shift: Shift value to get the error count
67 * @ways_shift: Shift value to get the error ways
69 struct llcc_edac_reg_data {
81 struct llcc_edac_reg_offset {
82 /* LLCC TRP registers */
83 u32 trp_ecc_error_status0;
84 u32 trp_ecc_error_status1;
85 u32 trp_ecc_sb_err_syn0;
86 u32 trp_ecc_db_err_syn0;
87 u32 trp_ecc_error_cntr_clear;
88 u32 trp_interrupt_0_status;
89 u32 trp_interrupt_0_clear;
90 u32 trp_interrupt_0_enable;
92 /* LLCC Common registers */
94 u32 cmn_interrupt_0_enable;
95 u32 cmn_interrupt_2_enable;
97 /* LLCC DRP registers */
98 u32 drp_ecc_error_cfg;
99 u32 drp_ecc_error_cntr_clear;
100 u32 drp_interrupt_status;
101 u32 drp_interrupt_clear;
102 u32 drp_interrupt_enable;
103 u32 drp_ecc_error_status0;
104 u32 drp_ecc_error_status1;
105 u32 drp_ecc_sb_err_syn0;
106 u32 drp_ecc_db_err_syn0;
110 * struct llcc_drv_data - Data associated with the llcc driver
111 * @regmaps: regmaps associated with the llcc device
112 * @bcast_regmap: regmap associated with llcc broadcast offset
113 * @cfg: pointer to the data structure for slice configuration
114 * @edac_reg_offset: Offset of the LLCC EDAC registers
115 * @lock: mutex associated with each slice
116 * @cfg_size: size of the config data table
117 * @max_slices: max slices as read from device tree
118 * @num_banks: Number of llcc banks
119 * @bitmap: Bit map to track the active slice ids
120 * @ecc_irq: interrupt for llcc cache error detection and reporting
121 * @version: Indicates the LLCC version
123 struct llcc_drv_data {
124 struct regmap **regmaps;
125 struct regmap *bcast_regmap;
126 const struct llcc_slice_config *cfg;
127 const struct llcc_edac_reg_offset *edac_reg_offset;
132 unsigned long *bitmap;
137 #if IS_ENABLED(CONFIG_QCOM_LLCC)
139 * llcc_slice_getd - get llcc slice descriptor
140 * @uid: usecase_id of the client
142 struct llcc_slice_desc *llcc_slice_getd(u32 uid);
145 * llcc_slice_putd - llcc slice descritpor
146 * @desc: Pointer to llcc slice descriptor
148 void llcc_slice_putd(struct llcc_slice_desc *desc);
151 * llcc_get_slice_id - get slice id
152 * @desc: Pointer to llcc slice descriptor
154 int llcc_get_slice_id(struct llcc_slice_desc *desc);
157 * llcc_get_slice_size - llcc slice size
158 * @desc: Pointer to llcc slice descriptor
160 size_t llcc_get_slice_size(struct llcc_slice_desc *desc);
163 * llcc_slice_activate - Activate the llcc slice
164 * @desc: Pointer to llcc slice descriptor
166 int llcc_slice_activate(struct llcc_slice_desc *desc);
169 * llcc_slice_deactivate - Deactivate the llcc slice
170 * @desc: Pointer to llcc slice descriptor
172 int llcc_slice_deactivate(struct llcc_slice_desc *desc);
175 static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
180 static inline void llcc_slice_putd(struct llcc_slice_desc *desc)
185 static inline int llcc_get_slice_id(struct llcc_slice_desc *desc)
190 static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc)
194 static inline int llcc_slice_activate(struct llcc_slice_desc *desc)
199 static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc)