Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
0004  *
0005  */
0006 
0007 #include <linux/platform_device.h>
0008 #ifndef __LLCC_QCOM__
0009 #define __LLCC_QCOM__
0010 
0011 #define LLCC_CPUSS       1
0012 #define LLCC_VIDSC0      2
0013 #define LLCC_VIDSC1      3
0014 #define LLCC_ROTATOR     4
0015 #define LLCC_VOICE       5
0016 #define LLCC_AUDIO       6
0017 #define LLCC_MDMHPGRW    7
0018 #define LLCC_MDM         8
0019 #define LLCC_MODHW       9
0020 #define LLCC_CMPT        10
0021 #define LLCC_GPUHTW      11
0022 #define LLCC_GPU         12
0023 #define LLCC_MMUHWT      13
0024 #define LLCC_CMPTDMA     15
0025 #define LLCC_DISP        16
0026 #define LLCC_VIDFW       17
0027 #define LLCC_MDMHPFX     20
0028 #define LLCC_MDMPNG      21
0029 #define LLCC_AUDHW       22
0030 #define LLCC_NPU         23
0031 #define LLCC_WLHW        24
0032 #define LLCC_PIMEM       25
0033 #define LLCC_DRE         26
0034 #define LLCC_CVP         28
0035 #define LLCC_MODPE       29
0036 #define LLCC_APTCM       30
0037 #define LLCC_WRCACHE     31
0038 #define LLCC_CVPFW       32
0039 #define LLCC_CPUSS1      33
0040 #define LLCC_CAMEXP0     34
0041 #define LLCC_CPUMTE      35
0042 #define LLCC_CPUHWT      36
0043 #define LLCC_MDMCLAD2    37
0044 #define LLCC_CAMEXP1     38
0045 #define LLCC_AENPU       45
0046 
0047 /**
0048  * struct llcc_slice_desc - Cache slice descriptor
0049  * @slice_id: llcc slice id
0050  * @slice_size: Size allocated for the llcc slice
0051  */
0052 struct llcc_slice_desc {
0053     u32 slice_id;
0054     size_t slice_size;
0055 };
0056 
0057 /**
0058  * struct llcc_edac_reg_data - llcc edac registers data for each error type
0059  * @name: Name of the error
0060  * @synd_reg: Syndrome register address
0061  * @count_status_reg: Status register address to read the error count
0062  * @ways_status_reg: Status register address to read the error ways
0063  * @reg_cnt: Number of registers
0064  * @count_mask: Mask value to get the error count
0065  * @ways_mask: Mask value to get the error ways
0066  * @count_shift: Shift value to get the error count
0067  * @ways_shift: Shift value to get the error ways
0068  */
0069 struct llcc_edac_reg_data {
0070     char *name;
0071     u64 synd_reg;
0072     u64 count_status_reg;
0073     u64 ways_status_reg;
0074     u32 reg_cnt;
0075     u32 count_mask;
0076     u32 ways_mask;
0077     u8  count_shift;
0078     u8  ways_shift;
0079 };
0080 
0081 /**
0082  * struct llcc_drv_data - Data associated with the llcc driver
0083  * @regmap: regmap associated with the llcc device
0084  * @bcast_regmap: regmap associated with llcc broadcast offset
0085  * @cfg: pointer to the data structure for slice configuration
0086  * @lock: mutex associated with each slice
0087  * @cfg_size: size of the config data table
0088  * @max_slices: max slices as read from device tree
0089  * @num_banks: Number of llcc banks
0090  * @bitmap: Bit map to track the active slice ids
0091  * @offsets: Pointer to the bank offsets array
0092  * @ecc_irq: interrupt for llcc cache error detection and reporting
0093  * @version: Indicates the LLCC version
0094  */
0095 struct llcc_drv_data {
0096     struct regmap *regmap;
0097     struct regmap *bcast_regmap;
0098     const struct llcc_slice_config *cfg;
0099     struct mutex lock;
0100     u32 cfg_size;
0101     u32 max_slices;
0102     u32 num_banks;
0103     unsigned long *bitmap;
0104     u32 *offsets;
0105     int ecc_irq;
0106     u32 version;
0107 };
0108 
0109 #if IS_ENABLED(CONFIG_QCOM_LLCC)
0110 /**
0111  * llcc_slice_getd - get llcc slice descriptor
0112  * @uid: usecase_id of the client
0113  */
0114 struct llcc_slice_desc *llcc_slice_getd(u32 uid);
0115 
0116 /**
0117  * llcc_slice_putd - llcc slice descritpor
0118  * @desc: Pointer to llcc slice descriptor
0119  */
0120 void llcc_slice_putd(struct llcc_slice_desc *desc);
0121 
0122 /**
0123  * llcc_get_slice_id - get slice id
0124  * @desc: Pointer to llcc slice descriptor
0125  */
0126 int llcc_get_slice_id(struct llcc_slice_desc *desc);
0127 
0128 /**
0129  * llcc_get_slice_size - llcc slice size
0130  * @desc: Pointer to llcc slice descriptor
0131  */
0132 size_t llcc_get_slice_size(struct llcc_slice_desc *desc);
0133 
0134 /**
0135  * llcc_slice_activate - Activate the llcc slice
0136  * @desc: Pointer to llcc slice descriptor
0137  */
0138 int llcc_slice_activate(struct llcc_slice_desc *desc);
0139 
0140 /**
0141  * llcc_slice_deactivate - Deactivate the llcc slice
0142  * @desc: Pointer to llcc slice descriptor
0143  */
0144 int llcc_slice_deactivate(struct llcc_slice_desc *desc);
0145 
0146 #else
0147 static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
0148 {
0149     return NULL;
0150 }
0151 
0152 static inline void llcc_slice_putd(struct llcc_slice_desc *desc)
0153 {
0154 
0155 };
0156 
0157 static inline int llcc_get_slice_id(struct llcc_slice_desc *desc)
0158 {
0159     return -EINVAL;
0160 }
0161 
0162 static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc)
0163 {
0164     return 0;
0165 }
0166 static inline int llcc_slice_activate(struct llcc_slice_desc *desc)
0167 {
0168     return -EINVAL;
0169 }
0170 
0171 static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc)
0172 {
0173     return -EINVAL;
0174 }
0175 #endif
0176 
0177 #endif