Commit | Line | Data |
---|---|---|
a3134fb0 RB |
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/kernel.h> | |
8 | #include <linux/module.h> | |
9 | #include <linux/of.h> | |
10 | #include <linux/of_device.h> | |
11 | #include <linux/soc/qcom/llcc-qcom.h> | |
12 | ||
13 | /* | |
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 | |
23 | * other client. | |
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 | |
34 | * collapse. | |
35 | * activate_on_init: Activate the slice immediately after the SCT is programmed | |
36 | */ | |
37 | #define SCT_ENTRY(uid, sid, mc, p, fs, bway, rway, cmod, ptw, dca, rp, a) \ | |
38 | { \ | |
39 | .usecase_id = uid, \ | |
40 | .slice_id = sid, \ | |
41 | .max_cap = mc, \ | |
42 | .priority = p, \ | |
43 | .fixed_size = fs, \ | |
44 | .bonus_ways = bway, \ | |
45 | .res_ways = rway, \ | |
46 | .cache_mode = cmod, \ | |
47 | .probe_target_ways = ptw, \ | |
48 | .dis_cap_alloc = dca, \ | |
49 | .retain_on_pc = rp, \ | |
50 | .activate_on_init = a, \ | |
51 | } | |
52 | ||
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), | |
72 | }; | |
73 | ||
72d1cd03 JC |
74 | static int sdm845_qcom_llcc_remove(struct platform_device *pdev) |
75 | { | |
76 | return qcom_llcc_remove(pdev); | |
77 | } | |
78 | ||
a3134fb0 RB |
79 | static int sdm845_qcom_llcc_probe(struct platform_device *pdev) |
80 | { | |
81 | return qcom_llcc_probe(pdev, sdm845_data, ARRAY_SIZE(sdm845_data)); | |
82 | } | |
83 | ||
84 | static const struct of_device_id sdm845_qcom_llcc_of_match[] = { | |
85 | { .compatible = "qcom,sdm845-llcc", }, | |
86 | { } | |
87 | }; | |
88 | ||
89 | static struct platform_driver sdm845_qcom_llcc_driver = { | |
90 | .driver = { | |
91 | .name = "sdm845-llcc", | |
92 | .of_match_table = sdm845_qcom_llcc_of_match, | |
93 | }, | |
94 | .probe = sdm845_qcom_llcc_probe, | |
72d1cd03 | 95 | .remove = sdm845_qcom_llcc_remove, |
a3134fb0 RB |
96 | }; |
97 | module_platform_driver(sdm845_qcom_llcc_driver); | |
98 | ||
99 | MODULE_DESCRIPTION("QCOM sdm845 LLCC driver"); | |
100 | MODULE_LICENSE("GPL v2"); |