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
20 #define LLCC_GPUHTW 11
22 #define LLCC_MMUHWT 13
23 #define LLCC_CMPTDMA 15
26 #define LLCC_MDMHPFX 20
27 #define LLCC_MDMPNG 21
31 * llcc_slice_desc - Cache slice descriptor
32 * @slice_id: llcc slice id
33 * @slice_size: Size allocated for the llcc slice
35 struct llcc_slice_desc {
41 * llcc_slice_config - Data associated with the llcc slice
42 * @usecase_id: usecase id for which the llcc slice is used
43 * @slice_id: llcc slice id assigned to each slice
44 * @max_cap: maximum capacity of the llcc slice
45 * @priority: priority of the llcc slice
46 * @fixed_size: whether the llcc slice can grow beyond its size
47 * @bonus_ways: bonus ways associated with llcc slice
48 * @res_ways: reserved ways associated with llcc slice
49 * @cache_mode: mode of the llcc slice
50 * @probe_target_ways: Probe only reserved and bonus ways on a cache miss
51 * @dis_cap_alloc: Disable capacity based allocation
52 * @retain_on_pc: Retain through power collapse
53 * @activate_on_init: activate the slice on init
55 struct llcc_slice_config {
64 u32 probe_target_ways;
67 bool activate_on_init;
71 * llcc_drv_data - Data associated with the llcc driver
72 * @regmap: regmap associated with the llcc device
73 * @cfg: pointer to the data structure for slice configuration
74 * @lock: mutex associated with each slice
75 * @cfg_size: size of the config data table
76 * @max_slices: max slices as read from device tree
77 * @bcast_off: Offset of the broadcast bank
78 * @num_banks: Number of llcc banks
79 * @bitmap: Bit map to track the active slice ids
80 * @offsets: Pointer to the bank offsets array
82 struct llcc_drv_data {
83 struct regmap *regmap;
84 const struct llcc_slice_config *cfg;
90 unsigned long *bitmap;
94 #if IS_ENABLED(CONFIG_QCOM_LLCC)
96 * llcc_slice_getd - get llcc slice descriptor
97 * @uid: usecase_id of the client
99 struct llcc_slice_desc *llcc_slice_getd(u32 uid);
102 * llcc_slice_putd - llcc slice descritpor
103 * @desc: Pointer to llcc slice descriptor
105 void llcc_slice_putd(struct llcc_slice_desc *desc);
108 * llcc_get_slice_id - get slice id
109 * @desc: Pointer to llcc slice descriptor
111 int llcc_get_slice_id(struct llcc_slice_desc *desc);
114 * llcc_get_slice_size - llcc slice size
115 * @desc: Pointer to llcc slice descriptor
117 size_t llcc_get_slice_size(struct llcc_slice_desc *desc);
120 * llcc_slice_activate - Activate the llcc slice
121 * @desc: Pointer to llcc slice descriptor
123 int llcc_slice_activate(struct llcc_slice_desc *desc);
126 * llcc_slice_deactivate - Deactivate the llcc slice
127 * @desc: Pointer to llcc slice descriptor
129 int llcc_slice_deactivate(struct llcc_slice_desc *desc);
132 * qcom_llcc_probe - program the sct table
133 * @pdev: platform device pointer
134 * @table: soc sct table
135 * @sz: Size of the config table
137 int qcom_llcc_probe(struct platform_device *pdev,
138 const struct llcc_slice_config *table, u32 sz);
140 static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
145 static inline void llcc_slice_putd(struct llcc_slice_desc *desc)
150 static inline int llcc_get_slice_id(struct llcc_slice_desc *desc)
155 static inline size_t llcc_get_slice_size(struct llcc_slice_desc *desc)
159 static inline int llcc_slice_activate(struct llcc_slice_desc *desc)
164 static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc)
168 static inline int qcom_llcc_probe(struct platform_device *pdev,
169 const struct llcc_slice_config *table, u32 sz)
174 static inline int qcom_llcc_remove(struct platform_device *pdev)