* [PATCH v2 1/3] dt-bindings: power: reset: Convert syscon-reboot-mode to DT schema
2020-05-07 23:38 ` [PATCH v2 0/3] syscon: Alter syscon and reboot drivers Serge Semin
@ 2020-05-07 23:38 ` Serge Semin
2020-05-07 23:38 ` [PATCH v2 2/3] dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node Serge Semin
2020-05-07 23:38 ` [PATCH v2 3/3] power: reset: syscon-reboot: Add parental syscon support Serge Semin
2 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2020-05-07 23:38 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring
Cc: Serge Semin, Serge Semin, Rob Herring, Sebastian Reichel,
Alexey Malahov, Thomas Bogendoerfer, Paul Burton, Ralf Baechle,
Arnd Bergmann, Allison Randal, Richard Fontana, Kate Stewart,
Thomas Gleixner, linux-mips, linux-pm, devicetree, linux-kernel
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.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Allison Randal <allison@lohutok.net>
Cc: Richard Fontana <rfontana@redhat.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@vger.kernel.org
---
.../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
diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt b/Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
deleted file mode 100644
index f7ce1d8af04a..000000000000
--- a/Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt
+++ /dev/null
@@ -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>;
- };
- };
diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml
new file mode 100644
index 000000000000..9b1ffceefe3d
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%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 <sre@kernel.org>
+
+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>;
+ };
+...
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 2/3] dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node
2020-05-07 23:38 ` [PATCH v2 0/3] syscon: Alter syscon and reboot drivers Serge Semin
2020-05-07 23:38 ` [PATCH v2 1/3] dt-bindings: power: reset: Convert syscon-reboot-mode to DT schema Serge Semin
@ 2020-05-07 23:38 ` Serge Semin
2020-05-15 3:14 ` Rob Herring
2020-05-07 23:38 ` [PATCH v2 3/3] power: reset: syscon-reboot: Add parental syscon support Serge Semin
2 siblings, 1 reply; 6+ messages in thread
From: Serge Semin @ 2020-05-07 23:38 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring
Cc: Serge Semin, Serge Semin, Alexey Malahov, Thomas Bogendoerfer,
Paul Burton, Ralf Baechle, Arnd Bergmann, Allison Randal,
Richard Fontana, Kate Stewart, Thomas Gleixner, linux-mips,
Rob Herring, Jonathan Cameron, Krzysztof Kozlowski,
Alexandre Belloni, linux-pm, devicetree, linux-kernel
Since normally syscon-reboot block is supposed to be a part of a system
controller, lets mark the regmap property as deprecated and recommend the
syscon-reboot node to be a sub-node of SYSCON.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Allison Randal <allison@lohutok.net>
Cc: Richard Fontana <rfontana@redhat.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@vger.kernel.org
---
Changelog v2:
- This is a new patch created as a result of the discussion:
https://lore.kernel.org/linux-pm/20200306130402.1F4F0803079F@mail.baikalelectronics.ru/
---
.../bindings/power/reset/syscon-reboot.yaml | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
index b80772cb9f06..da2509724812 100644
--- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
+++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
@@ -12,9 +12,12 @@ maintainers:
description: |+
This is a generic reset driver using syscon to map the reset register.
The reset is generally performed with a write to the reset register
- defined by the register map pointed by syscon reference plus the offset
- with the value and mask defined in the reboot node.
- Default will be little endian mode, 32 bit access only.
+ defined by the SYSCON register map base plus the offset with the value and
+ mask defined in the reboot node. Default will be little endian mode, 32 bit
+ access only. The SYSCON registers map is normally retrieved from the
+ parental dt-node. So the SYSCON reboot node should be represented as a
+ sub-node of a "syscon", "simple-mfd" node. Though the regmap property
+ pointing to the system controller node is also supported.
properties:
compatible:
@@ -30,7 +33,10 @@ properties:
regmap:
$ref: /schemas/types.yaml#/definitions/phandle
- description: Phandle to the register map node.
+ deprecated: true
+ description: |
+ Phandle to the register map node. This property is deprecated in favor of
+ the syscon-reboot node been a child of a system controller node.
value:
$ref: /schemas/types.yaml#/definitions/uint32
@@ -38,7 +44,6 @@ properties:
required:
- compatible
- - regmap
- offset
additionalProperties: false
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 2/3] dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node
2020-05-07 23:38 ` [PATCH v2 2/3] dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node Serge Semin
@ 2020-05-15 3:14 ` Rob Herring
2020-05-16 13:26 ` Serge Semin
0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2020-05-15 3:14 UTC (permalink / raw)
To: Serge Semin
Cc: Ralf Baechle, linux-mips, Allison Randal, Kate Stewart,
Sebastian Reichel, Thomas Bogendoerfer, linux-kernel,
Krzysztof Kozlowski, Jonathan Cameron, Arnd Bergmann,
Alexandre Belloni, Paul Burton, linux-pm, devicetree,
Richard Fontana, Thomas Gleixner, Rob Herring, Serge Semin,
Alexey Malahov
On Fri, 8 May 2020 02:38:45 +0300, Serge Semin wrote:
> Since normally syscon-reboot block is supposed to be a part of a system
> controller, lets mark the regmap property as deprecated and recommend the
> syscon-reboot node to be a sub-node of SYSCON.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Paul Burton <paulburton@kernel.org>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Allison Randal <allison@lohutok.net>
> Cc: Richard Fontana <rfontana@redhat.com>
> Cc: Kate Stewart <kstewart@linuxfoundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-mips@vger.kernel.org
>
> ---
>
> Changelog v2:
> - This is a new patch created as a result of the discussion:
> https://lore.kernel.org/linux-pm/20200306130402.1F4F0803079F@mail.baikalelectronics.ru/
> ---
> .../bindings/power/reset/syscon-reboot.yaml | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node
2020-05-15 3:14 ` Rob Herring
@ 2020-05-16 13:26 ` Serge Semin
0 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2020-05-16 13:26 UTC (permalink / raw)
To: Rob Herring, Sebastian Reichel
Cc: Serge Semin, Ralf Baechle, linux-mips, Allison Randal,
Kate Stewart, Thomas Bogendoerfer, linux-kernel,
Krzysztof Kozlowski, Jonathan Cameron, Arnd Bergmann,
Alexandre Belloni, Paul Burton, linux-pm, devicetree,
Richard Fontana, Thomas Gleixner, Rob Herring, Alexey Malahov
On Thu, May 14, 2020 at 10:14:49PM -0500, Rob Herring wrote:
> On Fri, 8 May 2020 02:38:45 +0300, Serge Semin wrote:
> > Since normally syscon-reboot block is supposed to be a part of a system
> > controller, lets mark the regmap property as deprecated and recommend the
> > syscon-reboot node to be a sub-node of SYSCON.
> >
> > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> > Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> > Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Cc: Paul Burton <paulburton@kernel.org>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Allison Randal <allison@lohutok.net>
> > Cc: Richard Fontana <rfontana@redhat.com>
> > Cc: Kate Stewart <kstewart@linuxfoundation.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: linux-mips@vger.kernel.org
> >
> > ---
> >
> > Changelog v2:
> > - This is a new patch created as a result of the discussion:
> > https://lore.kernel.org/linux-pm/20200306130402.1F4F0803079F@mail.baikalelectronics.ru/
> > ---
> > .../bindings/power/reset/syscon-reboot.yaml | 15 ++++++++++-----
> > 1 file changed, 10 insertions(+), 5 deletions(-)
> >
>
> Reviewed-by: Rob Herring <robh@kernel.org>
Great. Thanks!
Sebastian, Rob is ok with the change. Could you take a look at the next patch?
-Sergey
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] power: reset: syscon-reboot: Add parental syscon support
2020-05-07 23:38 ` [PATCH v2 0/3] syscon: Alter syscon and reboot drivers Serge Semin
2020-05-07 23:38 ` [PATCH v2 1/3] dt-bindings: power: reset: Convert syscon-reboot-mode to DT schema Serge Semin
2020-05-07 23:38 ` [PATCH v2 2/3] dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node Serge Semin
@ 2020-05-07 23:38 ` Serge Semin
2 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2020-05-07 23:38 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Serge Semin, Serge Semin, Alexey Malahov, Thomas Bogendoerfer,
Paul Burton, Ralf Baechle, Arnd Bergmann, Rob Herring, linux-mips,
devicetree, Kate Stewart, Thomas Gleixner, Allison Randal,
Richard Fontana, linux-pm, linux-kernel
Since normally syscon-reboot block is supposed to be a part of a system
controller, lets look for the syscon regmap in a parental DT node if
regmap property isn't specified. DT binding from now considers the regmap
property as deprecated.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: devicetree@vger.kernel.org
---
Changelog v2:
- This is a new patch created as a result of the discussion:
https://lore.kernel.org/linux-pm/20200306130402.1F4F0803079F@mail.baikalelectronics.ru/
---
drivers/power/reset/syscon-reboot.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
index 62fbba0df971..510e363381ca 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -51,8 +51,11 @@ static int syscon_reboot_probe(struct platform_device *pdev)
return -ENOMEM;
ctx->map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap");
- if (IS_ERR(ctx->map))
- return PTR_ERR(ctx->map);
+ if (IS_ERR(ctx->map)) {
+ ctx->map = syscon_node_to_regmap(dev->parent->of_node);
+ if (IS_ERR(ctx->map))
+ return PTR_ERR(ctx->map);
+ }
if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
return -EINVAL;
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread