[PATCH v2 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding

Faruque Ansari <[email protected]>
Newsgroups org.kernel.vger.linux-watchdog,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm
Message-ID <[email protected]>
Add binding for the PSCRR NVMEM recorder. Records the power state
change reason into a small NVMEM cell, such as a PMIC SDAM byte or
RTC scratch register — so the cause survives a power cycle and can be
read back on the next boot.

Signed-off-by: Faruque Ansari <[email protected]>
---
 .../bindings/power/reset/pscrr-nvmem.yaml          | 59 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 60 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml b/Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml
new file mode 100644
index 000000000000..5334c923d644
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/pscrr-nvmem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVMEM Power State Change Reason recorder
+
+maintainers:
+  - Faruque Ansari <[email protected]>
+  - Oleksij Rempel <[email protected]>
+
+description:
+  An NVMEM-backed recorder for Power State Change Reasons (PSCRR). Persists
+  the reboot or shutdown cause into a small NVMEM cell, such as an RTC
+  scratch register, a PMIC SDAM (Scratch Data Access Memory) byte, or an
+  EEPROM — so the reason survives a power cycle and can be read back on the
+  next boot. The cell is referenced via the standard nvmem-cells consumer
+  binding.
+
+allOf:
+  - $ref: /schemas/nvmem/nvmem-consumer.yaml#
+
+properties:
+  compatible:
+    const: pscrr-nvmem
+
+  nvmem-cells:
+    maxItems: 1
+
+  nvmem-cell-names:
+    items:
+      - const: pscr
+
+required:
+  - compatible
+  - nvmem-cells
+  - nvmem-cell-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    nvmem-layout {
+        compatible = "fixed-layout";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        reboot_reason_persist: reboot-reason-persist@49 {
+            reg = <0x49 0x1>;
+        };
+    };
+
+    reboot-reason {
+        compatible = "pscrr-nvmem";
+        nvmem-cells = <&reboot_reason_persist>;
+        nvmem-cell-names = "pscr";
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 19b9f6605d98..f329cd9d0491 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21693,6 +21693,7 @@ R:	Pengutronix Kernel Team <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/ABI/testing/sysfs-kernel-pscrr
+F:	Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml
 F:	drivers/power/reset/pscrr/
 F:	include/linux/pscrr.h
 F:	tools/testing/selftests/pscrr/

-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.