Commit Graph

32 Commits

Author SHA1 Message Date
Luca Weiss
64ce6ca673 Switch to SPDX License headers
Remove a lot of boilerplate and make the files consistent.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2025-07-04 16:40:16 +02:00
Christian Marangi
93f5ccd037 debugcc: supports custom xo rate
Some device have a different rate for the xo debug oscillator. Add
support for defining custom xo rate in the primary debug mux.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-07 23:08:20 +01:00
Christian Marangi
bde23d9858 debugcc: support setting xo_div4 custom value
Some xo require special value to set it to /4 divisor. Introduce
xo_div4_val to handle this special implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-07 22:49:11 +01:00
Christian Marangi
5dd120810b debugcc: support 32 bit systems
Unsigned long have a different size in 32 bit system and this cause the
malfunction of debugcc returning wrong frequency. Use 64bit unsigned int
to correctly support 32 bit system and provide correct frequency.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-07 22:47:41 +01:00
Dmitry Baryshkov
cf5664f7c4 debugcc: Rework clock muxes into a chain structure
Enforcing a primary+leaf configuration does not walk for all the cases.
Some clocks (msm8996 CPU) have more muxes to be powered on. Other (MCCC)
do not require GCC at all. Make clock measurement more versatile by
reworking GCC + optional leaf into a chain of muxes.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-06 14:24:13 +02:00
Dmitry Baryshkov
6e28b9165b debugcc: fix building failure on arm32 machines
Fix the following error:

../debugcc.c: In function 'mmap_mux':
../debugcc.c:295:40: error: format '%zx' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Werror=format=]

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-06 13:23:06 +02:00
Dmitry Baryshkov
9db71d48e8 debugcc: switch to meson
Switch to meson as a build system. Define a list of supported platforms
and use it to generate platforms list and the symlink targets.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-11-06 13:01:36 +02:00
Konrad Dybcio
1f2d56984e Add msm8998 / cobalt
NOTE: cpu debug mux support is not included, I can not get it to
cooperate..
2023-02-14 23:17:20 -06:00
Konrad Dybcio
5fe497e2b4 Add SM6375 / blair 2023-02-14 23:17:20 -06:00
Konrad Dybcio
5341f2d08e Add SM6350 / lagoon 2023-02-14 23:17:20 -06:00
Konrad Dybcio
6a32f8a8bd Add SM6125 / trinket 2023-02-14 23:17:20 -06:00
Konrad Dybcio
e449b70045 Add MSM8994 / plutonium
NOTE: this should 99% work on 8992 too, untested though!
2023-02-14 23:17:20 -06:00
Konrad Dybcio
80f81a693b Add SM6115 / bengal
SM6115 and its other bengal friends have 5 debug muxes, one of which
(memory controller) is out of scope here, as it's not defined in dt.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
2023-02-14 23:17:20 -06:00
Marijn Suijten
7365bca626 Implement MCCC measurements for SM8150 and SM8250 2023-02-14 10:02:12 -06:00
Dmitry Baryshkov
a9e76e4f1b debugcc: skip registers with no masks defined
Provide a way to skip programming enable/mux registers (as we do for
div_reg) if the corresponding mask is zero.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-02-14 09:42:21 -06:00
Dmitry Baryshkov
360769b5fc debugcc: allow leaf muxes to override measurement function
MCCC (memory clock controller) uses non-standard measuring process (just
read the rate and return). Provide a way to override default
measurement proces with the leaf cc hook.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-02-14 09:42:21 -06:00
Dmitry Baryshkov
bdb901f2ae debugcc: split measurement function
Split measurement function into clock rate calculation
(measure_default()) and the wrapper that prepares muxes and then
disables them. This fixes the issue that muxes will not be disabled for
the clocks that are not turned off (because measure function will return
early for disabled clocks).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-02-14 09:42:21 -06:00
Marijn Suijten
23583b8546 Add SM8250 support 2023-02-14 09:40:27 -06:00
Bjorn Andersson
e60a2d1693 Merge branch 'sm8150' of https://github.com/MarijnS95/debugcc 2023-01-17 20:50:27 -08:00
Neil Armstrong
97771010c6 Add DEBUGCC entries for SM8550
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-01-17 22:30:46 -06:00
Marijn Suijten
d7dcae1718 Add SM8150 support 2023-01-18 01:55:12 +01:00
Dmitry Baryshkov
783b4ffdd2 debugcc: allow customizing the measurement process
MSM8996 requires additional setup to measure CPU clocks. Add hooks to
customize the mux enable/disable and measurement process.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-01-05 10:55:11 -06:00
Dmitry Baryshkov
7c544f0c40 msm8996: add support for MSM8996 platform
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-01-05 10:55:11 -06:00
Dmitry Baryshkov
34fb8ccda7 debugcc: preserve xo_div4 contents
Preserve the contents of the xo_div4 register. Downstream kernel
preserves the contents of the register. Writing just 1 makes the msm8996
report the value divided by 4 rather than the actual clock frequency.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-01-05 10:55:11 -06:00
Dmitry Baryshkov
ac35e7a205 debugcc: add support for printing clocks from a single CC
Add a way to print clocks related to a particular CC. Add -b option,
which takes 'block' name: cam, disp, cpu, gpu, video. Pass "-b core" to
limit debugcc to "core" (gcc) clocks.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2023-01-05 10:54:17 -06:00