diff mbox series

[v2,04/10] dt-bindings: timer: Add EcoNet EN751221 "HPT" CPU Timer

Message ID 20250325134349.2476458-5-cjd@cjdns.fr (mailing list archive)
State New
Headers show
Series Add EcoNet EN751221 MIPS platform support | expand

Commit Message

Caleb James DeLisle March 25, 2025, 1:43 p.m. UTC
Add device tree bindings for the so-called high-precision timer (HPT)
in the EcoNet EN751221 SoC.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
HPT is a name commonly used in vendor and 3rd party out-of-tree sources.
---
 .../bindings/timer/econet,en751221-timer.yaml | 78 +++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml

Comments

Krzysztof Kozlowski March 26, 2025, 8:04 a.m. UTC | #1
On Tue, Mar 25, 2025 at 01:43:43PM +0000, Caleb James DeLisle wrote:
> +title: EcoNet EN751221 High Precision Timer (HPT)
> +
> +maintainers:
> +  - Caleb James DeLisle <cjd@cjdns.fr>
> +
> +description:
> +  The EcoNet High Precision Timer (HPT) is a timer peripheral found in various
> +  EcoNet SoCs, including the EN751221 and EN751627 families. It provides per-VPE
> +  count/compare registers and a per-CPU control register, with a single interrupt
> +  line using a percpu-devid interrupt mechanism.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:

Drop items, that's const directly.

> +          - const: econet,en751221-timer
> +      - items:
> +          - const: econet,en751627-timer
> +          - const: econet,en751221-timer
> +
> +  reg: true

Widest constraints are always here.

> +
> +  interrupts:
> +    maxItems: 1
> +    description: A percpu-devid timer interrupt shared across CPUs.
> +
> +  clocks:
> +    maxItems: 1
> +
> +if:

This goes under allOf:, to save re-indent later, and then after
required: block (see example-schema).

> +  properties:
> +    compatible:
> +      contains:
> +        const: econet,en751627-timer
> +then:
> +  properties:
> +    reg:
> +      items:
> +        - description: Base address for VPE timers 0 and 1

s/Base address for//
because it is redundant. Bus/parent addressing already defines this as
base address, cannot be anything else.

> +        - description: Base address for VPE timers 2 and 3
> +else:
> +  properties:
> +    reg:
> +      items:
> +        - description: Base address for VPE timers 0 and 1

Best regards,
Krzysztof
Caleb James DeLisle March 26, 2025, 8:19 a.m. UTC | #2
On 26/03/2025 09:04, Krzysztof Kozlowski wrote:
> On Tue, Mar 25, 2025 at 01:43:43PM +0000, Caleb James DeLisle wrote:
>> +title: EcoNet EN751221 High Precision Timer (HPT)
>> +
>> +maintainers:
>> +  - Caleb James DeLisle <cjd@cjdns.fr>
>> +
>> +description:
>> +  The EcoNet High Precision Timer (HPT) is a timer peripheral found in various
>> +  EcoNet SoCs, including the EN751221 and EN751627 families. It provides per-VPE
>> +  count/compare registers and a per-CPU control register, with a single interrupt
>> +  line using a percpu-devid interrupt mechanism.
>> +
>> +properties:
>> +  compatible:
>> +    oneOf:
>> +      - items:
> Drop items, that's const directly.
Got it.
>
>> +          - const: econet,en751221-timer
>> +      - items:
>> +          - const: econet,en751627-timer
>> +          - const: econet,en751221-timer
>> +
>> +  reg: true
> Widest constraints are always here.

(AFACT) there's no common constraint to both.

en751221 => minItems: 1, maxItems: 1

en751627 => minItems: 2, maxItems: 2

I spent some time playing with this, thinking I could override constraints
but everything I tried lead me to validation errors. Please let me know if
there's something I'm missing here...

>
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +    description: A percpu-devid timer interrupt shared across CPUs.
>> +
>> +  clocks:
>> +    maxItems: 1
>> +
>> +if:
> This goes under allOf:, to save re-indent later, and then after
> required: block (see example-schema).
Got it.
>
>> +  properties:
>> +    compatible:
>> +      contains:
>> +        const: econet,en751627-timer
>> +then:
>> +  properties:
>> +    reg:
>> +      items:
>> +        - description: Base address for VPE timers 0 and 1
> s/Base address for//
> because it is redundant. Bus/parent addressing already defines this as
> base address, cannot be anything else.

Indeed, got it.


Thank you for the review.

Caleb


>
>> +        - description: Base address for VPE timers 2 and 3
>> +else:
>> +  properties:
>> +    reg:
>> +      items:
>> +        - description: Base address for VPE timers 0 and 1
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski March 26, 2025, 2:20 p.m. UTC | #3
On 26/03/2025 09:19, Caleb James DeLisle wrote:
>>
>>> +          - const: econet,en751221-timer
>>> +      - items:
>>> +          - const: econet,en751627-timer
>>> +          - const: econet,en751221-timer
>>> +
>>> +  reg: true
>> Widest constraints are always here.
> 
> (AFACT) there's no common constraint to both.

That's why I did not ask for common, but for the widest, just like the
example I gave explicitly for that case in my talk.

https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127

Best regards,
Krzysztof
Caleb James DeLisle March 26, 2025, 4:43 p.m. UTC | #4
On 26/03/2025 15:20, Krzysztof Kozlowski wrote:
> On 26/03/2025 09:19, Caleb James DeLisle wrote:
>>>> +          - const: econet,en751221-timer
>>>> +      - items:
>>>> +          - const: econet,en751627-timer
>>>> +          - const: econet,en751221-timer
>>>> +
>>>> +  reg: true
>>> Widest constraints are always here.
>> (AFACT) there's no common constraint to both.
> That's why I did not ask for common, but for the widest, just like the
> example I gave explicitly for that case in my talk.
>
> https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127

Got it, thank you for the clarification.

Caleb

>
> Best regards,
> Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml b/Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml
new file mode 100644
index 000000000000..a897af322135
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml
@@ -0,0 +1,78 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/econet,en751221-timer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: EcoNet EN751221 High Precision Timer (HPT)
+
+maintainers:
+  - Caleb James DeLisle <cjd@cjdns.fr>
+
+description:
+  The EcoNet High Precision Timer (HPT) is a timer peripheral found in various
+  EcoNet SoCs, including the EN751221 and EN751627 families. It provides per-VPE
+  count/compare registers and a per-CPU control register, with a single interrupt
+  line using a percpu-devid interrupt mechanism.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: econet,en751221-timer
+      - items:
+          - const: econet,en751627-timer
+          - const: econet,en751221-timer
+
+  reg: true
+
+  interrupts:
+    maxItems: 1
+    description: A percpu-devid timer interrupt shared across CPUs.
+
+  clocks:
+    maxItems: 1
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: econet,en751627-timer
+then:
+  properties:
+    reg:
+      items:
+        - description: Base address for VPE timers 0 and 1
+        - description: Base address for VPE timers 2 and 3
+else:
+  properties:
+    reg:
+      items:
+        - description: Base address for VPE timers 0 and 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    timer@1fbf0400 {
+        compatible = "econet,en751627-timer", "econet,en751221-timer";
+        reg = <0x1fbf0400 0x100>, <0x1fbe0000 0x100>;
+        interrupt-parent = <&intc>;
+        interrupts = <30>;
+        clocks = <&hpt_clock>;
+    };
+  - |
+    timer@1fbf0400 {
+        compatible = "econet,en751221-timer";
+        reg = <0x1fbe0400 0x100>;
+        interrupt-parent = <&intc>;
+        interrupts = <30>;
+        clocks = <&hpt_clock>;
+    };
+...