Skip to contentSkip to conversation

ARM: tegra: add nvidia,wdt-timer-id optional property

PATCH In review Andrew Chew 3 participants 7 messages Jan 31, 2014 – Feb 3, 2014

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

PATCH 1/1 ARM: tegra: add nvidia,wdt-timer-id optional property

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

---
 Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt +8 -0
index b5082a1..e87fa70 100644
@@ -13,6 +13,13 @@ Required properties:
 - clocks : Must contain one entry, for the module clock.
   See ../clocks/clock-bindings.txt for details.
 
+Optional properties:
+
+- nvidia,wdt-timer-id: A list of timer IDs to be used for watchdogs.
+    Watchdog 0 will be assigned to the first timer listed, watchdog 1 will
+    be assigned to the second timer listed, etc. up to the number of watchdogs
+    available.
+
 timer {
 	compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer";
 	reg = <0x60005000 0x400>;
@@ -23,4 +30,5 @@ timer {
 		      0 121 0x04
 		      0 122 0x04>;
 	clocks = <&tegra_car 214>;
+	nvidia,wdt-timer-id = <7 8>;
 };
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 2 lines · Andrew Chew

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

Is there any reason that a particular timer should be used?

This shouldn't even mention the driver, as the binding should describe the HW, not how it's used by Linux at the moment.

Quoted 11 lines
---
 Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt +0 -0
index b5082a1..e87fa70 100644

Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt Required properties: · line 21

Quoted 9 lines
Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt +6 -0
@@ -13,6 +13,13 @@ Required properties:
 - clocks : Must contain one entry, for the module clock.
   See ../clocks/clock-bindings.txt for details.
 
+Optional properties:
+
+- nvidia,wdt-timer-id: A list of timer IDs to be used for watchdogs.
+    Watchdog 0 will be assigned to the first timer listed, watchdog 1 will
+    be assigned to the second timer listed, etc. up to the number of watchdogs
+    available.

This sounds like a description of what software should do. Is there any reason this order is important?

Also, it feels odd for the proerty name to be singular given it's a list...

Thanks,
Mark.

#2 lore raw
Quoted 5 lines · Andrew Chew
Quoted 2 lines

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

Is there any reason that a particular timer should be used?

I worry about colliding with other timer allocations, and wanted to be flexible in this regard.

Quoted 26 lines

This shouldn't even mention the driver, as the binding should describe the HW, not how it's used by Linux at the moment.

Quoted 14 lines
---
 Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt | 8
++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt b/Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt index b5082a1..e87fa70 100644

Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt Required properties: · line 20

Quoted 8 lines
Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt +5 -0
@@ -13,6 +13,13 @@ Required properties:
 - clocks : Must contain one entry, for the module clock.
   See ../clocks/clock-bindings.txt for details.
 
+Optional properties:
+
+- nvidia,wdt-timer-id: A list of timer IDs to be used for watchdogs.
+    Watchdog 0 will be assigned to the first timer listed, watchdog 1 will
+    be assigned to the second timer listed, etc. up to the number of

watchdogs

Quoted 4 lines

Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt Required properties: · line 21

Quoted 1 line
Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt +1 -0
+    available.

This sounds like a description of what software should do. Is there any reason this order is important?

The order in regards to which watchdog (watchdog 0, watchdog 1, etc) is paired with which timer is unimportant for purposes of the watchdog driver that I will follow up with. I can leave those details out of the bindings description if that resolves your concern.

Quoted 1 line

Also, it feels odd for the proerty name to be singular given it's a list...

You're right. Given what it is, it really should be nvidia,wdt-timer-ids.

#3 lore raw
Quoted 8 lines · Andrew Chew
Quoted 5 lines · Andrew Chew
Quoted 2 lines

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

Is there any reason that a particular timer should be used?

I worry about colliding with other timer allocations, and wanted to be flexible in this regard.

Are the other timer allocations represented in DT, or simply made by or hard-coded in the driver? If the former, this property seems like a good equivalent of any existing allocations. If the latter, can't the driver just allocate or hard-code the allocation in the same way as any existing allocations?

#4 lore raw
Quoted 10 lines · Andrew Chew
Quoted 8 lines
Quoted 5 lines · Andrew Chew
Quoted 2 lines

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

Is there any reason that a particular timer should be used?

I worry about colliding with other timer allocations, and wanted to be flexible in this regard.

Quoted 6 lines

Are the other timer allocations represented in DT, or simply made by or hard- coded in the driver? If the former, this property seems like a good equivalent of any existing allocations. If the latter, can't the driver just allocate or hard- code the allocation in the same way as any existing allocations?

From what I've seen, timer allocations are just hard-coded into whatever driver.

I didn't think this was a particularly good idea, since when writing other drivers that for some reason need a timer, the author has to be aware of allocations made in other, barely related drivers. In addition, what seems like an arbitrary allocation in one scenario, I anticipate may not be completely arbitrary in a different scenario, so I thought it would be better to freeze the device driver code, and allow for flexibility at the device tree level.

But I'll do whatever others think is right. I can make my watchdog driver just take an arbitrary (to me right now) timer and instantiate one watchdog for it. If I'm to do that, then this device node property isn't necessary, and we can drop this patch. --
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 15 lines · Andrew Chew
Quoted 7 lines · Andrew Chew
Quoted 6 lines
Quoted 5 lines · Andrew Chew
Quoted 2 lines

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

Is there any reason that a particular timer should be used?

Quoted 7 lines
Quoted 2 lines

I worry about colliding with other timer allocations, and wanted to be flexible in this regard.

Are the other timer allocations represented in DT, or simply made by or hard- coded in the driver? If the former, this property seems like a good equivalent of any existing allocations. If the latter, can't the driver just allocate or hard- code the allocation in the same way as any existing allocations?

Quoted 4 lines

From what I've seen, timer allocations are just hard-coded into whatever driver. I didn't think this was a particularly good idea, since when writing other drivers that for some reason need a timer, the author has to be aware of allocations made in other, barely related drivers.

I'm not sure that they would; why wouldn't the timer driver register the various timers with standard Linux APIs which the clients talk to, thus avoiding the clients having any knowledge at all of which channels are used for what.

If you're talking about the watchdog driver, then can't we just create a shared header file that the clocksource and watchdog drivers both include, which defines the timer ID allocations?

#6 lore raw
Quoted 23 lines · Andrew Chew
Quoted 7 lines
Quoted 7 lines · Andrew Chew
Quoted 6 lines
Quoted 5 lines · Andrew Chew
Quoted 2 lines

This optional property can be used to specify which timers are to be used for hardware watchdog timeouts (via a tegra wdt driver).

Is there any reason that a particular timer should be used?

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

I worry about colliding with other timer allocations, and wanted to be flexible in this regard.

Are the other timer allocations represented in DT, or simply made by or hard- coded in the driver? If the former, this property seems like a good equivalent of any existing allocations. If the latter, can't the driver just allocate or hard- code the allocation in the same way as any

existing allocations?

Quoted 2 lines

From what I've seen, timer allocations are just hard-coded into whatever

driver.

Quoted 3 lines

I didn't think this was a particularly good idea, since when writing other drivers that for some reason need a timer, the author has to be aware of allocations made in other, barely related drivers.

Quoted 8 lines

I'm not sure that they would; why wouldn't the timer driver register the various timers with standard Linux APIs which the clients talk to, thus avoiding the clients having any knowledge at all of which channels are used for what.

If you're talking about the watchdog driver, then can't we just create a shared header file that the clocksource and watchdog drivers both include, which defines the timer ID allocations?

Sure, let's go with that. In that case, this patch isn't needed, and should be dropped.