Skip to contentSkip to conversation

dt-bindings: syscon: Add syscon endian properties support

PATCH In review [email protected] 3 participants 19 messages Mar 6, 2020 – Apr 17, 2020 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/4 dt-bindings: syscon: Add syscon endian properties support

From: Serge Semin <[email protected]>

In accordance with the syscon-driver (drivers/mfd/syscon.c) the syscon dts-nodes may accept endian properties of the boolean type: little-endian, big-endian, native-endian. Lets make sure that syscon bindings json-schema also supports them.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 Documentation/devicetree/bindings/mfd/syscon.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +14 -0
index 39375e4313d2..9ee404991533 100644
@@ -61,6 +61,11 @@ properties:
     description:
       Reference to a phandle of a hardware spinlock provider node.
 
+patternProperties:
+  "^(big|little|native)-endian$":
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Bytes order of the system controller memory space.
+
 required:
   - compatible
   - reg
@@ -81,4 +86,13 @@ examples:
         hwlocks = <&hwlock1 1>;
     };
 
+  - |
+    cpu_ctl: cpu@1F04D02C {
+      compatible = "syscon";
+      reg = <0x1F04D02C 0x004>;
+
+      little-endian;
+      reg-io-width = <4>;
+    };
+
 ...
Signature · 1 line
2.25.1
maintainer
#2 lore raw
Quoted 21 lines · On Fri, Mar 06, 2020 at 04:03:38PM +0300, [email protected]…

From: Serge Semin <[email protected]>

In accordance with the syscon-driver (drivers/mfd/syscon.c) the syscon dts-nodes may accept endian properties of the boolean type: little-endian, big-endian, native-endian. Lets make sure that syscon bindings json-schema also supports them.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 Documentation/devicetree/bindings/mfd/syscon.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +0 -0
index 39375e4313d2..9ee404991533 100644

Documentation/devicetree/bindings/mfd/syscon.yaml properties: · line 67

Quoted 7 lines
Documentation/devicetree/bindings/mfd/syscon.yaml +4 -0
@@ -61,6 +61,11 @@ properties:
     description:
       Reference to a phandle of a hardware spinlock provider node.
 
+patternProperties:
+  "^(big|little|native)-endian$":
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Bytes order of the system controller memory space.

Common properties should have a type definition in a common schema. For this one, I'd like it in the core schema in dtschema.

I'd expect for any specific 'syscon', either none or only a subset of these are valid, so I don't think this should be added here.

Rob

#3 lore raw
Quoted 25 lines · Rob Herring
Quoted 24 lines · On Fri, Mar 06, 2020 at 04:03:38PM +0300, [email protected]…

From: Serge Semin <[email protected]>

In accordance with the syscon-driver (drivers/mfd/syscon.c) the syscon dts-nodes may accept endian properties of the boolean type: little-endian, big-endian, native-endian. Lets make sure that syscon bindings json-schema also supports them.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 Documentation/devicetree/bindings/mfd/syscon.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +0 -0
index 39375e4313d2..9ee404991533 100644
@@ -61,6 +61,11 @@ properties:
     description:
       Reference to a phandle of a hardware spinlock provider node.
 
Quoted 7 lines

Documentation/devicetree/bindings/mfd/syscon.yaml properties: · line 67

Quoted 4 lines
Documentation/devicetree/bindings/mfd/syscon.yaml +4 -0
+patternProperties:
+  "^(big|little|native)-endian$":
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: Bytes order of the system controller memory space.

Common properties should have a type definition in a common schema. For this one, I'd like it in the core schema in dtschema.

So what do you suggest then? Will you move this file to the dt-scheme/schemas in your repo? What shall I do with this patch, just drop? Or would you like me to fork your dt-schema repo, add dt-schemas/schemas/mfd/syscon.yaml file similar to this one with "*-endian" property supported, then pull-request or send a patch with the alteration back to your repo?

Quoted 3 lines

I'd expect for any specific 'syscon', either none or only a subset of these are valid, so I don't think this should be added here.

AFAIU mfd/syscon.yaml describes a generic syscon compatible with generic driver drivers/mfd/syscon.c, which may have any of these properties declared in its dt-node. We can't predict which one because, well, it's generic. At the same time, yes, only a subset of these properties can be supported by a specific system controller, which one can be determined by the controller specific dt schema. So if we left the property here in the generic syscon.yaml, then the controller dt-schema would have had a pattern like:

Quoted 9 lines

allOf:
- $ref: ../../mfd/syscon.yaml#

properties:
little-endian: true

additionalProperties: false

as I did for soc/baikal-t1/be,bt1-l2-ctl.yaml. See the patch: "dt-bindings:
Add Baikal-T1 L2-cache Control Block dts bindings file" in the corresponding patchset in your email Inbox.

Regards,
-Sergey

Quoted 2 lines

Rob

#4 lore raw

PATCH 2/4 dt-bindings: power: reset: Replace SYSCON reboot-mode legacy bindings with YAML-based one

In reply to a message not in the archive

From: Serge Semin <[email protected]>

Modern device tree bindings are supposed to be created as YAML-files in accordance with dt-schema. This commit replaces SYSCON reboot-mode legacy bare text bindings with YAML file. As before the bindings file states that the corresponding dts node is supposed to be compatible "syscon-reboot-mode" device and necessarily have an offset property to determine which register from the regmap is supposed to keep the mode on reboot.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 .../power/reset/syscon-reboot-mode.txt        | 35 ------------
 .../power/reset/syscon-reboot-mode.yaml       | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt deleted +0 -35
deleted file mode 100644
index f7ce1d8af04a..000000000000
@@ -1,35 +0,0 @@
-SYSCON reboot mode driver
-
-This driver gets reboot mode magic value form reboot-mode driver
-and stores it in a SYSCON mapped register. Then the bootloader
-can read it and take different action according to the magic
-value stored.
-
-This DT node should be represented as a sub-node of a "syscon", "simple-mfd"
-node.
-
-Required properties:
-- compatible: should be "syscon-reboot-mode"
-- offset: offset in the register map for the storage register (in bytes)
-
-Optional property:
-- mask: bits mask of the bits in the register to store the reboot mode magic value,
-  default set to 0xffffffff if missing.
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-	pmu: pmu@20004000 {
-		compatible = "rockchip,rk3066-pmu", "syscon", "simple-mfd";
-		reg = <0x20004000 0x100>;
-
-		reboot-mode {
-			compatible = "syscon-reboot-mode";
-			offset = <0x40>;
-			mode-normal = <BOOT_NORMAL>;
-			mode-recovery = <BOOT_RECOVERY>;
-			mode-bootloader = <BOOT_FASTBOOT>;
-			mode-loader = <BOOT_BL_DOWNLOAD>;
-		};
-	};
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer Acked-by on v1 2/4
#5 lore raw

Re: [PATCH 2/4] dt-bindings: power: reset: Replace SYSCON reboot-mode legacy bindings with YAML-based one

Hi,

Quoted 10 lines · On Fri, Mar 06, 2020 at 04:03:39PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Modern device tree bindings are supposed to be created as YAML-files in accordance with dt-schema. This commit replaces SYSCON reboot-mode legacy bare text bindings with YAML file. As before the bindings file states that the corresponding dts node is supposed to be compatible "syscon-reboot-mode" device and necessarily have an offset property to determine which register from the regmap is supposed to keep the mode on reboot.

Quoted 6 lines
Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>

---

I'm missing patch 1 and would like an Acked-by from Rob Herring, so for now:

-- Sebastian

Quoted 111 lines
 .../power/reset/syscon-reboot-mode.txt        | 35 ------------
 .../power/reset/syscon-reboot-mode.yaml       | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt deleted +0 -35
deleted file mode 100644
index f7ce1d8af04a..000000000000
@@ -1,35 +0,0 @@
-SYSCON reboot mode driver
-
-This driver gets reboot mode magic value form reboot-mode driver
-and stores it in a SYSCON mapped register. Then the bootloader
-can read it and take different action according to the magic
-value stored.
-
-This DT node should be represented as a sub-node of a "syscon", "simple-mfd"
-node.
-
-Required properties:
-- compatible: should be "syscon-reboot-mode"
-- offset: offset in the register map for the storage register (in bytes)
-
-Optional property:
-- mask: bits mask of the bits in the register to store the reboot mode magic value,
-  default set to 0xffffffff if missing.
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-	pmu: pmu@20004000 {
-		compatible = "rockchip,rk3066-pmu", "syscon", "simple-mfd";
-		reg = <0x20004000 0x100>;
-
-		reboot-mode {
-			compatible = "syscon-reboot-mode";
-			offset = <0x40>;
-			mode-normal = <BOOT_NORMAL>;
-			mode-recovery = <BOOT_RECOVERY>;
-			mode-bootloader = <BOOT_FASTBOOT>;
-			mode-loader = <BOOT_BL_DOWNLOAD>;
-		};
-	};
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml new file +55 -0
new file mode 100644
index 000000000000..e09bb07b1abb
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/syscon-reboot-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic SYSCON reboot mode driver
+
+maintainers:
+  - Sebastian Reichel <[email protected]>
+
+description: |
+  This driver gets reboot mode magic value from reboot-mode driver
+  and stores it in a SYSCON mapped register. Then the bootloader
+  can read it and take different action according to the magic
+  value stored. The SYSCON mapped register is retrieved from the
+  parental dt-node plus the offset. So the SYSCON reboot-mode node
+  should be represented as a sub-node of a "syscon", "simple-mfd" node.
+
+properties:
+  compatible:
+    const: syscon-reboot-mode
+
+  mask:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Update only the register bits defined by the mask (32 bit).
+
+  offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Offset in the register map for the mode register (in bytes).
+
+patternProperties:
+  "^mode-.+":
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Vendor-specific mode value written to the mode register.
+
+additionalProperties: false
+
+required:
+  - compatible
+  - offset
+
+examples:
+  - |
+    #include <dt-bindings/soc/rockchip,boot-mode.h>
+
+    reboot-mode {
+      compatible = "syscon-reboot-mode";
+      offset = <0x40>;
+      mode-normal = <BOOT_NORMAL>;
+      mode-recovery = <BOOT_RECOVERY>;
+      mode-bootloader = <BOOT_FASTBOOT>;
+      mode-loader = <BOOT_BL_DOWNLOAD>;
+    };
+...
Signature · 1 line
2.25.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [PATCH 2/4] dt-bindings: power: reset: Replace SYSCON reboot-mode legacy bindings with YAML-based one

Quoted 20 lines · Sebastian Reichel

Hi,

Quoted 10 lines · On Fri, Mar 06, 2020 at 04:03:39PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Modern device tree bindings are supposed to be created as YAML-files in accordance with dt-schema. This commit replaces SYSCON reboot-mode legacy bare text bindings with YAML file. As before the bindings file states that the corresponding dts node is supposed to be compatible "syscon-reboot-mode" device and necessarily have an offset property to determine which register from the regmap is supposed to keep the mode on reboot.

Quoted 6 lines
Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>

---

Quoted 5 lines

I'm missing patch 1 and would like an Acked-by from Rob Herring, so for now:

Great. Thanks. I'll resend the patchset very soon. You aren't in the first patch Cc because it doesn't concern power/reset subsystem, but mfd/syscon. That's why my submission script didn't add you to the list. Sorry about that. I'll send a v2 copy to you.

Regards,
-Sergey

Quoted 113 lines

-- Sebastian

Quoted 111 lines
 .../power/reset/syscon-reboot-mode.txt        | 35 ------------
 .../power/reset/syscon-reboot-mode.yaml       | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt deleted +0 -35
deleted file mode 100644
index f7ce1d8af04a..000000000000
@@ -1,35 +0,0 @@
-SYSCON reboot mode driver
-
-This driver gets reboot mode magic value form reboot-mode driver
-and stores it in a SYSCON mapped register. Then the bootloader
-can read it and take different action according to the magic
-value stored.
-
-This DT node should be represented as a sub-node of a "syscon", "simple-mfd"
-node.
-
-Required properties:
-- compatible: should be "syscon-reboot-mode"
-- offset: offset in the register map for the storage register (in bytes)
-
-Optional property:
-- mask: bits mask of the bits in the register to store the reboot mode magic value,
-  default set to 0xffffffff if missing.
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-	pmu: pmu@20004000 {
-		compatible = "rockchip,rk3066-pmu", "syscon", "simple-mfd";
-		reg = <0x20004000 0x100>;
-
-		reboot-mode {
-			compatible = "syscon-reboot-mode";
-			offset = <0x40>;
-			mode-normal = <BOOT_NORMAL>;
-			mode-recovery = <BOOT_RECOVERY>;
-			mode-bootloader = <BOOT_FASTBOOT>;
-			mode-loader = <BOOT_BL_DOWNLOAD>;
-		};
-	};
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml new file +55 -0
new file mode 100644
index 000000000000..e09bb07b1abb
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/syscon-reboot-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic SYSCON reboot mode driver
+
+maintainers:
+  - Sebastian Reichel <[email protected]>
+
+description: |
+  This driver gets reboot mode magic value from reboot-mode driver
+  and stores it in a SYSCON mapped register. Then the bootloader
+  can read it and take different action according to the magic
+  value stored. The SYSCON mapped register is retrieved from the
+  parental dt-node plus the offset. So the SYSCON reboot-mode node
+  should be represented as a sub-node of a "syscon", "simple-mfd" node.
+
+properties:
+  compatible:
+    const: syscon-reboot-mode
+
+  mask:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Update only the register bits defined by the mask (32 bit).
+
+  offset:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Offset in the register map for the mode register (in bytes).
+
+patternProperties:
+  "^mode-.+":
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Vendor-specific mode value written to the mode register.
+
+additionalProperties: false
+
+required:
+  - compatible
+  - offset
+
+examples:
+  - |
+    #include <dt-bindings/soc/rockchip,boot-mode.h>
+
+    reboot-mode {
+      compatible = "syscon-reboot-mode";
+      offset = <0x40>;
+      mode-normal = <BOOT_NORMAL>;
+      mode-recovery = <BOOT_RECOVERY>;
+      mode-bootloader = <BOOT_FASTBOOT>;
+      mode-loader = <BOOT_BL_DOWNLOAD>;
+    };
+...
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 2/4
#8 lore raw

Re: [PATCH 2/4] dt-bindings: power: reset: Replace SYSCON reboot-mode legacy bindings with YAML-based one

In reply to [email protected]
Quoted 15 lines · On Fri, 6 Mar 2020 16:03:39 +0300, <[email protected]> wrote:

From: Serge Semin <[email protected]>

Modern device tree bindings are supposed to be created as YAML-files in accordance with dt-schema. This commit replaces SYSCON reboot-mode legacy bare text bindings with YAML file. As before the bindings file states that the corresponding dts node is supposed to be compatible "syscon-reboot-mode" device and necessarily have an offset property to determine which register from the regmap is supposed to keep the mode on reboot.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
Quoted 7 lines
---
 .../power/reset/syscon-reboot-mode.txt        | 35 ------------
 .../power/reset/syscon-reboot-mode.yaml       | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml
#9 lore raw

PATCH 3/4 dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

In reply to a message not in the archive

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 .../bindings/power/reset/syscon-reboot-mode.yaml         | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml +6 -3
index e09bb07b1abb..f47bf52ad983 100644
@@ -13,9 +13,8 @@ description: |
   This driver gets reboot mode magic value from reboot-mode driver
   and stores it in a SYSCON mapped register. Then the bootloader
   can read it and take different action according to the magic
-  value stored. The SYSCON mapped register is retrieved from the
-  parental dt-node plus the offset. So the SYSCON reboot-mode node
-  should be represented as a sub-node of a "syscon", "simple-mfd" node.
+  value stored. The SYSCON mapped register is retrieved either from
+  the parental dt-node or from a regmap phandle plus the offset.
 
 properties:
   compatible:
@@ -29,6 +28,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: Offset in the register map for the mode register (in bytes).
 
+  regmap:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the register map node.
+
 patternProperties:
   "^mode-.+":
     $ref: /schemas/types.yaml#/definitions/uint32
Signature · 1 line
2.25.1
maintainer Acked-by on v1 3/4
#10 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Hi,

Quoted 11 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>

---

-- Sebastian

Quoted 33 lines
 .../bindings/power/reset/syscon-reboot-mode.yaml         | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml +6 -3
index e09bb07b1abb..f47bf52ad983 100644
@@ -13,9 +13,8 @@ description: |
   This driver gets reboot mode magic value from reboot-mode driver
   and stores it in a SYSCON mapped register. Then the bootloader
   can read it and take different action according to the magic
-  value stored. The SYSCON mapped register is retrieved from the
-  parental dt-node plus the offset. So the SYSCON reboot-mode node
-  should be represented as a sub-node of a "syscon", "simple-mfd" node.
+  value stored. The SYSCON mapped register is retrieved either from
+  the parental dt-node or from a regmap phandle plus the offset.
 
 properties:
   compatible:
@@ -29,6 +28,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: Offset in the register map for the mode register (in bytes).
 
+  regmap:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the register map node.
+
 patternProperties:
   "^mode-.+":
     $ref: /schemas/types.yaml#/definitions/uint32
Signature · 1 line
2.25.1
maintainer
#11 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

In reply to [email protected]
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

NAK. It should simply be a child node of the 'syscon-controller'.

Quoted 40 lines
Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 .../bindings/power/reset/syscon-reboot-mode.yaml         | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml +6 -3
index e09bb07b1abb..f47bf52ad983 100644
@@ -13,9 +13,8 @@ description: |
   This driver gets reboot mode magic value from reboot-mode driver
   and stores it in a SYSCON mapped register. Then the bootloader
   can read it and take different action according to the magic
-  value stored. The SYSCON mapped register is retrieved from the
-  parental dt-node plus the offset. So the SYSCON reboot-mode node
-  should be represented as a sub-node of a "syscon", "simple-mfd" node.
+  value stored. The SYSCON mapped register is retrieved either from
+  the parental dt-node or from a regmap phandle plus the offset.
 
 properties:
   compatible:
@@ -29,6 +28,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: Offset in the register map for the mode register (in bytes).
 
+  regmap:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the register map node.
+
 patternProperties:
   "^mode-.+":
     $ref: /schemas/types.yaml#/definitions/uint32
Signature · 1 line
2.25.1
#12 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Quoted 7 lines · Rob Herring
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree.) So the code change will be merged while the doc-part won't? Lets discuss then to settle the issue.

Why 'syscon-reboot' can be out of syscon-controller node, while 'syscon-reboot-mode' can't? They both belong to the same usecase: save cause id and reboot. So having similar properties-set and declaring their nodes someplace nearby is natural. According to the driver 'syscon-reboot' can't lack the regmap property because it's mandatory, while here you refuse to have even optional support. Additionally in most of the cases the 'syscon-reboot' nodes aren't declared as a child of a system controller node. Why 'syscon-reboot-mode' can't work in a similar way?

Regards,
-Sergey

Quoted 41 lines
Quoted 41 lines
Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 .../bindings/power/reset/syscon-reboot-mode.yaml         | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml +6 -3
index e09bb07b1abb..f47bf52ad983 100644
@@ -13,9 +13,8 @@ description: |
   This driver gets reboot mode magic value from reboot-mode driver
   and stores it in a SYSCON mapped register. Then the bootloader
   can read it and take different action according to the magic
-  value stored. The SYSCON mapped register is retrieved from the
-  parental dt-node plus the offset. So the SYSCON reboot-mode node
-  should be represented as a sub-node of a "syscon", "simple-mfd" node.
+  value stored. The SYSCON mapped register is retrieved either from
+  the parental dt-node or from a regmap phandle plus the offset.
 
 properties:
   compatible:
@@ -29,6 +28,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: Offset in the register map for the mode register (in bytes).
 
+  regmap:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the register map node.
+
 patternProperties:
   "^mode-.+":
     $ref: /schemas/types.yaml#/definitions/uint32
Signature · 1 line
2.25.1
#13 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Hi,

Quoted 11 lines · Sergey Semin
Quoted 6 lines · Rob Herring
Quoted 3 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]> Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree. So the code change will be merged while the doc-part won't?

FWIW I do not merge with bindings being NAK'd by Rob.

-- Sebastian

maintainer
#14 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

In reply to Sergey Semin
Quoted 8 lines · Sergey Semin
Quoted 6 lines · Rob Herring
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Quoted 8 lines
Quoted 1 line

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree.) So the code change will be merged while the doc-part won't? Lets discuss then to settle the issue.

Why 'syscon-reboot' can be out of syscon-controller node, while 'syscon-reboot-mode' can't?

Look at the history and you will see one was reviewed by DT maintainers and one wasn't.

Quoted 3 lines

They both belong to the same usecase: save
cause id and reboot. So having similar properties-set and declaring their nodes someplace nearby is natural.

Which is what I'm asking for. Where else in the tree does it make sense to locate the 'syscon-reboot-mode' node? Locate nodes where they logically belong.

Quoted 5 lines

According to the driver 'syscon-reboot'
can't lack the regmap property because it's mandatory, while here you refuse to have even optional support. Additionally in most of the cases the 'syscon-reboot' nodes aren't declared as a child of a system controller node. Why 'syscon-reboot-mode' can't work in a similar way?

There's plenty of bad or "don't follow current best practice" examples in the tree for all sorts of things. That is not a reason for doing something in a new binding or adding to an existing one.

Rob

#15 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Quoted 36 lines · Rob Herring
Quoted 8 lines · Sergey Semin
Quoted 6 lines · Rob Herring
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Quoted 8 lines
Quoted 1 line

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree.) So the code change will be merged while the doc-part won't? Lets discuss then to settle the issue.

Why 'syscon-reboot' can be out of syscon-controller node, while 'syscon-reboot-mode' can't?

Look at the history and you will see one was reviewed by DT maintainers and one wasn't.

Quoted 3 lines

They both belong to the same usecase: save
cause id and reboot. So having similar properties-set and declaring their nodes someplace nearby is natural.

Which is what I'm asking for. Where else in the tree does it make sense to locate the 'syscon-reboot-mode' node? Locate nodes where they logically belong.

Quoted 5 lines

According to the driver 'syscon-reboot'
can't lack the regmap property because it's mandatory, while here you refuse to have even optional support. Additionally in most of the cases the 'syscon-reboot' nodes aren't declared as a child of a system controller node. Why 'syscon-reboot-mode' can't work in a similar way?

Quoted 5 lines

There's plenty of bad or "don't follow current best practice" examples in the tree for all sorts of things. That is not a reason for doing something in a new binding or adding to an existing one.

Rob

Alright. I see your point. What about I'd provide a sort of opposite implementation? I could make the "regmap"-phandle reference being optional in the !"syscon-reboot"! driver instead of adding the regmap-property support to the "syscon-reboot-mode" driver. So if regmap property isn't defined in the "syscon-reboot"-compatible node, the driver will try to get a syscon regmap from the parental node as it's done in the "syscon-reboot-mode" driver.

Seeing you think that regmap-property-based design is a bad practice in this case, I also could mark the property as deprecated in the "syscon-reboot" dt schema and print a warning from the "syscon-reboot" driver if one is defined.

What do you think?

Regards,
-Sergey

#16 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Rob,
Any comment on my suggestion below?

Regards,
-Sergey

Quoted 59 lines · Sergey Semin
Quoted 36 lines · Rob Herring
Quoted 8 lines · Sergey Semin
Quoted 6 lines · Rob Herring
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Quoted 8 lines
Quoted 1 line

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree.) So the code change will be merged while the doc-part won't? Lets discuss then to settle the issue.

Why 'syscon-reboot' can be out of syscon-controller node, while 'syscon-reboot-mode' can't?

Look at the history and you will see one was reviewed by DT maintainers and one wasn't.

Quoted 3 lines

They both belong to the same usecase: save
cause id and reboot. So having similar properties-set and declaring their nodes someplace nearby is natural.

Which is what I'm asking for. Where else in the tree does it make sense to locate the 'syscon-reboot-mode' node? Locate nodes where they logically belong.

Quoted 5 lines

According to the driver 'syscon-reboot'
can't lack the regmap property because it's mandatory, while here you refuse to have even optional support. Additionally in most of the cases the 'syscon-reboot' nodes aren't declared as a child of a system controller node. Why 'syscon-reboot-mode' can't work in a similar way?

Quoted 5 lines

There's plenty of bad or "don't follow current best practice" examples in the tree for all sorts of things. That is not a reason for doing something in a new binding or adding to an existing one.

Rob

Alright. I see your point. What about I'd provide a sort of opposite implementation? I could make the "regmap"-phandle reference being optional in the !"syscon-reboot"! driver instead of adding the regmap-property support to the "syscon-reboot-mode" driver. So if regmap property isn't defined in the "syscon-reboot"-compatible node, the driver will try to get a syscon regmap from the parental node as it's done in the "syscon-reboot-mode" driver.

Seeing you think that regmap-property-based design is a bad practice in this case, I also could mark the property as deprecated in the "syscon-reboot" dt schema and print a warning from the "syscon-reboot" driver if one is defined.

What do you think?

Regards,
-Sergey

maintainer
#17 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Quoted 57 lines · Sergey Semin

Rob,
Any comment on my suggestion below?

Regards,
-Sergey

Quoted 50 lines · Sergey Semin
Quoted 36 lines · Rob Herring
Quoted 8 lines · Sergey Semin
Quoted 6 lines · Rob Herring
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Quoted 8 lines
Quoted 1 line

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree.) So the code change will be merged while the doc-part won't? Lets discuss then to settle the issue.

Why 'syscon-reboot' can be out of syscon-controller node, while 'syscon-reboot-mode' can't?

Look at the history and you will see one was reviewed by DT maintainers and one wasn't.

Quoted 3 lines

They both belong to the same usecase: save
cause id and reboot. So having similar properties-set and declaring their nodes someplace nearby is natural.

Which is what I'm asking for. Where else in the tree does it make sense to locate the 'syscon-reboot-mode' node? Locate nodes where they logically belong.

Quoted 5 lines

According to the driver 'syscon-reboot'
can't lack the regmap property because it's mandatory, while here you refuse to have even optional support. Additionally in most of the cases the 'syscon-reboot' nodes aren't declared as a child of a system controller node. Why 'syscon-reboot-mode' can't work in a similar way?

Quoted 5 lines

There's plenty of bad or "don't follow current best practice" examples in the tree for all sorts of things. That is not a reason for doing something in a new binding or adding to an existing one.

Rob

Alright. I see your point. What about I'd provide a sort of opposite implementation? I could make the "regmap"-phandle reference being optional in the !"syscon-reboot"! driver instead of adding the regmap-property support to the "syscon-reboot-mode" driver. So if regmap property isn't defined in the "syscon-reboot"-compatible node, the driver will try to get a syscon regmap from the parental node as it's done in the "syscon-reboot-mode" driver.

That seems fine.

Quoted 3 lines
Quoted 3 lines

Seeing you think that regmap-property-based design is a bad practice in this case, I also could mark the property as deprecated in the "syscon-reboot" dt schema and print a warning from the "syscon-reboot" driver if one is defined.

Depends on how many platforms will start getting warnings. I think just marking deprecated is enough.

Rob

#18 lore raw

Re: [PATCH 3/4] dt-bindings: power: reset: Add regmap support to the SYSCON reboot-mode bindings

Quoted 59 lines · Rob Herring
Quoted 57 lines · Sergey Semin

Rob,
Any comment on my suggestion below?

Regards,
-Sergey

Quoted 50 lines · Sergey Semin
Quoted 36 lines · Rob Herring
Quoted 8 lines · Sergey Semin
Quoted 6 lines · Rob Herring
Quoted 4 lines · On Fri, Mar 06, 2020 at 04:03:40PM +0300, [email protected]…

From: Serge Semin <[email protected]>

Optional regmap property will be used to refer to a syscon-controller having a reboot tolerant register mapped.

Quoted 8 lines
Quoted 1 line

NAK. It should simply be a child node of the 'syscon-controller'.

Hm, It's dilemma. The driver maintainer said ack, while you disagree.) So the code change will be merged while the doc-part won't? Lets discuss then to settle the issue.

Why 'syscon-reboot' can be out of syscon-controller node, while 'syscon-reboot-mode' can't?

Look at the history and you will see one was reviewed by DT maintainers and one wasn't.

Quoted 3 lines

They both belong to the same usecase: save
cause id and reboot. So having similar properties-set and declaring their nodes someplace nearby is natural.

Which is what I'm asking for. Where else in the tree does it make sense to locate the 'syscon-reboot-mode' node? Locate nodes where they logically belong.

Quoted 5 lines

According to the driver 'syscon-reboot'
can't lack the regmap property because it's mandatory, while here you refuse to have even optional support. Additionally in most of the cases the 'syscon-reboot' nodes aren't declared as a child of a system controller node. Why 'syscon-reboot-mode' can't work in a similar way?

Quoted 5 lines

There's plenty of bad or "don't follow current best practice" examples in the tree for all sorts of things. That is not a reason for doing something in a new binding or adding to an existing one.

Rob

Alright. I see your point. What about I'd provide a sort of opposite implementation? I could make the "regmap"-phandle reference being optional in the !"syscon-reboot"! driver instead of adding the regmap-property support to the "syscon-reboot-mode" driver. So if regmap property isn't defined in the "syscon-reboot"-compatible node, the driver will try to get a syscon regmap from the parental node as it's done in the "syscon-reboot-mode" driver.

Quoted 8 lines

That seems fine.

Quoted 3 lines
Quoted 3 lines

Seeing you think that regmap-property-based design is a bad practice in this case, I also could mark the property as deprecated in the "syscon-reboot" dt schema and print a warning from the "syscon-reboot" driver if one is defined.

Depends on how many platforms will start getting warnings. I think just marking deprecated is enough.

Ok. Thanks. I'll do this in v2.

Regards,
-Sergey

Quoted 2 lines

Rob

#19 lore raw

PATCH 4/4 power: reset: syscon-reboot-mode: Add regmap dts-property support

In reply to a message not in the archive

From: Serge Semin <[email protected]>

'Reboot-mode'-type of devices are supposed to work in conjunction with 'reboot'-type devices. In particular Baikal-T1 SoC provides a special CCU_WDT_RCR register, which is preserved during any type of the CPU reset (standard and caused by a watchdog one). Since both of them are responsible for the system-wide operation and related with each other it would be better to place them at the same place in the dt hierarchy. In particular the best location would be the dt root node. Currently 'syscon-reboot' device node can be placed anywhere in a dtb as long as the corresponding device is created at the system boot-up procedure. While according to the corresponding bindings file 'system-boot-mode' should be represented as a sub-node of a "syscon", "simple-mfd" node. This isn't always suitable especially when the reboot-preserved register is provided by some device, which we don't want to declared as MFD. In this case it would be good to have the 'syscon-reboot-mode' node accepting the 'regmap' property with a phandle reference to the 'syscon' dt-node, in the same way the 'syscon-reboot' driver does. This is what this patch provides - it makes the driver to handle the optional 'regmap' property. In case if one isn't provided the previously implemented scheme is expected to be found in dtb.

Moreover seeing current dt-interface implementation of the 'syscon-reboot', 'syscon-poweroff' and 'syscon-reboot-mode' drivers, they look more or less similar. All of them handle 'offset' and 'mask' dt-properties. While 'value' property is only acceptable by the 'syscon-reboot' and 'syscon-poweroff' driver, the 'mode-*' properties of 'syscon-reboot-mode' serve to the similar purpose. The only strong difference between them is the ability to get the syscon regmap from the 'regmap' property. By having this patch merged we'll have that difference eliminated, so the interfaces would look unified.

Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 drivers/power/reset/syscon-reboot-mode.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/power/reset/syscon-reboot-mode.c +8 -3
index e0772c9f70f7..f8f8218ae3ee 100644
@@ -40,6 +40,7 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
 {
 	int ret;
 	struct syscon_reboot_mode *syscon_rbm;
+	struct regmap *map;
 
 	syscon_rbm = devm_kzalloc(&pdev->dev, sizeof(*syscon_rbm), GFP_KERNEL);
 	if (!syscon_rbm)
@@ -49,9 +50,13 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
 	syscon_rbm->reboot.write = syscon_reboot_mode_write;
 	syscon_rbm->mask = 0xffffffff;
 
-	syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node);
-	if (IS_ERR(syscon_rbm->map))
-		return PTR_ERR(syscon_rbm->map);
+	map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap");
+	if (IS_ERR(map)) {
+		map = syscon_node_to_regmap(pdev->dev.parent->of_node);
+		if (IS_ERR(map))
+			return PTR_ERR(map);
+	}
+	syscon_rbm->map = map;
 
 	if (of_property_read_u32(pdev->dev.of_node, "offset",
 	    &syscon_rbm->offset))
Signature · 1 line
2.25.1
maintainer Acked-by on v1 4/4
#20 lore raw

Re: [PATCH 4/4] power: reset: syscon-reboot-mode: Add regmap dts-property support

Hi,

Quoted 33 lines · On Fri, Mar 06, 2020 at 04:03:41PM +0300, [email protected]…

From: Serge Semin <[email protected]>

'Reboot-mode'-type of devices are supposed to work in conjunction with 'reboot'-type devices. In particular Baikal-T1 SoC provides a special CCU_WDT_RCR register, which is preserved during any type of the CPU reset (standard and caused by a watchdog one). Since both of them are responsible for the system-wide operation and related with each other it would be better to place them at the same place in the dt hierarchy. In particular the best location would be the dt root node. Currently 'syscon-reboot' device node can be placed anywhere in a dtb as long as the corresponding device is created at the system boot-up procedure. While according to the corresponding bindings file 'system-boot-mode' should be represented as a sub-node of a "syscon", "simple-mfd" node. This isn't always suitable especially when the reboot-preserved register is provided by some device, which we don't want to declared as MFD. In this case it would be good to have the 'syscon-reboot-mode' node accepting the 'regmap' property with a phandle reference to the 'syscon' dt-node, in the same way the 'syscon-reboot' driver does. This is what this patch provides - it makes the driver to handle the optional 'regmap' property. In case if one isn't provided the previously implemented scheme is expected to be found in dtb.

Moreover seeing current dt-interface implementation of the 'syscon-reboot', 'syscon-poweroff' and 'syscon-reboot-mode' drivers, they look more or less similar. All of them handle 'offset' and 'mask' dt-properties. While 'value' property is only acceptable by the 'syscon-reboot' and 'syscon-poweroff' driver, the 'mode-*' properties of 'syscon-reboot-mode' serve to the similar purpose. The only strong difference between them is the ability to get the syscon regmap from the 'regmap' property. By having this patch merged we'll have that difference eliminated, so the interfaces would look unified.

Quoted 6 lines
Cc Thomas Bogendoerfer <[email protected]>
Cc Paul Burton <[email protected]>
Cc Ralf Baechle <[email protected]>

---

-- Sebastian

Quoted 35 lines
 drivers/power/reset/syscon-reboot-mode.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/power/reset/syscon-reboot-mode.c +8 -3
index e0772c9f70f7..f8f8218ae3ee 100644
@@ -40,6 +40,7 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
 {
 	int ret;
 	struct syscon_reboot_mode *syscon_rbm;
+	struct regmap *map;
 
 	syscon_rbm = devm_kzalloc(&pdev->dev, sizeof(*syscon_rbm), GFP_KERNEL);
 	if (!syscon_rbm)
@@ -49,9 +50,13 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
 	syscon_rbm->reboot.write = syscon_reboot_mode_write;
 	syscon_rbm->mask = 0xffffffff;
 
-	syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node);
-	if (IS_ERR(syscon_rbm->map))
-		return PTR_ERR(syscon_rbm->map);
+	map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap");
+	if (IS_ERR(map)) {
+		map = syscon_node_to_regmap(pdev->dev.parent->of_node);
+		if (IS_ERR(map))
+			return PTR_ERR(map);
+	}
+	syscon_rbm->map = map;
 
 	if (of_property_read_u32(pdev->dev.of_node, "offset",
 	    &syscon_rbm->offset))
Signature · 1 line
2.25.1