1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
7 #include <linux/kernel.h>
8 #include <linux/module.h>
10 #include <linux/of_device.h>
11 #include <linux/soc/qcom/llcc-qcom.h>
14 * SCT(System Cache Table) entry contains of the following members:
15 * usecase_id: Unique id for the client's use case
16 * slice_id: llcc slice id for each client
17 * max_cap: The maximum capacity of the cache slice provided in KB
18 * priority: Priority of the client used to select victim line for replacement
19 * fixed_size: Boolean indicating if the slice has a fixed capacity
20 * bonus_ways: Bonus ways are additional ways to be used for any slice,
21 * if client ends up using more than reserved cache ways. Bonus
22 * ways are allocated only if they are not reserved for some
24 * res_ways: Reserved ways for the cache slice, the reserved ways cannot
25 * be used by any other client than the one its assigned to.
26 * cache_mode: Each slice operates as a cache, this controls the mode of the
27 * slice: normal or TCM(Tightly Coupled Memory)
28 * probe_target_ways: Determines what ways to probe for access hit. When
29 * configured to 1 only bonus and reserved ways are probed.
30 * When configured to 0 all ways in llcc are probed.
31 * dis_cap_alloc: Disable capacity based allocation for a client
32 * retain_on_pc: If this bit is set and client has maintained active vote
33 * then the ways assigned to this client are not flushed on power
35 * activate_on_init: Activate the slice immediately after the SCT is programmed
37 #define SCT_ENTRY(uid, sid, mc, p, fs, bway, rway, cmod, ptw, dca, rp, a) \
47 .probe_target_ways = ptw, \
48 .dis_cap_alloc = dca, \
50 .activate_on_init = a, \
53 static struct llcc_slice_config sdm845_data
[] = {
54 SCT_ENTRY(LLCC_CPUSS
, 1, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 1),
55 SCT_ENTRY(LLCC_VIDSC0
, 2, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0),
56 SCT_ENTRY(LLCC_VIDSC1
, 3, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0),
57 SCT_ENTRY(LLCC_ROTATOR
, 4, 563, 2, 1, 0x0, 0x00e, 2, 0, 1, 1, 0),
58 SCT_ENTRY(LLCC_VOICE
, 5, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
59 SCT_ENTRY(LLCC_AUDIO
, 6, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
60 SCT_ENTRY(LLCC_MDMHPGRW
, 7, 1024, 2, 0, 0xfc, 0xf00, 0, 0, 1, 1, 0),
61 SCT_ENTRY(LLCC_MDM
, 8, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
62 SCT_ENTRY(LLCC_CMPT
, 10, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
63 SCT_ENTRY(LLCC_GPUHTW
, 11, 512, 1, 1, 0xc, 0x0, 0, 0, 1, 1, 0),
64 SCT_ENTRY(LLCC_GPU
, 12, 2304, 1, 0, 0xff0, 0x2, 0, 0, 1, 1, 0),
65 SCT_ENTRY(LLCC_MMUHWT
, 13, 256, 2, 0, 0x0, 0x1, 0, 0, 1, 0, 1),
66 SCT_ENTRY(LLCC_CMPTDMA
, 15, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
67 SCT_ENTRY(LLCC_DISP
, 16, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
68 SCT_ENTRY(LLCC_VIDFW
, 17, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
69 SCT_ENTRY(LLCC_MDMHPFX
, 20, 1024, 2, 1, 0x0, 0xf00, 0, 0, 1, 1, 0),
70 SCT_ENTRY(LLCC_MDMPNG
, 21, 1024, 0, 1, 0x1e, 0x0, 0, 0, 1, 1, 0),
71 SCT_ENTRY(LLCC_AUDHW
, 22, 1024, 1, 1, 0xffc, 0x2, 0, 0, 1, 1, 0),
74 static int sdm845_qcom_llcc_probe(struct platform_device
*pdev
)
76 return qcom_llcc_probe(pdev
, sdm845_data
, ARRAY_SIZE(sdm845_data
));
79 static const struct of_device_id sdm845_qcom_llcc_of_match
[] = {
80 { .compatible
= "qcom,sdm845-llcc", },
84 static struct platform_driver sdm845_qcom_llcc_driver
= {
86 .name
= "sdm845-llcc",
87 .of_match_table
= sdm845_qcom_llcc_of_match
,
89 .probe
= sdm845_qcom_llcc_probe
,
91 module_platform_driver(sdm845_qcom_llcc_driver
);
93 MODULE_DESCRIPTION("QCOM sdm845 LLCC driver");
94 MODULE_LICENSE("GPL v2");