Skip to contentSkip to conversation

arm64: qcom: fix the reboot reason handling on sa8775p

PATCH Applied Bartosz Golaszewski 5 participants 8 messages Apr 17, 2023 – May 15, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover arm64: qcom: fix the reboot reason handling on sa8775p

From: Bartosz Golaszewski <[email protected]>

SA8775P uses nvmem to pass the reboot reason magic value to the bootloader. Remove the reboot modes from the PON node and introduce an SDAM node passed to the nvmem-reboot-mode driver. While at it: convert the bindings for nvmem-reboot-mode to YAML and enable it for arm64 in defconfig.

v1 -> v2:
- dropped the defconfig patch as it went upstream already
- in patch 1: explained better why we need to drop the reboot-modes from the PON node
- fixed formatting and order of properties in dt-bindings
- fixed naming of nodes in device tree

Bartosz Golaszewski (1):
dt-bindings: power: reset: convert nvmem-reboot-mode bindings to YAML

Parikshit Pareek (2):
arm64: dts: qcom: sa8775p: pmic: remove the PON modes
arm64: dts: qcom: sa8775p: pmic: add the sdam_0 node

 .../power/reset/nvmem-reboot-mode.txt         | 26 ----------
 .../power/reset/nvmem-reboot-mode.yaml        | 52 +++++++++++++++++++
 arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi   | 23 +++++++-
 3 files changed, 73 insertions(+), 28 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.yaml
Signature · 1 line
2.37.2
#1 lore raw

PATCH v2 1/3 arm64: dts: qcom: sa8775p: pmic: remove the PON modes

From: Parikshit Pareek <[email protected]>

On this PMIC, the PON peripheral does not provide passing reboot modes over HLOS. They must be passed over SDAM. Remove the reboot-mode properties as we'll provide a proper SDAM node in a later commit.

Fixes d2d9a592746c ("arm64: dts: qcom: sa8775p: add the Power On device node")
---
 arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +0 -2
index 7602cca47bae..5abdc239d3a6 100644
@@ -108,8 +108,6 @@ pmm8654au_0_pon: pon@1200 {
 			compatible = "qcom,pmk8350-pon";
 			reg = <0x1200>, <0x800>;
 			reg-names = "hlos", "pbs";
-			mode-recovery = <0x1>;
-			mode-bootloader = <0x2>;
 
 			pmm8654au_0_pon_pwrkey: pwrkey {
 				compatible = "qcom,pmk8350-pwrkey";
Signature · 1 line
2.37.2
#2 lore raw

PATCH v2 2/3 dt-bindings: power: reset: convert nvmem-reboot-mode bindings to YAML

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Convert the DT binding document for nvmem-reboot-mode from .txt to YAML.

---
 .../power/reset/nvmem-reboot-mode.txt         | 26 ----------
 .../power/reset/nvmem-reboot-mode.yaml        | 52 +++++++++++++++++++
 2 files changed, 52 insertions(+), 26 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.yaml
Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.txt deleted +0 -26
deleted file mode 100644
index 752d6126d5da..000000000000
@@ -1,26 +0,0 @@
-NVMEM reboot mode driver
-
-This driver gets reboot mode magic value from reboot-mode driver
-and stores it in a NVMEM cell named "reboot-mode". Then the bootloader
-can read it and take different action according to the magic
-value stored.
-
-Required properties:
-- compatible: should be "nvmem-reboot-mode".
-- nvmem-cells: A phandle to the reboot mode provided by a nvmem device.
-- nvmem-cell-names: Should be "reboot-mode".
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-	reboot-mode {
-		compatible = "nvmem-reboot-mode";
-		nvmem-cells = <&reboot_mode>;
-		nvmem-cell-names = "reboot-mode";
-
-		mode-normal     = <0xAAAA5501>;
-		mode-bootloader = <0xBBBB5500>;
-		mode-recovery   = <0xCCCC5502>;
-		mode-test       = <0xDDDD5503>;
-	};
Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.yaml new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.37.2
#4 lore raw

PATCH v2 3/3 arm64: dts: qcom: sa8775p: pmic: add the sdam_0 node

In reply to Bartosz Golaszewski

From: Parikshit Pareek <[email protected]>

Introduce sdam_0 node, which is to be used via nvmem for power on reasons during reboot. Add supported PoN reaons supported via sdam_0 node.

---
 arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +21 -0
index 5abdc239d3a6..3c3b6287cd27 100644
@@ -88,6 +88,14 @@ trip1 {
 			};
 		};
 	};
+
+	reboot-mode {
+		compatible = "nvmem-reboot-mode";
+		nvmem-cells = <&reboot_reason>;
+		nvmem-cell-names = "reboot-mode";
+		mode-recovery = <0x01>;
+		mode-bootloader = <0x02>;
+	};
 };
 
 &spmi_bus {
@@ -133,6 +141,19 @@ pmm8654au_0_gpios: gpio@8800 {
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pmm8654au_0_sdam_0: nvram@7100 {
+			compatible = "qcom,spmi-sdam";
+			reg = <0x7100>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0x7100 0x100>;
+
+			reboot_reason: reboot-reason@48 {
+				reg = <0x48 0x1>;
+				bits = <1 7>;
+			};
+		};
 	};
 
 	pmm8654au_1: pmic@2 {
Signature · 1 line
2.37.2
Reviewed-by on v2 3/3
#5 lore raw

Re: [PATCH v2 3/3] arm64: dts: qcom: sa8775p: pmic: add the sdam_0 node

Quoted 9 lines · Bartosz Golaszewski

From: Parikshit Pareek <[email protected]>

Introduce sdam_0 node, which is to be used via nvmem for power on reasons during reboot. Add supported PoN reaons supported via sdam_0 node.

---

Konrad

Quoted 42 lines
 arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +21 -0
index 5abdc239d3a6..3c3b6287cd27 100644
@@ -88,6 +88,14 @@ trip1 {
 			};
 		};
 	};
+
+	reboot-mode {
+		compatible = "nvmem-reboot-mode";
+		nvmem-cells = <&reboot_reason>;
+		nvmem-cell-names = "reboot-mode";
+		mode-recovery = <0x01>;
+		mode-bootloader = <0x02>;
+	};
 };
 
 &spmi_bus {
@@ -133,6 +141,19 @@ pmm8654au_0_gpios: gpio@8800 {
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pmm8654au_0_sdam_0: nvram@7100 {
+			compatible = "qcom,spmi-sdam";
+			reg = <0x7100>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0x7100 0x100>;
+
+			reboot_reason: reboot-reason@48 {
+				reg = <0x48 0x1>;
+				bits = <1 7>;
+			};
+		};
 	};
 
 	pmm8654au_1: pmic@2 {
Tested-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] arm64: dts: qcom: sa8775p: pmic: add the sdam_0 node

In reply to Bartosz Golaszewski
Quoted 11 lines · Bartosz Golaszewski

From: Parikshit Pareek <[email protected]>

Introduce sdam_0 node, which is to be used via nvmem for power on reasons during reboot. Add supported PoN reaons supported via sdam_0 node.

---
 arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
Quoted 43 lines
arch/arm64/boot/dts/qcom/sa8775p-pmics.dtsi +21 -0
index 5abdc239d3a6..3c3b6287cd27 100644
@@ -88,6 +88,14 @@ trip1 {
 			};
 		};
 	};
+
+	reboot-mode {
+		compatible = "nvmem-reboot-mode";
+		nvmem-cells = <&reboot_reason>;
+		nvmem-cell-names = "reboot-mode";
+		mode-recovery = <0x01>;
+		mode-bootloader = <0x02>;
+	};
 };
 
 &spmi_bus {
@@ -133,6 +141,19 @@ pmm8654au_0_gpios: gpio@8800 {
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pmm8654au_0_sdam_0: nvram@7100 {
+			compatible = "qcom,spmi-sdam";
+			reg = <0x7100>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0x7100 0x100>;
+
+			reboot_reason: reboot-reason@48 {
+				reg = <0x48 0x1>;
+				bits = <1 7>;
+			};
+		};
 	};
 
 	pmm8654au_1: pmic@2 {
Signature · 1 line
2.37.2
Signature · 1 line
Eric Chanudet
#3 lore raw

Re: [PATCH v2 2/3] dt-bindings: power: reset: convert nvmem-reboot-mode bindings to YAML

In reply to Bartosz Golaszewski

Hi,

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Convert the DT binding document for nvmem-reboot-mode from .txt to YAML.

---

Thanks, queued.

-- Sebastian

Quoted 99 lines
 .../power/reset/nvmem-reboot-mode.txt         | 26 ----------
 .../power/reset/nvmem-reboot-mode.yaml        | 52 +++++++++++++++++++
 2 files changed, 52 insertions(+), 26 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.yaml
Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.txt deleted +0 -26
deleted file mode 100644
index 752d6126d5da..000000000000
@@ -1,26 +0,0 @@
-NVMEM reboot mode driver
-
-This driver gets reboot mode magic value from reboot-mode driver
-and stores it in a NVMEM cell named "reboot-mode". Then the bootloader
-can read it and take different action according to the magic
-value stored.
-
-Required properties:
-- compatible: should be "nvmem-reboot-mode".
-- nvmem-cells: A phandle to the reboot mode provided by a nvmem device.
-- nvmem-cell-names: Should be "reboot-mode".
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-	reboot-mode {
-		compatible = "nvmem-reboot-mode";
-		nvmem-cells = <&reboot_mode>;
-		nvmem-cell-names = "reboot-mode";
-
-		mode-normal     = <0xAAAA5501>;
-		mode-bootloader = <0xBBBB5500>;
-		mode-recovery   = <0xCCCC5502>;
-		mode-test       = <0xDDDD5503>;
-	};
Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.yaml new file +52 -0
new file mode 100644
index 000000000000..14a262bcbf7c
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/nvmem-reboot-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic NVMEM reboot mode
+
+maintainers:
+  - Bartosz Golaszewski <[email protected]>
+
+description:
+  This driver gets the reboot mode magic value from the reboot-mode driver
+  and stores it in the NVMEM cell named "reboot-mode". The bootloader can
+  then read it and take different action according to the value.
+
+properties:
+  compatible:
+    const: nvmem-reboot-mode
+
+  nvmem-cells:
+    description:
+      A phandle pointing to the nvmem-cells node where the vendor-specific
+      magic value representing the reboot mode is stored.
+    maxItems: 1
+
+  nvmem-cell-names:
+    items:
+      - const: reboot-mode
+
+patternProperties:
+  "^mode-.+":
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Vendor-specific mode value written to the mode register
+
+required:
+  - compatible
+  - nvmem-cells
+  - nvmem-cell-names
+
+additionalProperties: false
+
+examples:
+  - |
+    reboot-mode {
+        compatible = "nvmem-reboot-mode";
+        nvmem-cells = <&reboot_reason>;
+        nvmem-cell-names = "reboot-mode";
+        mode-recovery = <0x01>;
+        mode-bootloader = <0x02>;
+    };
+...
Signature · 1 line
2.37.2
maintainer Applied
#7 lore raw

Re: (subset) [PATCH v2 0/3] arm64: qcom: fix the reboot reason handling on sa8775p

In reply to Bartosz Golaszewski
Quoted 8 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

SA8775P uses nvmem to pass the reboot reason magic value to the bootloader. Remove the reboot modes from the PON node and introduce an SDAM node passed to the nvmem-reboot-mode driver. While at it: convert the bindings for nvmem-reboot-mode to YAML and enable it for arm64 in defconfig.

[...]

Applied, thanks!

[1/3] arm64: dts: qcom: sa8775p: pmic: remove the PON modes

      commit: 40d5835998705c28b985b1325114114c6007546e
[3/3] arm64: dts: qcom: sa8775p: pmic: add the sdam_0 node
      commit: 6c92689a0a57b40c758a12c1ca668d6a36a805a6

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>