Skip to content

usb: dwc3: qcom: Add support for firmware-managed resources

Sriram Dash linux-arm-msm linux-devicetree linux-usb lkml oe-kbuild oe-kbuild-all 1 version In review

Get series with b4
b4 am 20251127-controller_scmi_upstream-v1-0-38bcca513c28@oss.qualcomm.com change-id 20251127-controller_scmi_upstream-a344bad23bcc

Versions newest first

  1. v1 Latest2 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2dt-bindings: usb: qcom,snps-dwc3: Add support for firmware-managed resourcesDocumentation/devicetree/bindings/usb/qcom,snps-dwc3.yaml+111 -624 replies
2/2usb: dwc3: qcom: Support firmware-managed resource states for power managementdrivers/usb/dwc3/dwc3-qcom.c+88 -94 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] usb: dwc3: qcom: Add support for firmware-managed resources

On Qualcomm automotive SoC sa8255p, platform resources like clocks, interconnect, resets, regulators and GDSC are configured remotely by firmware.

PM OPP is used to abstract these resources in firmware
and SCMI power protocol is used to request resource operations by using runtime PM framework APIs such as pm_runtime_get/put_sync to invoke power_on/_off calls from kernel respectively.

"qcom,snps-dwc3-fw-managed" compatible allows the driver to determine if device resources are managed by firmware. Additionally, it makes the power-domains property mandatory and excludes the clocks property for the IPs where resources are managed by firmware.

Macros are introduced to represent key lifecycle events:
initialization, system and runtime suspend/resume, and exit. The driver sets the appropriate resource state during probe, remove, suspend, and resume operations, enabling bulk ON/OFF transitions of grouped resources according to the controller's operational state.

Below architecture diagram explains the firmware managed resource abstraction:

                                         +--------------------+
                                         |   Shared Memory    |
                                         |                    |
                                         | +----------------+ |       +--------------------+
  +----------------------------+       +-+->  usb-shmem     <-+---+   |    Linux VM        |
  |        Firmware VM         |       | | +----------------+ |   |   |   +----------+     |
  |                            |       | |                    |   |   |   |   USB    |     |
  | +---------+ f +----------+ |       | |                    |   |   |   |  Driver  |     |
  | |Drivers  <---+  SCMI    | |   e   | |         |          |   |   |   +--+----^--+     |
  | | (clks,  | g | Server   +-+-------+ |                    |   |   |      |    |        |
  | |  GDSC,  +--->          | |   h     |         |          |  b|k  |     a|   l|        |
  | |  gpio,  |   +--^-----+-+ |         |                    |   |   |      |    |        |
  | |  resets,|      |     |   |         |         |          |   |   |  +---v----+----+   |
  | |  etc.)  |      |     |   |         |                    |   +---+--+  USB SCMI   |   |
  | +---------+      |     |   |         |                    |       |  |  INSTANCE   |   |
  |                  |     |   |         |  +---------------+ |       |  +-^-----+-----+   |
  |                  |     |   |         |  |  pcie-shmem   | |       |    |     |         |
  +------------------+-----+---+         |  +---------------+ |       +----+-----+---------+
                     |     |             |                    |            |     |
                     |     |             +--------------------+            |     |
                    d|IRQ i|HVC                                           j|IRQ c|HVC
                     |     |                                               |     |
                     |     |                                               |     |
+--------------------+-----v-----------------------------------------------+-----v---------+
|                                              HYPERVISOR                                  |
+------------------------------------------------------------------------------------------+
     +--------+   +--------+                                           +----------+
     | CLOCK  |   |  Reset |                                           |   USB    |
     +--------+   +--------+                                           +----------+

Below architecture diagram explains the PM suspend and resume sequences (the runtime suspend or resume also will follow similar flow, using different levels to signal the firmware for managing respective resources for the operational states):

PM Suspend Sequence

+-----------+    +-----------+    +-----------+    +-------+    +-----------+    +----------------+    +----------+
|Kernel_PM  |    |DWC3_QCOM  |    |DWC3_CORE  |    |  PHY  |    |   PMOPP   |    | SCMI_Transport |    | Firmware |
+-----------+    +-----------+    +-----------+    +-------+    +-----------+    +----------------+    +----------+
     |                |                |              |              |                  |                  |
     | Call suspend   |                |              |              |                  |                  |
     |--------------->|                |              |              |                  |                  |
     |                | Notify core    |              |              |                  |                  |
     |                | for suspend    |              |              |                  |                  |
     |                |--------------->|              |              |                  |                  |
     |                |                | Trigger PHY  |              |                  |                  |
     |                |                | exit         |              |                  |                  |
     |                |                |------------->|              |                  |                  |
     |                |                | Ack PHY exit |              |                  |                  |
     |                |                |<-------------|              |                  |                  |
     |                |                |              |              |                  |                  |
     |                |  core Suspend  |              |              |                  |                  |
     |                |    complete    |              |              |                  |                  |
     |                |<---------------|              |              |                  |                  |
     |                |                |              |              |                  |                  |
     |                |                | dev_pm_set_level(SYSTEM_SUSPEND)               |                  |
     |                |--------------------------------------------->|                  |                  |
     |                |                |              |              |                  |                  |
     |                |                |              |              |                  |                  |
     |                |                |              |              | Forward set_level|                  |
     |                |                |              |              | (channel A,      |                  |
     |                |                |              |              | domain B,        |                  |
     |                |                |              |              | SYSTEM_SUSPEND)  |                  |
     |                |                |              |              |----------------->|                  |
     |                |                |              |              |                  | Pass suspend info|
     |                |                |              |              |                  | (channel A,      |
     |                |                |              |              |                  | domain B,        |
     |                |                |              |              |                  | SYSTEM_SUSPEND)  |
     |                |                |              |              |                  |----------------->|
     |                |                |              |              |                  |                  | Switch off clocks
     |                |                |              |              |                  |                  |  interconnects,
     |                |                |              |              |                  |                  |  disable GDSC,
     |                |                |              |              |                  |                  |  disable VBUS
     |                |                |              |              |                  |                  |
     |                |                |              |              |                  | Ack              |
     |                |                |              |              |                  |<-----------------|
     |                |                |              |              | Ack              |                  |
     |                |                |              |              |<-----------------|                  |
     |                |                |              | Ack          |                  |                  |
     |                |<---------------------------------------------|                  |                  |
     |                |                |              |              |                  |                  |
     |                |                |              |              |                  |                  |
     |<---------------|                |              |              |                  |                  |
     | Suspend        |                |              |              |                  |                  |
     | complete       |                |              |              |                  |                  |
+-----------+    +-----------+    +-----------+    +-------+    +-----------+    +----------------+    +--------+

PM Resume Sequence

+-----------+    +-----------+    +-----------+    +-------+    +-----------+    +----------------+    +----------+
|Kernel_PM  |    |DWC3_QCOM  |    |DWC3_CORE  |    |  PHY  |    |   PMOPP   |    | SCMI_Transport |    | Firmware |
+-----------+    +-----------+    +-----------+    +-------+    +-----------+    +----------------+    +----------+
     |                |                |              |              |                  |                  |
     | Call resume    |                |              |              |                  |                  |
     |--------------->|                |              |              |                  |                  |
     |                | Notify core    |              |              |                  |                  |
     |                | for resume     |              |              |                  |                  |
     |                |--------------->|              |              |                  |                  |
     |                |                | Trigger PHY  |              |                  |                  |
     |                |                | init         |              |                  |                  |
     |                |                |------------->|              |                  |                  |
     |                |                | Ack PHY init |              |                  |                  |
     |                |                |<-------------|              |                  |                  |
     |                |                |              |              |                  |                  |
     |                |  core Resume   |              |              |                  |                  |
     |                |    complete    |              |              |                  |                  |
     |                |<---------------|              |              |                  |                  |
     |                |                |              |              |                  |                  |
     |                |                |              |              |                  |                  |
     |                |                | dev_pm_set_level(SYSTEM_RESUME)                |                  |
     |                |--------------------------------------------->|                  |                  |
     |                |                |              |              | Forward set_level|                  |
     |                |                |              |              | (channel A,      |                  |
     |                |                |              |              | domain B,        |                  |
     |                |                |              |              | SYSTEM_RESUME)   |                  |
     |                |                |              |              |----------------->|                  |
     |                |                |              |              |                  | Pass resume info |
     |                |                |              |              |                  | (channel A,      |
     |                |                |              |              |                  | domain B,        |
     |                |                |              |              |                  | SYSTEM_RESUME)   |
     |                |                |              |              |                  |----------------->|
     |                |                |              |              |                  |                  | Enable VBUS,
     |                |                |              |              |                  |                  | enable GDSC,
     |                |                |              |              |                  |                  | switch ON clocks,
     |                |                |              |              |                  |                  | interconnects
     |                |                |              |              |                  |                  |
     |                |                |              |              |                  | Ack              |
     |                |                |              |              |                  |<-----------------|
     |                |                |              |              | Ack              |                  |
     |                |                |              |              |<-----------------|                  |
     |                |                |              | Ack          |                  |                  |
     |                |<---------------------------------------------|                  |                  |
     |                |                |              |              |                  |                  |
     |                |                |              |              |                  |                  |
     |<---------------|                |              |              |                  |                  |
     | Resume         |                |              |              |                  |                  |
     | complete       |                |              |              |                  |                  |
+-----------+    +-----------+    +-----------+    +-------+    +-----------+    +----------------+    +--------+

---
Depends-on: https://lore.kernel.org/all/[email protected]/

---
Sriram Dash (2):
dt-bindings: usb: qcom,snps-dwc3: Add support for firmware-managed resources
usb: dwc3: qcom: Support firmware-managed resource states for power management

 .../devicetree/bindings/usb/qcom,snps-dwc3.yaml    | 173 +++++++++++++--------
 drivers/usb/dwc3/dwc3-qcom.c                       |  97 ++++++++++--
 2 files changed, 199 insertions(+), 71 deletions(-)

---
base-commit: c77a6544d8a2364e4bee1b52890f577be27b7296
change-id: 20251127-controller_scmi_upstream-a344bad23bcc

Best regards,

Signature · 1 line
Sriram Dash <[email protected]>