All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
@ 2021-11-02 15:22 Rafał Miłecki
  2021-11-02 15:22 ` [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example Rafał Miłecki
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Rafał Miłecki @ 2021-11-02 15:22 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring
  Cc: linux-pm, devicetree, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
	Florian Fainelli, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

During my work on MFD binding for Broadcom's TWD block I received
comment from Rob saying that "syscon-reboot" should use "reg" property.
I'm not sure if my understanding & implementation are correct so I'm
sending this RFC.

What bothers me is non-standard "reg" property usage. Treating it as a
simple (unsigned) integer number means different logic when it comes to
ranges.

Consider this example:

timer@400 {
	compatible = "simple-mfd", "syscon";
	reg = <0x400 0x3c>;
	ranges;

	#address-cells = <1>;
	#size-cells = <1>;

	reboot@434 {
		compatible = "syscon-reboot";
		reg = <0x34 0x4>;
		mask = <0x1>;
	};
};

I've reboot@434 node with reg 0x34. Also 0x4 is ignored but must be
present because of of MFD addressing.

Please review this idea / binding / implementation.

Rafał Miłecki (3):
  dt-bindings: power: reset: syscon-reboot: use non-deprecated example
  dt-bindings: power: reset: syscon-reboot: add "reg" property
  power: reset: syscon-reboot: support "reg" property

 .../bindings/power/reset/syscon-reboot.yaml   | 28 +++++++++++++------
 drivers/power/reset/syscon-reboot.c           |  9 ++++--
 2 files changed, 26 insertions(+), 11 deletions(-)

-- 
2.31.1


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

* [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example
  2021-11-02 15:22 [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
@ 2021-11-02 15:22 ` Rafał Miłecki
  2021-11-12 19:33   ` Rob Herring
  2021-11-02 15:22 ` [PATCH RFC 2/3] dt-bindings: power: reset: syscon-reboot: add "reg" property Rafał Miłecki
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Rafał Miłecki @ 2021-11-02 15:22 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring
  Cc: linux-pm, devicetree, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
	Florian Fainelli, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Usage of "regmap" property has been deprecated by the commit
2140d68d69d4 ("dt-bindings: power: reset: Unrequire regmap property in
syscon-reboot node"). Rewrite example to help people using
non-deprecated binding.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../bindings/power/reset/syscon-reboot.yaml        | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
index da2509724812..ebae55683d39 100644
--- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
+++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
@@ -59,9 +59,13 @@ allOf:
 
 examples:
   - |
-    reboot {
-        compatible = "syscon-reboot";
-        regmap = <&regmapnode>;
-        offset = <0x0>;
-        mask = <0x1>;
+    system-controller@12020000 {
+        compatible = "hisilicon,hi3519-sysctrl", "syscon";
+        reg = <0x12020000 0x1000>;
+
+        reboot {
+            compatible = "syscon-reboot";
+            offset = <0x4>;
+            mask = <0xdeadbeef>;
+        };
     };
-- 
2.31.1


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

* [PATCH RFC 2/3] dt-bindings: power: reset: syscon-reboot: add "reg" property
  2021-11-02 15:22 [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
  2021-11-02 15:22 ` [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example Rafał Miłecki
@ 2021-11-02 15:22 ` Rafał Miłecki
  2021-11-12 19:34   ` Rob Herring
  2021-11-02 15:22 ` [PATCH RFC 3/3] power: reset: syscon-reboot: support " Rafał Miłecki
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Rafał Miłecki @ 2021-11-02 15:22 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring
  Cc: linux-pm, devicetree, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
	Florian Fainelli, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Reboot node should be a child of mfd/syscon node and should use "reg"
property to specify regmap offset.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../bindings/power/reset/syscon-reboot.yaml        | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
index ebae55683d39..ddcf6e5dcdfa 100644
--- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
+++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
@@ -31,6 +31,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: Offset in the register map for the reboot register (in bytes).
 
+  reg:
+    maxItems: 1
+    description: Offset in the register map and size (must be 4 B)
+
   regmap:
     $ref: /schemas/types.yaml#/definitions/phandle
     deprecated: true
@@ -42,12 +46,14 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: The reset value written to the reboot register (32 bit access).
 
-required:
-  - compatible
-  - offset
-
 additionalProperties: false
 
+anyOf:
+  - required:
+      - reg
+  - required:
+      - offset
+
 allOf:
   - if:
       not:
-- 
2.31.1


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

* [PATCH RFC 3/3] power: reset: syscon-reboot: support "reg" property
  2021-11-02 15:22 [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
  2021-11-02 15:22 ` [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example Rafał Miłecki
  2021-11-02 15:22 ` [PATCH RFC 2/3] dt-bindings: power: reset: syscon-reboot: add "reg" property Rafał Miłecki
@ 2021-11-02 15:22 ` Rafał Miłecki
  2021-11-02 15:26 ` [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
  2021-11-12 22:18 ` Rob Herring
  4 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2021-11-02 15:22 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring
  Cc: linux-pm, devicetree, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
	Florian Fainelli, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

This follows binding update to use "reg" for reading regmap offset.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/power/reset/syscon-reboot.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
index 510e363381ca..a0999bac503e 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -44,6 +44,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
 	struct syscon_reboot_context *ctx;
 	struct device *dev = &pdev->dev;
 	int mask_err, value_err;
+	bool is_child = false;
 	int err;
 
 	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
@@ -55,10 +56,14 @@ static int syscon_reboot_probe(struct platform_device *pdev)
 		ctx->map = syscon_node_to_regmap(dev->parent->of_node);
 		if (IS_ERR(ctx->map))
 			return PTR_ERR(ctx->map);
+		is_child = true;
 	}
 
-	if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
-		return -EINVAL;
+	if (!is_child ||
+	    of_property_read_u32(dev->of_node, "reg", &ctx->offset)) {
+		if (of_property_read_u32(dev->of_node, "offset", &ctx->offset))
+			return -EINVAL;
+	}
 
 	value_err = of_property_read_u32(pdev->dev.of_node, "value", &ctx->value);
 	mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask);
-- 
2.31.1


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

* Re: [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
  2021-11-02 15:22 [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
                   ` (2 preceding siblings ...)
  2021-11-02 15:22 ` [PATCH RFC 3/3] power: reset: syscon-reboot: support " Rafał Miłecki
@ 2021-11-02 15:26 ` Rafał Miłecki
  2021-11-12 22:18 ` Rob Herring
  4 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2021-11-02 15:26 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring
  Cc: linux-pm, devicetree, Lee Jones, Wim Van Sebroeck, Guenter Roeck,
	Florian Fainelli, bcm-kernel-feedback-list,
	Rafał Miłecki

On 02.11.2021 16:22, Rafał Miłecki wrote:
> During my work on MFD binding for Broadcom's TWD block I received
> comment from Rob saying that "syscon-reboot" should use "reg" property.
> I'm not sure if my understanding & implementation are correct so I'm
> sending this RFC.

Reference:
Re: [PATCH 2/2] dt-bindings: mfd: add Broadcom's timer MFD block
Link: https://www.spinics.net/lists/linux-watchdog/msg21255.html

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

* Re: [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example
  2021-11-02 15:22 ` [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example Rafał Miłecki
@ 2021-11-12 19:33   ` Rob Herring
  0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2021-11-12 19:33 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Lee Jones, bcm-kernel-feedback-list, devicetree, Guenter Roeck,
	Florian Fainelli, Rafał Miłecki, linux-pm, Rob Herring,
	Wim Van Sebroeck, Sebastian Reichel

On Tue, 02 Nov 2021 16:22:05 +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Usage of "regmap" property has been deprecated by the commit
> 2140d68d69d4 ("dt-bindings: power: reset: Unrequire regmap property in
> syscon-reboot node"). Rewrite example to help people using
> non-deprecated binding.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  .../bindings/power/reset/syscon-reboot.yaml        | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH RFC 2/3] dt-bindings: power: reset: syscon-reboot: add "reg" property
  2021-11-02 15:22 ` [PATCH RFC 2/3] dt-bindings: power: reset: syscon-reboot: add "reg" property Rafał Miłecki
@ 2021-11-12 19:34   ` Rob Herring
  0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2021-11-12 19:34 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Wim Van Sebroeck, Guenter Roeck, Lee Jones,
	Rafał Miłecki, Sebastian Reichel, Florian Fainelli,
	linux-pm, bcm-kernel-feedback-list, Rob Herring, devicetree

On Tue, 02 Nov 2021 16:22:06 +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Reboot node should be a child of mfd/syscon node and should use "reg"
> property to specify regmap offset.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  .../bindings/power/reset/syscon-reboot.yaml        | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
  2021-11-02 15:22 [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
                   ` (3 preceding siblings ...)
  2021-11-02 15:26 ` [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
@ 2021-11-12 22:18 ` Rob Herring
  2021-11-12 22:23   ` Rafał Miłecki
  4 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2021-11-12 22:18 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Sebastian Reichel, open list:THERMAL, devicetree, Lee Jones,
	Wim Van Sebroeck, Guenter Roeck, Florian Fainelli,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
	Rafał Miłecki

On Tue, Nov 2, 2021 at 10:22 AM Rafał Miłecki <zajec5@gmail.com> wrote:
>
> From: Rafał Miłecki <rafal@milecki.pl>
>
> During my work on MFD binding for Broadcom's TWD block I received
> comment from Rob saying that "syscon-reboot" should use "reg" property.
> I'm not sure if my understanding & implementation are correct so I'm
> sending this RFC.
>
> What bothers me is non-standard "reg" property usage. Treating it as a
> simple (unsigned) integer number means different logic when it comes to
> ranges.

It shouldn't be. The idea is that 'reg' works like normal. See below.

> Consider this example:
>
> timer@400 {
>         compatible = "simple-mfd", "syscon";
>         reg = <0x400 0x3c>;
>         ranges;

ranges = <0 0x400 0x100>; // Just guessing for size

>
>         #address-cells = <1>;
>         #size-cells = <1>;
>
>         reboot@434 {

reboot@34

Just reading 'reg' is fine, but really, Linux should be either getting
the translated address or have a function to get the offset from the
parent base. IOW, it should also work if you just changed 'reg' to
'<0x434 0x4>'.

>                 compatible = "syscon-reboot";
>                 reg = <0x34 0x4>;
>                 mask = <0x1>;
>         };
> };
>
> I've reboot@434 node with reg 0x34. Also 0x4 is ignored but must be
> present because of of MFD addressing.
>
> Please review this idea / binding / implementation.
>
> Rafał Miłecki (3):
>   dt-bindings: power: reset: syscon-reboot: use non-deprecated example
>   dt-bindings: power: reset: syscon-reboot: add "reg" property
>   power: reset: syscon-reboot: support "reg" property
>
>  .../bindings/power/reset/syscon-reboot.yaml   | 28 +++++++++++++------
>  drivers/power/reset/syscon-reboot.c           |  9 ++++--
>  2 files changed, 26 insertions(+), 11 deletions(-)
>
> --
> 2.31.1
>

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

* Re: [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
  2021-11-12 22:18 ` Rob Herring
@ 2021-11-12 22:23   ` Rafał Miłecki
  2021-11-12 22:32     ` Rob Herring
  0 siblings, 1 reply; 12+ messages in thread
From: Rafał Miłecki @ 2021-11-12 22:23 UTC (permalink / raw)
  To: Rob Herring
  Cc: Sebastian Reichel, open list:THERMAL, devicetree, Lee Jones,
	Wim Van Sebroeck, Guenter Roeck, Florian Fainelli,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
	Rafał Miłecki

On 12.11.2021 23:18, Rob Herring wrote:
> On Tue, Nov 2, 2021 at 10:22 AM Rafał Miłecki <zajec5@gmail.com> wrote:
>>
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> During my work on MFD binding for Broadcom's TWD block I received
>> comment from Rob saying that "syscon-reboot" should use "reg" property.
>> I'm not sure if my understanding & implementation are correct so I'm
>> sending this RFC.
>>
>> What bothers me is non-standard "reg" property usage. Treating it as a
>> simple (unsigned) integer number means different logic when it comes to
>> ranges.
> 
> It shouldn't be. The idea is that 'reg' works like normal. See below.
> 
>> Consider this example:
>>
>> timer@400 {
>>          compatible = "simple-mfd", "syscon";
>>          reg = <0x400 0x3c>;
>>          ranges;
> 
> ranges = <0 0x400 0x100>; // Just guessing for size
> 
>>
>>          #address-cells = <1>;
>>          #size-cells = <1>;
>>
>>          reboot@434 {
> 
> reboot@34
> 
> Just reading 'reg' is fine, but really, Linux should be either getting
> the translated address or have a function to get the offset from the
> parent base. IOW, it should also work if you just changed 'reg' to
> '<0x434 0x4>'.

Are you aware of anyone working on support for getting translated
address? Do you recall any efforts on implementing such a helper?

Thanks a lot for commenting on this concern explicitly.

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

* Re: [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
  2021-11-12 22:23   ` Rafał Miłecki
@ 2021-11-12 22:32     ` Rob Herring
  2021-12-02 17:21       ` Sebastian Reichel
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2021-11-12 22:32 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Sebastian Reichel, open list:THERMAL, devicetree, Lee Jones,
	Wim Van Sebroeck, Guenter Roeck, Florian Fainelli,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
	Rafał Miłecki

On Fri, Nov 12, 2021 at 4:23 PM Rafał Miłecki <zajec5@gmail.com> wrote:
>
> On 12.11.2021 23:18, Rob Herring wrote:
> > On Tue, Nov 2, 2021 at 10:22 AM Rafał Miłecki <zajec5@gmail.com> wrote:
> >>
> >> From: Rafał Miłecki <rafal@milecki.pl>
> >>
> >> During my work on MFD binding for Broadcom's TWD block I received
> >> comment from Rob saying that "syscon-reboot" should use "reg" property.
> >> I'm not sure if my understanding & implementation are correct so I'm
> >> sending this RFC.
> >>
> >> What bothers me is non-standard "reg" property usage. Treating it as a
> >> simple (unsigned) integer number means different logic when it comes to
> >> ranges.
> >
> > It shouldn't be. The idea is that 'reg' works like normal. See below.
> >
> >> Consider this example:
> >>
> >> timer@400 {
> >>          compatible = "simple-mfd", "syscon";
> >>          reg = <0x400 0x3c>;
> >>          ranges;
> >
> > ranges = <0 0x400 0x100>; // Just guessing for size
> >
> >>
> >>          #address-cells = <1>;
> >>          #size-cells = <1>;
> >>
> >>          reboot@434 {
> >
> > reboot@34
> >
> > Just reading 'reg' is fine, but really, Linux should be either getting
> > the translated address or have a function to get the offset from the
> > parent base. IOW, it should also work if you just changed 'reg' to
> > '<0x434 0x4>'.
>
> Are you aware of anyone working on support for getting translated
> address? Do you recall any efforts on implementing such a helper?

All the DT address functions give you translated addresses. It's the
latter that doesn't exist that I'm aware of offhand. It's just
of_address_to_resource() on the child and parent nodes and then
calculate the offset.

Rob

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

* Re: [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
  2021-11-12 22:32     ` Rob Herring
@ 2021-12-02 17:21       ` Sebastian Reichel
  2021-12-02 17:23         ` Rafał Miłecki
  0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Reichel @ 2021-12-02 17:21 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, open list:THERMAL, devicetree, Lee Jones,
	Wim Van Sebroeck, Guenter Roeck, Florian Fainelli,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
	Rafał Miłecki

[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]

Hi,

On Fri, Nov 12, 2021 at 04:32:48PM -0600, Rob Herring wrote:
> On Fri, Nov 12, 2021 at 4:23 PM Rafał Miłecki <zajec5@gmail.com> wrote:
> >
> > On 12.11.2021 23:18, Rob Herring wrote:
> > > On Tue, Nov 2, 2021 at 10:22 AM Rafał Miłecki <zajec5@gmail.com> wrote:
> > >>
> > >> From: Rafał Miłecki <rafal@milecki.pl>
> > >>
> > >> During my work on MFD binding for Broadcom's TWD block I received
> > >> comment from Rob saying that "syscon-reboot" should use "reg" property.
> > >> I'm not sure if my understanding & implementation are correct so I'm
> > >> sending this RFC.
> > >>
> > >> What bothers me is non-standard "reg" property usage. Treating it as a
> > >> simple (unsigned) integer number means different logic when it comes to
> > >> ranges.
> > >
> > > It shouldn't be. The idea is that 'reg' works like normal. See below.
> > >
> > >> Consider this example:
> > >>
> > >> timer@400 {
> > >>          compatible = "simple-mfd", "syscon";
> > >>          reg = <0x400 0x3c>;
> > >>          ranges;
> > >
> > > ranges = <0 0x400 0x100>; // Just guessing for size
> > >
> > >>
> > >>          #address-cells = <1>;
> > >>          #size-cells = <1>;
> > >>
> > >>          reboot@434 {
> > >
> > > reboot@34
> > >
> > > Just reading 'reg' is fine, but really, Linux should be either getting
> > > the translated address or have a function to get the offset from the
> > > parent base. IOW, it should also work if you just changed 'reg' to
> > > '<0x434 0x4>'.
> >
> > Are you aware of anyone working on support for getting translated
> > address? Do you recall any efforts on implementing such a helper?
> 
> All the DT address functions give you translated addresses. It's the
> latter that doesn't exist that I'm aware of offhand. It's just
> of_address_to_resource() on the child and parent nodes and then
> calculate the offset.

Has a new version beent sent with this change, that I missed?

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support
  2021-12-02 17:21       ` Sebastian Reichel
@ 2021-12-02 17:23         ` Rafał Miłecki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2021-12-02 17:23 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rob Herring, open list:THERMAL, devicetree, Lee Jones,
	Wim Van Sebroeck, Guenter Roeck, Florian Fainelli,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE,
	Rafał Miłecki

Hi,

On 02.12.2021 18:21, Sebastian Reichel wrote:
> On Fri, Nov 12, 2021 at 04:32:48PM -0600, Rob Herring wrote:
>> On Fri, Nov 12, 2021 at 4:23 PM Rafał Miłecki <zajec5@gmail.com> wrote:
>>>
>>> On 12.11.2021 23:18, Rob Herring wrote:
>>>> On Tue, Nov 2, 2021 at 10:22 AM Rafał Miłecki <zajec5@gmail.com> wrote:
>>>>>
>>>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>>>
>>>>> During my work on MFD binding for Broadcom's TWD block I received
>>>>> comment from Rob saying that "syscon-reboot" should use "reg" property.
>>>>> I'm not sure if my understanding & implementation are correct so I'm
>>>>> sending this RFC.
>>>>>
>>>>> What bothers me is non-standard "reg" property usage. Treating it as a
>>>>> simple (unsigned) integer number means different logic when it comes to
>>>>> ranges.
>>>>
>>>> It shouldn't be. The idea is that 'reg' works like normal. See below.
>>>>
>>>>> Consider this example:
>>>>>
>>>>> timer@400 {
>>>>>           compatible = "simple-mfd", "syscon";
>>>>>           reg = <0x400 0x3c>;
>>>>>           ranges;
>>>>
>>>> ranges = <0 0x400 0x100>; // Just guessing for size
>>>>
>>>>>
>>>>>           #address-cells = <1>;
>>>>>           #size-cells = <1>;
>>>>>
>>>>>           reboot@434 {
>>>>
>>>> reboot@34
>>>>
>>>> Just reading 'reg' is fine, but really, Linux should be either getting
>>>> the translated address or have a function to get the offset from the
>>>> parent base. IOW, it should also work if you just changed 'reg' to
>>>> '<0x434 0x4>'.
>>>
>>> Are you aware of anyone working on support for getting translated
>>> address? Do you recall any efforts on implementing such a helper?
>>
>> All the DT address functions give you translated addresses. It's the
>> latter that doesn't exist that I'm aware of offhand. It's just
>> of_address_to_resource() on the child and parent nodes and then
>> calculate the offset.
> 
> Has a new version beent sent with this change, that I missed?

Not yet, I was sidetracked by pinctrl & OpenWrt stuff.

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

end of thread, other threads:[~2021-12-02 17:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 15:22 [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
2021-11-02 15:22 ` [PATCH RFC 1/3] dt-bindings: power: reset: syscon-reboot: use non-deprecated example Rafał Miłecki
2021-11-12 19:33   ` Rob Herring
2021-11-02 15:22 ` [PATCH RFC 2/3] dt-bindings: power: reset: syscon-reboot: add "reg" property Rafał Miłecki
2021-11-12 19:34   ` Rob Herring
2021-11-02 15:22 ` [PATCH RFC 3/3] power: reset: syscon-reboot: support " Rafał Miłecki
2021-11-02 15:26 ` [PATCH RFC 0/3] reset: syscon-reboot: add "reg" property support Rafał Miłecki
2021-11-12 22:18 ` Rob Herring
2021-11-12 22:23   ` Rafał Miłecki
2021-11-12 22:32     ` Rob Herring
2021-12-02 17:21       ` Sebastian Reichel
2021-12-02 17:23         ` Rafał Miłecki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.