soc: qcom: icc-bwmon: use regmap and prepare for BWMON v5
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Thu, 28 Jul 2022 11:37:44 +0000 (13:37 +0200)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 18 Aug 2022 19:13:46 +0000 (14:13 -0500)
commitec63dcd3c863bf966b7a222b1a6465b4a55a30b1
treee8ee8b7f2b2d3c1cfce3e80787be92169d94095a
parent650db9fa2c540b860fce547514e305fbee01aa2d
soc: qcom: icc-bwmon: use regmap and prepare for BWMON v5

Refactor the code to prepare it for supporting BWMON v5 which comes with
different register layout by:
1. Adding use of MMIO regmap and regmap fields which allows to keep one
   code logic with different register maps.
2. The "clear" type registers do not allow reading, therefore regmap
   requires using cache with default values.
3. regmap has an effect of introducing barriers after each readl/writel,
   which should negligible effect as only few writes were relaxed.
4. Additionally usage of regmap fields removes need of shifting the
   register values.
5. Add "V4" prefix to names of all defines with register addresses (so
   BWMON_V4_xxx) to differentiate it from V5.  The actual register values
   are shared so keep their naming.
6. While changing the defines, pad register addresses to three digits
   for readability.

Cc: Rajendra Nayak <quic_rjendra@quicinc.com>
Cc: Sibi Sankar <quic_sibis@quicinc.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220728113748.170548-8-krzysztof.kozlowski@linaro.org
drivers/soc/qcom/icc-bwmon.c