U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 00/24] qcom: rpmh core and regulator support
@ 2024-07-15 10:07 Caleb Connolly
  2024-07-15 10:08 ` [PATCH v6 01/24] dm: core: scan reserved-memory nodes Caleb Connolly
                   ` (24 more replies)
  0 siblings, 25 replies; 36+ messages in thread
From: Caleb Connolly @ 2024-07-15 10:07 UTC (permalink / raw)
  To: Tom Rini, Caleb Connolly, Neil Armstrong, Sumit Garg,
	Jaehoon Chung, Simon Glass
  Cc: u-boot, u-boot-qcom

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.

To: Tom Rini <trini@konsulko.com>
To: Caleb Connolly <caleb.connolly@linaro.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
To: Sumit Garg <sumit.garg@linaro.org>
To: Jaehoon Chung <jh80.chung@samsung.com>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Cc: u-boot-qcom@groups.io

Changes in v6:
- Use the driver model for cmd-db
- Extend dm_extended_scan() to scan nodes under /reserved-memory so that
  cmd-db will be bound.
- Link to v5: https://lore.kernel.org/r/20240711-b4-qcom-rpmh-v5-0-fbf04ce6a7e8@linaro.org

Changes in v5:
- Add Kconfig / Makefiles after introducing drivers to avoid breaking
  compilation when bisecting (Thanks Neil).
- Link to v4: https://lore.kernel.org/r/20240709-b4-qcom-rpmh-v4-0-c06d0a26644a@linaro.org

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

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 (24):
      dm: core: scan reserved-memory nodes
      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: adjust probe for U-Boot
      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
      soc: qcom: add build infrastructure
      power: regulator: import qcom-rpmh-regulator from Linux
      power: regulator: qcom-rpmh-regulator: adjust headers for U-Boot
      power: regulator: qcom-rpmh-regulator: port over lineage_range helpers
      power: regulator: qcom-rpmh-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
      power: regulator: qcom-rpmh-regulator: add build infra
      qcom_defconfig: enable rpmh regulators

 configs/qcom_defconfig                        |   5 +
 drivers/core/root.c                           |   3 +-
 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                     | 225 +++++++++++
 drivers/soc/qcom/rpmh-internal.h              | 138 +++++++
 drivers/soc/qcom/rpmh-rsc.c                   | 505 ++++++++++++++++++++++++
 drivers/soc/qcom/rpmh.c                       | 110 ++++++
 include/linux/bitmap.h                        |   8 +
 include/soc/qcom/cmd-db.h                     |  30 ++
 include/soc/qcom/rpmh.h                       |  28 ++
 include/soc/qcom/tcs.h                        |  81 ++++
 17 files changed, 1718 insertions(+), 1 deletion(-)
---
change-id: 20240611-b4-qcom-rpmh-fcfd32ac2940
base-commit: 834df20b4ef50cda26936fbc435689fa0c5d47b1

// Caleb (they/them)


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2024-07-25 23:38 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15 10:07 [PATCH v6 00/24] qcom: rpmh core and regulator support Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 01/24] dm: core: scan reserved-memory nodes Caleb Connolly
2024-07-15 11:39   ` Simon Glass
2024-07-15 10:08 ` [PATCH v6 02/24] linux/bitmap.h: add bitmap_empty helper Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 03/24] soc: qcom: import rpmh and cmd-db drivers from Linux Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 04/24] soc: qcom: cmd-db: adjust headers for U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 05/24] soc: qcom: cmd-db: drop unused functions Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 06/24] soc: qcom: cmd-db: adjust probe for U-Boot Caleb Connolly
2024-07-15 11:39   ` Simon Glass
2024-07-15 21:42     ` Caleb Connolly
2024-07-16  7:04       ` Simon Glass
2024-07-16  7:16         ` Caleb Connolly
2024-07-19 15:04           ` Simon Glass
2024-07-19 19:45             ` Caleb Connolly
2024-07-20 12:36               ` Simon Glass
2024-07-15 10:08 ` [PATCH v6 07/24] soc: qcom: cmd-db: adjust for U-Boot API Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 08/24] soc: qcom: rpmh-rsc: drop unused multi-threading and non-active TCS support Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 09/24] soc: qcom: rpmh-rsc: adjust headers for U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 10/24] soc: qcom: rpmh-rsc: adjust probe " Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 11/24] soc: qcom: rpmh-rsc: remaining U-Boot API changes Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 12/24] soc: qcom: rpmh: adjust headers for U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 13/24] soc: qcom: rpmh: drop unused functions Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 14/24] soc: qcom: rpmh: U-Boot API changes Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 15/24] soc: qcom: add build infrastructure Caleb Connolly
2024-07-15 12:29   ` Neil Armstrong
2024-07-15 10:08 ` [PATCH v6 16/24] power: regulator: import qcom-rpmh-regulator from Linux Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 17/24] power: regulator: qcom-rpmh-regulator: adjust headers for U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 18/24] power: regulator: qcom-rpmh-regulator: port over lineage_range helpers Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 19/24] power: regulator: qcom-rpmh-regulator: adjust structs for U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 20/24] power: regulator: qcom-rpmh-regulator: remove unused regulators Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 21/24] power: regulator: qcom-rpmh-regulator: port ops to U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 22/24] power: regulator: qcom-rpmh-regulator: adjust probe for U-Boot Caleb Connolly
2024-07-15 10:08 ` [PATCH v6 23/24] power: regulator: qcom-rpmh-regulator: add build infra Caleb Connolly
2024-07-15 12:29   ` Neil Armstrong
2024-07-15 10:08 ` [PATCH v6 24/24] qcom_defconfig: enable rpmh regulators Caleb Connolly
2024-07-25 23:38 ` [PATCH v6 00/24] qcom: rpmh core and regulator support Caleb Connolly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox