Skip to contentSkip to conversation

dt-bindings: timer: Update TI timer to yaml

PATCH Superseded Tony Lindgren 3 participants 9 messages Apr 11, 2022 – Apr 12, 2022

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: timer: Update TI timer to yaml

Let's update the TI timer binding to use yaml. As this binding is specific to the TI dual-mode timers also known as dm-timers, let's use file name ti,timer-dm.yaml to avoid confusion with other timers.

We also correct the issue with the old binding that was out of date for several properties.

The am43 related timers are undocumented, but compatible with the am3 timers. Let's add the am43 timers too.

The dm814 and dm816 timers are missing, let's add them.

Some timers on some SoCs are dual mapped, like the ABE timers on omap4 and 5. The reg property maxItems must be updated to 2.

The timer clocks can be managed by the parent interconnect target module with no clocks assigned for the timer node. And in some cases the SoC may need to configure additional clocks for the timer in addition to the functional clock.

The clock names are optional and not specific to the comptible property. For example, dra7 timers on l3 interconnect do not need clock-names,while the timers on dra7 l4 interconnect need them with both being compatible with ti,omap5430-timer.

Cc Daniel Lezcano <[email protected]>
Cc Keerthy <[email protected]>
Cc Nishanth Menon <[email protected]>
Cc Vignesh Raghavendra <[email protected]>
---
 .../bindings/pwm/pwm-omap-dmtimer.txt         |   2 +-
 .../bindings/timer/ti,timer-dm.yaml           | 128 ++++++++++++++++++
 .../devicetree/bindings/timer/ti,timer.txt    |  44 ------
 3 files changed, 129 insertions(+), 45 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/timer/ti,timer-dm.yaml
 delete mode 100644 Documentation/devicetree/bindings/timer/ti,timer.txt
Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt +1 -1
@@ -2,7 +2,7 @@
 
 Required properties:
 - compatible: Shall contain "ti,omap-dmtimer-pwm".
-- ti,timers: phandle to PWM capable OMAP timer. See timer/ti,timer.txt for info
+- ti,timers: phandle to PWM capable OMAP timer. See timer/ti,timer-dm.yaml for info
   about these timers.
 - #pwm-cells: Should be 3. See pwm.yaml in this directory for a description of
   the cells format.
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +128 -0

128 lines not on this page · raw message

Documentation/devicetree/bindings/timer/ti,timer.txt deleted +0 -44

44 lines not on this page · raw message

Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 dt-bindings: timer: Add compatible for am6 for TI timer-dm

Let's add compatible for ti,am654-timer for TI am64, am65 and j72 SoCs. As the timer hardware is the same between am64, am65 and j72 we use the compatible name for the earliest SoC with this timer.

The timer interrupts are not routable for the operating system for some timers on am6. Let's make sure the interrupts are configured for the timers on all other SoCs.

Cc Daniel Lezcano <[email protected]>
Cc Keerthy <[email protected]>
Cc Nishanth Menon <[email protected]>
Cc Vignesh Raghavendra <[email protected]>
---
 .../devicetree/bindings/timer/ti,timer-dm.yaml       | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml +11 -1
@@ -19,6 +19,7 @@ properties:
           - enum:
               - ti,am335x-timer
               - ti,am335x-timer-1ms
+              - ti,am654-timer
               - ti,dm814-timer
               - ti,dm816-timer
               - ti,omap2420-timer
@@ -92,11 +93,20 @@ properties:
 required:
   - compatible
   - reg
-  - interrupts
 
 additionalProperties: false
 
 allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              const: ti,am654-timer
+    then:
+      required:
+        - interrupts
+
   - if:
       properties:
         compatible:
Signature · 1 line
2.35.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] dt-bindings: timer: Add compatible for am6 for TI timer-dm

Quoted 8 lines · Tony Lindgren

Let's add compatible for ti,am654-timer for TI am64, am65 and j72 SoCs. As the timer hardware is the same between am64, am65 and j72 we use the compatible name for the earliest SoC with this timer.

The timer interrupts are not routable for the operating system for some timers on am6. Let's make sure the interrupts are configured for the timers on all other SoCs.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
In reply to Tony Lindgren
Quoted 83 lines · Tony Lindgren

Let's update the TI timer binding to use yaml. As this binding is specific to the TI dual-mode timers also known as dm-timers, let's use file name ti,timer-dm.yaml to avoid confusion with other timers.

We also correct the issue with the old binding that was out of date for several properties.

The am43 related timers are undocumented, but compatible with the am3 timers. Let's add the am43 timers too.

The dm814 and dm816 timers are missing, let's add them.

Some timers on some SoCs are dual mapped, like the ABE timers on omap4 and 5. The reg property maxItems must be updated to 2.

The timer clocks can be managed by the parent interconnect target module with no clocks assigned for the timer node. And in some cases the SoC may need to configure additional clocks for the timer in addition to the functional clock.

The clock names are optional and not specific to the comptible property. For example, dra7 timers on l3 interconnect do not need clock-names,while the timers on dra7 l4 interconnect need them with both being compatible with ti,omap5430-timer.

Cc Daniel Lezcano <[email protected]>
Cc Keerthy <[email protected]>
Cc Nishanth Menon <[email protected]>
Cc Vignesh Raghavendra <[email protected]>
---
  .../bindings/pwm/pwm-omap-dmtimer.txt         |   2 +-
  .../bindings/timer/ti,timer-dm.yaml           | 128 ++++++++++++++++++
  .../devicetree/bindings/timer/ti,timer.txt    |  44 ------
  3 files changed, 129 insertions(+), 45 deletions(-)

create mode 100644 Documentation/devicetree/bindings/timer/ti,timer-dm.yaml delete mode 100644 Documentation/devicetree/bindings/timer/ti,timer.txt

Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt +1 -1
@@ -2,7 +2,7 @@
 
  Required properties:
  - compatible: Shall contain "ti,omap-dmtimer-pwm".
-- ti,timers: phandle to PWM capable OMAP timer. See timer/ti,timer.txt for info
+- ti,timers: phandle to PWM capable OMAP timer. See timer/ti,timer-dm.yaml for info
    about these timers.
  - #pwm-cells: Should be 3. See pwm.yaml in this directory for a description of
    the cells format.
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +28 -0
new file mode 100644
@@ -0,0 +1,128 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/ti,timer-dm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI dual-mode timer
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+description: |
+  The TI dual-mode timer is a general purpose timer with PWM capabilities.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - ti,am335x-timer
+              - ti,am335x-timer-1ms
+              - ti,dm814-timer
+              - ti,dm816-timer
+              - ti,omap2420-timer
+              - ti,omap3430-timer
+              - ti,omap4430-timer
+              - ti,omap5430-timer
+      - items:

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 38

Quoted 10 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +10 -0
+          - const: ti,am4372-timer
+          - const: ti,am335x-timer
+      - items:
+          - const: ti,am4372-timer-1ms
+          - const: ti,am335x-timer-1ms
+
+  reg:
+    minItems: 1
+    maxItems: 2
+    description: Timer IO register range

if i'm not mistaken - you need to provide description for every item unless it's obviously determined by "-names" properties

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 44

Quoted 6 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +6 -0
+
+  clocks:
+    description:
+      The functional clock for the timer. Some SoCs like omap24xx also have a
+      separate interface clock, and some clocks may be only defined for the
+      interconnect target module parent.

ditto

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 50

Quoted 6 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +6 -0
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    description:
+      Timer clock names like "fck", "timer_sys_ck".

and description here make no sense

Quoted 127 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +78 -0
+    oneOf:
+      - enum: [ ick, fck ]
+      - items:
+          - const: fck
+          - enum: [ ick, timer_sys_ck ]
+
+  interrupts:
+    description:
+      Interrupt if available. The timer PWM features may be usable
+      in a limited way even without interrupts.
+    maxItems: 1
+
+  ti,timer-alwon:
+    description:
+      Timer is always enabled when the SoC is powered. Note that some SoCs like
+      am335x can suspend to PM coprocessor RTC only mode and in that case the
+      SoC power is cut including timers.
+    type: boolean
+
+  ti,timer-dsp:
+    description:
+      Timer is routable to the DSP in addition to the operating system.
+    type: boolean
+
+  ti,timer-pwm:
+    description:
+      Timer has been wired for PWM capability.
+    type: boolean
+
+  ti,timer-secure:
+    description:
+      Timer access has been limited to secure mode only.
+    type: boolean
+
+  ti,hwmods:
+    description:
+      Name of the HWMOD associated with timer. This is for legacy
+      omap2/3 platforms only.
+    $ref: /schemas/types.yaml#/definitions/string
+    deprecated: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,dm814-timer
+              - ti,dm816-timer
+              - ti,omap2420-timer
+              - ti,omap3430-timer
+    then:
+      properties:
+        ti,hwmods:
+          items:
+            - pattern: "^timer([1-9]|1[0-2])$"
+    else:
+      properties:
+        ti,hwmods: false
+
+examples:
+  - |
+    timer1: timer@0 {
+      compatible = "ti,am335x-timer-1ms";
+      reg = <0x0 0x400>;
+      interrupts = <67>;
+      ti,timer-alwon;
+      clocks = <&timer1_fck>;
+      clock-names = "fck";
+    };
+...
Documentation/devicetree/bindings/timer/ti,timer.txt deleted +0 -44
deleted file mode 100644
@@ -1,44 +0,0 @@
-OMAP Timer bindings
-
-Required properties:
-- compatible:		Should be set to one of the below. Please note that
-			OMAP44xx devices have timer instances that are 100%
-			register compatible with OMAP3xxx devices as well as
-			newer timers that are not 100% register compatible.
-			So for OMAP44xx devices timer instances may use
-			different compatible strings.
-
-			ti,omap2420-timer (applicable to OMAP24xx devices)
-			ti,omap3430-timer (applicable to OMAP3xxx/44xx devices)
-			ti,omap4430-timer (applicable to OMAP44xx devices)
-			ti,omap5430-timer (applicable to OMAP543x devices)
-			ti,am335x-timer	(applicable to AM335x devices)
-			ti,am335x-timer-1ms (applicable to AM335x devices)
-
-- reg:			Contains timer register address range (base address and
-			length).
-- interrupts: 		Contains the interrupt information for the timer. The
-			format is being dependent on which interrupt controller
-			the OMAP device uses.
-- ti,hwmods:		Name of the hwmod associated to the timer, "timer<X>",
-			where <X> is the instance number of the timer from the
-			HW spec.
-
-Optional properties:
-- ti,timer-alwon:	Indicates the timer is in an alway-on power domain.
-- ti,timer-dsp:		Indicates the timer can interrupt the on-chip DSP in
-			addition to the ARM CPU.
-- ti,timer-pwm: 	Indicates the timer can generate a PWM output.
-- ti,timer-secure: 	Indicates the timer is reserved on a secure OMAP device
-			and therefore cannot be used by the kernel.
-
-Example:
-
-timer12: timer@48304000 {
-	compatible = "ti,omap3430-timer";
-	reg = <0x48304000 0x400>;
-	interrupts = <95>;
-	ti,hwmods = "timer12"
-	ti,timer-alwon;
-	ti,timer-secure;
-};
Signature · 7 lines
Best regards,
Grygorii, Ukraine

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw
Quoted 7 lines · Grygorii Strashko

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 38

Quoted 4 lines · Tony Lindgren
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +4 -0
+  reg:
+    minItems: 1
+    maxItems: 2
+    description: Timer IO register range

if i'm not mistaken - you need to provide description for every item unless it's obviously determined by "-names" properties

OK thanks will update for reg and clocks.

Quoted 5 lines

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 50

Quoted 3 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +3 -0
+  clock-names:
+    description:
+      Timer clock names like "fck", "timer_sys_ck".

and description here make no sense

So you just want to leave out the description from the clock-names if I read your comment above right?

Regards,

Tony

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw
Quoted 11 lines · Tony Lindgren
Quoted 7 lines · Grygorii Strashko

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 38

Quoted 4 lines · Tony Lindgren
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +4 -0
+  reg:
+    minItems: 1
+    maxItems: 2
+    description: Timer IO register range

if i'm not mistaken - you need to provide description for every item unless it's obviously determined by "-names" properties

OK thanks will update for reg and clocks.

Quoted 8 lines
Quoted 5 lines

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 50

Quoted 3 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +3 -0
+  clock-names:
+    description:
+      Timer clock names like "fck", "timer_sys_ck".

and description here make no sense

So you just want to leave out the description from the clock-names if I read your comment above right?

yes.

Quoted 4 lines

Regards,

Tony

Signature · 7 lines
Best regards,
Grygorii, Ukraine

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw
In reply to Tony Lindgren
Quoted 14 lines · Tony Lindgren

Let's update the TI timer binding to use yaml. As this binding is specific to the TI dual-mode timers also known as dm-timers, let's use file name ti,timer-dm.yaml to avoid confusion with other timers.

We also correct the issue with the old binding that was out of date for several properties.

The am43 related timers are undocumented, but compatible with the am3 timers. Let's add the am43 timers too.

The dm814 and dm816 timers are missing, let's add them.

Some timers on some SoCs are dual mapped, like the ABE timers on omap4 and 5. The reg property maxItems must be updated to 2.

(...)

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 39

Quoted 5 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +5 -0
+  reg:
+    minItems: 1
+    maxItems: 2
+    description: Timer IO register range
+

Apart from what Grygorii said, it would be useful if you add "if:then:" case constraining it per implementation (as I understood from commit msg only some use double mapping).

This looks like:
https://elixir.bootlin.com/linux/v5.18-rc2/source/Documentation/devicetree/bindings/clock/samsung,exynos7885-clock.yaml#L53

Similarly should be done for clocks, unless it's impossible (same compatible uses different setups of clocks).

BTW, it's a bit confusing it is not a v2...

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

Hi,

Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Tony Lindgren

Some timers on some SoCs are dual mapped, like the ABE timers on omap4 and 5. The reg property maxItems must be updated to 2.

So on omap4/5 there are timers with a single IO register and with dual mapped IO registers.

Quoted 8 lines

(...)

Documentation/devicetree/bindings/timer/ti,timer-dm.yaml line 39

Quoted 5 lines
Documentation/devicetree/bindings/timer/ti,timer-dm.yaml new file +5 -0
+  reg:
+    minItems: 1
+    maxItems: 2
+    description: Timer IO register range
+
Quoted 6 lines

Apart from what Grygorii said, it would be useful if you add "if:then:" case constraining it per implementation (as I understood from commit msg only some use double mapping).

This looks like:
https://elixir.bootlin.com/linux/v5.18-rc2/source/Documentation/devicetree/bindings/clock/samsung,exynos7885-clock.yaml#L53

Yes I tried, but see the above. The compatible property is the same for single mapped and dual mapped timers on the same SoC for omap4/5.

Quoted 2 lines

Similarly should be done for clocks, unless it's impossible (same compatible uses different setups of clocks).

It's the same situation for clocks, the same compatible is used for timers with one clock and timers with two clocks for example on dra7.

I'll check the description again to clarify this, maybe it's not clear yet.

Quoted 1 line

BTW, it's a bit confusing it is not a v2...

Oops sorry looks like I forgot to update the version.

Regards,

Tony

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#8 lore raw
Quoted 9 lines · Tony Lindgren
Quoted 6 lines

Apart from what Grygorii said, it would be useful if you add "if:then:" case constraining it per implementation (as I understood from commit msg only some use double mapping).

This looks like:
https://elixir.bootlin.com/linux/v5.18-rc2/source/Documentation/devicetree/bindings/clock/samsung,exynos7885-clock.yaml#L53

Yes I tried, but see the above. The compatible property is the same for single mapped and dual mapped timers on the same SoC for omap4/5.

But all on others this is single mapped? Then at least reduce them to one item inside allOf:if:then. The omap4/5 will accept both - one and two items.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel