[0/3] Fix BWMONv4 for <SDM845

Message ID 20230304-topic-ddr_bwmon-v1-0-e563837dc7d1@linaro.org
Headers
Series Fix BWMONv4 for <SDM845 |

Message

Konrad Dybcio March 4, 2023, 3:39 p.m. UTC
  BWMONv4 (the one used for DDR scaling on all SoCs from msm8998 to sm8550)
features two register regions: "monitor" and "global" with the first one
containing registers specific to the throughput monitor itself and the
second one containing some sort of a head switch.

The register layout on all BWMON versions an implementations up to that
looked like this:

|..........[GLOBAL].........[MONITOR]........|

however with SDM845 somebody thought it would be a good idea to turn it
into this:

|................[GLOBAL]....................|
|....................[MONITOR]...............|

Sadly, the existing upstream driver was architected with SDM845 in mind,
which means it doesn't support the global registers being somewhere else
than near the beginning of the monitor space. This series tries to address
that in the hopefully least painful way. Tested on msm8998 (the count unit
seems to be wrong, should probably be 1MiB and not 64 KiB but the point is
that this series makes it work at all, as without it the headswitch is
never turned on) and SM6375 (with the "combined" layout introduced in
SDM845). Equally sadly, everybody uses the qcom,msm8998-bwmon compatible
(which frankly should have been just qcom,bwmon-v4) that never actually
worked on MSM8998 , which prevents us from handling it in a simpler way..

While at it, an unused struct member is removed.

One suboptimal feature of this patchset is that it introduces an "invalid
resource" print from within devres. This could be solved with an
introduction of devm_ioremap_resource_optional or by dropping devres
functions in place of manual handling, which also doesn't sound great..
I'll leave it up to the reviewers to decide.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Konrad Dybcio (3):
      dt-bindings: interconnect: qcom,msm8998-bwmon: Add global registers
      soc: qcom: icc-bwmon: Handle global registers correctly
      soc: qcom: icc-bwmon: Remove unused struct member

 .../bindings/interconnect/qcom,msm8998-bwmon.yaml  |  28 ++++-
 drivers/soc/qcom/icc-bwmon.c                       | 137 ++++++++++++++++++---
 2 files changed, 142 insertions(+), 23 deletions(-)
---
base-commit: 1acf39ef8f1425cd105f630dc2c7c1d8fff27ed1
change-id: 20230304-topic-ddr_bwmon-609022cd5e35

Best regards,