1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 2 /* 3 * Copyright (c) 2017-2018, The Linux Foundati 3 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. 4 * 4 * 5 */ 5 */ 6 6 7 #include <linux/platform_device.h> 7 #include <linux/platform_device.h> 8 #ifndef __LLCC_QCOM__ 8 #ifndef __LLCC_QCOM__ 9 #define __LLCC_QCOM__ 9 #define __LLCC_QCOM__ 10 10 11 #define LLCC_CPUSS 1 11 #define LLCC_CPUSS 1 12 #define LLCC_VIDSC0 2 12 #define LLCC_VIDSC0 2 13 #define LLCC_VIDSC1 3 13 #define LLCC_VIDSC1 3 14 #define LLCC_ROTATOR 4 14 #define LLCC_ROTATOR 4 15 #define LLCC_VOICE 5 15 #define LLCC_VOICE 5 16 #define LLCC_AUDIO 6 16 #define LLCC_AUDIO 6 17 #define LLCC_MDMHPGRW 7 17 #define LLCC_MDMHPGRW 7 18 #define LLCC_MDM 8 18 #define LLCC_MDM 8 19 #define LLCC_MODHW 9 19 #define LLCC_MODHW 9 20 #define LLCC_CMPT 10 20 #define LLCC_CMPT 10 21 #define LLCC_GPUHTW 11 21 #define LLCC_GPUHTW 11 22 #define LLCC_GPU 12 22 #define LLCC_GPU 12 23 #define LLCC_MMUHWT 13 23 #define LLCC_MMUHWT 13 24 #define LLCC_CMPTDMA 15 24 #define LLCC_CMPTDMA 15 25 #define LLCC_DISP 16 25 #define LLCC_DISP 16 26 #define LLCC_VIDFW 17 26 #define LLCC_VIDFW 17 27 #define LLCC_MDMHPFX 20 27 #define LLCC_MDMHPFX 20 28 #define LLCC_MDMPNG 21 28 #define LLCC_MDMPNG 21 29 #define LLCC_AUDHW 22 29 #define LLCC_AUDHW 22 30 #define LLCC_NPU 23 30 #define LLCC_NPU 23 31 #define LLCC_WLHW 24 31 #define LLCC_WLHW 24 32 #define LLCC_PIMEM 25 32 #define LLCC_PIMEM 25 33 #define LLCC_ECC 26 33 #define LLCC_ECC 26 34 #define LLCC_CVP 28 34 #define LLCC_CVP 28 35 #define LLCC_MODPE 29 35 #define LLCC_MODPE 29 36 #define LLCC_APTCM 30 36 #define LLCC_APTCM 30 37 #define LLCC_WRCACHE 31 37 #define LLCC_WRCACHE 31 38 #define LLCC_CVPFW 32 38 #define LLCC_CVPFW 32 39 #define LLCC_CPUSS1 33 39 #define LLCC_CPUSS1 33 40 #define LLCC_CAMEXP0 34 40 #define LLCC_CAMEXP0 34 41 #define LLCC_CPUMTE 35 41 #define LLCC_CPUMTE 35 42 #define LLCC_CPUHWT 36 42 #define LLCC_CPUHWT 36 43 #define LLCC_MDMCLAD2 37 43 #define LLCC_MDMCLAD2 37 44 #define LLCC_CAMEXP1 38 44 #define LLCC_CAMEXP1 38 45 #define LLCC_CMPTHCP 39 45 #define LLCC_CMPTHCP 39 46 #define LLCC_LCPDARE 40 46 #define LLCC_LCPDARE 40 47 #define LLCC_AENPU 45 47 #define LLCC_AENPU 45 48 #define LLCC_ISLAND1 46 48 #define LLCC_ISLAND1 46 49 #define LLCC_ISLAND2 47 49 #define LLCC_ISLAND2 47 50 #define LLCC_ISLAND3 48 50 #define LLCC_ISLAND3 48 51 #define LLCC_ISLAND4 49 51 #define LLCC_ISLAND4 49 52 #define LLCC_CAMEXP2 50 52 #define LLCC_CAMEXP2 50 53 #define LLCC_CAMEXP3 51 53 #define LLCC_CAMEXP3 51 54 #define LLCC_CAMEXP4 52 54 #define LLCC_CAMEXP4 52 55 #define LLCC_DISP_WB 53 55 #define LLCC_DISP_WB 53 56 #define LLCC_DISP_1 54 56 #define LLCC_DISP_1 54 57 #define LLCC_VIDVSP 64 57 #define LLCC_VIDVSP 64 58 58 59 /** 59 /** 60 * struct llcc_slice_desc - Cache slice descri 60 * struct llcc_slice_desc - Cache slice descriptor 61 * @slice_id: llcc slice id 61 * @slice_id: llcc slice id 62 * @slice_size: Size allocated for the llcc sl 62 * @slice_size: Size allocated for the llcc slice 63 */ 63 */ 64 struct llcc_slice_desc { 64 struct llcc_slice_desc { 65 u32 slice_id; 65 u32 slice_id; 66 size_t slice_size; 66 size_t slice_size; 67 }; 67 }; 68 68 69 /** 69 /** 70 * struct llcc_edac_reg_data - llcc edac regis 70 * struct llcc_edac_reg_data - llcc edac registers data for each error type 71 * @name: Name of the error 71 * @name: Name of the error 72 * @reg_cnt: Number of registers 72 * @reg_cnt: Number of registers 73 * @count_mask: Mask value to get the error co 73 * @count_mask: Mask value to get the error count 74 * @ways_mask: Mask value to get the error way 74 * @ways_mask: Mask value to get the error ways 75 * @count_shift: Shift value to get the error 75 * @count_shift: Shift value to get the error count 76 * @ways_shift: Shift value to get the error w 76 * @ways_shift: Shift value to get the error ways 77 */ 77 */ 78 struct llcc_edac_reg_data { 78 struct llcc_edac_reg_data { 79 char *name; 79 char *name; 80 u32 reg_cnt; 80 u32 reg_cnt; 81 u32 count_mask; 81 u32 count_mask; 82 u32 ways_mask; 82 u32 ways_mask; 83 u8 count_shift; 83 u8 count_shift; 84 u8 ways_shift; 84 u8 ways_shift; 85 }; 85 }; 86 86 87 struct llcc_edac_reg_offset { 87 struct llcc_edac_reg_offset { 88 /* LLCC TRP registers */ 88 /* LLCC TRP registers */ 89 u32 trp_ecc_error_status0; 89 u32 trp_ecc_error_status0; 90 u32 trp_ecc_error_status1; 90 u32 trp_ecc_error_status1; 91 u32 trp_ecc_sb_err_syn0; 91 u32 trp_ecc_sb_err_syn0; 92 u32 trp_ecc_db_err_syn0; 92 u32 trp_ecc_db_err_syn0; 93 u32 trp_ecc_error_cntr_clear; 93 u32 trp_ecc_error_cntr_clear; 94 u32 trp_interrupt_0_status; 94 u32 trp_interrupt_0_status; 95 u32 trp_interrupt_0_clear; 95 u32 trp_interrupt_0_clear; 96 u32 trp_interrupt_0_enable; 96 u32 trp_interrupt_0_enable; 97 97 98 /* LLCC Common registers */ 98 /* LLCC Common registers */ 99 u32 cmn_status0; 99 u32 cmn_status0; 100 u32 cmn_interrupt_0_enable; 100 u32 cmn_interrupt_0_enable; 101 u32 cmn_interrupt_2_enable; 101 u32 cmn_interrupt_2_enable; 102 102 103 /* LLCC DRP registers */ 103 /* LLCC DRP registers */ 104 u32 drp_ecc_error_cfg; 104 u32 drp_ecc_error_cfg; 105 u32 drp_ecc_error_cntr_clear; 105 u32 drp_ecc_error_cntr_clear; 106 u32 drp_interrupt_status; 106 u32 drp_interrupt_status; 107 u32 drp_interrupt_clear; 107 u32 drp_interrupt_clear; 108 u32 drp_interrupt_enable; 108 u32 drp_interrupt_enable; 109 u32 drp_ecc_error_status0; 109 u32 drp_ecc_error_status0; 110 u32 drp_ecc_error_status1; 110 u32 drp_ecc_error_status1; 111 u32 drp_ecc_sb_err_syn0; 111 u32 drp_ecc_sb_err_syn0; 112 u32 drp_ecc_db_err_syn0; 112 u32 drp_ecc_db_err_syn0; 113 }; 113 }; 114 114 115 /** 115 /** 116 * struct llcc_drv_data - Data associated with 116 * struct llcc_drv_data - Data associated with the llcc driver 117 * @regmaps: regmaps associated with the llcc 117 * @regmaps: regmaps associated with the llcc device 118 * @bcast_regmap: regmap associated with llcc 118 * @bcast_regmap: regmap associated with llcc broadcast OR offset 119 * @bcast_and_regmap: regmap associated with l 119 * @bcast_and_regmap: regmap associated with llcc broadcast AND offset 120 * @cfg: pointer to the data structure for sli 120 * @cfg: pointer to the data structure for slice configuration 121 * @edac_reg_offset: Offset of the LLCC EDAC r 121 * @edac_reg_offset: Offset of the LLCC EDAC registers 122 * @lock: mutex associated with each slice 122 * @lock: mutex associated with each slice 123 * @cfg_size: size of the config data table 123 * @cfg_size: size of the config data table 124 * @max_slices: max slices as read from device 124 * @max_slices: max slices as read from device tree 125 * @num_banks: Number of llcc banks 125 * @num_banks: Number of llcc banks 126 * @bitmap: Bit map to track the active slice 126 * @bitmap: Bit map to track the active slice ids 127 * @ecc_irq: interrupt for llcc cache error de 127 * @ecc_irq: interrupt for llcc cache error detection and reporting 128 * @version: Indicates the LLCC version 128 * @version: Indicates the LLCC version 129 */ 129 */ 130 struct llcc_drv_data { 130 struct llcc_drv_data { 131 struct regmap **regmaps; 131 struct regmap **regmaps; 132 struct regmap *bcast_regmap; 132 struct regmap *bcast_regmap; 133 struct regmap *bcast_and_regmap; 133 struct regmap *bcast_and_regmap; 134 const struct llcc_slice_config *cfg; 134 const struct llcc_slice_config *cfg; 135 const struct llcc_edac_reg_offset *eda 135 const struct llcc_edac_reg_offset *edac_reg_offset; 136 struct mutex lock; 136 struct mutex lock; 137 u32 cfg_size; 137 u32 cfg_size; 138 u32 max_slices; 138 u32 max_slices; 139 u32 num_banks; 139 u32 num_banks; 140 unsigned long *bitmap; 140 unsigned long *bitmap; 141 int ecc_irq; 141 int ecc_irq; 142 u32 version; 142 u32 version; 143 }; 143 }; 144 144 145 #if IS_ENABLED(CONFIG_QCOM_LLCC) 145 #if IS_ENABLED(CONFIG_QCOM_LLCC) 146 /** 146 /** 147 * llcc_slice_getd - get llcc slice descriptor 147 * llcc_slice_getd - get llcc slice descriptor 148 * @uid: usecase_id of the client 148 * @uid: usecase_id of the client 149 */ 149 */ 150 struct llcc_slice_desc *llcc_slice_getd(u32 ui 150 struct llcc_slice_desc *llcc_slice_getd(u32 uid); 151 151 152 /** 152 /** 153 * llcc_slice_putd - llcc slice descritpor 153 * llcc_slice_putd - llcc slice descritpor 154 * @desc: Pointer to llcc slice descriptor 154 * @desc: Pointer to llcc slice descriptor 155 */ 155 */ 156 void llcc_slice_putd(struct llcc_slice_desc *d 156 void llcc_slice_putd(struct llcc_slice_desc *desc); 157 157 158 /** 158 /** 159 * llcc_get_slice_id - get slice id 159 * llcc_get_slice_id - get slice id 160 * @desc: Pointer to llcc slice descriptor 160 * @desc: Pointer to llcc slice descriptor 161 */ 161 */ 162 int llcc_get_slice_id(struct llcc_slice_desc * 162 int llcc_get_slice_id(struct llcc_slice_desc *desc); 163 163 164 /** 164 /** 165 * llcc_get_slice_size - llcc slice size 165 * llcc_get_slice_size - llcc slice size 166 * @desc: Pointer to llcc slice descriptor 166 * @desc: Pointer to llcc slice descriptor 167 */ 167 */ 168 size_t llcc_get_slice_size(struct llcc_slice_d 168 size_t llcc_get_slice_size(struct llcc_slice_desc *desc); 169 169 170 /** 170 /** 171 * llcc_slice_activate - Activate the llcc sli 171 * llcc_slice_activate - Activate the llcc slice 172 * @desc: Pointer to llcc slice descriptor 172 * @desc: Pointer to llcc slice descriptor 173 */ 173 */ 174 int llcc_slice_activate(struct llcc_slice_desc 174 int llcc_slice_activate(struct llcc_slice_desc *desc); 175 175 176 /** 176 /** 177 * llcc_slice_deactivate - Deactivate the llcc 177 * llcc_slice_deactivate - Deactivate the llcc slice 178 * @desc: Pointer to llcc slice descriptor 178 * @desc: Pointer to llcc slice descriptor 179 */ 179 */ 180 int llcc_slice_deactivate(struct llcc_slice_de 180 int llcc_slice_deactivate(struct llcc_slice_desc *desc); 181 181 182 #else 182 #else 183 static inline struct llcc_slice_desc *llcc_sli 183 static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid) 184 { 184 { 185 return NULL; 185 return NULL; 186 } 186 } 187 187 188 static inline void llcc_slice_putd(struct llcc 188 static inline void llcc_slice_putd(struct llcc_slice_desc *desc) 189 { 189 { 190 190 191 }; 191 }; 192 192 193 static inline int llcc_get_slice_id(struct llc 193 static inline int llcc_get_slice_id(struct llcc_slice_desc *desc) 194 { 194 { 195 return -EINVAL; 195 return -EINVAL; 196 } 196 } 197 197 198 static inline size_t llcc_get_slice_size(struc 198 static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc) 199 { 199 { 200 return 0; 200 return 0; 201 } 201 } 202 static inline int llcc_slice_activate(struct l 202 static inline int llcc_slice_activate(struct llcc_slice_desc *desc) 203 { 203 { 204 return -EINVAL; 204 return -EINVAL; 205 } 205 } 206 206 207 static inline int llcc_slice_deactivate(struct 207 static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc) 208 { 208 { 209 return -EINVAL; 209 return -EINVAL; 210 } 210 } 211 #endif 211 #endif 212 212 213 #endif 213 #endif 214 214
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.