• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
4  *
5  */
6 
7 #include <linux/platform_device.h>
8 #ifndef __LLCC_QCOM__
9 #define __LLCC_QCOM__
10 
11 #define LLCC_CPUSS       1
12 #define LLCC_VIDSC0      2
13 #define LLCC_VIDSC1      3
14 #define LLCC_ROTATOR     4
15 #define LLCC_VOICE       5
16 #define LLCC_AUDIO       6
17 #define LLCC_MDMHPGRW    7
18 #define LLCC_MDM         8
19 #define LLCC_MODHW       9
20 #define LLCC_CMPT        10
21 #define LLCC_GPUHTW      11
22 #define LLCC_GPU         12
23 #define LLCC_MMUHWT      13
24 #define LLCC_CMPTDMA     15
25 #define LLCC_DISP        16
26 #define LLCC_VIDFW       17
27 #define LLCC_MDMHPFX     20
28 #define LLCC_MDMPNG      21
29 #define LLCC_AUDHW       22
30 #define LLCC_NPU         23
31 #define LLCC_WLHW        24
32 #define LLCC_CVP         28
33 #define LLCC_MODPE       29
34 #define LLCC_APTCM       30
35 #define LLCC_WRCACHE     31
36 
37 /**
38  * struct llcc_slice_desc - Cache slice descriptor
39  * @slice_id: llcc slice id
40  * @slice_size: Size allocated for the llcc slice
41  */
42 struct llcc_slice_desc {
43 	u32 slice_id;
44 	size_t slice_size;
45 };
46 
47 /**
48  * struct llcc_edac_reg_data - llcc edac registers data for each error type
49  * @name: Name of the error
50  * @synd_reg: Syndrome register address
51  * @count_status_reg: Status register address to read the error count
52  * @ways_status_reg: Status register address to read the error ways
53  * @reg_cnt: Number of registers
54  * @count_mask: Mask value to get the error count
55  * @ways_mask: Mask value to get the error ways
56  * @count_shift: Shift value to get the error count
57  * @ways_shift: Shift value to get the error ways
58  */
59 struct llcc_edac_reg_data {
60 	char *name;
61 	u64 synd_reg;
62 	u64 count_status_reg;
63 	u64 ways_status_reg;
64 	u32 reg_cnt;
65 	u32 count_mask;
66 	u32 ways_mask;
67 	u8  count_shift;
68 	u8  ways_shift;
69 };
70 
71 /**
72  * struct llcc_drv_data - Data associated with the llcc driver
73  * @regmap: regmap associated with the llcc device
74  * @bcast_regmap: regmap associated with llcc broadcast offset
75  * @cfg: pointer to the data structure for slice configuration
76  * @lock: mutex associated with each slice
77  * @cfg_size: size of the config data table
78  * @max_slices: max slices as read from device tree
79  * @num_banks: Number of llcc banks
80  * @bitmap: Bit map to track the active slice ids
81  * @offsets: Pointer to the bank offsets array
82  * @ecc_irq: interrupt for llcc cache error detection and reporting
83  * @major_version: Indicates the LLCC major version
84  */
85 struct llcc_drv_data {
86 	struct regmap *regmap;
87 	struct regmap *bcast_regmap;
88 	const struct llcc_slice_config *cfg;
89 	struct mutex lock;
90 	u32 cfg_size;
91 	u32 max_slices;
92 	u32 num_banks;
93 	unsigned long *bitmap;
94 	u32 *offsets;
95 	int ecc_irq;
96 	u32 major_version;
97 };
98 
99 #if IS_ENABLED(CONFIG_QCOM_LLCC)
100 /**
101  * llcc_slice_getd - get llcc slice descriptor
102  * @uid: usecase_id of the client
103  */
104 struct llcc_slice_desc *llcc_slice_getd(u32 uid);
105 
106 /**
107  * llcc_slice_putd - llcc slice descritpor
108  * @desc: Pointer to llcc slice descriptor
109  */
110 void llcc_slice_putd(struct llcc_slice_desc *desc);
111 
112 /**
113  * llcc_get_slice_id - get slice id
114  * @desc: Pointer to llcc slice descriptor
115  */
116 int llcc_get_slice_id(struct llcc_slice_desc *desc);
117 
118 /**
119  * llcc_get_slice_size - llcc slice size
120  * @desc: Pointer to llcc slice descriptor
121  */
122 size_t llcc_get_slice_size(struct llcc_slice_desc *desc);
123 
124 /**
125  * llcc_slice_activate - Activate the llcc slice
126  * @desc: Pointer to llcc slice descriptor
127  */
128 int llcc_slice_activate(struct llcc_slice_desc *desc);
129 
130 /**
131  * llcc_slice_deactivate - Deactivate the llcc slice
132  * @desc: Pointer to llcc slice descriptor
133  */
134 int llcc_slice_deactivate(struct llcc_slice_desc *desc);
135 
136 #else
llcc_slice_getd(u32 uid)137 static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
138 {
139 	return NULL;
140 }
141 
llcc_slice_putd(struct llcc_slice_desc * desc)142 static inline void llcc_slice_putd(struct llcc_slice_desc *desc)
143 {
144 
145 };
146 
llcc_get_slice_id(struct llcc_slice_desc * desc)147 static inline int llcc_get_slice_id(struct llcc_slice_desc *desc)
148 {
149 	return -EINVAL;
150 }
151 
llcc_get_slice_size(struct llcc_slice_desc * desc)152 static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc)
153 {
154 	return 0;
155 }
llcc_slice_activate(struct llcc_slice_desc * desc)156 static inline int llcc_slice_activate(struct llcc_slice_desc *desc)
157 {
158 	return -EINVAL;
159 }
160 
llcc_slice_deactivate(struct llcc_slice_desc * desc)161 static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc)
162 {
163 	return -EINVAL;
164 }
165 #endif
166 
167 #endif
168