mbox series

[0/3] qcom: rpmh core and regulator support

Message ID 20240617-b4-qcom-rpmh-v1-0-bd2336923e0a@linaro.org
Headers show
Series qcom: rpmh core and regulator support | expand

Message

Caleb Connolly June 17, 2024, 8:32 a.m. UTC
This series introduces support for the RPMh (Resource Power Manager
(hardened)) co-processor and associated regulator driver found on most
modern Qualcomm platforms (since ~2017).

Even though most regulators are controlled via SPMI, the specific
regions on the PMICs for controlling the regulators are restricted and
can't be accessed by the Applications Processor (AP/HLOS). Instead,
these resources are proxied via the RPMh where they can be voted on by
multiple subsystems (Linux, the modem, and the other DSPs). This is done
for security (to protect clocks, power domains, and regulators that are
specifically relevant for the trustzone) as well as to simplify the
management of shared peripherals and to allow for handover of
peripherals like the USB controller.

For U-Boot, our main concern is the regulators. Since all regulators on
the system are controlled via the RPMh, it is necessary to support it to
enable USB VBUS on some platforms, and may be needed for other
peripherals in the future.

Communicating with the RPMh additional requires accessing the cmd-db
shared memory region, this contains key/value maps to determine the
address of specific resources on the RPMh.

Introduce support for the cmd-db, the RPMh framework, and some of the
regulators that are necessary to enable USB VBUS on the RB5 development
board.

These drivers were originally taken from Linux, however they have been
heavily modified and simplified for U-Boot. Since the original Linux
drivers contained heavy optimisations related to multithreading and
asynchronous probing, as well as support for idle and suspend states
which we don't need to deal with here.

The U-Boot version of the driver supports a single TCS and always
requests a response from the RPMh, since we don't need to worry about
having multiple transactions in flight at once.

---
Caleb Connolly (3):
      linux/bitmap.h: add bitmap_empty helper
      soc: qcom: rpmh and cmd-db drivers
      power: regulator: add qcom-rpmh-regulator

 drivers/power/regulator/Kconfig               |   8 +
 drivers/power/regulator/Makefile              |   1 +
 drivers/power/regulator/qcom-rpmh-regulator.c | 534 ++++++++++++++++++++++
 drivers/soc/Kconfig                           |   1 +
 drivers/soc/Makefile                          |   1 +
 drivers/soc/qcom/Kconfig                      |  25 ++
 drivers/soc/qcom/Makefile                     |   4 +
 drivers/soc/qcom/cmd-db.c                     | 246 ++++++++++
 drivers/soc/qcom/rpmh-internal.h              | 141 ++++++
 drivers/soc/qcom/rpmh-rsc.c                   | 619 ++++++++++++++++++++++++++
 drivers/soc/qcom/rpmh.c                       | 110 +++++
 include/linux/bitmap.h                        |   8 +
 include/soc/qcom/cmd-db.h                     |  42 ++
 include/soc/qcom/rpmh.h                       |  29 ++
 include/soc/qcom/tcs.h                        |  78 ++++
 15 files changed, 1847 insertions(+)
---
change-id: 20240611-b4-qcom-rpmh-fcfd32ac2940
base-commit: 65134a67bca5e11415e93262e530b1c91fee154f

// Caleb (they/them)