Skip to contentSkip to conversation

watchdog: realtek-otto: add fallback compatible

PATCH In review Sander Vanheule 5 participants 13 messages May 12 – May 16

Subsystems (3)
lore
Share & tools
lore

Sander Vanheule

author maintainer
#0 lore raw

v2 cover watchdog: realtek-otto: add fallback compatible

Like for the GPIO hardware of the Realtek Otto platform, add a fallback compatible for the watchdog hardware.

For backward compatibility, the binding will still allow current single-compatible devicetrees to work, but new devicetrees, including new compatibles, should use a two-component compatible.

This series serves to address comments regarding the device compatibles for the patches adding RTL9607C watchdog support [1].

[1] https://lore.kernel.org/lkml/[email protected]/

Sander Vanheule (2):
dt-bindings: watchdog: realtek,otto-wdt: Add fallback compatible
watchdog: realtek-otto: add fallback compatible

 .../bindings/watchdog/realtek,otto-wdt.yaml   | 22 ++++++++++++++-----
 drivers/watchdog/realtek_otto_wdt.c           |  2 ++
 2 files changed, 18 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH v2 1/2 dt-bindings: watchdog: realtek,otto-wdt: Add fallback compatible

As all known hardware instantiations of this watchdog behave the same, a fallback compatible can be added.

To remain compatible with existing single-compatible bindings, the current compatibles are duplicated. New compatibles should only be added to the list with fallback.

---
Changes since v1:
- Fix indendations
- Add deprecated property to old compatible
- Use two-part compatible in example

---
 .../bindings/watchdog/realtek,otto-wdt.yaml   | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +16 -6
index 1f5390a67cdb..e470e0fcbb2a 100644
@@ -25,11 +25,21 @@ allOf:
 
 properties:
   compatible:
-    enum:
-      - realtek,rtl8380-wdt
-      - realtek,rtl8390-wdt
-      - realtek,rtl9300-wdt
-      - realtek,rtl9310-wdt
+    oneOf:
+      - items:
+          - enum:
+              - realtek,rtl8380-wdt
+              - realtek,rtl8390-wdt
+              - realtek,rtl9300-wdt
+              - realtek,rtl9310-wdt
+          - const: realtek,otto-wdt
+      # Legacy without fallback, do not extend
+      - deprecated: true
+        enum:
+          - realtek,rtl8380-wdt
+          - realtek,rtl8390-wdt
+          - realtek,rtl9300-wdt
+          - realtek,rtl9310-wdt
 
   reg:
     maxItems: 1
@@ -74,7 +84,7 @@ unevaluatedProperties: false
 examples:
   - |
     watchdog: watchdog@3150 {
-        compatible = "realtek,rtl8380-wdt";
+        compatible = "realtek,rtl8380-wdt", "realtek,otto-wdt";
         reg = <0x3150 0xc>;
 
         realtek,reset-mode = "soc";
Signature · 1 line
2.54.0
maintainer
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: watchdog: realtek,otto-wdt: Add fallback compatible

Quoted 28 lines · Sander Vanheule

As all known hardware instantiations of this watchdog behave the same, a fallback compatible can be added.

To remain compatible with existing single-compatible bindings, the current compatibles are duplicated. New compatibles should only be added to the list with fallback.

---
Changes since v1:
- Fix indendations
- Add deprecated property to old compatible
- Use two-part compatible in example

---
 .../bindings/watchdog/realtek,otto-wdt.yaml   | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +0 -3
index 1f5390a67cdb..e470e0fcbb2a 100644
@@ -25,11 +25,21 @@ allOf:
 
 properties:
   compatible:
-    enum:
-      - realtek,rtl8380-wdt
-      - realtek,rtl8390-wdt

Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml allOf: · line 35

Quoted 10 lines
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +8 -2
-      - realtek,rtl9300-wdt
-      - realtek,rtl9310-wdt
+    oneOf:
+      - items:
+          - enum:
+              - realtek,rtl8380-wdt
+              - realtek,rtl8390-wdt
+              - realtek,rtl9300-wdt
+              - realtek,rtl9310-wdt
+          - const: realtek,otto-wdt

For the Apple watchdog driver, the generic property "apple,wdt" is considered to be bad and is not supposed to be used for newer chips. For this watchdog driver, a generic property is introduced.

What is the overall logic ? Is there some rule when a generic property such as "realtek,otto-wdt" is appropriate and preferred, and when it isn't (as in "apple,wdt") ?

Thanks,
Guenter

maintainer
#3 lore raw

Re: [PATCH v2 1/2] dt-bindings: watchdog: realtek,otto-wdt: Add fallback compatible

Quoted 44 lines · Guenter Roeck
Quoted 28 lines · Sander Vanheule

As all known hardware instantiations of this watchdog behave the same, a fallback compatible can be added.

To remain compatible with existing single-compatible bindings, the current compatibles are duplicated. New compatibles should only be added to the list with fallback.

---
Changes since v1:
- Fix indendations
- Add deprecated property to old compatible
- Use two-part compatible in example

---
 .../bindings/watchdog/realtek,otto-wdt.yaml   | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +0 -3
index 1f5390a67cdb..e470e0fcbb2a 100644
@@ -25,11 +25,21 @@ allOf:
 
 properties:
   compatible:
-    enum:
-      - realtek,rtl8380-wdt
-      - realtek,rtl8390-wdt

Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml allOf: · line 35

Quoted 10 lines
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +8 -2
-      - realtek,rtl9300-wdt
-      - realtek,rtl9310-wdt
+    oneOf:
+      - items:
+          - enum:
+              - realtek,rtl8380-wdt
+              - realtek,rtl8390-wdt
+              - realtek,rtl9300-wdt
+              - realtek,rtl9310-wdt
+          - const: realtek,otto-wdt

For the Apple watchdog driver, the generic property "apple,wdt" is considered to be bad and is not supposed to be used for newer chips. For this watchdog driver, a generic property is introduced.

Quoted 3 lines

What is the overall logic ? Is there some rule when a generic property such as "realtek,otto-wdt" is appropriate and preferred, and when it isn't (as in "apple,wdt") ?

Never preferred. Retroactively adding them, that's a definite no.

Rob

#4 lore raw

Re: [PATCH v2 1/2] dt-bindings: watchdog: realtek,otto-wdt: Add fallback compatible

In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml allOf: · line 35

Quoted 8 lines
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +8 -0
+    oneOf:
+      - items:
+          - enum:
+              - realtek,rtl8380-wdt
+              - realtek,rtl8390-wdt
+              - realtek,rtl9300-wdt
+              - realtek,rtl9310-wdt
+          - const: realtek,otto-wdt
Quoted 7 lines

For the Apple watchdog driver, the generic property "apple,wdt" is considered to be bad and is not supposed to be used for newer chips. For this watchdog driver, a generic property is introduced.

What is the overall logic ? Is there some rule when a generic property such as "realtek,otto-wdt" is appropriate and preferred, and when it isn't (as in "apple,wdt") ?

Except what Rob said, it is also documented:

https://elixir.bootlin.com/linux/v7.1-rc3/source/Documentation/devicetree/bindings/writing-bindings.rst#L60

Best regards,
Krzysztof

author maintainer
#5 lore raw

PATCH v2 2/2 watchdog: realtek-otto: add fallback compatible

In reply to Sander Vanheule

As the binding now supports a fallback compatible for (new) devicetrees, let's add it to the list of supported compatibles. If new compatibles are added to the binding, driver updates may no longer be required.

---
 drivers/watchdog/realtek_otto_wdt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/watchdog/realtek_otto_wdt.c +2 -0
index 2c30ddd574c5..b4eb2f87f991 100644
@@ -350,6 +350,8 @@ static int otto_wdt_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id otto_wdt_ids[] = {
+	{ .compatible = "realtek,otto-wdt" },
+	/* Legacy bindings without fallback compatible */
 	{ .compatible = "realtek,rtl8380-wdt" },
 	{ .compatible = "realtek,rtl8390-wdt" },
 	{ .compatible = "realtek,rtl9300-wdt" },
Signature · 1 line
2.54.0
maintainer
#6 lore raw
In reply to Sander Vanheule
Quoted 11 lines · Sander Vanheule

Like for the GPIO hardware of the Realtek Otto platform, add a fallback compatible for the watchdog hardware.

For backward compatibility, the binding will still allow current single-compatible devicetrees to work, but new devicetrees, including new compatibles, should use a two-component compatible.

This series serves to address comments regarding the device compatibles for the patches adding RTL9607C watchdog support [1].

[1] https://lore.kernel.org/lkml/[email protected]/

You misunderstood the discussion (though some came after this). The fallback should be one of the existing compatibles (the oldest one), so there are no driver changes needed for the OS. Creating a new fallback completely misses that point.

Rob

author maintainer
#7 lore raw
Quoted 11 lines · Rob Herring
Quoted 10 lines · Sander Vanheule

Like for the GPIO hardware of the Realtek Otto platform, add a fallback compatible for the watchdog hardware.

For backward compatibility, the binding will still allow current single-compatible devicetrees to work, but new devicetrees, including new compatibles, should use a two-component compatible.

This series serves to address comments regarding the device compatibles for the patches adding RTL9607C watchdog support [1].

Quoted 6 lines
Quoted 1 line

[1] https://lore.kernel.org/lkml/[email protected]/

You misunderstood the discussion (though some came after this). The fallback should be one of the existing compatibles (the oldest one), so there are no driver changes needed for the OS. Creating a new fallback completely misses that point.

Using a SoC-specific compatible would mean we should go for something like:

	compatible = "realtek,rtl9706c-wdt", "realtek,rtl8380-wdt";

Then that means we can never change our interpretation of how the rtl8380 behaves (we don't have datasheets), because it would also impact the behavior of the rtl9706c.

I also think "apple,wdt" is a bad example to compare with "realtek,otto-wdt". The former only specifies the vendor, while the latter refers to the line of SoCs this IP block is used for. Although I see the docs also discourage family compatibles.

If I may ask, what is the rationale for preferring the "older implementation" approach over a "family compatible" to match the common subset of supported features?

Best,
Sander

maintainer
#8 lore raw
Quoted 20 lines · Sander Vanheule
Quoted 11 lines · Rob Herring
Quoted 10 lines · Sander Vanheule

Like for the GPIO hardware of the Realtek Otto platform, add a fallback compatible for the watchdog hardware.

For backward compatibility, the binding will still allow current single-compatible devicetrees to work, but new devicetrees, including new compatibles, should use a two-component compatible.

This series serves to address comments regarding the device compatibles for the patches adding RTL9607C watchdog support [1].

Quoted 6 lines
Quoted 1 line

[1] https://lore.kernel.org/lkml/[email protected]/

You misunderstood the discussion (though some came after this). The fallback should be one of the existing compatibles (the oldest one), so there are no driver changes needed for the OS. Creating a new fallback completely misses that point.

Quoted 6 lines

Using a SoC-specific compatible would mean we should go for something like:

        compatible = "realtek,rtl9706c-wdt", "realtek,rtl8380-wdt";

Then that means we can never change our interpretation of how the rtl8380 behaves (we don't have datasheets), because it would also impact the behavior of the rtl9706c.

No, at that point you would add the rtl9706c compatible to the driver to distinguish.

You have the same constraint with your generic compatible.

Quoted 4 lines

I also think "apple,wdt" is a bad example to compare with "realtek,otto-wdt". The former only specifies the vendor, while the latter refers to the line of SoCs this IP block is used for. Although I see the docs also discourage family compatibles.

Is M1, M2, M3 not a family? Maybe A series is included too, but if there's anyone that maintains some consistency across SoCs, it is Apple.

The docs are based on experience and regret...

Quoted 4 lines

If I may ask, what is the rationale for preferring the "older implementation" approach over a "family compatible" to match the common subset of supported features?

If you create bindings as the SoCs are created, then you don't really know what's in a family, only does it work with the existing driver . You only know what's in a family after the fact. Things are never that clean either.

I just picked the oldest as that's probably the most well known, least likely to need some future change, and would have the oldest OS version support.

Rob

author maintainer
#9 lore raw

Hi Rob,

Quoted 54 lines · Rob Herring
Quoted 21 lines · Sander Vanheule
Quoted 11 lines · Rob Herring
Quoted 10 lines · Sander Vanheule

Like for the GPIO hardware of the Realtek Otto platform, add a fallback compatible for the watchdog hardware.

For backward compatibility, the binding will still allow current single-compatible devicetrees to work, but new devicetrees, including new compatibles, should use a two-component compatible.

This series serves to address comments regarding the device compatibles for the patches adding RTL9607C watchdog support [1].

Quoted 7 lines
Quoted 2 lines

[1]
https://lore.kernel.org/lkml/[email protected]/

You misunderstood the discussion (though some came after this). The fallback should be one of the existing compatibles (the oldest one), so there are no driver changes needed for the OS. Creating a new fallback completely misses that point.

Quoted 7 lines

Using a SoC-specific compatible would mean we should go for something like:
        compatible = "realtek,rtl9706c-wdt", "realtek,rtl8380-wdt";

Then that means we can never change our interpretation of how the rtl8380 behaves (we don't have datasheets), because it would also impact the behavior of
the rtl9706c.

No, at that point you would add the rtl9706c compatible to the driver to distinguish.

You have the same constraint with your generic compatible.

Quoted 6 lines

I also think "apple,wdt" is a bad example to compare with "realtek,otto- wdt".
The former only specifies the vendor, while the latter refers to the line of SoCs this IP block is used for. Although I see the docs also discourage family
compatibles.

Is M1, M2, M3 not a family? Maybe A series is included too, but if there's anyone that maintains some consistency across SoCs, it is Apple.

The docs are based on experience and regret...

Quoted 5 lines

If I may ask, what is the rationale for preferring the "older implementation"
approach over a "family compatible" to match the common subset of supported features?

Quoted 8 lines

If you create bindings as the SoCs are created, then you don't really know what's in a family, only does it work with the existing driver . You only know what's in a family after the fact. Things are never that clean either.

I just picked the oldest as that's probably the most well known, least likely to need some future change, and would have the oldest OS version support.

Thanks for the extra context.

Rustam, will you take it from here to add the two-part compatible for the RTL9706C? Since you won't need update the driver, I guess a single patch would do.

Best,
Sander

#10 lore raw

Hello Sander,

Quoted 66 lines · Sander Vanheule

Hi Rob,

Quoted 54 lines · Rob Herring
Quoted 21 lines · Sander Vanheule
Quoted 11 lines · Rob Herring
Quoted 10 lines · Sander Vanheule

Like for the GPIO hardware of the Realtek Otto platform, add a fallback compatible for the watchdog hardware.

For backward compatibility, the binding will still allow current single-compatible devicetrees to work, but new devicetrees, including new compatibles, should use a two-component compatible.

This series serves to address comments regarding the device compatibles for the patches adding RTL9607C watchdog support [1].

Quoted 7 lines
Quoted 2 lines

[1]
https://lore.kernel.org/lkml/[email protected]/

You misunderstood the discussion (though some came after this). The fallback should be one of the existing compatibles (the oldest one), so there are no driver changes needed for the OS. Creating a new fallback completely misses that point.

Quoted 7 lines

Using a SoC-specific compatible would mean we should go for something like:
        compatible = "realtek,rtl9706c-wdt", "realtek,rtl8380-wdt";

Then that means we can never change our interpretation of how the rtl8380 behaves (we don't have datasheets), because it would also impact the behavior of
the rtl9706c.

No, at that point you would add the rtl9706c compatible to the driver to distinguish.

You have the same constraint with your generic compatible.

Quoted 6 lines

I also think "apple,wdt" is a bad example to compare with "realtek,otto- wdt".
The former only specifies the vendor, while the latter refers to the line of SoCs this IP block is used for. Although I see the docs also discourage family
compatibles.

Is M1, M2, M3 not a family? Maybe A series is included too, but if there's anyone that maintains some consistency across SoCs, it is Apple.

The docs are based on experience and regret...

Quoted 5 lines

If I may ask, what is the rationale for preferring the "older implementation"
approach over a "family compatible" to match the common subset of supported features?

Quoted 8 lines

If you create bindings as the SoCs are created, then you don't really know what's in a family, only does it work with the existing driver . You only know what's in a family after the fact. Things are never that clean either.

I just picked the oldest as that's probably the most well known, least likely to need some future change, and would have the oldest OS version support.

Quoted 5 lines

Thanks for the extra context.

Rustam, will you take it from here to add the two-part compatible for the RTL9706C? Since you won't need update the driver, I guess a single patch would do.

I can for sure, but would you mind clarifying what needs to be done? From my understanding two-part compatible for RTL9607C would look like compatible = "realtek,rtl9607-wdt", "realtek,rtl8380-wdt"; But it's only gonna be relevant to OpenWrt for now.

Do i need to patch the realtek,otto-wdt.yaml file in the same way as your patch 1 here?

Thanks in advance.

author maintainer
#11 lore raw
Quoted 10 lines · Rustam Adilov

Hello Sander,

Quoted 4 lines · Sander Vanheule

Rustam, will you take it from here to add the two-part compatible for the RTL9706C? Since you won't need update the driver, I guess a single patch would
do.

I can for sure, but would you mind clarifying what needs to be done? From my understanding two-part compatible for RTL9607C would look like compatible = "realtek,rtl9607-wdt", "realtek,rtl8380-wdt";

As I understand from the maintainers, this is indeed the desired approach.

Quoted 3 lines

But it's only gonna be relevant to OpenWrt for now.
Do i need to patch the realtek,otto-wdt.yaml file in the same way as your patch 1 here?

Yes, you'll need to make a distinction between the new two-part compatible, while still allowing the old one-part compatible (which then should not be deprecated). Another binding that implements this is fsl-imx7ulp-wdt.yaml, so you can also use that style, if you prefer.

Best,
Sander

#12 lore raw
In reply to Sander Vanheule
Quoted 8 lines · Sander Vanheule

I also think "apple,wdt" is a bad example to compare with "realtek,otto-wdt". The former only specifies the vendor, while the latter refers to the line of SoCs this IP block is used for. Although I see the docs also discourage family compatibles.

If I may ask, what is the rationale for preferring the "older implementation" approach over a "family compatible" to match the common subset of supported features?

To add on top of Rob's:
There were already a few cases of generic fallbacks of a few IP blocks in Qualcomm SoC, which were true for like a few years (50-100 different SoCs!). So you really thought a generic compatible is generic, matching entire family or all SoCS.

And then last year they came with a few new ones which are NOT COMPATIBLE with that generic one.

So let's create another generic fallback? But how do you define it? What is the generic part there? Even within family you have differences and in many cases SW people just don't know.

IMO, the generic fallback is fake construct or rather "faith" construct:
I hope these devices will be compatible enough to use that generic fallback. Hope is not enough and if that's the only thing you got, then just use specific fallback.

And that's exactly the feedback Qualcomm got for these new "generic" variants.

Best regards,
Krzysztof