public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101
@ 2026-03-06 10:29 André Draszik
  2026-03-06 10:29 ` [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc André Draszik
                   ` (9 more replies)
  0 siblings, 10 replies; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik, Marek Szyprowski,
	Krzysztof Kozlowski

Hi,

This series adds support for the power domains on Google GS101.

There are a few differences compared to SoCs already supported by this
driver:
* register access does not work via plain ioremap() / readl() /
  writel().
  Instead, the regmap created by the PMU driver must be used (which
  uses Arm SMCC calls under the hood).
* DTZPC: a call needs to be made before and after power domain off/on,
  to inform the EL3 firmware of the request.
* power domains can and are fed by a regulator rail and therefore
  regulator control needed be implemented.

Bullet points 2 and 3 are new since version 4 of this series, and
related changes are in patches 1, 2, 9, and 10. I can merge patch 9
(SMC call) into the gs101 patch (patch 7) if preferred, but for now I
kept them independent to make it easier to see changes compared to
previous versions of this series, and because patch 9 actually applies
to not only gs101, but to many newer Exynos SoCs, and to make patches 9
and 10 themselves easier to review and reason about.

The DT update to add the new required properties on gs101 will be
posted separately.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
Changes in v7:
- really be consistent with quoting (Krzysztof, patch 4)
- drop invalid tested-by tag (Krzysztof, patch 3 & 4)
- Link to v6: https://lore.kernel.org/r/20260305-gs101-pd-v6-0-8cb953c1a723@linaro.org

Changes in v6:
- collect tags
- patch 4: update commit message footer to clarify that while
  old/existing DT are now incomplete, they'll be updated once binding
  is accepted.
- Link to v5: https://lore.kernel.org/r/20260205-gs101-pd-v5-0-ede49cdb57a6@linaro.org

Changes in v5:
- add domain-supply to binding (patch 2)
- Link to v4: https://lore.kernel.org/r/20260128-gs101-pd-v4-0-cbe7bd5a4060@linaro.org

Changes in v4:
- drop unneeded or already merged patches
- drop patch "pmdomain: samsung: convert to regmap_read_poll_timeout()"
  as Marek reported issues on some platforms
- rebase
- DTZPC related changes
- Link to v3: https://lore.kernel.org/r/20251016-gs101-pd-v3-0-7b30797396e7@linaro.org

Changes in v3:
- use additionalProperties, not unevaluatedProperties in patch 2
- fix path in $id in patch 2 (Rob)
- drop comment around 'select' in patch 2 (Rob)
- collect tags
- Link to v2: https://lore.kernel.org/r/20251009-gs101-pd-v2-0-3f4a6db2af39@linaro.org

Changes in v2:
- Krzysztof:
  - move google,gs101-pmu binding into separate file
  - mark devm_kstrdup_const() patch as fix
  - use bool for need_early_sync_state
  - merge patches 8 and 10 from v1 series into one patch
- collect tags
- Link to v1: https://lore.kernel.org/r/20251006-gs101-pd-v1-0-f0cb0c01ea7b@linaro.org

---
André Draszik (10):
      dt-bindings: soc: google: add google,gs101-dtzpc
      dt-bindings: power: samsung: add google,gs101-pd
      dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding
      dt-bindings: soc: google: gs101-pmu: allow power domains as children
      pmdomain: samsung: convert to using regmap
      pmdomain: samsung: don't hard-code offset for registers to 0 and 4
      pmdomain: samsung: add support for google,gs101-pd
      pmdomain: samsung: use dev_err() instead of pr_err()
      pmdomain: samsung: implement SMC to save / restore TZ config
      pmdomain: samsung: implement domain-supply regulator

 .../devicetree/bindings/power/pd-samsung.yaml      |  33 ++-
 .../bindings/soc/google/google,gs101-dtzpc.yaml    |  42 ++++
 .../bindings/soc/google/google,gs101-pmu.yaml      |  97 ++++++++
 .../bindings/soc/samsung/exynos-pmu.yaml           |  20 --
 MAINTAINERS                                        |   2 +
 drivers/pmdomain/samsung/exynos-pm-domains.c       | 254 ++++++++++++++++++---
 6 files changed, 399 insertions(+), 49 deletions(-)
---
base-commit: fc7b1a72c6cd5cbbd989c6c32a6486e3e4e3594d
change-id: 20251001-gs101-pd-d4dc97d70a84

Best regards,
-- 
André Draszik <andre.draszik@linaro.org>


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

* [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 14:59   ` Peter Griffin
  2026-03-06 10:29 ` [PATCH v7 02/10] dt-bindings: power: samsung: add google,gs101-pd André Draszik
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik

The Exynos Distributed TruztZone Protection Control (D_TZPC) provides
an interface to the protection bits that are included in the TrustZone
design in a secure system. It configures each area of the memory as
secure or non-secure.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 .../bindings/soc/google/google,gs101-dtzpc.yaml    | 42 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 43 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
new file mode 100644
index 000000000000..a8c61ce069d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/google/google,gs101-dtzpc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung Exynos Distributed TruztZone Protection Control.
+
+description:
+  Distributed TrustZone Protection Control (D_TZPC) provides an interface to the
+  protection bits that are included in the TrustZone design in a secure system.
+  It configures each area of the memory as secure or non-secure.
+
+maintainers:
+  - André Draszik <andre.draszik@linaro.org>
+
+properties:
+  compatible:
+    const: google,gs101-dtzpc
+
+  clocks:
+    maxItems: 1
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - clocks
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/google,gs101.h>
+
+    dtzpc_hsi0: dtzpc@11010000 {
+      compatible = "google,gs101-dtzpc";
+      reg = <0x11010000 0x10000>;
+      clocks = <&cmu_hsi0 CLK_GOUT_HSI0_D_TZPC_HSI0_PCLK>;
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index f0b879760b6e..611fa8fb9f8f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10883,6 +10883,7 @@ P:	Documentation/process/maintainer-soc-clean-dts.rst
 C:	irc://irc.oftc.net/pixel6-kernel-dev
 F:	Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
 F:	Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml
+F:	Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
 F:	Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml
 F:	Documentation/devicetree/bindings/usb/google,lga-dwc3.yaml
 F:	arch/arm64/boot/dts/exynos/google/

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 02/10] dt-bindings: power: samsung: add google,gs101-pd
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
  2026-03-06 10:29 ` [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 14:56   ` Peter Griffin
  2026-03-06 10:29 ` [PATCH v7 03/10] dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding André Draszik
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik

Add support for the Google gs101 version of the Exynos power domains. A
new compatible is needed because register fields have changed and
because power domain operations involve interfacing with the TrustZone
protection control on newer Exynos SoCs.

Power domains can also have a power supply linked to them, so add
optional support for that, too. It is believed that all (existing)
platforms could benefit from this, hence it's not being limited to
gs101-pd.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>

---
v5:
- add domain-supply and update commit message

v4:
- add new vendor property samsung,dtzpc
- drop previous tags due to that
---
 .../devicetree/bindings/power/pd-samsung.yaml      | 33 ++++++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/pd-samsung.yaml b/Documentation/devicetree/bindings/power/pd-samsung.yaml
index 9c2c51133457..3f1a2dc17862 100644
--- a/Documentation/devicetree/bindings/power/pd-samsung.yaml
+++ b/Documentation/devicetree/bindings/power/pd-samsung.yaml
@@ -13,12 +13,10 @@ description: |+
   Exynos processors include support for multiple power domains which are used
   to gate power to one or more peripherals on the processor.
 
-allOf:
-  - $ref: power-domain.yaml#
-
 properties:
   compatible:
     enum:
+      - google,gs101-pd
       - samsung,exynos4210-pd
       - samsung,exynos5433-pd
 
@@ -33,6 +31,9 @@ properties:
     deprecated: true
     maxItems: 1
 
+  domain-supply:
+    description: domain regulator supply.
+
   label:
     description:
       Human readable string with domain name. Will be visible in userspace
@@ -44,11 +45,28 @@ properties:
   power-domains:
     maxItems: 1
 
+  samsung,dtzpc:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Distributed TrustZone Protection Control (DTZPC) node.
+
 required:
   - compatible
   - "#power-domain-cells"
   - reg
 
+allOf:
+  - $ref: power-domain.yaml#
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              const: google,gs101-pd
+    then:
+      properties:
+        samsung,dtzpc: false
+
 unevaluatedProperties: false
 
 examples:
@@ -66,3 +84,12 @@ examples:
         #power-domain-cells = <0>;
         label = "MFC";
     };
+
+    power-domain@2080 {
+        compatible = "google,gs101-pd";
+        reg = <0x2080 0x80>;
+        #power-domain-cells = <0>;
+        label = "hsi0";
+        domain-supply = <&ldo7m>;
+        samsung,dtzpc = <&dtzpc_hsi0>;
+    };

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 03/10] dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
  2026-03-06 10:29 ` [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc André Draszik
  2026-03-06 10:29 ` [PATCH v7 02/10] dt-bindings: power: samsung: add google,gs101-pd André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 14:59   ` Peter Griffin
  2026-03-06 10:29 ` [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children André Draszik
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik

The gs101-pmu binding is going to acquire various additional (pattern)
properties that don't apply to other PMUs supported by this binding.

To enable this, move google,gs101-pmu into a separate binding.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
v7:
- drop invalid tested-by tag (Krzysztof)

v4:
- update since 'syscon' was removed from gs101-pmu compatibles
- update since 'select:' was removed from google,gs101-pmu.yaml

v3:
- use additionalProperties, not unevaluatedProperties
- fix path in $id (Rob)
- drop comment around 'select' (Rob)
---
 .../bindings/soc/google/google,gs101-pmu.yaml      | 56 ++++++++++++++++++++++
 .../bindings/soc/samsung/exynos-pmu.yaml           | 20 --------
 MAINTAINERS                                        |  1 +
 3 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
new file mode 100644
index 000000000000..a06bd8ec3c20
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/google/google,gs101-pmu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Google GS101 Power Management Unit (PMU)
+
+maintainers:
+  - André Draszik <andre.draszik@linaro.org>
+
+properties:
+  compatible:
+    const: google,gs101-pmu
+
+  reg:
+    maxItems: 1
+
+  reboot-mode:
+    $ref: /schemas/power/reset/syscon-reboot-mode.yaml
+    type: object
+    description:
+      Reboot mode to alter bootloader behavior for the next boot
+
+  syscon-poweroff:
+    $ref: /schemas/power/reset/syscon-poweroff.yaml#
+    type: object
+    description:
+      Node for power off method
+
+  syscon-reboot:
+    $ref: /schemas/power/reset/syscon-reboot.yaml#
+    type: object
+    description:
+      Node for reboot method
+
+  google,pmu-intr-gen-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to PMU interrupt generation interface.
+
+required:
+  - compatible
+  - reg
+  - google,pmu-intr-gen-syscon
+
+additionalProperties: false
+
+examples:
+  - |
+    system-controller@17460000 {
+        compatible = "google,gs101-pmu";
+        reg = <0x17460000 0x10000>;
+
+        google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
+    };
diff --git a/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml b/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
index 76ce7e98c10f..09368dbb6de6 100644
--- a/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
+++ b/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
@@ -12,8 +12,6 @@ maintainers:
 properties:
   compatible:
     oneOf:
-      - enum:
-          - google,gs101-pmu
       - items:
           - enum:
               - samsung,exynos3250-pmu
@@ -110,11 +108,6 @@ properties:
     description:
       Node for reboot method
 
-  google,pmu-intr-gen-syscon:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    description:
-      Phandle to PMU interrupt generation interface.
-
 required:
   - compatible
   - reg
@@ -176,19 +169,6 @@ allOf:
       properties:
         dp-phy: false
 
-  - if:
-      properties:
-        compatible:
-          contains:
-            enum:
-              - google,gs101-pmu
-    then:
-      required:
-        - google,pmu-intr-gen-syscon
-    else:
-      properties:
-        google,pmu-intr-gen-syscon: false
-
 examples:
   - |
     #include <dt-bindings/clock/exynos5250.h>
diff --git a/MAINTAINERS b/MAINTAINERS
index 611fa8fb9f8f..6a00d97ccd09 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10884,6 +10884,7 @@ C:	irc://irc.oftc.net/pixel6-kernel-dev
 F:	Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
 F:	Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml
 F:	Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
+F:	Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
 F:	Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml
 F:	Documentation/devicetree/bindings/usb/google,lga-dwc3.yaml
 F:	arch/arm64/boot/dts/exynos/google/

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (2 preceding siblings ...)
  2026-03-06 10:29 ` [PATCH v7 03/10] dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 15:12   ` Peter Griffin
  2026-03-12 15:12   ` Rob Herring
  2026-03-06 10:29 ` [PATCH v7 05/10] pmdomain: samsung: convert to using regmap André Draszik
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik

The power domains are a property of / implemented in the PMU. As such,
they should be modelled as child nodes of the PMU.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
v7:
- really be consistent with quoting (Krzysztof)
- drop invalid tested-by tag (Krzysztof)

v4:
- consistent quoting using " (Krzysztof)
- add samsung,dtzpc to example

Note:
Because the properties added are 'required', this commit breaks DT
validation of the existing DT for Pixel 6, but a) that's simply because
the DT is incomplete and b) a DT update will be posted once the binding
is accepted.
It is not possible to write the binding such that it supports old
(incomplete) DTs in addition to the full version, but as per above
it's not required to keep supporting old DTs.
---
 .../bindings/soc/google/google,gs101-pmu.yaml      | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
index a06bd8ec3c20..dfe6f87e5949 100644
--- a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
+++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
@@ -16,6 +16,14 @@ properties:
   reg:
     maxItems: 1
 
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+  ranges: true
+
   reboot-mode:
     $ref: /schemas/power/reset/syscon-reboot-mode.yaml
     type: object
@@ -39,9 +47,23 @@ properties:
     description:
       Phandle to PMU interrupt generation interface.
 
+patternProperties:
+  "^power-domain@[0-9a-f]+$":
+    type: object
+    description: Child node describing one power domain within the PMU
+
+    additionalProperties: true
+
+    properties:
+      compatible:
+        const: google,gs101-pd
+
 required:
   - compatible
   - reg
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
   - google,pmu-intr-gen-syscon
 
 additionalProperties: false
@@ -51,6 +73,25 @@ examples:
     system-controller@17460000 {
         compatible = "google,gs101-pmu";
         reg = <0x17460000 0x10000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
 
         google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
+
+        pd_g3d: power-domain@1e00 {
+            compatible = "google,gs101-pd";
+            reg = <0x1e00 0x80>;
+            #power-domain-cells = <0>;
+            label = "g3d";
+            samsung,dtzpc = <&pd_g3d>;
+        };
+
+        power-domain@2000 {
+            compatible = "google,gs101-pd";
+            reg = <0x2000 0x80>;
+            #power-domain-cells = <0>;
+            power-domains = <&pd_g3d>;
+            label = "embedded_g3d";
+        };
     };

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 05/10] pmdomain: samsung: convert to using regmap
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (3 preceding siblings ...)
  2026-03-06 10:29 ` [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 15:30   ` Peter Griffin
  2026-03-06 10:29 ` [PATCH v7 06/10] pmdomain: samsung: don't hard-code offset for registers to 0 and 4 André Draszik
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik, Marek Szyprowski

On platforms such as Google gs101, direct mmio register access to the
PMU registers doesn't necessarily work and access must happen via a
regmap created by the PMU driver instead.

In preparation for supporting such SoCs convert the existing mmio
accesses to using a regmap wrapper.

With this change in place, a follow-up patch can update the driver to
optionally acquire the PMU-created regmap without having to change the
rest of the code.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
There is one checkpatch warning, relating to the non-const
regmap_config. It can not easily be made const at this stage, but a
follow-up patch allows us to make it const and the warning will go away
anyway.

v4:
- rework the loop in exynos_pd_power() slightly, to not return 0 early
  to allow more code to be run after pd on/off register write without
  changing the loop again, required for gs101.
- add error message in case first regmap write in exynos_pd_power() fails
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 83 +++++++++++++++++++++-------
 1 file changed, 62 insertions(+), 21 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index 5c3aa8983087..3bcba7d38ac1 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -9,15 +9,14 @@
 // conjunction with runtime-pm. Support for both device-tree and non-device-tree
 // based power domain support is included.
 
-#include <linux/io.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/pm_domain.h>
 #include <linux/delay.h>
 #include <linux/of.h>
-#include <linux/of_address.h>
 #include <linux/pm_runtime.h>
+#include <linux/regmap.h>
 
 struct exynos_pm_domain_config {
 	/* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
@@ -28,7 +27,7 @@ struct exynos_pm_domain_config {
  * Exynos specific wrapper around the generic power domain
  */
 struct exynos_pm_domain {
-	void __iomem *base;
+	struct regmap *regmap;
 	struct generic_pm_domain pd;
 	u32 local_pwr_cfg;
 };
@@ -36,31 +35,42 @@ struct exynos_pm_domain {
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
 	struct exynos_pm_domain *pd;
-	void __iomem *base;
 	u32 timeout, pwr;
-	char *op;
+	int err;
 
 	pd = container_of(domain, struct exynos_pm_domain, pd);
-	base = pd->base;
 
 	pwr = power_on ? pd->local_pwr_cfg : 0;
-	writel_relaxed(pwr, base);
+	err = regmap_write(pd->regmap, 0, pwr);
+	if (err) {
+		pr_err("Regmap write for power domain %s %sable failed: %d\n",
+		       domain->name, power_on ? "en" : "dis", err);
+		return err;
+	}
 
 	/* Wait max 1ms */
 	timeout = 10;
-
-	while ((readl_relaxed(base + 0x4) & pd->local_pwr_cfg) != pwr) {
-		if (!timeout) {
-			op = (power_on) ? "enable" : "disable";
-			pr_err("Power domain %s %s failed\n", domain->name, op);
-			return -ETIMEDOUT;
+	while (timeout-- > 0) {
+		unsigned int val;
+
+		err = regmap_read(pd->regmap, 0x4, &val);
+		if (err || ((val & pd->local_pwr_cfg) != pwr)) {
+			cpu_relax();
+			usleep_range(80, 100);
+			continue;
 		}
-		timeout--;
-		cpu_relax();
-		usleep_range(80, 100);
+
+		break;
 	}
 
-	return 0;
+	if (!timeout && !err)
+		/* Only return timeout if no other error also occurred. */
+		err = -ETIMEDOUT;
+	if (err)
+		pr_err("Power domain %s %sable failed: %d\n", domain->name,
+		       power_on ? "en" : "dis", err);
+
+	return err;
 }
 
 static int exynos_pd_power_on(struct generic_pm_domain *domain)
@@ -109,8 +119,18 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct of_phandle_args child, parent;
 	struct exynos_pm_domain *pd;
+	struct resource *res;
+	void __iomem *base;
+	unsigned int val;
 	int on, ret;
 
+	struct regmap_config reg_config = {
+		.reg_bits = 32,
+		.val_bits = 32,
+		.reg_stride = 4,
+		.use_relaxed_mmio = true,
+	};
+
 	pm_domain_cfg = of_device_get_match_data(dev);
 	pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
 	if (!pd)
@@ -120,9 +140,26 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	if (!pd->pd.name)
 		return -ENOMEM;
 
-	pd->base = of_iomap(np, 0);
-	if (!pd->base)
-		return -ENODEV;
+	/*
+	 * The resource typically points into the address space of the PMU.
+	 * Therefore, avoid using devm_platform_get_and_ioremap_resource() and
+	 * instead use platform_get_resource() and devm_ioremap() to avoid
+	 * conflicts due to address space overlap.
+	 */
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return dev_err_probe(dev, -ENXIO, "missing IO resources");
+
+	base = devm_ioremap(dev, res->start, resource_size(res));
+	if (!base)
+		return dev_err_probe(dev, -ENOMEM,
+				     "failed to ioremap PMU registers");
+
+	reg_config.max_register = resource_size(res) - reg_config.reg_stride;
+	pd->regmap = devm_regmap_init_mmio(dev, base, &reg_config);
+	if (IS_ERR(pd->regmap))
+		return dev_err_probe(dev, PTR_ERR(base),
+				     "failed to init regmap");
 
 	pd->pd.power_off = exynos_pd_power_off;
 	pd->pd.power_on = exynos_pd_power_on;
@@ -137,7 +174,11 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	    of_device_is_compatible(np, "samsung,exynos4210-pd"))
 		exynos_pd_power_off(&pd->pd);
 
-	on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg;
+	ret = regmap_read(pd->regmap, 0x4, &val);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to read status");
+
+	on = val & pd->local_pwr_cfg;
 
 	pm_genpd_init(&pd->pd, NULL, !on);
 	ret = of_genpd_add_provider_simple(np, &pd->pd);

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 06/10] pmdomain: samsung: don't hard-code offset for registers to 0 and 4
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (4 preceding siblings ...)
  2026-03-06 10:29 ` [PATCH v7 05/10] pmdomain: samsung: convert to using regmap André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 15:51   ` Peter Griffin
  2026-03-06 10:29 ` [PATCH v7 07/10] pmdomain: samsung: add support for google,gs101-pd André Draszik
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik, Marek Szyprowski

On platforms such as Google gs101, direct mmio register access to the
PMU registers doesn't necessarily work and access must happen via a
regmap created by the PMU driver instead.

When such a regmap is used it will cover the complete PMU memory region
rather than individual power domains. This means the register offsets
for the configuration and status registers will have to take the power
domain offsets into account, rather than unconditionally hard-coding 0
and 4 respectively.

Update the code to allow that.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index 3bcba7d38ac1..8df46b41f9bc 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -30,6 +30,8 @@ struct exynos_pm_domain {
 	struct regmap *regmap;
 	struct generic_pm_domain pd;
 	u32 local_pwr_cfg;
+	u32 configuration_reg;
+	u32 status_reg;
 };
 
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
@@ -41,7 +43,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 	pd = container_of(domain, struct exynos_pm_domain, pd);
 
 	pwr = power_on ? pd->local_pwr_cfg : 0;
-	err = regmap_write(pd->regmap, 0, pwr);
+	err = regmap_write(pd->regmap, pd->configuration_reg, pwr);
 	if (err) {
 		pr_err("Regmap write for power domain %s %sable failed: %d\n",
 		       domain->name, power_on ? "en" : "dis", err);
@@ -53,7 +55,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 	while (timeout-- > 0) {
 		unsigned int val;
 
-		err = regmap_read(pd->regmap, 0x4, &val);
+		err = regmap_read(pd->regmap, pd->status_reg, &val);
 		if (err || ((val & pd->local_pwr_cfg) != pwr)) {
 			cpu_relax();
 			usleep_range(80, 100);
@@ -164,6 +166,8 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	pd->pd.power_off = exynos_pd_power_off;
 	pd->pd.power_on = exynos_pd_power_on;
 	pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg;
+	pd->configuration_reg += 0;
+	pd->status_reg += 4;
 
 	/*
 	 * Some Samsung platforms with bootloaders turning on the splash-screen
@@ -174,7 +178,7 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	    of_device_is_compatible(np, "samsung,exynos4210-pd"))
 		exynos_pd_power_off(&pd->pd);
 
-	ret = regmap_read(pd->regmap, 0x4, &val);
+	ret = regmap_read(pd->regmap, pd->status_reg, &val);
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to read status");
 

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 07/10] pmdomain: samsung: add support for google,gs101-pd
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (5 preceding siblings ...)
  2026-03-06 10:29 ` [PATCH v7 06/10] pmdomain: samsung: don't hard-code offset for registers to 0 and 4 André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 15:20   ` Peter Griffin
  2026-03-06 10:29 ` [PATCH v7 08/10] pmdomain: samsung: use dev_err() instead of pr_err() André Draszik
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik, Marek Szyprowski

On Google gs101, direct mmio register access to the PMU registers
doesn't work and access must happen via a regmap created by the PMU
driver instead.

Add a flag to the device match data to denote this case, and obtain
the regmap using the parent node in DT if true, while keeping to use
the traditional direct mmio regmap otherwise.

Additionally, the status is just one bit on gs101.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>

---
v4:
- add 'use_parent_regmap' flag instead of going by 'syscon' compatible
  in parent, as it's not a given that the parent provides a syscon-
  compatible regmap (it actually doesn't anymore after recent changes
  on gs101)

I've still kept Marek's Tested-by from v3, as legacy Exynos code
doesn't change.
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 66 +++++++++++++++++++---------
 1 file changed, 46 insertions(+), 20 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index 8df46b41f9bc..2214d9f32d59 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -12,6 +12,7 @@
 #include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/mfd/syscon.h>
 #include <linux/pm_domain.h>
 #include <linux/delay.h>
 #include <linux/of.h>
@@ -21,6 +22,7 @@
 struct exynos_pm_domain_config {
 	/* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
 	u32 local_pwr_cfg;
+	bool use_parent_regmap;
 };
 
 /*
@@ -93,8 +95,16 @@ static const struct exynos_pm_domain_config exynos5433_cfg = {
 	.local_pwr_cfg		= 0xf,
 };
 
+static const struct exynos_pm_domain_config gs101_cfg = {
+	.local_pwr_cfg		= BIT(0),
+	.use_parent_regmap	= true,
+};
+
 static const struct of_device_id exynos_pm_domain_of_match[] = {
 	{
+		.compatible = "google,gs101-pd",
+		.data = &gs101_cfg,
+	}, {
 		.compatible = "samsung,exynos4210-pd",
 		.data = &exynos4210_cfg,
 	}, {
@@ -122,17 +132,9 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	struct of_phandle_args child, parent;
 	struct exynos_pm_domain *pd;
 	struct resource *res;
-	void __iomem *base;
 	unsigned int val;
 	int on, ret;
 
-	struct regmap_config reg_config = {
-		.reg_bits = 32,
-		.val_bits = 32,
-		.reg_stride = 4,
-		.use_relaxed_mmio = true,
-	};
-
 	pm_domain_cfg = of_device_get_match_data(dev);
 	pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
 	if (!pd)
@@ -143,25 +145,49 @@ static int exynos_pd_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/*
-	 * The resource typically points into the address space of the PMU.
+	 * The resource typically points into the address space of the PMU and
+	 * we have to consider two cases:
+	 *   1) some implementations require a custom regmap (from PMU parent)
+	 *   2) this driver might map the same addresses as the PMU driver
 	 * Therefore, avoid using devm_platform_get_and_ioremap_resource() and
-	 * instead use platform_get_resource() and devm_ioremap() to avoid
+	 * instead use platform_get_resource() here, and below for case 1) use
+	 * syscon_node_to_regmap() while for case 2) use devm_ioremap() to avoid
 	 * conflicts due to address space overlap.
 	 */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return dev_err_probe(dev, -ENXIO, "missing IO resources");
 
-	base = devm_ioremap(dev, res->start, resource_size(res));
-	if (!base)
-		return dev_err_probe(dev, -ENOMEM,
-				     "failed to ioremap PMU registers");
-
-	reg_config.max_register = resource_size(res) - reg_config.reg_stride;
-	pd->regmap = devm_regmap_init_mmio(dev, base, &reg_config);
-	if (IS_ERR(pd->regmap))
-		return dev_err_probe(dev, PTR_ERR(base),
-				     "failed to init regmap");
+	if (pm_domain_cfg->use_parent_regmap) {
+		pd->regmap = syscon_node_to_regmap(dev->parent->of_node);
+		if (IS_ERR(pd->regmap))
+			return dev_err_probe(dev, PTR_ERR(pd->regmap),
+					     "failed to acquire PMU regmap");
+
+		pd->configuration_reg = res->start;
+		pd->status_reg = res->start;
+	} else {
+		void __iomem *base;
+
+		const struct regmap_config reg_config = {
+			.reg_bits = 32,
+			.val_bits = 32,
+			.reg_stride = 4,
+			.use_relaxed_mmio = true,
+			.max_register = (resource_size(res)
+					 - reg_config.reg_stride),
+		};
+
+		base = devm_ioremap(dev, res->start, resource_size(res));
+		if (!base)
+			return dev_err_probe(dev, -ENOMEM,
+					     "failed to ioremap PMU registers");
+
+		pd->regmap = devm_regmap_init_mmio(dev, base, &reg_config);
+		if (IS_ERR(pd->regmap))
+			return dev_err_probe(dev, PTR_ERR(base),
+					     "failed to init regmap");
+	}
 
 	pd->pd.power_off = exynos_pd_power_off;
 	pd->pd.power_on = exynos_pd_power_on;

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 08/10] pmdomain: samsung: use dev_err() instead of pr_err()
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (6 preceding siblings ...)
  2026-03-06 10:29 ` [PATCH v7 07/10] pmdomain: samsung: add support for google,gs101-pd André Draszik
@ 2026-03-06 10:29 ` André Draszik
  2026-03-06 15:21   ` Peter Griffin
  2026-03-06 10:30 ` [PATCH v7 09/10] pmdomain: samsung: implement SMC to save / restore TZ config André Draszik
  2026-03-06 10:30 ` [PATCH v7 10/10] pmdomain: samsung: implement domain-supply regulator André Draszik
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik, Marek Szyprowski,
	Krzysztof Kozlowski

dev_err() gives us more consistent error messages, which include the
device. Switch to using dev_err().

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index 2214d9f32d59..41a232b3cdaf 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -30,6 +30,7 @@ struct exynos_pm_domain_config {
  */
 struct exynos_pm_domain {
 	struct regmap *regmap;
+	struct device *dev;
 	struct generic_pm_domain pd;
 	u32 local_pwr_cfg;
 	u32 configuration_reg;
@@ -47,8 +48,9 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 	pwr = power_on ? pd->local_pwr_cfg : 0;
 	err = regmap_write(pd->regmap, pd->configuration_reg, pwr);
 	if (err) {
-		pr_err("Regmap write for power domain %s %sable failed: %d\n",
-		       domain->name, power_on ? "en" : "dis", err);
+		dev_err(pd->dev,
+			"Regmap write for power domain %s %sable failed: %d\n",
+			domain->name, power_on ? "en" : "dis", err);
 		return err;
 	}
 
@@ -71,8 +73,8 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 		/* Only return timeout if no other error also occurred. */
 		err = -ETIMEDOUT;
 	if (err)
-		pr_err("Power domain %s %sable failed: %d\n", domain->name,
-		       power_on ? "en" : "dis", err);
+		dev_err(pd->dev, "Power domain %s %sable failed: %d\n",
+			domain->name, power_on ? "en" : "dis", err);
 
 	return err;
 }
@@ -140,6 +142,8 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	if (!pd)
 		return -ENOMEM;
 
+	pd->dev = dev;
+
 	pd->pd.name = exynos_get_domain_name(dev, np);
 	if (!pd->pd.name)
 		return -ENOMEM;

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 09/10] pmdomain: samsung: implement SMC to save / restore TZ config
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (7 preceding siblings ...)
  2026-03-06 10:29 ` [PATCH v7 08/10] pmdomain: samsung: use dev_err() instead of pr_err() André Draszik
@ 2026-03-06 10:30 ` André Draszik
  2026-03-06 15:37   ` Peter Griffin
  2026-03-06 10:30 ` [PATCH v7 10/10] pmdomain: samsung: implement domain-supply regulator André Draszik
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:30 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik

Newer Exynos platforms have a Distributed Trust Zone Protection Control
(DTZPC) linked to each power domain. It controls the access permissions
to various registers from secure and non-secure world. An SMC call is
required to instruct the firmware that the power domain is about to be
turned off and again once it was turned on. This allows the firmware to
save and restore the DTZPC configuration. Without, register access to
various registers becomes impossible from Linux (causing SError), as
the PoR configuration doesn't allow access.

Neither the requirement for the SMC call, nor its arguments appear to
be specific to gs101, as at least Exynos E850 also uses the same as can
be seen in [1], hence prefix the new macros simply with EXYNOS_.

At least on gs101, this SMC call isn't implemented for all power
domains (e.g. it's missing for HSI2 (UFS)), therefore we issue a test
SMC to store the configuration during probe, and if it fails we mark a
domain as always-on to avoid the SErrors and to avoid unnecessarily
retrying for each domain on/off.

Link: https://lore.kernel.org/all/20230308233822.31180-4-semen.protsenko@linaro.org/ [1]
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 96 ++++++++++++++++++++++++++--
 1 file changed, 90 insertions(+), 6 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index 41a232b3cdaf..f59986b56213 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -9,6 +9,7 @@
 // conjunction with runtime-pm. Support for both device-tree and non-device-tree
 // based power domain support is included.
 
+#include <linux/arm-smccc.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -16,12 +17,19 @@
 #include <linux/pm_domain.h>
 #include <linux/delay.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
+#define EXYNOS_SMC_CMD_PREPARE_PD_ONOFF		0x82000410
+#define EXYNOS_GET_IN_PD_DOWN			0
+#define EXYNOS_WAKEUP_PD_DOWN			1
+#define EXYNOS_RUNTIME_PM_TZPC_GROUP		2
+
 struct exynos_pm_domain_config {
 	/* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
 	u32 local_pwr_cfg;
+	u32 smc_offset;
 	bool use_parent_regmap;
 };
 
@@ -32,11 +40,28 @@ struct exynos_pm_domain {
 	struct regmap *regmap;
 	struct device *dev;
 	struct generic_pm_domain pd;
-	u32 local_pwr_cfg;
+	const struct exynos_pm_domain_config *cfg;
 	u32 configuration_reg;
 	u32 status_reg;
+	phys_addr_t ac_pa;
 };
 
+static int exynos_pd_access_controller_power(struct exynos_pm_domain *pd,
+					     bool power_on)
+{
+	struct arm_smccc_res res;
+
+	if (!pd->ac_pa || !pd->cfg->smc_offset)
+		return 0;
+
+	arm_smccc_smc(EXYNOS_SMC_CMD_PREPARE_PD_ONOFF,
+		      power_on ? EXYNOS_WAKEUP_PD_DOWN : EXYNOS_GET_IN_PD_DOWN,
+		      pd->ac_pa + pd->cfg->smc_offset,
+		      EXYNOS_RUNTIME_PM_TZPC_GROUP, 0, 0, 0, 0, &res);
+
+	return res.a0;
+}
+
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
 	struct exynos_pm_domain *pd;
@@ -45,7 +70,17 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 
 	pd = container_of(domain, struct exynos_pm_domain, pd);
 
-	pwr = power_on ? pd->local_pwr_cfg : 0;
+	if (!power_on) {
+		err = exynos_pd_access_controller_power(pd, power_on);
+		if (err) {
+			dev_err(pd->dev,
+				"SMC for power domain %s %sable failed: %d\n",
+				domain->name, power_on ? "en" : "dis", err);
+			return err;
+		}
+	}
+
+	pwr = power_on ? pd->cfg->local_pwr_cfg : 0;
 	err = regmap_write(pd->regmap, pd->configuration_reg, pwr);
 	if (err) {
 		dev_err(pd->dev,
@@ -60,7 +95,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 		unsigned int val;
 
 		err = regmap_read(pd->regmap, pd->status_reg, &val);
-		if (err || ((val & pd->local_pwr_cfg) != pwr)) {
+		if (err || ((val & pd->cfg->local_pwr_cfg) != pwr)) {
 			cpu_relax();
 			usleep_range(80, 100);
 			continue;
@@ -72,9 +107,21 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 	if (!timeout && !err)
 		/* Only return timeout if no other error also occurred. */
 		err = -ETIMEDOUT;
-	if (err)
+	if (err) {
 		dev_err(pd->dev, "Power domain %s %sable failed: %d\n",
 			domain->name, power_on ? "en" : "dis", err);
+		return err;
+	}
+
+	if (power_on) {
+		err = exynos_pd_access_controller_power(pd, power_on);
+		if (err) {
+			dev_err(pd->dev,
+				"SMC for power domain %s %sable failed: %d\n",
+				domain->name, power_on ? "en" : "dis", err);
+			return err;
+		}
+	}
 
 	return err;
 }
@@ -99,6 +146,7 @@ static const struct exynos_pm_domain_config exynos5433_cfg = {
 
 static const struct exynos_pm_domain_config gs101_cfg = {
 	.local_pwr_cfg		= BIT(0),
+	.smc_offset		= 0x0204,
 	.use_parent_regmap	= true,
 };
 
@@ -126,6 +174,38 @@ static const char *exynos_get_domain_name(struct device *dev,
 	return devm_kstrdup_const(dev, name, GFP_KERNEL);
 }
 
+static int exynos_pd_get_access_controller(struct exynos_pm_domain *pd)
+{
+	struct device_node *ac_np;
+	struct resource ac_res;
+	int ret;
+
+	ac_np = of_parse_phandle(pd->dev->of_node, "samsung,dtzpc", 0);
+	if (!ac_np)
+		return 0;
+
+	ret = of_address_to_resource(ac_np, 0, &ac_res);
+	of_node_put(ac_np);
+	if (ret)
+		return dev_err_probe(pd->dev, ret,
+				     "failed to get access controller\n");
+
+	pd->ac_pa = ac_res.start;
+
+	/*
+	 * For some domains, TZ save/restore might not be implemented. If that
+	 * is the case, simply mark it as always on, as otherwise a power cycle
+	 * will lead to lost TZ configuration, making it impossible to access
+	 * registers from Linux afterwards.
+	 */
+	if (exynos_pd_access_controller_power(pd, false) == -ENOENT) {
+		pd->ac_pa = 0;
+		pd->pd.flags |= GENPD_FLAG_ALWAYS_ON;
+	}
+
+	return 0;
+}
+
 static int exynos_pd_probe(struct platform_device *pdev)
 {
 	const struct exynos_pm_domain_config *pm_domain_cfg;
@@ -195,10 +275,14 @@ static int exynos_pd_probe(struct platform_device *pdev)
 
 	pd->pd.power_off = exynos_pd_power_off;
 	pd->pd.power_on = exynos_pd_power_on;
-	pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg;
+	pd->cfg = pm_domain_cfg;
 	pd->configuration_reg += 0;
 	pd->status_reg += 4;
 
+	ret = exynos_pd_get_access_controller(pd);
+	if (ret)
+		return ret;
+
 	/*
 	 * Some Samsung platforms with bootloaders turning on the splash-screen
 	 * and handing it over to the kernel, requires the power-domains to be
@@ -212,7 +296,7 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to read status");
 
-	on = val & pd->local_pwr_cfg;
+	on = val & pd->cfg->local_pwr_cfg;
 
 	pm_genpd_init(&pd->pd, NULL, !on);
 	ret = of_genpd_add_provider_simple(np, &pd->pd);

-- 
2.53.0.473.g4a7958ca14-goog


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

* [PATCH v7 10/10] pmdomain: samsung: implement domain-supply regulator
  2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
                   ` (8 preceding siblings ...)
  2026-03-06 10:30 ` [PATCH v7 09/10] pmdomain: samsung: implement SMC to save / restore TZ config André Draszik
@ 2026-03-06 10:30 ` André Draszik
  2026-03-06 15:47   ` Peter Griffin
  9 siblings, 1 reply; 26+ messages in thread
From: André Draszik @ 2026-03-06 10:30 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown
  Cc: Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm, André Draszik

Some power domains on Exynos are fed by a regulator rail and therefore
regulator control needs be implemented for Exynos power domains.

On Google gs101, HSI0 (USB) is one example of such a power domain.

While at it, add a to_exynos_pd() to avoid direct use of
container_of() in various additional places, and update existing code
to use it.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 53 +++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 5 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index f59986b56213..ed7a5807555b 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -20,12 +20,15 @@
 #include <linux/of_address.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 
 #define EXYNOS_SMC_CMD_PREPARE_PD_ONOFF		0x82000410
 #define EXYNOS_GET_IN_PD_DOWN			0
 #define EXYNOS_WAKEUP_PD_DOWN			1
 #define EXYNOS_RUNTIME_PM_TZPC_GROUP		2
 
+#define to_exynos_pd(gpd) container_of_const(gpd, struct exynos_pm_domain, pd)
+
 struct exynos_pm_domain_config {
 	/* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
 	u32 local_pwr_cfg;
@@ -39,6 +42,7 @@ struct exynos_pm_domain_config {
 struct exynos_pm_domain {
 	struct regmap *regmap;
 	struct device *dev;
+	struct regulator *supply;
 	struct generic_pm_domain pd;
 	const struct exynos_pm_domain_config *cfg;
 	u32 configuration_reg;
@@ -64,12 +68,10 @@ static int exynos_pd_access_controller_power(struct exynos_pm_domain *pd,
 
 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
-	struct exynos_pm_domain *pd;
+	struct exynos_pm_domain *pd = to_exynos_pd(domain);
 	u32 timeout, pwr;
 	int err;
 
-	pd = container_of(domain, struct exynos_pm_domain, pd);
-
 	if (!power_on) {
 		err = exynos_pd_access_controller_power(pd, power_on);
 		if (err) {
@@ -126,14 +128,45 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
 	return err;
 }
 
+static int exynos_pd_regulator_enable(struct regulator *supply)
+{
+	return supply ? regulator_enable(supply) : 0;
+}
+
+static int exynos_pd_regulator_disable(struct regulator *supply)
+{
+	return supply ? regulator_disable(supply) : 0;
+}
+
 static int exynos_pd_power_on(struct generic_pm_domain *domain)
 {
-	return exynos_pd_power(domain, true);
+	struct exynos_pm_domain *pd = to_exynos_pd(domain);
+	int ret;
+
+	ret = exynos_pd_regulator_enable(pd->supply);
+	if (ret)
+		return ret;
+
+	ret = exynos_pd_power(domain, true);
+	if (ret)
+		exynos_pd_regulator_disable(pd->supply);
+
+	return ret;
 }
 
 static int exynos_pd_power_off(struct generic_pm_domain *domain)
 {
-	return exynos_pd_power(domain, false);
+	struct exynos_pm_domain *pd = to_exynos_pd(domain);
+	int ret;
+
+	ret = exynos_pd_power(domain, false);
+	if (ret)
+		return ret;
+
+	/* Ignore regulator errors - the domain was disabled after all. */
+	exynos_pd_regulator_disable(pd->supply);
+
+	return 0;
 }
 
 static const struct exynos_pm_domain_config exynos4210_cfg = {
@@ -283,6 +316,16 @@ static int exynos_pd_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	/* get the domain power supply if required */
+	pd->supply = devm_regulator_get_optional(dev, "domain");
+	if (IS_ERR(pd->supply)) {
+		if (PTR_ERR(pd->supply) != -ENODEV)
+			return dev_err_probe(dev, PTR_ERR(pd->supply),
+					     "failed to get domain supply");
+
+		pd->supply = NULL;
+	}
+
 	/*
 	 * Some Samsung platforms with bootloaders turning on the splash-screen
 	 * and handing it over to the kernel, requires the power-domains to be

-- 
2.53.0.473.g4a7958ca14-goog


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

* Re: [PATCH v7 02/10] dt-bindings: power: samsung: add google,gs101-pd
  2026-03-06 10:29 ` [PATCH v7 02/10] dt-bindings: power: samsung: add google,gs101-pd André Draszik
@ 2026-03-06 14:56   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 14:56 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> Add support for the Google gs101 version of the Exynos power domains. A
> new compatible is needed because register fields have changed and
> because power domain operations involve interfacing with the TrustZone
> protection control on newer Exynos SoCs.
>
> Power domains can also have a power supply linked to them, so add
> optional support for that, too. It is believed that all (existing)
> platforms could benefit from this, hence it's not being limited to
> gs101-pd.
>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

> v5:
> - add domain-supply and update commit message
>
> v4:
> - add new vendor property samsung,dtzpc
> - drop previous tags due to that
> ---
>  .../devicetree/bindings/power/pd-samsung.yaml      | 33 ++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/power/pd-samsung.yaml b/Documentation/devicetree/bindings/power/pd-samsung.yaml
> index 9c2c51133457..3f1a2dc17862 100644
> --- a/Documentation/devicetree/bindings/power/pd-samsung.yaml
> +++ b/Documentation/devicetree/bindings/power/pd-samsung.yaml
> @@ -13,12 +13,10 @@ description: |+
>    Exynos processors include support for multiple power domains which are used
>    to gate power to one or more peripherals on the processor.
>
> -allOf:
> -  - $ref: power-domain.yaml#
> -
>  properties:
>    compatible:
>      enum:
> +      - google,gs101-pd
>        - samsung,exynos4210-pd
>        - samsung,exynos5433-pd
>
> @@ -33,6 +31,9 @@ properties:
>      deprecated: true
>      maxItems: 1
>
> +  domain-supply:
> +    description: domain regulator supply.
> +
>    label:
>      description:
>        Human readable string with domain name. Will be visible in userspace
> @@ -44,11 +45,28 @@ properties:
>    power-domains:
>      maxItems: 1
>
> +  samsung,dtzpc:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Distributed TrustZone Protection Control (DTZPC) node.
> +
>  required:
>    - compatible
>    - "#power-domain-cells"
>    - reg
>
> +allOf:
> +  - $ref: power-domain.yaml#
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              const: google,gs101-pd
> +    then:
> +      properties:
> +        samsung,dtzpc: false
> +
>  unevaluatedProperties: false
>
>  examples:
> @@ -66,3 +84,12 @@ examples:
>          #power-domain-cells = <0>;
>          label = "MFC";
>      };
> +
> +    power-domain@2080 {
> +        compatible = "google,gs101-pd";
> +        reg = <0x2080 0x80>;
> +        #power-domain-cells = <0>;
> +        label = "hsi0";
> +        domain-supply = <&ldo7m>;
> +        samsung,dtzpc = <&dtzpc_hsi0>;
> +    };
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc
  2026-03-06 10:29 ` [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc André Draszik
@ 2026-03-06 14:59   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 14:59 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> The Exynos Distributed TruztZone Protection Control (D_TZPC) provides
> an interface to the protection bits that are included in the TrustZone
> design in a secure system. It configures each area of the memory as
> secure or non-secure.
>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

>  .../bindings/soc/google/google,gs101-dtzpc.yaml    | 42 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 43 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
> new file mode 100644
> index 000000000000..a8c61ce069d6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
> @@ -0,0 +1,42 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/google/google,gs101-dtzpc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Samsung Exynos Distributed TruztZone Protection Control.
> +
> +description:
> +  Distributed TrustZone Protection Control (D_TZPC) provides an interface to the
> +  protection bits that are included in the TrustZone design in a secure system.
> +  It configures each area of the memory as secure or non-secure.
> +
> +maintainers:
> +  - André Draszik <andre.draszik@linaro.org>
> +
> +properties:
> +  compatible:
> +    const: google,gs101-dtzpc
> +
> +  clocks:
> +    maxItems: 1
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - clocks
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/google,gs101.h>
> +
> +    dtzpc_hsi0: dtzpc@11010000 {
> +      compatible = "google,gs101-dtzpc";
> +      reg = <0x11010000 0x10000>;
> +      clocks = <&cmu_hsi0 CLK_GOUT_HSI0_D_TZPC_HSI0_PCLK>;
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f0b879760b6e..611fa8fb9f8f 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10883,6 +10883,7 @@ P:      Documentation/process/maintainer-soc-clean-dts.rst
>  C:     irc://irc.oftc.net/pixel6-kernel-dev
>  F:     Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
>  F:     Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml
> +F:     Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
>  F:     Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml
>  F:     Documentation/devicetree/bindings/usb/google,lga-dwc3.yaml
>  F:     arch/arm64/boot/dts/exynos/google/
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 03/10] dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding
  2026-03-06 10:29 ` [PATCH v7 03/10] dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding André Draszik
@ 2026-03-06 14:59   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 14:59 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> The gs101-pmu binding is going to acquire various additional (pattern)
> properties that don't apply to other PMUs supported by this binding.
>
> To enable this, move google,gs101-pmu into a separate binding.
>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

> v7:
> - drop invalid tested-by tag (Krzysztof)
>
> v4:
> - update since 'syscon' was removed from gs101-pmu compatibles
> - update since 'select:' was removed from google,gs101-pmu.yaml
>
> v3:
> - use additionalProperties, not unevaluatedProperties
> - fix path in $id (Rob)
> - drop comment around 'select' (Rob)
> ---
>  .../bindings/soc/google/google,gs101-pmu.yaml      | 56 ++++++++++++++++++++++
>  .../bindings/soc/samsung/exynos-pmu.yaml           | 20 --------
>  MAINTAINERS                                        |  1 +
>  3 files changed, 57 insertions(+), 20 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> new file mode 100644
> index 000000000000..a06bd8ec3c20
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/google/google,gs101-pmu.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Google GS101 Power Management Unit (PMU)
> +
> +maintainers:
> +  - André Draszik <andre.draszik@linaro.org>
> +
> +properties:
> +  compatible:
> +    const: google,gs101-pmu
> +
> +  reg:
> +    maxItems: 1
> +
> +  reboot-mode:
> +    $ref: /schemas/power/reset/syscon-reboot-mode.yaml
> +    type: object
> +    description:
> +      Reboot mode to alter bootloader behavior for the next boot
> +
> +  syscon-poweroff:
> +    $ref: /schemas/power/reset/syscon-poweroff.yaml#
> +    type: object
> +    description:
> +      Node for power off method
> +
> +  syscon-reboot:
> +    $ref: /schemas/power/reset/syscon-reboot.yaml#
> +    type: object
> +    description:
> +      Node for reboot method
> +
> +  google,pmu-intr-gen-syscon:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to PMU interrupt generation interface.
> +
> +required:
> +  - compatible
> +  - reg
> +  - google,pmu-intr-gen-syscon
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    system-controller@17460000 {
> +        compatible = "google,gs101-pmu";
> +        reg = <0x17460000 0x10000>;
> +
> +        google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> +    };
> diff --git a/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml b/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
> index 76ce7e98c10f..09368dbb6de6 100644
> --- a/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
> +++ b/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml
> @@ -12,8 +12,6 @@ maintainers:
>  properties:
>    compatible:
>      oneOf:
> -      - enum:
> -          - google,gs101-pmu
>        - items:
>            - enum:
>                - samsung,exynos3250-pmu
> @@ -110,11 +108,6 @@ properties:
>      description:
>        Node for reboot method
>
> -  google,pmu-intr-gen-syscon:
> -    $ref: /schemas/types.yaml#/definitions/phandle
> -    description:
> -      Phandle to PMU interrupt generation interface.
> -
>  required:
>    - compatible
>    - reg
> @@ -176,19 +169,6 @@ allOf:
>        properties:
>          dp-phy: false
>
> -  - if:
> -      properties:
> -        compatible:
> -          contains:
> -            enum:
> -              - google,gs101-pmu
> -    then:
> -      required:
> -        - google,pmu-intr-gen-syscon
> -    else:
> -      properties:
> -        google,pmu-intr-gen-syscon: false
> -
>  examples:
>    - |
>      #include <dt-bindings/clock/exynos5250.h>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 611fa8fb9f8f..6a00d97ccd09 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10884,6 +10884,7 @@ C:      irc://irc.oftc.net/pixel6-kernel-dev
>  F:     Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
>  F:     Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml
>  F:     Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml
> +F:     Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
>  F:     Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml
>  F:     Documentation/devicetree/bindings/usb/google,lga-dwc3.yaml
>  F:     arch/arm64/boot/dts/exynos/google/
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-06 10:29 ` [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children André Draszik
@ 2026-03-06 15:12   ` Peter Griffin
  2026-03-12 15:12   ` Rob Herring
  1 sibling, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:12 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> The power domains are a property of / implemented in the PMU. As such,
> they should be modelled as child nodes of the PMU.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

> v7:
> - really be consistent with quoting (Krzysztof)
> - drop invalid tested-by tag (Krzysztof)
>
> v4:
> - consistent quoting using " (Krzysztof)
> - add samsung,dtzpc to example
>
> Note:
> Because the properties added are 'required', this commit breaks DT
> validation of the existing DT for Pixel 6, but a) that's simply because
> the DT is incomplete and b) a DT update will be posted once the binding
> is accepted.
> It is not possible to write the binding such that it supports old
> (incomplete) DTs in addition to the full version, but as per above
> it's not required to keep supporting old DTs.
> ---
>  .../bindings/soc/google/google,gs101-pmu.yaml      | 41 ++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> index a06bd8ec3c20..dfe6f87e5949 100644
> --- a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> +++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> @@ -16,6 +16,14 @@ properties:
>    reg:
>      maxItems: 1
>
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 1
> +
> +  ranges: true
> +
>    reboot-mode:
>      $ref: /schemas/power/reset/syscon-reboot-mode.yaml
>      type: object
> @@ -39,9 +47,23 @@ properties:
>      description:
>        Phandle to PMU interrupt generation interface.
>
> +patternProperties:
> +  "^power-domain@[0-9a-f]+$":
> +    type: object
> +    description: Child node describing one power domain within the PMU
> +
> +    additionalProperties: true
> +
> +    properties:
> +      compatible:
> +        const: google,gs101-pd
> +
>  required:
>    - compatible
>    - reg
> +  - "#address-cells"
> +  - "#size-cells"
> +  - ranges
>    - google,pmu-intr-gen-syscon
>
>  additionalProperties: false
> @@ -51,6 +73,25 @@ examples:
>      system-controller@17460000 {
>          compatible = "google,gs101-pmu";
>          reg = <0x17460000 0x10000>;
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges;
>
>          google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> +
> +        pd_g3d: power-domain@1e00 {
> +            compatible = "google,gs101-pd";
> +            reg = <0x1e00 0x80>;
> +            #power-domain-cells = <0>;
> +            label = "g3d";
> +            samsung,dtzpc = <&pd_g3d>;
> +        };
> +
> +        power-domain@2000 {
> +            compatible = "google,gs101-pd";
> +            reg = <0x2000 0x80>;
> +            #power-domain-cells = <0>;
> +            power-domains = <&pd_g3d>;
> +            label = "embedded_g3d";
> +        };
>      };
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 07/10] pmdomain: samsung: add support for google,gs101-pd
  2026-03-06 10:29 ` [PATCH v7 07/10] pmdomain: samsung: add support for google,gs101-pd André Draszik
@ 2026-03-06 15:20   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:20 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Marek Szyprowski

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> On Google gs101, direct mmio register access to the PMU registers
> doesn't work and access must happen via a regmap created by the PMU
> driver instead.
>
> Add a flag to the device match data to denote this case, and obtain
> the regmap using the parent node in DT if true, while keeping to use
> the traditional direct mmio regmap otherwise.
>
> Additionally, the status is just one bit on gs101.
>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

> v4:
> - add 'use_parent_regmap' flag instead of going by 'syscon' compatible
>   in parent, as it's not a given that the parent provides a syscon-
>   compatible regmap (it actually doesn't anymore after recent changes
>   on gs101)
>
> I've still kept Marek's Tested-by from v3, as legacy Exynos code
> doesn't change.
> ---
>  drivers/pmdomain/samsung/exynos-pm-domains.c | 66 +++++++++++++++++++---------
>  1 file changed, 46 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
> index 8df46b41f9bc..2214d9f32d59 100644
> --- a/drivers/pmdomain/samsung/exynos-pm-domains.c
> +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
> @@ -12,6 +12,7 @@
>  #include <linux/err.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> +#include <linux/mfd/syscon.h>
>  #include <linux/pm_domain.h>
>  #include <linux/delay.h>
>  #include <linux/of.h>
> @@ -21,6 +22,7 @@
>  struct exynos_pm_domain_config {
>         /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
>         u32 local_pwr_cfg;
> +       bool use_parent_regmap;
>  };
>
>  /*
> @@ -93,8 +95,16 @@ static const struct exynos_pm_domain_config exynos5433_cfg = {
>         .local_pwr_cfg          = 0xf,
>  };
>
> +static const struct exynos_pm_domain_config gs101_cfg = {
> +       .local_pwr_cfg          = BIT(0),
> +       .use_parent_regmap      = true,
> +};
> +
>  static const struct of_device_id exynos_pm_domain_of_match[] = {
>         {
> +               .compatible = "google,gs101-pd",
> +               .data = &gs101_cfg,
> +       }, {
>                 .compatible = "samsung,exynos4210-pd",
>                 .data = &exynos4210_cfg,
>         }, {
> @@ -122,17 +132,9 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         struct of_phandle_args child, parent;
>         struct exynos_pm_domain *pd;
>         struct resource *res;
> -       void __iomem *base;
>         unsigned int val;
>         int on, ret;
>
> -       struct regmap_config reg_config = {
> -               .reg_bits = 32,
> -               .val_bits = 32,
> -               .reg_stride = 4,
> -               .use_relaxed_mmio = true,
> -       };
> -
>         pm_domain_cfg = of_device_get_match_data(dev);
>         pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
>         if (!pd)
> @@ -143,25 +145,49 @@ static int exynos_pd_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>
>         /*
> -        * The resource typically points into the address space of the PMU.
> +        * The resource typically points into the address space of the PMU and
> +        * we have to consider two cases:
> +        *   1) some implementations require a custom regmap (from PMU parent)
> +        *   2) this driver might map the same addresses as the PMU driver
>          * Therefore, avoid using devm_platform_get_and_ioremap_resource() and
> -        * instead use platform_get_resource() and devm_ioremap() to avoid
> +        * instead use platform_get_resource() here, and below for case 1) use
> +        * syscon_node_to_regmap() while for case 2) use devm_ioremap() to avoid
>          * conflicts due to address space overlap.
>          */
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         if (!res)
>                 return dev_err_probe(dev, -ENXIO, "missing IO resources");
>
> -       base = devm_ioremap(dev, res->start, resource_size(res));
> -       if (!base)
> -               return dev_err_probe(dev, -ENOMEM,
> -                                    "failed to ioremap PMU registers");
> -
> -       reg_config.max_register = resource_size(res) - reg_config.reg_stride;
> -       pd->regmap = devm_regmap_init_mmio(dev, base, &reg_config);
> -       if (IS_ERR(pd->regmap))
> -               return dev_err_probe(dev, PTR_ERR(base),
> -                                    "failed to init regmap");
> +       if (pm_domain_cfg->use_parent_regmap) {
> +               pd->regmap = syscon_node_to_regmap(dev->parent->of_node);
> +               if (IS_ERR(pd->regmap))
> +                       return dev_err_probe(dev, PTR_ERR(pd->regmap),
> +                                            "failed to acquire PMU regmap");
> +
> +               pd->configuration_reg = res->start;
> +               pd->status_reg = res->start;
> +       } else {
> +               void __iomem *base;
> +
> +               const struct regmap_config reg_config = {
> +                       .reg_bits = 32,
> +                       .val_bits = 32,
> +                       .reg_stride = 4,
> +                       .use_relaxed_mmio = true,
> +                       .max_register = (resource_size(res)
> +                                        - reg_config.reg_stride),
> +               };
> +
> +               base = devm_ioremap(dev, res->start, resource_size(res));
> +               if (!base)
> +                       return dev_err_probe(dev, -ENOMEM,
> +                                            "failed to ioremap PMU registers");
> +
> +               pd->regmap = devm_regmap_init_mmio(dev, base, &reg_config);
> +               if (IS_ERR(pd->regmap))
> +                       return dev_err_probe(dev, PTR_ERR(base),
> +                                            "failed to init regmap");
> +       }
>
>         pd->pd.power_off = exynos_pd_power_off;
>         pd->pd.power_on = exynos_pd_power_on;
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 08/10] pmdomain: samsung: use dev_err() instead of pr_err()
  2026-03-06 10:29 ` [PATCH v7 08/10] pmdomain: samsung: use dev_err() instead of pr_err() André Draszik
@ 2026-03-06 15:21   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:21 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Marek Szyprowski

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> dev_err() gives us more consistent error messages, which include the
> device. Switch to using dev_err().
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

>  drivers/pmdomain/samsung/exynos-pm-domains.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
> index 2214d9f32d59..41a232b3cdaf 100644
> --- a/drivers/pmdomain/samsung/exynos-pm-domains.c
> +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
> @@ -30,6 +30,7 @@ struct exynos_pm_domain_config {
>   */
>  struct exynos_pm_domain {
>         struct regmap *regmap;
> +       struct device *dev;
>         struct generic_pm_domain pd;
>         u32 local_pwr_cfg;
>         u32 configuration_reg;
> @@ -47,8 +48,9 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>         pwr = power_on ? pd->local_pwr_cfg : 0;
>         err = regmap_write(pd->regmap, pd->configuration_reg, pwr);
>         if (err) {
> -               pr_err("Regmap write for power domain %s %sable failed: %d\n",
> -                      domain->name, power_on ? "en" : "dis", err);
> +               dev_err(pd->dev,
> +                       "Regmap write for power domain %s %sable failed: %d\n",
> +                       domain->name, power_on ? "en" : "dis", err);
>                 return err;
>         }
>
> @@ -71,8 +73,8 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>                 /* Only return timeout if no other error also occurred. */
>                 err = -ETIMEDOUT;
>         if (err)
> -               pr_err("Power domain %s %sable failed: %d\n", domain->name,
> -                      power_on ? "en" : "dis", err);
> +               dev_err(pd->dev, "Power domain %s %sable failed: %d\n",
> +                       domain->name, power_on ? "en" : "dis", err);
>
>         return err;
>  }
> @@ -140,6 +142,8 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         if (!pd)
>                 return -ENOMEM;
>
> +       pd->dev = dev;
> +
>         pd->pd.name = exynos_get_domain_name(dev, np);
>         if (!pd->pd.name)
>                 return -ENOMEM;
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 05/10] pmdomain: samsung: convert to using regmap
  2026-03-06 10:29 ` [PATCH v7 05/10] pmdomain: samsung: convert to using regmap André Draszik
@ 2026-03-06 15:30   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:30 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Marek Szyprowski

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> On platforms such as Google gs101, direct mmio register access to the
> PMU registers doesn't necessarily work and access must happen via a
> regmap created by the PMU driver instead.
>
> In preparation for supporting such SoCs convert the existing mmio
> accesses to using a regmap wrapper.
>
> With this change in place, a follow-up patch can update the driver to
> optionally acquire the PMU-created regmap without having to change the
> rest of the code.
>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> There is one checkpatch warning, relating to the non-const
> regmap_config. It can not easily be made const at this stage, but a
> follow-up patch allows us to make it const and the warning will go away
> anyway.
>
> v4:
> - rework the loop in exynos_pd_power() slightly, to not return 0 early
>   to allow more code to be run after pd on/off register write without
>   changing the loop again, required for gs101.
> - add error message in case first regmap write in exynos_pd_power() fails
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

>  drivers/pmdomain/samsung/exynos-pm-domains.c | 83 +++++++++++++++++++++-------
>  1 file changed, 62 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
> index 5c3aa8983087..3bcba7d38ac1 100644
> --- a/drivers/pmdomain/samsung/exynos-pm-domains.c
> +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
> @@ -9,15 +9,14 @@
>  // conjunction with runtime-pm. Support for both device-tree and non-device-tree
>  // based power domain support is included.
>
> -#include <linux/io.h>
>  #include <linux/err.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  #include <linux/pm_domain.h>
>  #include <linux/delay.h>
>  #include <linux/of.h>
> -#include <linux/of_address.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/regmap.h>
>
>  struct exynos_pm_domain_config {
>         /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
> @@ -28,7 +27,7 @@ struct exynos_pm_domain_config {
>   * Exynos specific wrapper around the generic power domain
>   */
>  struct exynos_pm_domain {
> -       void __iomem *base;
> +       struct regmap *regmap;
>         struct generic_pm_domain pd;
>         u32 local_pwr_cfg;
>  };
> @@ -36,31 +35,42 @@ struct exynos_pm_domain {
>  static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>  {
>         struct exynos_pm_domain *pd;
> -       void __iomem *base;
>         u32 timeout, pwr;
> -       char *op;
> +       int err;
>
>         pd = container_of(domain, struct exynos_pm_domain, pd);
> -       base = pd->base;
>
>         pwr = power_on ? pd->local_pwr_cfg : 0;
> -       writel_relaxed(pwr, base);
> +       err = regmap_write(pd->regmap, 0, pwr);
> +       if (err) {
> +               pr_err("Regmap write for power domain %s %sable failed: %d\n",
> +                      domain->name, power_on ? "en" : "dis", err);
> +               return err;
> +       }
>
>         /* Wait max 1ms */
>         timeout = 10;
> -
> -       while ((readl_relaxed(base + 0x4) & pd->local_pwr_cfg) != pwr) {
> -               if (!timeout) {
> -                       op = (power_on) ? "enable" : "disable";
> -                       pr_err("Power domain %s %s failed\n", domain->name, op);
> -                       return -ETIMEDOUT;
> +       while (timeout-- > 0) {
> +               unsigned int val;
> +
> +               err = regmap_read(pd->regmap, 0x4, &val);
> +               if (err || ((val & pd->local_pwr_cfg) != pwr)) {
> +                       cpu_relax();
> +                       usleep_range(80, 100);
> +                       continue;
>                 }
> -               timeout--;
> -               cpu_relax();
> -               usleep_range(80, 100);
> +
> +               break;
>         }
>
> -       return 0;
> +       if (!timeout && !err)
> +               /* Only return timeout if no other error also occurred. */
> +               err = -ETIMEDOUT;
> +       if (err)
> +               pr_err("Power domain %s %sable failed: %d\n", domain->name,
> +                      power_on ? "en" : "dis", err);
> +
> +       return err;
>  }
>
>  static int exynos_pd_power_on(struct generic_pm_domain *domain)
> @@ -109,8 +119,18 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         struct device_node *np = dev->of_node;
>         struct of_phandle_args child, parent;
>         struct exynos_pm_domain *pd;
> +       struct resource *res;
> +       void __iomem *base;
> +       unsigned int val;
>         int on, ret;
>
> +       struct regmap_config reg_config = {
> +               .reg_bits = 32,
> +               .val_bits = 32,
> +               .reg_stride = 4,
> +               .use_relaxed_mmio = true,
> +       };
> +
>         pm_domain_cfg = of_device_get_match_data(dev);
>         pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
>         if (!pd)
> @@ -120,9 +140,26 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         if (!pd->pd.name)
>                 return -ENOMEM;
>
> -       pd->base = of_iomap(np, 0);
> -       if (!pd->base)
> -               return -ENODEV;
> +       /*
> +        * The resource typically points into the address space of the PMU.
> +        * Therefore, avoid using devm_platform_get_and_ioremap_resource() and
> +        * instead use platform_get_resource() and devm_ioremap() to avoid
> +        * conflicts due to address space overlap.
> +        */
> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res)
> +               return dev_err_probe(dev, -ENXIO, "missing IO resources");
> +
> +       base = devm_ioremap(dev, res->start, resource_size(res));
> +       if (!base)
> +               return dev_err_probe(dev, -ENOMEM,
> +                                    "failed to ioremap PMU registers");
> +
> +       reg_config.max_register = resource_size(res) - reg_config.reg_stride;
> +       pd->regmap = devm_regmap_init_mmio(dev, base, &reg_config);
> +       if (IS_ERR(pd->regmap))
> +               return dev_err_probe(dev, PTR_ERR(base),
> +                                    "failed to init regmap");
>
>         pd->pd.power_off = exynos_pd_power_off;
>         pd->pd.power_on = exynos_pd_power_on;
> @@ -137,7 +174,11 @@ static int exynos_pd_probe(struct platform_device *pdev)
>             of_device_is_compatible(np, "samsung,exynos4210-pd"))
>                 exynos_pd_power_off(&pd->pd);
>
> -       on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg;
> +       ret = regmap_read(pd->regmap, 0x4, &val);
> +       if (ret)
> +               return dev_err_probe(dev, ret, "failed to read status");
> +
> +       on = val & pd->local_pwr_cfg;
>
>         pm_genpd_init(&pd->pd, NULL, !on);
>         ret = of_genpd_add_provider_simple(np, &pd->pd);
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 09/10] pmdomain: samsung: implement SMC to save / restore TZ config
  2026-03-06 10:30 ` [PATCH v7 09/10] pmdomain: samsung: implement SMC to save / restore TZ config André Draszik
@ 2026-03-06 15:37   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:37 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Fri, 6 Mar 2026 at 10:30, André Draszik <andre.draszik@linaro.org> wrote:
>
> Newer Exynos platforms have a Distributed Trust Zone Protection Control
> (DTZPC) linked to each power domain. It controls the access permissions
> to various registers from secure and non-secure world. An SMC call is
> required to instruct the firmware that the power domain is about to be
> turned off and again once it was turned on. This allows the firmware to
> save and restore the DTZPC configuration. Without, register access to
> various registers becomes impossible from Linux (causing SError), as
> the PoR configuration doesn't allow access.
>
> Neither the requirement for the SMC call, nor its arguments appear to
> be specific to gs101, as at least Exynos E850 also uses the same as can
> be seen in [1], hence prefix the new macros simply with EXYNOS_.
>
> At least on gs101, this SMC call isn't implemented for all power
> domains (e.g. it's missing for HSI2 (UFS)), therefore we issue a test
> SMC to store the configuration during probe, and if it fails we mark a
> domain as always-on to avoid the SErrors and to avoid unnecessarily
> retrying for each domain on/off.
>
> Link: https://lore.kernel.org/all/20230308233822.31180-4-semen.protsenko@linaro.org/ [1]
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

>  drivers/pmdomain/samsung/exynos-pm-domains.c | 96 ++++++++++++++++++++++++++--
>  1 file changed, 90 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
> index 41a232b3cdaf..f59986b56213 100644
> --- a/drivers/pmdomain/samsung/exynos-pm-domains.c
> +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
> @@ -9,6 +9,7 @@
>  // conjunction with runtime-pm. Support for both device-tree and non-device-tree
>  // based power domain support is included.
>
> +#include <linux/arm-smccc.h>
>  #include <linux/err.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> @@ -16,12 +17,19 @@
>  #include <linux/pm_domain.h>
>  #include <linux/delay.h>
>  #include <linux/of.h>
> +#include <linux/of_address.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>
> +#define EXYNOS_SMC_CMD_PREPARE_PD_ONOFF                0x82000410
> +#define EXYNOS_GET_IN_PD_DOWN                  0
> +#define EXYNOS_WAKEUP_PD_DOWN                  1
> +#define EXYNOS_RUNTIME_PM_TZPC_GROUP           2
> +
>  struct exynos_pm_domain_config {
>         /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
>         u32 local_pwr_cfg;
> +       u32 smc_offset;
>         bool use_parent_regmap;
>  };
>
> @@ -32,11 +40,28 @@ struct exynos_pm_domain {
>         struct regmap *regmap;
>         struct device *dev;
>         struct generic_pm_domain pd;
> -       u32 local_pwr_cfg;
> +       const struct exynos_pm_domain_config *cfg;
>         u32 configuration_reg;
>         u32 status_reg;
> +       phys_addr_t ac_pa;
>  };
>
> +static int exynos_pd_access_controller_power(struct exynos_pm_domain *pd,
> +                                            bool power_on)
> +{
> +       struct arm_smccc_res res;
> +
> +       if (!pd->ac_pa || !pd->cfg->smc_offset)
> +               return 0;
> +
> +       arm_smccc_smc(EXYNOS_SMC_CMD_PREPARE_PD_ONOFF,
> +                     power_on ? EXYNOS_WAKEUP_PD_DOWN : EXYNOS_GET_IN_PD_DOWN,
> +                     pd->ac_pa + pd->cfg->smc_offset,
> +                     EXYNOS_RUNTIME_PM_TZPC_GROUP, 0, 0, 0, 0, &res);
> +
> +       return res.a0;
> +}
> +
>  static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>  {
>         struct exynos_pm_domain *pd;
> @@ -45,7 +70,17 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>
>         pd = container_of(domain, struct exynos_pm_domain, pd);
>
> -       pwr = power_on ? pd->local_pwr_cfg : 0;
> +       if (!power_on) {
> +               err = exynos_pd_access_controller_power(pd, power_on);
> +               if (err) {
> +                       dev_err(pd->dev,
> +                               "SMC for power domain %s %sable failed: %d\n",
> +                               domain->name, power_on ? "en" : "dis", err);
> +                       return err;
> +               }
> +       }
> +
> +       pwr = power_on ? pd->cfg->local_pwr_cfg : 0;
>         err = regmap_write(pd->regmap, pd->configuration_reg, pwr);
>         if (err) {
>                 dev_err(pd->dev,
> @@ -60,7 +95,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>                 unsigned int val;
>
>                 err = regmap_read(pd->regmap, pd->status_reg, &val);
> -               if (err || ((val & pd->local_pwr_cfg) != pwr)) {
> +               if (err || ((val & pd->cfg->local_pwr_cfg) != pwr)) {
>                         cpu_relax();
>                         usleep_range(80, 100);
>                         continue;
> @@ -72,9 +107,21 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>         if (!timeout && !err)
>                 /* Only return timeout if no other error also occurred. */
>                 err = -ETIMEDOUT;
> -       if (err)
> +       if (err) {
>                 dev_err(pd->dev, "Power domain %s %sable failed: %d\n",
>                         domain->name, power_on ? "en" : "dis", err);
> +               return err;
> +       }
> +
> +       if (power_on) {
> +               err = exynos_pd_access_controller_power(pd, power_on);
> +               if (err) {
> +                       dev_err(pd->dev,
> +                               "SMC for power domain %s %sable failed: %d\n",
> +                               domain->name, power_on ? "en" : "dis", err);
> +                       return err;
> +               }
> +       }
>
>         return err;
>  }
> @@ -99,6 +146,7 @@ static const struct exynos_pm_domain_config exynos5433_cfg = {
>
>  static const struct exynos_pm_domain_config gs101_cfg = {
>         .local_pwr_cfg          = BIT(0),
> +       .smc_offset             = 0x0204,
>         .use_parent_regmap      = true,
>  };
>
> @@ -126,6 +174,38 @@ static const char *exynos_get_domain_name(struct device *dev,
>         return devm_kstrdup_const(dev, name, GFP_KERNEL);
>  }
>
> +static int exynos_pd_get_access_controller(struct exynos_pm_domain *pd)
> +{
> +       struct device_node *ac_np;
> +       struct resource ac_res;
> +       int ret;
> +
> +       ac_np = of_parse_phandle(pd->dev->of_node, "samsung,dtzpc", 0);
> +       if (!ac_np)
> +               return 0;
> +
> +       ret = of_address_to_resource(ac_np, 0, &ac_res);
> +       of_node_put(ac_np);
> +       if (ret)
> +               return dev_err_probe(pd->dev, ret,
> +                                    "failed to get access controller\n");
> +
> +       pd->ac_pa = ac_res.start;
> +
> +       /*
> +        * For some domains, TZ save/restore might not be implemented. If that
> +        * is the case, simply mark it as always on, as otherwise a power cycle
> +        * will lead to lost TZ configuration, making it impossible to access
> +        * registers from Linux afterwards.
> +        */
> +       if (exynos_pd_access_controller_power(pd, false) == -ENOENT) {
> +               pd->ac_pa = 0;
> +               pd->pd.flags |= GENPD_FLAG_ALWAYS_ON;
> +       }
> +
> +       return 0;
> +}
> +
>  static int exynos_pd_probe(struct platform_device *pdev)
>  {
>         const struct exynos_pm_domain_config *pm_domain_cfg;
> @@ -195,10 +275,14 @@ static int exynos_pd_probe(struct platform_device *pdev)
>
>         pd->pd.power_off = exynos_pd_power_off;
>         pd->pd.power_on = exynos_pd_power_on;
> -       pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg;
> +       pd->cfg = pm_domain_cfg;
>         pd->configuration_reg += 0;
>         pd->status_reg += 4;
>
> +       ret = exynos_pd_get_access_controller(pd);
> +       if (ret)
> +               return ret;
> +
>         /*
>          * Some Samsung platforms with bootloaders turning on the splash-screen
>          * and handing it over to the kernel, requires the power-domains to be
> @@ -212,7 +296,7 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         if (ret)
>                 return dev_err_probe(dev, ret, "failed to read status");
>
> -       on = val & pd->local_pwr_cfg;
> +       on = val & pd->cfg->local_pwr_cfg;
>
>         pm_genpd_init(&pd->pd, NULL, !on);
>         ret = of_genpd_add_provider_simple(np, &pd->pd);
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 10/10] pmdomain: samsung: implement domain-supply regulator
  2026-03-06 10:30 ` [PATCH v7 10/10] pmdomain: samsung: implement domain-supply regulator André Draszik
@ 2026-03-06 15:47   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:47 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Fri, 6 Mar 2026 at 10:30, André Draszik <andre.draszik@linaro.org> wrote:
>
> Some power domains on Exynos are fed by a regulator rail and therefore
> regulator control needs be implemented for Exynos power domains.
>
> On Google gs101, HSI0 (USB) is one example of such a power domain.
>
> While at it, add a to_exynos_pd() to avoid direct use of
> container_of() in various additional places, and update existing code
> to use it.
>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

>  drivers/pmdomain/samsung/exynos-pm-domains.c | 53 +++++++++++++++++++++++++---
>  1 file changed, 48 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
> index f59986b56213..ed7a5807555b 100644
> --- a/drivers/pmdomain/samsung/exynos-pm-domains.c
> +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
> @@ -20,12 +20,15 @@
>  #include <linux/of_address.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
>
>  #define EXYNOS_SMC_CMD_PREPARE_PD_ONOFF                0x82000410
>  #define EXYNOS_GET_IN_PD_DOWN                  0
>  #define EXYNOS_WAKEUP_PD_DOWN                  1
>  #define EXYNOS_RUNTIME_PM_TZPC_GROUP           2
>
> +#define to_exynos_pd(gpd) container_of_const(gpd, struct exynos_pm_domain, pd)
> +
>  struct exynos_pm_domain_config {
>         /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */
>         u32 local_pwr_cfg;
> @@ -39,6 +42,7 @@ struct exynos_pm_domain_config {
>  struct exynos_pm_domain {
>         struct regmap *regmap;
>         struct device *dev;
> +       struct regulator *supply;
>         struct generic_pm_domain pd;
>         const struct exynos_pm_domain_config *cfg;
>         u32 configuration_reg;
> @@ -64,12 +68,10 @@ static int exynos_pd_access_controller_power(struct exynos_pm_domain *pd,
>
>  static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>  {
> -       struct exynos_pm_domain *pd;
> +       struct exynos_pm_domain *pd = to_exynos_pd(domain);
>         u32 timeout, pwr;
>         int err;
>
> -       pd = container_of(domain, struct exynos_pm_domain, pd);
> -
>         if (!power_on) {
>                 err = exynos_pd_access_controller_power(pd, power_on);
>                 if (err) {
> @@ -126,14 +128,45 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>         return err;
>  }
>
> +static int exynos_pd_regulator_enable(struct regulator *supply)
> +{
> +       return supply ? regulator_enable(supply) : 0;
> +}
> +
> +static int exynos_pd_regulator_disable(struct regulator *supply)
> +{
> +       return supply ? regulator_disable(supply) : 0;
> +}
> +
>  static int exynos_pd_power_on(struct generic_pm_domain *domain)
>  {
> -       return exynos_pd_power(domain, true);
> +       struct exynos_pm_domain *pd = to_exynos_pd(domain);
> +       int ret;
> +
> +       ret = exynos_pd_regulator_enable(pd->supply);
> +       if (ret)
> +               return ret;
> +
> +       ret = exynos_pd_power(domain, true);
> +       if (ret)
> +               exynos_pd_regulator_disable(pd->supply);
> +
> +       return ret;
>  }
>
>  static int exynos_pd_power_off(struct generic_pm_domain *domain)
>  {
> -       return exynos_pd_power(domain, false);
> +       struct exynos_pm_domain *pd = to_exynos_pd(domain);
> +       int ret;
> +
> +       ret = exynos_pd_power(domain, false);
> +       if (ret)
> +               return ret;
> +
> +       /* Ignore regulator errors - the domain was disabled after all. */
> +       exynos_pd_regulator_disable(pd->supply);
> +
> +       return 0;
>  }
>
>  static const struct exynos_pm_domain_config exynos4210_cfg = {
> @@ -283,6 +316,16 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         if (ret)
>                 return ret;
>
> +       /* get the domain power supply if required */
> +       pd->supply = devm_regulator_get_optional(dev, "domain");
> +       if (IS_ERR(pd->supply)) {
> +               if (PTR_ERR(pd->supply) != -ENODEV)
> +                       return dev_err_probe(dev, PTR_ERR(pd->supply),
> +                                            "failed to get domain supply");
> +
> +               pd->supply = NULL;
> +       }
> +
>         /*
>          * Some Samsung platforms with bootloaders turning on the splash-screen
>          * and handing it over to the kernel, requires the power-domains to be
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 06/10] pmdomain: samsung: don't hard-code offset for registers to 0 and 4
  2026-03-06 10:29 ` [PATCH v7 06/10] pmdomain: samsung: don't hard-code offset for registers to 0 and 4 André Draszik
@ 2026-03-06 15:51   ` Peter Griffin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Griffin @ 2026-03-06 15:51 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Tudor Ambarus, Juan Yescas, Will McVicker, kernel-team,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Marek Szyprowski

On Fri, 6 Mar 2026 at 10:29, André Draszik <andre.draszik@linaro.org> wrote:
>
> On platforms such as Google gs101, direct mmio register access to the
> PMU registers doesn't necessarily work and access must happen via a
> regmap created by the PMU driver instead.
>
> When such a regmap is used it will cover the complete PMU memory region
> rather than individual power domains. This means the register offsets
> for the configuration and status registers will have to take the power
> domain offsets into account, rather than unconditionally hard-coding 0
> and 4 respectively.
>
> Update the code to allow that.
>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>

>  drivers/pmdomain/samsung/exynos-pm-domains.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
> index 3bcba7d38ac1..8df46b41f9bc 100644
> --- a/drivers/pmdomain/samsung/exynos-pm-domains.c
> +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
> @@ -30,6 +30,8 @@ struct exynos_pm_domain {
>         struct regmap *regmap;
>         struct generic_pm_domain pd;
>         u32 local_pwr_cfg;
> +       u32 configuration_reg;
> +       u32 status_reg;
>  };
>
>  static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
> @@ -41,7 +43,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>         pd = container_of(domain, struct exynos_pm_domain, pd);
>
>         pwr = power_on ? pd->local_pwr_cfg : 0;
> -       err = regmap_write(pd->regmap, 0, pwr);
> +       err = regmap_write(pd->regmap, pd->configuration_reg, pwr);
>         if (err) {
>                 pr_err("Regmap write for power domain %s %sable failed: %d\n",
>                        domain->name, power_on ? "en" : "dis", err);
> @@ -53,7 +55,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
>         while (timeout-- > 0) {
>                 unsigned int val;
>
> -               err = regmap_read(pd->regmap, 0x4, &val);
> +               err = regmap_read(pd->regmap, pd->status_reg, &val);
>                 if (err || ((val & pd->local_pwr_cfg) != pwr)) {
>                         cpu_relax();
>                         usleep_range(80, 100);
> @@ -164,6 +166,8 @@ static int exynos_pd_probe(struct platform_device *pdev)
>         pd->pd.power_off = exynos_pd_power_off;
>         pd->pd.power_on = exynos_pd_power_on;
>         pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg;
> +       pd->configuration_reg += 0;
> +       pd->status_reg += 4;
>
>         /*
>          * Some Samsung platforms with bootloaders turning on the splash-screen
> @@ -174,7 +178,7 @@ static int exynos_pd_probe(struct platform_device *pdev)
>             of_device_is_compatible(np, "samsung,exynos4210-pd"))
>                 exynos_pd_power_off(&pd->pd);
>
> -       ret = regmap_read(pd->regmap, 0x4, &val);
> +       ret = regmap_read(pd->regmap, pd->status_reg, &val);
>         if (ret)
>                 return dev_err_probe(dev, ret, "failed to read status");
>
>
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-06 10:29 ` [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children André Draszik
  2026-03-06 15:12   ` Peter Griffin
@ 2026-03-12 15:12   ` Rob Herring
  2026-03-13 10:48     ` André Draszik
  1 sibling, 1 reply; 26+ messages in thread
From: Rob Herring @ 2026-03-12 15:12 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm

On Fri, Mar 06, 2026 at 10:29:55AM +0000, André Draszik wrote:
> The power domains are a property of / implemented in the PMU. As such,
> they should be modelled as child nodes of the PMU.
> 
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> v7:
> - really be consistent with quoting (Krzysztof)
> - drop invalid tested-by tag (Krzysztof)
> 
> v4:
> - consistent quoting using " (Krzysztof)
> - add samsung,dtzpc to example
> 
> Note:
> Because the properties added are 'required', this commit breaks DT
> validation of the existing DT for Pixel 6, but a) that's simply because
> the DT is incomplete and b) a DT update will be posted once the binding
> is accepted.
> It is not possible to write the binding such that it supports old
> (incomplete) DTs in addition to the full version, but as per above
> it's not required to keep supporting old DTs.

This information needs to go in the commit msg.

> ---
>  .../bindings/soc/google/google,gs101-pmu.yaml      | 41 ++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> index a06bd8ec3c20..dfe6f87e5949 100644
> --- a/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> +++ b/Documentation/devicetree/bindings/soc/google/google,gs101-pmu.yaml
> @@ -16,6 +16,14 @@ properties:
>    reg:
>      maxItems: 1
>  
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 1
> +
> +  ranges: true
> +
>    reboot-mode:
>      $ref: /schemas/power/reset/syscon-reboot-mode.yaml
>      type: object
> @@ -39,9 +47,23 @@ properties:
>      description:
>        Phandle to PMU interrupt generation interface.
>  
> +patternProperties:
> +  "^power-domain@[0-9a-f]+$":
> +    type: object
> +    description: Child node describing one power domain within the PMU
> +
> +    additionalProperties: true
> +
> +    properties:
> +      compatible:
> +        const: google,gs101-pd
> +
>  required:
>    - compatible
>    - reg
> +  - "#address-cells"
> +  - "#size-cells"
> +  - ranges
>    - google,pmu-intr-gen-syscon
>  
>  additionalProperties: false
> @@ -51,6 +73,25 @@ examples:
>      system-controller@17460000 {
>          compatible = "google,gs101-pmu";
>          reg = <0x17460000 0x10000>;
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges;
>  
>          google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> +
> +        pd_g3d: power-domain@1e00 {
> +            compatible = "google,gs101-pd";
> +            reg = <0x1e00 0x80>;

I'm assuming 0x1e00 is an offset from 0x17460000. That's not what ranges 
says though. It says both addresses are in the same address space 
(system-controller@17460000 parent's address space). You need:

ranges = <0x0 0x17460000 0x10000>;


> +            #power-domain-cells = <0>;
> +            label = "g3d";
> +            samsung,dtzpc = <&pd_g3d>;
> +        };
> +
> +        power-domain@2000 {
> +            compatible = "google,gs101-pd";
> +            reg = <0x2000 0x80>;
> +            #power-domain-cells = <0>;
> +            power-domains = <&pd_g3d>;
> +            label = "embedded_g3d";
> +        };
>      };
> 
> -- 
> 2.53.0.473.g4a7958ca14-goog
> 

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

* Re: [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-12 15:12   ` Rob Herring
@ 2026-03-13 10:48     ` André Draszik
  2026-03-13 11:43       ` André Draszik
  2026-03-13 13:26       ` Rob Herring
  0 siblings, 2 replies; 26+ messages in thread
From: André Draszik @ 2026-03-13 10:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Alim Akhtar, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm

On Thu, 2026-03-12 at 10:12 -0500, Rob Herring wrote:
> On Fri, Mar 06, 2026 at 10:29:55AM +0000, André Draszik wrote:
> 
> >      system-controller@17460000 {
> >          compatible = "google,gs101-pmu";
> >          reg = <0x17460000 0x10000>;
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +        ranges;
> >  
> >          google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> > +
> > +        pd_g3d: power-domain@1e00 {
> > +            compatible = "google,gs101-pd";
> > +            reg = <0x1e00 0x80>;
> 
> I'm assuming 0x1e00 is an offset from 0x17460000. That's not what ranges 
> says though. It says both addresses are in the same address space 
> (system-controller@17460000 parent's address space). You need:
> 
> ranges = <0x0 0x17460000 0x10000>;

Thanks Rob! On gs101, the PD driver can not do direct mmio. Instead it
needs to use the regmap that the parent has created and apply the
offset from the PD's reg property (using struct resource::start)
(patch 7).

When using ranges as per your suggestion that doesn't work anymore,
as resource->start isn't the offset anymore but the final physical
address, and using that in combination with the parent's regmap
doesn't give us the right address anymore.

Is there an alternative other than using completely arbitrary indices
like e.g. rockchip is doing?


Cheers,
Andre'

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

* Re: [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-13 10:48     ` André Draszik
@ 2026-03-13 11:43       ` André Draszik
  2026-03-13 13:26       ` Rob Herring
  1 sibling, 0 replies; 26+ messages in thread
From: André Draszik @ 2026-03-13 11:43 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Alim Akhtar, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm

On Fri, 2026-03-13 at 10:48 +0000, André Draszik wrote:
> On Thu, 2026-03-12 at 10:12 -0500, Rob Herring wrote:
> > On Fri, Mar 06, 2026 at 10:29:55AM +0000, André Draszik wrote:
> > 
> > >      system-controller@17460000 {
> > >          compatible = "google,gs101-pmu";
> > >          reg = <0x17460000 0x10000>;
> > > +        #address-cells = <1>;
> > > +        #size-cells = <1>;
> > > +        ranges;
> > >  
> > >          google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> > > +
> > > +        pd_g3d: power-domain@1e00 {
> > > +            compatible = "google,gs101-pd";
> > > +            reg = <0x1e00 0x80>;
> > 
> > I'm assuming 0x1e00 is an offset from 0x17460000. That's not what ranges 
> > says though. It says both addresses are in the same address space 
> > (system-controller@17460000 parent's address space). You need:
> > 
> > ranges = <0x0 0x17460000 0x10000>;
> 
> Thanks Rob! On gs101, the PD driver can not do direct mmio. Instead it
> needs to use the regmap that the parent has created and apply the
> offset from the PD's reg property (using struct resource::start)
> (patch 7).
> 
> When using ranges as per your suggestion that doesn't work anymore,
> as resource->start isn't the offset anymore but the final physical
> address, and using that in combination with the parent's regmap
> doesn't give us the right address anymore.
> 
> Is there an alternative other than using completely arbitrary indices
> like e.g. rockchip is doing?

My driver could of course peek into the parent and get the parent's
IORESOURCE_MEM and subtract that start address to get the offset
back.

Is that considered clean (enough)?

	ppdev = to_platform_device(dev->parent);
	pres = platform_get_resource(ppdev, IORESOURCE_MEM, 0);

	pd->regmap = syscon_node_to_regmap(dev->parent->of_node);

	pd->configuration_reg = res->start - pres->start;
	pd->status_reg = res->start - pres->start;


Cheers,
Andre'

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

* Re: [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-13 10:48     ` André Draszik
  2026-03-13 11:43       ` André Draszik
@ 2026-03-13 13:26       ` Rob Herring
  2026-03-13 14:15         ` André Draszik
  1 sibling, 1 reply; 26+ messages in thread
From: Rob Herring @ 2026-03-13 13:26 UTC (permalink / raw)
  To: André Draszik
  Cc: Krzysztof Kozlowski, Alim Akhtar, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm

On Fri, Mar 13, 2026 at 5:48 AM André Draszik <andre.draszik@linaro.org> wrote:
>
> On Thu, 2026-03-12 at 10:12 -0500, Rob Herring wrote:
> > On Fri, Mar 06, 2026 at 10:29:55AM +0000, André Draszik wrote:
> >
> > >      system-controller@17460000 {
> > >          compatible = "google,gs101-pmu";
> > >          reg = <0x17460000 0x10000>;
> > > +        #address-cells = <1>;
> > > +        #size-cells = <1>;
> > > +        ranges;
> > >
> > >          google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> > > +
> > > +        pd_g3d: power-domain@1e00 {
> > > +            compatible = "google,gs101-pd";
> > > +            reg = <0x1e00 0x80>;
> >
> > I'm assuming 0x1e00 is an offset from 0x17460000. That's not what ranges
> > says though. It says both addresses are in the same address space
> > (system-controller@17460000 parent's address space). You need:
> >
> > ranges = <0x0 0x17460000 0x10000>;
>
> Thanks Rob! On gs101, the PD driver can not do direct mmio. Instead it
> needs to use the regmap that the parent has created and apply the
> offset from the PD's reg property (using struct resource::start)
> (patch 7).
>
> When using ranges as per your suggestion that doesn't work anymore,
> as resource->start isn't the offset anymore but the final physical
> address, and using that in combination with the parent's regmap
> doesn't give us the right address anymore.

You are mixing kernel implementation details and h/w. Are the
registers in the child nodes MMIO or not? If not, then drop ranges. If
they are, then what I suggested for ranges is correct.

For MMIO, your kernel implementation options are what you suggested,
do a regmap for each child, or use of_property_read_reg().

Rob

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

* Re: [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children
  2026-03-13 13:26       ` Rob Herring
@ 2026-03-13 14:15         ` André Draszik
  0 siblings, 0 replies; 26+ messages in thread
From: André Draszik @ 2026-03-13 14:15 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Alim Akhtar, Conor Dooley,
	Krzysztof Kozlowski, Ulf Hansson, Liam Girdwood, Mark Brown,
	Peter Griffin, Tudor Ambarus, Juan Yescas, Will McVicker,
	kernel-team, linux-arm-kernel, linux-samsung-soc, devicetree,
	linux-kernel, linux-pm

On Fri, 2026-03-13 at 08:26 -0500, Rob Herring wrote:
> On Fri, Mar 13, 2026 at 5:48 AM André Draszik <andre.draszik@linaro.org> wrote:
> > 
> > On Thu, 2026-03-12 at 10:12 -0500, Rob Herring wrote:
> > > On Fri, Mar 06, 2026 at 10:29:55AM +0000, André Draszik wrote:
> > > 
> > > >      system-controller@17460000 {
> > > >          compatible = "google,gs101-pmu";
> > > >          reg = <0x17460000 0x10000>;
> > > > +        #address-cells = <1>;
> > > > +        #size-cells = <1>;
> > > > +        ranges;
> > > > 
> > > >          google,pmu-intr-gen-syscon = <&pmu_intr_gen>;
> > > > +
> > > > +        pd_g3d: power-domain@1e00 {
> > > > +            compatible = "google,gs101-pd";
> > > > +            reg = <0x1e00 0x80>;
> > > 
> > > I'm assuming 0x1e00 is an offset from 0x17460000. That's not what ranges
> > > says though. It says both addresses are in the same address space
> > > (system-controller@17460000 parent's address space). You need:
> > > 
> > > ranges = <0x0 0x17460000 0x10000>;
> > 
> > Thanks Rob! On gs101, the PD driver can not do direct mmio. Instead it
> > needs to use the regmap that the parent has created and apply the
> > offset from the PD's reg property (using struct resource::start)
> > (patch 7).
> > 
> > When using ranges as per your suggestion that doesn't work anymore,
> > as resource->start isn't the offset anymore but the final physical
> > address, and using that in combination with the parent's regmap
> > doesn't give us the right address anymore.
> 
> You are mixing kernel implementation details and h/w.

Just trying to get to the best solution, considering both.

> Are the
> registers in the child nodes MMIO or not? If not, then drop ranges. If
> they are, then what I suggested for ranges is correct.

While they are MMIO in theory and offsets into the parent's address
space, in practice access from the OS is not possible via mmio APIs,
only via the custom regmap created by the parent (which defers to the
EL3 firmware) - hence the driver's need for the offset from the
parent's base address.

> For MMIO, your kernel implementation options are what you suggested,
> do a regmap for each child, or use of_property_read_reg().

OK, I'll go with the first option then, thanks for your patience Rob!

Cheers,
Andre'

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

end of thread, other threads:[~2026-03-13 14:14 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 10:29 [PATCH v7 00/10] pmdomain: samsung: add support for Google GS101 André Draszik
2026-03-06 10:29 ` [PATCH v7 01/10] dt-bindings: soc: google: add google,gs101-dtzpc André Draszik
2026-03-06 14:59   ` Peter Griffin
2026-03-06 10:29 ` [PATCH v7 02/10] dt-bindings: power: samsung: add google,gs101-pd André Draszik
2026-03-06 14:56   ` Peter Griffin
2026-03-06 10:29 ` [PATCH v7 03/10] dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding André Draszik
2026-03-06 14:59   ` Peter Griffin
2026-03-06 10:29 ` [PATCH v7 04/10] dt-bindings: soc: google: gs101-pmu: allow power domains as children André Draszik
2026-03-06 15:12   ` Peter Griffin
2026-03-12 15:12   ` Rob Herring
2026-03-13 10:48     ` André Draszik
2026-03-13 11:43       ` André Draszik
2026-03-13 13:26       ` Rob Herring
2026-03-13 14:15         ` André Draszik
2026-03-06 10:29 ` [PATCH v7 05/10] pmdomain: samsung: convert to using regmap André Draszik
2026-03-06 15:30   ` Peter Griffin
2026-03-06 10:29 ` [PATCH v7 06/10] pmdomain: samsung: don't hard-code offset for registers to 0 and 4 André Draszik
2026-03-06 15:51   ` Peter Griffin
2026-03-06 10:29 ` [PATCH v7 07/10] pmdomain: samsung: add support for google,gs101-pd André Draszik
2026-03-06 15:20   ` Peter Griffin
2026-03-06 10:29 ` [PATCH v7 08/10] pmdomain: samsung: use dev_err() instead of pr_err() André Draszik
2026-03-06 15:21   ` Peter Griffin
2026-03-06 10:30 ` [PATCH v7 09/10] pmdomain: samsung: implement SMC to save / restore TZ config André Draszik
2026-03-06 15:37   ` Peter Griffin
2026-03-06 10:30 ` [PATCH v7 10/10] pmdomain: samsung: implement domain-supply regulator André Draszik
2026-03-06 15:47   ` Peter Griffin

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