[PATCH v4 00/21] qcom: rpmh core and regulator support

Sumit Garg sumit.garg at linaro.org
Wed Jul 10 13:33:08 CEST 2024


Hi Caleb,

On Tue, 9 Jul 2024 at 15:04, Caleb Connolly <caleb.connolly at linaro.org> wrote:
>
> 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 are taken from Linux, then modified and simplified for
> U-Boot. The original Linux drivers contain 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. This unused
> code is removed before finally adjusting the drivers to properly build
> for U-Boot and use its device model.
>
> The U-Boot version of the driver supports a single ACTIVE_ONLY TCS and
> waits for it to be cleared after use. We don't support programming
> low power states.
>
> ---
> Changes in v4:
> - Denote original Linux version in bitmap.h patch
> - Rebased on Linux 6.10-rc6 and re-apply U-Boot changes preserving git
>   history. Allowing for future changes to the Linux drivers to be ported
>   over more easily.
> - Add missing check to wait for the TCS to be cleared after use (seems
>   we were just racing the RPMh before, oops!).
> - Fix missing n_modes in pmic5_pldo regulator.
> - Link to v3: https://lore.kernel.org/r/20240708-b4-qcom-rpmh-v3-0-846cc6c5b728@linaro.org

Thanks for doing this, this looks much better from a maintainability
perspective. Although I am seeing a lot of patches saying adjustments
and build fixes, I think you should have taken care of commits
bisect-ability such that individual commits don't cause any build
errors.

FWIW, for the series:

Acked-by: Sumit Garg <sumit.garg at linaro.org>

-Sumit

>
> Changes in v3:
> - Don't call dm_scan_fdt_dev(), since DM core will scan.
> - Link to v2: https://lore.kernel.org/r/20240708-b4-qcom-rpmh-v2-0-8bc765606e56@linaro.org
>
> Changes in v2:
> - Implement Neil's suggestions and fixes for SM8[56]50
> - Slightly refactor cmd_db_init() for better abstraction.
> - Improve logging (printf -> log_err/dev_err)
> - Add missing error check in rpmh_regulators_bind()
> - Link to v1: https://lore.kernel.org/r/20240617-b4-qcom-rpmh-v1-0-bd2336923e0a@linaro.org
>
> ---
> Caleb Connolly (21):
>       linux/bitmap.h: add bitmap_empty helper
>       soc: qcom: import rpmh and cmd-db drivers from Linux
>       soc: qcom: cmd-db: adjust headers for U-Boot
>       soc: qcom: cmd-db: drop unused functions
>       soc: qcom: cmd-db: replace cmd_db_ready() with cmd_db_init()
>       soc: qcom: cmd-db: adjust for U-Boot API
>       soc: qcom: rpmh-rsc: drop unused multi-threading and non-active TCS support
>       soc: qcom: rpmh-rsc: adjust headers for U-Boot
>       soc: qcom: rpmh-rsc: adjust probe for U-Boot
>       soc: qcom: rpmh-rsc: remaining U-Boot API changes
>       soc: qcom: rpmh: adjust headers for U-Boot
>       soc: qcom: rpmh: drop unused functions
>       soc: qcom: rpmh: U-Boot API changes
>       power: regulator: import qcom-rpmh-regulator from Linux
>       power: regulator: adjust headers for U-Boot
>       power: regulator: qcom-rpmh-regulator: port over lineage_range helpers
>       power: regulator: adjust structs for U-Boot
>       power: regulator: qcom-rpmh-regulator: remove unused regulators
>       power: regulator: qcom-rpmh-regulator: port ops to U-Boot
>       power: regulator: qcom-rpmh-regulator: adjust probe for U-Boot
>       qcom_defconfig: enable rpmh regulators
>
>  configs/qcom_defconfig                        |   5 +
>  drivers/power/regulator/Kconfig               |   8 +
>  drivers/power/regulator/Makefile              |   1 +
>  drivers/power/regulator/qcom-rpmh-regulator.c | 544 ++++++++++++++++++++++++++
>  drivers/soc/Kconfig                           |   1 +
>  drivers/soc/Makefile                          |   1 +
>  drivers/soc/qcom/Kconfig                      |  27 ++
>  drivers/soc/qcom/Makefile                     |   4 +
>  drivers/soc/qcom/cmd-db.c                     | 213 ++++++++++
>  drivers/soc/qcom/rpmh-internal.h              | 138 +++++++
>  drivers/soc/qcom/rpmh-rsc.c                   | 518 ++++++++++++++++++++++++
>  drivers/soc/qcom/rpmh.c                       | 110 ++++++
>  include/linux/bitmap.h                        |   8 +
>  include/soc/qcom/cmd-db.h                     |  33 ++
>  include/soc/qcom/rpmh.h                       |  28 ++
>  include/soc/qcom/tcs.h                        |  81 ++++
>  16 files changed, 1720 insertions(+)
> ---
> change-id: 20240611-b4-qcom-rpmh-fcfd32ac2940
> base-commit: 50adc932e7aa34e6d9c738ec13ed09382a9d109a
>
> // Caleb (they/them)
>


More information about the U-Boot mailing list