soc: qcom: icc-bwmon: Handle global registers correctly
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Wed, 15 Mar 2023 14:11:21 +0000 (15:11 +0100)
committerBjorn Andersson <andersson@kernel.org>
Tue, 4 Apr 2023 19:34:23 +0000 (12:34 -0700)
commitb6e9fb7ac236bc48cc2c667e0b51153d2daa5268
treebd1fe518c941af77c9403363104a62cd0eed3803
parent452c165e3597691a953e3f4c4c0442c41c8e02f4
soc: qcom: icc-bwmon: Handle global registers correctly

The BWMON hardware has two sets of registers: one for the monitor itself
and one called "global". It has what seems to be some kind of a head
switch and an interrupt control register. It's usually 0x200 in size.

On fairly recent SoCs (with the starting point seemingly being moving
the OSM programming to the firmware) these two register sets are
contiguous and overlapping, like this (on sm8450):

/* notice how base.start == global_base.start+0x100 */
reg = <0x90b6400 0x300>, <0x90b6300 0x200>;
reg-names = "base", "global_base";

Which led to some confusion and the assumption that since the
"interesting" global registers begin right after global_base+0x100,
there's no need to map two separate regions and one can simply subtract
0x100 from the offsets.

This is however not the case for anything older than SDM845, as the
global region can appear in seemingly random spots on the register map.

Handle the case where the global registers are mapped separately to allow
proper functioning of BWMONv4 on MSM8998 and older. Add specific
compatibles for 845, 8280xp, 7280 and 8550 (all of which use the single
reg space scheme) to keep backwards compatibility with old DTs.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230304-topic-ddr_bwmon-v3-3-77a050c2fbda@linaro.org
drivers/soc/qcom/icc-bwmon.c