Skip to contentSkip to conversation

Add support for Qualcomm TSCSS hardware

PATCH In review Imran Shaik 4 participants 31 messages Nov 8 – Nov 13

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

v2 cover Add support for Qualcomm TSCSS hardware

This series introduces support for the Qualcomm Timestamp Counter Subsystem (TSCSS) hardware, a time synchronization subsystem present on Qualcomm Lemans, Monaco and QDU1000 SoCs.

TSCSS is composed of two main hardware blocks:
- Timestamp Counter (TSC): a free-running hardware counter that provides continuous timekeeping for the SoC, and is functional with a GCC TSC AHB config clock and a global counter clock. The TSC counter resolution and supported functionalities vary across SoC variants.

- Event Timestamp Unit (ETU): It captures TSC counter timestamps against external hardware events. Each ETU slice binds a slice identifier to an external event selector, and the ETU additionally requires its own clock, pinctrl along with either a per-slice interrupt (QDU1000) or a single summary interrupt across all ETU slices (Lemans and Monaco).

 +------------------------------------------------+  +------------------+
 | Global clock controller - TSC AHB/CNTR/ETU CLK |  |  EVENT_IN[0:15]  |
 +------------------------------------------------+  +------------------+
                          |                                  |
                          v                                  v
 +----------------------------------------------------------------------+
 |               Timestamp Counter Subsystem (TSCSS)                    |
 |                                                                      |
 |                   +----------------------------------------------+   |
 |  +------------+   |         Event Timestamp Unit (ETU)           |   |
 |  | Timestamp  |   |           0x01C90000-0x01C9FFFF              |   |
 |  |  Counter   |   | +------------------------------------------+ |   |
 |  |   (TSC)    |   | |               ETU Slices                 | |   |
 |  |            |   | | [Slice 0]  [Slice 1]   [...]  [Slice 15] | |   |
 |  | 0x1C80000  |   | | 0x1C90000  0x1C91000          0x1C9F000  | |   |
 |  +------------+   | |                                          | |   |
 |                   | +-----------+------------------------------+ |   |
 |                   +-------------|--------------------+-----------+   |
 |                                 |                    |               |
 +---------------------------------|--------------------|---------------+
                                   |                    |
                                   v                    v
                         +----------------------------------------+
                         |    per-slice IRQ  (OR)  summary IRQ    |
                         |      (QDU1000)            (Lemans)     |
                         +----------------------------------------+
                                             |
                                             v
                              +-----------------------------+
                              |   Interrupt Controller      |
                              +-----------------------------+

The address offsets shown in the diagram above are specific to Qualcomm Lemans SoC.

The Qualcomm Nord SoC additionally has a timer register region used to generate a periodic pulse in sync with the TSC counter.

This series currently covers only the TSC block driver functionality; ETU driver support will follow in a later series.

---
Changes in v2:
- Fixed SoC names, and updated bindings as per review comments on v1 [Krzysztof]
- Added ARCH_QCOM in Kconfig, fixed the probe() and remove() order, and used dev_err_probe [Krzysztof]
- Dropped the unnecessary "inline" keyword [Jakub]
- Added support for Nord and Shikra SoCs, which support continuous dynamic dynamic drift correction.
- Updated the clocks handling.
- Link to v1: https://lore.kernel.org/r/[email protected]

To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Richard Cochran <[email protected]>
To: Andrew Lunn <[email protected]>
To: "David S. Miller" <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
To: Abel Vesa <[email protected]>
Cc: Ajit Pandey <[email protected]>
Cc: Imran Shaik <[email protected]>
Cc: Taniya Das <[email protected]>
Cc: Jagadeesh Kona <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Imran Shaik (10):
dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs
dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC
dt-bindings: ptp: Document TSCSS hardware on Qualcomm Nord and Shikra SoCs
ptp: qcom: Add PTP driver for the Qualcomm TSC hardware
arm64: defconfig: Enable Qualcomm TSC driver
arm64: dts: qcom: lemans: Add support for TSCSS node
arm64: dts: qcom: monaco: Add support for TSCSS node
arm64: dts: qcom: qdu1000: Add support for TSCSS node
arm64: dts: qcom: shikra: Add support for TSCSS node
arm64: dts: qcom: nord: Add support for TSCSS node

 .../devicetree/bindings/ptp/qcom,nord-tscss.yaml   | 186 +++++++
 .../bindings/ptp/qcom,qdu1000-tscss.yaml           | 170 ++++++
 .../bindings/ptp/qcom,sa8775p-tscss.yaml           | 169 ++++++
 arch/arm64/boot/dts/qcom/lemans.dtsi               |  12 +
 arch/arm64/boot/dts/qcom/monaco.dtsi               |  12 +
 arch/arm64/boot/dts/qcom/nord-embedded.dtsi        |  14 +
 arch/arm64/boot/dts/qcom/qdu1000.dtsi              |  13 +
 arch/arm64/boot/dts/qcom/shikra.dtsi               |  12 +
 arch/arm64/configs/defconfig                       |   1 +
 drivers/ptp/Kconfig                                |  11 +
 drivers/ptp/Makefile                               |   1 +
 drivers/ptp/ptp_qcom_tsc.c                         | 598 +++++++++++++++++++++
 12 files changed, 1199 insertions(+)

---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20260705-tscss-441d844c1ee7
prerequisite-change-id: 20261107-gcc_i2c_tsc_support-64aa352d3b1d:v1
prerequisite-patch-id: 8c93973348ea4b80f1dfcd445a8a3afb8a530d21
prerequisite-patch-id: 5a3418fa67b14fd6b67e00f8c21ee699fedb320d

Best regards,

Signature · 1 line
Imran Shaik <[email protected]>
#1 lore raw

PATCH v2 1/10 dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

Add Devicetree bindings for the Timestamp Counter Subsystem (TSCSS) found on Qualcomm SA8775P and QCS8300 SoCs.

TSCSS is a time synchronization subsystem composed of two main blocks:
Timestamp Counter (TSC) and Event Timestamp Unit (ETU). The TSC block provides a continuously running counter used for timekeeping, while the ETU captures timestamps for external hardware event triggers.

---
 .../bindings/ptp/qcom,sa8775p-tscss.yaml           | 169 +++++++++++++++++++++
 1 file changed, 169 insertions(+)
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +169 -0
new file mode 100644
index 000000000000..b3e3a7cd7166
@@ -0,0 +1,169 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ptp/qcom,sa8775p-tscss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Timestamp Counter Subsystem (TSCSS) on Qualcomm SA8775P and QCS8300
+
+maintainers:
+  - Imran Shaik <[email protected]>
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm TSCSS is a time synchronization subsystem composed of two main
+  blocks - the Timestamp Counter (TSC) and the Event Timestamp Unit (ETU).
+
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and a
+  single summary interrupt is raised for any ETU slice event.
+
+properties:
+  compatible:
+    oneOf:
+      - const: qcom,sa8775p-tscss
+      - items:
+          - const: qcom,qcs8300-tscss
+          - const: qcom,sa8775p-tscss
+
+  reg:
+    minItems: 1
+    maxItems: 2
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu
+
+  clocks:
+    items:
+      - description: TSC AHB configuration clock.
+      - description: TSC global counter clock.
+      - description: TSC ETU clock.
+
+  clock-names:
+    items:
+      - const: ahb
+      - const: cntr
+      - const: etu
+
+  interrupts:
+    items:
+      - description:
+          Summary interrupt raised based on an external event for any
+          of the ETU slices.
+
+  interrupt-names:
+    items:
+      - const: etu_summary
+
+  pinctrl-names:
+    minItems: 1
+    maxItems: 16
+    items:
+      pattern: "^slice[0-9]+$"
+
+  qcom,etu-slice:
+    description:
+      ETU slice number for each entry in pinctrl-<n>, pinctrl-names and
+      qcom,etu-event-sel.
+    minItems: 1
+    maxItems: 16
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  qcom,etu-event-sel:
+    description:
+      External event selection value for each ETU slice listed in
+      qcom,etu-slice.
+    minItems: 1
+    maxItems: 16
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
+    then:
+      properties:
+        reg:
+          minItems: 2
+          maxItems: 2
+      required:
+        - interrupts
+        - interrupt-names
+        - pinctrl-names
+        - qcom,etu-slice
+        - qcom,etu-event-sel
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,sa8775p-gcc.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ptp@1c80000 {
+        compatible = "qcom,sa8775p-tscss";
+        reg = <0x0 0x01c80000 0x0 0x2000>;
+        reg-names = "tsc";
+
+        clocks = <&gcc GCC_TSCSS_AHB_CLK>,
+                 <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
+                 <&gcc GCC_TSCSS_ETU_CLK>;
+        clock-names = "ahb", "cntr", "etu";
+
+        assigned-clocks = <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>;
+        assigned-clock-rates = <15625000>;
+      };
+    };
+
+  - |
+    #include <dt-bindings/clock/qcom,sa8775p-gcc.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ptp@1c80000 {
+        compatible = "qcom,sa8775p-tscss";
+        reg = <0x0 0x01c80000 0x0 0x2000>,
+              <0x0 0x01c90000 0x0 0x10000>;
+        reg-names = "tsc", "etu";
+
+        clocks = <&gcc GCC_TSCSS_AHB_CLK>,
+                 <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
+                 <&gcc GCC_TSCSS_ETU_CLK>;
+        clock-names = "ahb", "cntr", "etu";
+
+        assigned-clocks = <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>;
+        assigned-clock-rates = <15625000>;
+
+        interrupts = <GIC_SPI 766 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "etu_summary";
+
+        pinctrl-0 = <&cci_timer0>;
+        pinctrl-1 = <&cci_timer1>;
+        pinctrl-names = "slice1", "slice2";
+
+        qcom,etu-slice = <1 2>;
+        qcom,etu-event-sel = <1 2>;
+      };
+    };
+...
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 01/10] dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

Quoted 17 lines · Imran Shaik
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +17 -0
+properties:
+  compatible:
+    oneOf:
+      - const: qcom,sa8775p-tscss
+      - items:
+          - const: qcom,qcs8300-tscss
+          - const: qcom,sa8775p-tscss
+
+  reg:
+    minItems: 1
+    maxItems: 2
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu

...

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 98

Quoted 13 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +13 -0
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu

Reason for same devices with different address space details should be provided somewhere, preferrably in description. Assuming in the first place, that this stays because how two devices can be basically identical (same compatible) if they have different programming interface?

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v2 01/10] dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

Quoted 32 lines · Krzysztof Kozlowski
Quoted 17 lines · Imran Shaik
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +17 -0
+properties:
+  compatible:
+    oneOf:
+      - const: qcom,sa8775p-tscss
+      - items:
+          - const: qcom,qcs8300-tscss
+          - const: qcom,sa8775p-tscss
+
+  reg:
+    minItems: 1
+    maxItems: 2
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu

...

Quoted 11 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +11 -0
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+allOf:
+  - if:
+      properties:
+        reg-names:
Quoted 9 lines

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 98

Quoted 2 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +2 -0
+          contains:
+            const: etu

Reason for same devices with different address space details should be provided somewhere, preferrably in description. Assuming in the first place, that this stays because how two devices can be basically identical (same compatible) if they have different programming interface?

TSCSS is a single hardware device, split into two sub-blocks - TSC and ETU, each with its own register address. Every SoC with this compatible has both blocks in hardware.

What changes is whether the vendor/board actually wires up the ETU's external event. The ETU block captures a timestamp from the TSC block when an external event fires one of the ETU slices, which are driven through board-level GPIO/IRQs. If a board doesn't wire any slice, there's nothing in the ETU region for Linux to use.

So interrupts/pinctrl/qcom,etu-* only matter once a slice is actually connected. Because of this, only the tsc reg space is described in the DTS patches today.

Instead, I'll use the "qcom,etu-slice" property to drive the required constraints, and add reg/reg-names support in DTS by default for both TSC and ETU, and update the description with the above details in the next series. I hope that works.

Thanks,
Imran

#4 lore raw

Re: [PATCH v2 01/10] dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

Quoted 14 lines · Imran Shaik
Quoted 7 lines

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 98

Quoted 6 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +6 -0
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
Quoted 6 lines

Reason for same devices with different address space details should be provided somewhere, preferrably in description. Assuming in the first place, that this stays because how two devices can be basically identical (same compatible) if they have different programming interface?

Quoted 3 lines

TSCSS is a single hardware device, split into two sub-blocks - TSC and ETU, each with its own register address. Every SoC with this compatible has both blocks in hardware.

This is not what the binding said.

Quoted 6 lines

What changes is whether the vendor/board actually wires up the ETU's external event. The ETU block captures a timestamp from the TSC block when an external event fires one of the ETU slices, which are driven through board-level GPIO/IRQs. If a board doesn't wire any slice, there's nothing in the ETU region for Linux to use.

This is not what the binding said. The binding said there are different types of devices, one with etu and one without. Look, easy to spot:

+ reg:
+ minItems: 1
+ maxItems: 2

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v2 01/10] dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

Quoted 32 lines · Krzysztof Kozlowski
Quoted 14 lines · Imran Shaik
Quoted 7 lines

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 98

Quoted 6 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +6 -0
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
Quoted 6 lines

Reason for same devices with different address space details should be provided somewhere, preferrably in description. Assuming in the first place, that this stays because how two devices can be basically identical (same compatible) if they have different programming interface?

Quoted 3 lines

TSCSS is a single hardware device, split into two sub-blocks - TSC and ETU, each with its own register address. Every SoC with this compatible has both blocks in hardware.

This is not what the binding said.

Quoted 6 lines

What changes is whether the vendor/board actually wires up the ETU's external event. The ETU block captures a timestamp from the TSC block when an external event fires one of the ETU slices, which are driven through board-level GPIO/IRQs. If a board doesn't wire any slice, there's nothing in the ETU region for Linux to use.

This is not what the binding said. The binding said there are different types of devices, one with etu and one without. Look, easy to spot:

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 34

Quoted 3 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +3 -0
+  reg:
+    minItems: 1
+    maxItems: 2

Sure, I will drop this reg handling, and add all the register spaces support by default in next series.

Thanks,
Imran

#6 lore raw

Re: [PATCH v2 01/10] dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

In reply to Imran Shaik
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] dt-bindings: ptp: qcom,sa8775p-tscss: misuse of pinctrl states for ETU slices - [Medium]…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] dt-bindings: ptp: qcom,sa8775p-tscss: misuse of pinctrl states for ETU slices
- [Medium] dt-bindings: ptp: qcom,sa8775p-tscss: coupling SoC etu reg to board properties
- [Low] dt-bindings: ptp: qcom,sa8775p-tscss: missing bounds on slice and event arrays
--

commit b07780b80d655036ec2e7df24ec2f89f821cf257
Author: Imran Shaik <[email protected]>

dt-bindings: ptp: Document the TSCSS on Qualcomm SA8775P and QCS8300 SoCs

This commit adds the Devicetree binding schema for the Timestamp Counter Subsystem (TSCSS) on Qualcomm SA8775P and QCS8300 SoCs.

Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +0 -0
new file mode 100644
index 0000000000000..b3e3a7cd71664

[ ... ]

Quoted 27 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +27 -0
+  reg:
+    minItems: 1
+    maxItems: 2
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu
+
+  clocks:
+    items:
+      - description: TSC AHB configuration clock.
+      - description: TSC global counter clock.
+      - description: TSC ETU clock.
+
+  clock-names:
+    items:
+      - const: ahb
+      - const: cntr
+      - const: etu
+
+  interrupts:
+    items:
+      - description:
+          Summary interrupt raised based on an external event for any
+          of the ETU slices.

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +10 -0
+
+  interrupt-names:
+    items:
+      - const: etu_summary
+
+  pinctrl-names:
+    minItems: 1
+    maxItems: 16
+    items:
+      pattern: "^slice[0-9]+$"

[Severity: Medium]
Does defining pinctrl-names as per-slice entries ("slice1", "slice2", ...) and placing each slice's pin into a separate pinctrl-<n> property (as shown in the second example with pinctrl-0 and pinctrl-1) misuse pinctrl states?

In the Devicetree pinctrl binding and drivers/pinctrl/core.c, pinctrl-0 through pinctrl-N represent mutually exclusive device-wide states such as "default" and "sleep", not concurrent channels. When pinctrl_commit_state() switches to a new state on the device, it calls pinctrl_cond_disable_mux_setting(old_state, NULL), which disables the pinmux settings of the previously active slice state so multiple slices cannot be active at the same time. Restricting pinctrl-names to "^slice[0-9]+$" also prevents standard "default" and "sleep" pin states from being used; all concurrently active ETU slice pins belong in a single state such as pinctrl-0 with pinctrl-names = "default".

Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +5 -0
+  qcom,etu-slice:
+    description:
+      ETU slice number for each entry in pinctrl-<n>, pinctrl-names and
+      qcom,etu-event-sel.
+    minItems: 1

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 84

Quoted 10 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +10 -0
+    maxItems: 16
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  qcom,etu-event-sel:
+    description:
+      External event selection value for each ETU slice listed in
+      qcom,etu-slice.
+    minItems: 1
+    maxItems: 16
+    $ref: /schemas/types.yaml#/definitions/uint32-array

[Severity: Low]
Should qcom,etu-slice and qcom,etu-event-sel define per-item minimum/maximum bounds (and uniqueItems: true on qcom,etu-slice)?

Without item bounds, out-of-range slice indices or event selector values and duplicate slice entries will not be caught by dtbs_check. Also, encoding the slice index in both pinctrl-names ("^slice[0-9]+$") and qcom,etu-slice duplicates the slice number across two properties without ensuring they match.

Quoted 14 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +14 -0
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
+    then:

Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml line 109

Quoted 10 lines
Documentation/devicetree/bindings/ptp/qcom,sa8775p-tscss.yaml new file +10 -0
+      properties:
+        reg:
+          minItems: 2
+          maxItems: 2
+      required:
+        - interrupts
+        - interrupt-names
+        - pinctrl-names
+        - qcom,etu-slice
+        - qcom,etu-event-sel

[Severity: Medium]
Should the SoC-level etu register region and interrupt be decoupled from the board-specific ETU slice properties?

The tsc and etu register blocks, clocks, and etu_summary interrupt are fixed SoC resources, whereas pinctrl-names, qcom,etu-slice, and qcom,etu-event-sel depend on board pin wiring. Requiring the board slice properties whenever reg-names contains "etu" prevents an SoC dtsi from describing the full TSCSS register map and interrupt unless every board also configures ETU slices.

In addition, this if/then block has no else branch when "etu" is absent, which allows reg to have 2 entries when reg-names only lists "tsc" and leaves the ETU properties allowed without the etu register region. Finally, the description notes that the TSC block is functional with just the AHB and counter clocks, yet clocks and clock-names unconditionally require all three clocks including "etu".

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#7 lore raw

PATCH v2 2/10 dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC

In reply to Imran Shaik

Add Devicetree bindings for the Timestamp Counter Subsystem (TSCSS) found on Qualcomm QDU1000 SoC.

TSCSS is a time synchronization subsystem composed of two main blocks:
Timestamp Counter (TSC) and Event Timestamp Unit (ETU). The TSC block provides a continuously running counter used for timekeeping, while the ETU captures timestamps for external hardware event triggers.

---
 .../bindings/ptp/qcom,qdu1000-tscss.yaml           | 170 +++++++++++++++++++++
 1 file changed, 170 insertions(+)
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +170 -0
new file mode 100644
index 000000000000..52a063ec4b78
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ptp/qcom,qdu1000-tscss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Timestamp Counter Subsystem (TSCSS) on Qualcomm QDU1000 SoC
+
+maintainers:
+  - Imran Shaik <[email protected]>
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm TSCSS is a time synchronization subsystem composed of two main
+  blocks - the Timestamp Counter (TSC) and the Event Timestamp Unit (ETU).
+
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and
+  generates its own interrupt when that event is triggered.
+
+properties:
+  compatible:
+    const: qcom,qdu1000-tscss
+
+  reg:
+    minItems: 1
+    maxItems: 2
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu
+
+  clocks:
+    items:
+      - description: TSC AHB configuration clock.
+      - description: TSC global counter clock.
+      - description: TSC ETU clock.
+
+  clock-names:
+    items:
+      - const: ahb
+      - const: cntr
+      - const: etu
+
+  interrupts:
+    minItems: 1
+    maxItems: 16
+    description:
+      Per slice interrupt raised based on an external event mapped to
+      that ETU slice.
+
+  interrupt-names:
+    minItems: 1
+    maxItems: 16
+    items:
+      pattern: "^slice[0-9]+$"
+
+  pinctrl-names:
+    minItems: 1
+    maxItems: 16
+    items:
+      pattern: "^slice[0-9]+$"
+
+  qcom,etu-slice:
+    description:
+      ETU slice number for each entry in interrupts, interrupt-names,
+      pinctrl-<n>, pinctrl-names and qcom,etu-event-sel.
+    minItems: 1
+    maxItems: 16
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  qcom,etu-event-sel:
+    description:
+      External event selection value for each ETU slice listed in
+      qcom,etu-slice.
+    minItems: 1
+    maxItems: 16
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
+    then:
+      properties:
+        reg:
+          minItems: 2
+          maxItems: 2
+      required:
+        - interrupts
+        - interrupt-names
+        - pinctrl-names
+        - qcom,etu-slice
+        - qcom,etu-event-sel
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,qdu1000-gcc.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ptp@1da0000 {
+        compatible = "qcom,qdu1000-tscss";
+        reg = <0x0 0x01da0000 0x0 0x2000>;
+        reg-names = "tsc";
+
+        clocks = <&gcc GCC_TSC_CFG_AHB_CLK>,
+                 <&gcc GCC_TSC_CNTR_CLK>,
+                 <&gcc GCC_TSC_ETU_CLK>;
+        clock-names = "ahb", "cntr", "etu";
+        assigned-clocks = <&gcc GCC_TSC_CNTR_CLK>;
+        assigned-clock-rates = <500000000>;
+      };
+    };
+
+  - |
+    #include <dt-bindings/clock/qcom,qdu1000-gcc.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ptp@1da0000 {
+        compatible = "qcom,qdu1000-tscss";
+        reg = <0x0 0x01da0000 0x0 0x2000>,
+              <0x0 0x01db0000 0x0 0x10000>;
+        reg-names = "tsc", "etu";
+
+        clocks = <&gcc GCC_TSC_CFG_AHB_CLK>,
+                 <&gcc GCC_TSC_CNTR_CLK>,
+                 <&gcc GCC_TSC_ETU_CLK>;
+        clock-names = "ahb", "cntr", "etu";
+
+        assigned-clocks = <&gcc GCC_TSC_CNTR_CLK>;
+        assigned-clock-rates = <500000000>;
+
+        interrupts = <GIC_SPI 329 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 333 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 334 IRQ_TYPE_EDGE_RISING>;
+        interrupt-names = "slice1", "slice5", "slice6";
+
+        pinctrl-0 = <&tod_pps>;
+        pinctrl-1 = <&gps_pps>;
+        pinctrl-2 = <&hardsync_pps>;
+        pinctrl-names = "slice1", "slice5", "slice6";
+
+        qcom,etu-slice = <1 5 6>;
+        qcom,etu-event-sel = <1 3 2>;
+      };
+    };
+...
Signature · 1 line
2.34.1
#8 lore raw

Re: [PATCH v2 02/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC

Quoted 37 lines · Imran Shaik

Add Devicetree bindings for the Timestamp Counter Subsystem (TSCSS) found on Qualcomm QDU1000 SoC.

TSCSS is a time synchronization subsystem composed of two main blocks:
Timestamp Counter (TSC) and Event Timestamp Unit (ETU). The TSC block provides a continuously running counter used for timekeeping, while the ETU captures timestamps for external hardware event triggers.

---
 .../bindings/ptp/qcom,qdu1000-tscss.yaml           | 170 +++++++++++++++++++++
 1 file changed, 170 insertions(+)
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +16 -0
new file mode 100644
index 000000000000..52a063ec4b78
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ptp/qcom,qdu1000-tscss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Timestamp Counter Subsystem (TSCSS) on Qualcomm QDU1000 SoC
+
+maintainers:
+  - Imran Shaik <[email protected]>
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm TSCSS is a time synchronization subsystem composed of two main
+  blocks - the Timestamp Counter (TSC) and the Event Timestamp Unit (ETU).
+

Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +10 -0
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and
+  generates its own interrupt when that event is triggered.
+
+properties:
+  compatible:
+    const: qcom,qdu1000-tscss

I failed to spot the difference against your binding at patch #1. How do they differ?

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH v2 02/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC

Quoted 43 lines · Krzysztof Kozlowski
Quoted 42 lines · Imran Shaik

Add Devicetree bindings for the Timestamp Counter Subsystem (TSCSS) found on Qualcomm QDU1000 SoC.

TSCSS is a time synchronization subsystem composed of two main blocks:
Timestamp Counter (TSC) and Event Timestamp Unit (ETU). The TSC block provides a continuously running counter used for timekeeping, while the ETU captures timestamps for external hardware event triggers.

---
  .../bindings/ptp/qcom,qdu1000-tscss.yaml           | 170 +++++++++++++++++++++
  1 file changed, 170 insertions(+)
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +21 -0
new file mode 100644
index 000000000000..52a063ec4b78
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ptp/qcom,qdu1000-tscss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Timestamp Counter Subsystem (TSCSS) on Qualcomm QDU1000 SoC
+
+maintainers:
+  - Imran Shaik <[email protected]>
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm TSCSS is a time synchronization subsystem composed of two main
+  blocks - the Timestamp Counter (TSC) and the Event Timestamp Unit (ETU).
+
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and
Quoted 9 lines

Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml line 26

Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +5 -0
+  generates its own interrupt when that event is triggered.
+
+properties:
+  compatible:
+    const: qcom,qdu1000-tscss

I failed to spot the difference against your binding at patch #1. How do they differ?

The ETU interrupt wiring between the QDU1000 and SA8775P/QCS8300 is different.
The SA8775P/QCS8300 share one summary interrupt across all ETU slices, and the QDU1000 has each slice with its own interrupt line. Due to this, kept them as separate bindings.

Can add them into one file with an if/then on compatible if you'd prefer. Please let me know.

Thanks,
Imran

#10 lore raw

Re: [PATCH v2 02/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC

Quoted 15 lines · Imran Shaik
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +5 -0
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and
Quoted 9 lines

Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml line 26

Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +5 -0
+  generates its own interrupt when that event is triggered.
+
+properties:
+  compatible:
+    const: qcom,qdu1000-tscss

I failed to spot the difference against your binding at patch #1. How do they differ?

Quoted 8 lines

The ETU interrupt wiring between the QDU1000 and SA8775P/QCS8300 is different.
The SA8775P/QCS8300 share one summary interrupt across all ETU slices, and the QDU1000 has each slice with its own interrupt line. Due to this, kept them as separate bindings.

Can add them into one file with an if/then on compatible if you'd prefer. Please let me know.

I see, it's fine to keep them separate, but you need common schema to define common vendor properties.

Best regards,
Krzysztof

#11 lore raw

Re: [PATCH v2 02/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm QDU1000 SoC

Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Imran Shaik
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +5 -0
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and
Quoted 9 lines

Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml line 26

Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,qdu1000-tscss.yaml new file +5 -0
+  generates its own interrupt when that event is triggered.
+
+properties:
+  compatible:
+    const: qcom,qdu1000-tscss

I failed to spot the difference against your binding at patch #1. How do they differ?

The ETU interrupt wiring between the QDU1000 and SA8775P/QCS8300 is different.
The SA8775P/QCS8300 share one summary interrupt across all ETU slices, and the QDU1000 has each slice with its own interrupt line. Due to this, kept them as separate bindings.

Quoted 6 lines
Quoted 2 lines

Can add them into one file with an if/then on compatible if you'd prefer. Please let me know.

I see, it's fine to keep them separate, but you need common schema to define common vendor properties.

Sure, I will introduce a common schema qcom,tscss.yaml with the shared properties, and take care of overriding SoC specific constraints in per SoC files.

Thanks,
Imran

#12 lore raw

PATCH v2 3/10 dt-bindings: ptp: Document TSCSS hardware on Qualcomm Nord and Shikra SoCs

In reply to Imran Shaik

Add Devicetree bindings for the Timestamp Counter Subsystem (TSCSS) found on Qualcomm Nord and Shikra SoCs.

TSCSS is a time synchronization subsystem composed of two main blocks:
Timestamp Counter (TSC) and Event Timestamp Unit (ETU). The TSC block provides a continuously running counter used for timekeeping, while the ETU captures timestamps for external hardware event triggers.

Nord additionally has a timer register region used to generate a periodic pulse in sync with the TSC counter.

---
 .../devicetree/bindings/ptp/qcom,nord-tscss.yaml   | 186 +++++++++++++++++++++
 1 file changed, 186 insertions(+)
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +186 -0
new file mode 100644
index 000000000000..9d49e66a35c9
@@ -0,0 +1,186 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ptp/qcom,nord-tscss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Timestamp Counter Subsystem (TSCSS) on Qualcomm Nord and Shikra
+
+maintainers:
+  - Imran Shaik <[email protected]>
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm TSCSS is a time synchronization subsystem composed of two main
+  blocks - the Timestamp Counter (TSC) and the Event Timestamp Unit (ETU).
+
+  The TSC block is a timestamp generator that maintains a running counter used
+  for system timekeeping, and is functional with just the AHB and counter
+  clocks.
+  The ETU block captures TSC timestamps for external hardware events. Each
+  ETU slice binds a slice number to an external event selector, and a
+  single summary interrupt is raised for any ETU slice event.
+
+  Nord additionally has a timer register region used to generate a
+  periodic pulse in sync with the TSC counter.
+
+properties:
+  compatible:
+    oneOf:
+      - const: qcom,nord-tscss
+      - items:
+          - const: qcom,shikra-tscss
+          - const: qcom,nord-tscss
+
+  reg:
+    minItems: 1
+    maxItems: 3
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu
+      - const: timer
+
+  clocks:
+    items:
+      - description: TSC AHB configuration clock.
+      - description: TSC global counter clock.
+      - description: TSC ETU clock.
+
+  clock-names:
+    items:
+      - const: ahb
+      - const: cntr
+      - const: etu
+
+  interrupts:
+    items:
+      - description:
+          Summary interrupt raised based on an external event for any
+          of the ETU slices.
+
+  interrupt-names:
+    items:
+      - const: etu_summary
+
+  pinctrl-names:
+    minItems: 1
+    maxItems: 32
+    items:
+      pattern: "^slice[0-9]+$"
+
+  qcom,etu-slice:
+    description:
+      ETU slice number for each entry in pinctrl-<n>, pinctrl-names and
+      qcom,etu-event-sel.
+    minItems: 1
+    maxItems: 32
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  qcom,etu-event-sel:
+    description:
+      External event selection value for each ETU slice listed in
+      qcom,etu-slice.
+    minItems: 1
+    maxItems: 32
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
+    then:
+      required:
+        - interrupts
+        - interrupt-names
+        - pinctrl-names
+        - qcom,etu-slice
+        - qcom,etu-event-sel
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: qcom,shikra-tscss
+    then:
+      properties:
+        reg-names:
+          minItems: 1
+          items:
+            - const: tsc
+            - const: etu
+        pinctrl-names:
+          maxItems: 8
+        qcom,etu-slice:
+          maxItems: 8
+        qcom,etu-event-sel:
+          maxItems: 8
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ptp@1c80000 {
+        compatible = "qcom,nord-tscss";
+        reg = <0x0 0x01c80000 0x0 0x2000>;
+        reg-names = "tsc";
+
+        clocks = <&gcc_tscss_ahb_clk>,
+                 <&gcc_tscss_cntr_clk>,
+                 <&gcc_tscss_etu_clk>;
+        clock-names = "ahb", "cntr", "etu";
+
+        assigned-clocks = <&gcc_tscss_cntr_clk>;
+        assigned-clock-rates = <250000000>;
+      };
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      ptp@1c80000 {
+        compatible = "qcom,nord-tscss";
+        reg = <0x0 0x01c80000 0x0 0x2000>,
+              <0x0 0x01ca0000 0x0 0x20000>,
+              <0x0 0x01c87000 0x0 0x1000>;
+        reg-names = "tsc", "etu", "timer";
+
+        clocks = <&gcc_tscss_ahb_clk>,
+                 <&gcc_tscss_cntr_clk>,
+                 <&gcc_tscss_etu_clk>;
+        clock-names = "ahb", "cntr", "etu";
+
+        assigned-clocks = <&gcc_tscss_cntr_clk>;
+        assigned-clock-rates = <250000000>;
+
+        interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "etu_summary";
+
+        pinctrl-0 = <&cci_timer0>;
+        pinctrl-1 = <&cci_timer1>;
+        pinctrl-names = "slice1", "slice2";
+
+        qcom,etu-slice = <1 2>;
+        qcom,etu-event-sel = <1 2>;
+      };
+    };
+...
Signature · 1 line
2.34.1
#13 lore raw

Re: [PATCH v2 03/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm Nord and Shikra SoCs

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 70

Quoted 7 lines · Imran Shaik
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +7 -0
+  interrupt-names:
+    items:
+      - const: etu_summary
+
+  pinctrl-names:
+    minItems: 1
+    maxItems: 32

So here there is difference, that justifies different binding file.

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 82

Quoted 12 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +12 -0
+    items:
+      pattern: "^slice[0-9]+$"
+
+  qcom,etu-slice:
+    description:
+      ETU slice number for each entry in pinctrl-<n>, pinctrl-names and
+      qcom,etu-event-sel.
+    minItems: 1
+    maxItems: 32
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  qcom,etu-event-sel:

Anyway, you need common schema defining qcom,etu-slice and qcom,etu-event-sel properties. Maybe also pinctrl-names and other common properties. The individual device schemas should only override/narrow constraints

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 85

Quoted 3 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +3 -0
+    description:
+      External event selection value for each ETU slice listed in
+      qcom,etu-slice.

Best regards,
Krzysztof

#14 lore raw

Re: [PATCH v2 03/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm Nord and Shikra SoCs

Quoted 20 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 70

Quoted 7 lines · Imran Shaik
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +7 -0
+  interrupt-names:
+    items:
+      - const: etu_summary
+
+  pinctrl-names:
+    minItems: 1
+    maxItems: 32

So here there is difference, that justifies different binding file.

Quoted 9 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +9 -0
+    items:
+      pattern: "^slice[0-9]+$"
+
+  qcom,etu-slice:
+    description:
+      ETU slice number for each entry in pinctrl-<n>, pinctrl-names and
+      qcom,etu-event-sel.
+    minItems: 1
+    maxItems: 32
Quoted 9 lines

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 82

Quoted 3 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +3 -0
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  qcom,etu-event-sel:

Anyway, you need common schema defining qcom,etu-slice and qcom,etu-event-sel properties. Maybe also pinctrl-names and other common properties. The individual device schemas should only override/narrow constraints

Sure, I will introduce a common schema qcom,tscss.yaml with the shared properties. Per-SoC files will take care of overriding their own constraints.

Thanks,
Imran

Quoted 8 lines

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 85

Quoted 4 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +3 -0
+    description:
+      External event selection value for each ETU slice listed in
+      qcom,etu-slice.

Best regards,
Krzysztof

#15 lore raw

Re: [PATCH v2 03/10] dt-bindings: ptp: Document TSCSS hardware on Qualcomm Nord and Shikra SoCs

In reply to Imran Shaik
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] dt-bindings: ptp: qcom,nord-tscss: missing reg constraints in allOf - [Low] dt-bindings: ptp…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] dt-bindings: ptp: qcom,nord-tscss: missing reg constraints in allOf
- [Low] dt-bindings: ptp: qcom,nord-tscss: invalid fallback and variant split
--

commit cdeb0d9b5fccebd2b2b765c9fc60dd95752de832
Author: Imran Shaik <[email protected]>

dt-bindings: ptp: Document TSCSS hardware on Qualcomm Nord and Shikra SoCs

This commit adds the devicetree binding schema for the Timestamp Counter Subsystem (TSCSS) on Qualcomm Nord and Shikra SoCs.

Quoted 5 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +0 -0
new file mode 100644
index 0000000000000..9d49e66a35c98

[ ... ]

Quoted 18 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +18 -0
+properties:
+  compatible:
+    oneOf:
+      - const: qcom,nord-tscss
+      - items:
+          - const: qcom,shikra-tscss
+          - const: qcom,nord-tscss
+
+  reg:
+    minItems: 1
+    maxItems: 3
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: tsc
+      - const: etu
+      - const: timer

[ ... ]

Quoted 22 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +22 -0
+allOf:
+  - if:
+      properties:
+        reg-names:
+          contains:
+            const: etu
+    then:
+      required:
+        - interrupts
+        - interrupt-names
+        - pinctrl-names
+        - qcom,etu-slice
+        - qcom,etu-event-sel
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: qcom,shikra-tscss
+    then:
+      properties:
+        reg-names:

Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml line 128

Quoted 10 lines
Documentation/devicetree/bindings/ptp/qcom,nord-tscss.yaml new file +10 -0
+          minItems: 1
+          items:
+            - const: tsc
+            - const: etu
+        pinctrl-names:
+          maxItems: 8
+        qcom,etu-slice:
+          maxItems: 8
+        qcom,etu-event-sel:
+          maxItems: 8

[Severity: Low]
Should these allOf conditionals also constrain reg to match reg-names?

When reg-names contains etu, reg is not given minItems: 2, so a node with a single reg entry still passes validation. Similarly, the qcom,shikra-tscss branch restricts reg-names to tsc and etu without setting maxItems: 2 on reg (and redefines the items list instead of setting
maxItems: 2 on reg-names), allowing 3 reg entries on Shikra.

[Severity: Low]
Is qcom,nord-tscss a valid fallback compatible for qcom,shikra-tscss?

Nord has a timer register region and up to 32 ETU slices, whereas Shikra lacks the timer region and only supports 8 slices, so a Shikra device is a subset rather than backwards-compatible with Nord. Combining them also requires per-compatible overrides for reg-names, pinctrl-names, qcom,etu-slice, and qcom,etu-event-sel; should qcom,shikra-tscss be split or grouped with a matching 2-region TSCSS schema instead of falling back to qcom,nord-tscss?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#16 lore raw

PATCH v2 4/10 ptp: qcom: Add PTP driver for the Qualcomm TSC hardware

In reply to Imran Shaik

Add a PTP Hardware Clock driver for the Qualcomm Timestamp Counter (TSC) hardware found on Qualcomm SA8775P, QDU1000 and Nord SoCs. The TSC is a free running hardware counter used for time synchronization, clocked by an AHB configuration clock and a global counter clock, with the counter resolution varying across SoCs.

---
 drivers/ptp/Kconfig        |  11 +
 drivers/ptp/Makefile       |   1 +
 drivers/ptp/ptp_qcom_tsc.c | 598 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 610 insertions(+)
drivers/ptp/Kconfig +11 -0
index feb50f8cc406..91bc347b2c50 100644
@@ -264,4 +264,15 @@ config PTP_NETC_V4_TIMER
 	  synchronization. It also supports periodic output signal (e.g. PPS)
 	  and external trigger timestamping.
 
+config PTP_QCOM_TSC
+	tristate "Qualcomm TSC as PTP clock"
+	depends on ARCH_QCOM || COMPILE_TEST
+	depends on COMMON_CLK && PTP_1588_CLOCK
+	help
+	  This driver adds support for using the Qualcomm Timestamp Counter
+	  Subsystem (TSCSS) as a PTP clock.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called ptp_qcom_tsc.
+
 endmenu
drivers/ptp/Makefile +1 -0
index bdc47e284f14..ff029323e98f 100644
@@ -22,3 +22,4 @@ obj-$(CONFIG_PTP_1588_CLOCK_OCP)	+= ptp_ocp.o
 obj-$(CONFIG_PTP_DFL_TOD)		+= ptp_dfl_tod.o
 obj-$(CONFIG_PTP_S390)			+= ptp_s390.o
 obj-$(CONFIG_PTP_NETC_V4_TIMER)		+= ptp_netc.o
+obj-$(CONFIG_PTP_QCOM_TSC)		+= ptp_qcom_tsc.o
drivers/ptp/ptp_qcom_tsc.c new file +598 -0

598 lines not on this page · raw message

Signature · 1 line
2.34.1
#17 lore raw

Re: [PATCH v2 04/10] ptp: qcom: Add PTP driver for the Qualcomm TSC hardware

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] ptp: qcom: torn 64-bit counter read in qcom_tsc_read_time() on rollover - [High] ptp: qcom: period…

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] ptp: qcom: torn 64-bit counter read in qcom_tsc_read_time() on rollover
- [High] ptp: qcom: period truncated to 0 for small negative ppb in adjfine()
- [Medium] ptp: qcom: ahb_clk and devres leak in qcom_tsc_enable_clocks() on error
- [Medium] ptp: qcom: uninitialized clock at probe and skipped config in qcom_tsc_settime()
--

commit 9c266c0baa9449c0c5ca7b1a7e003c4cbd0cb88b
Author: Imran Shaik <[email protected]>

ptp: qcom: Add PTP driver for the Qualcomm TSC hardware

This commit adds a PTP Hardware Clock driver for the Qualcomm Timestamp Counter (TSC) hardware on SA8775P, QDU1000, and Nord SoCs.

Quoted 6 lines
drivers/ptp/ptp_qcom_tsc.c new file +0 -0
new file mode 100644
index 0000000000000..82ddbdd63389d
@@ -0,0 +1,598 @@

[ ... ]

drivers/ptp/ptp_qcom_tsc.c line 105

Quoted 10 lines
drivers/ptp/ptp_qcom_tsc.c new file +10 -0
+static int qcom_tsc_read_time(struct qcom_tsc *tsc, struct timespec64 *ts)
+{
+	const struct qcom_tsc_regs *regs = tsc->soc->reg_layout;
+	u32 hi, lo;
+
+	if (!qcom_tsc_is_enabled(tsc))
+		return -EINVAL;
+
+	hi = readl_relaxed(tsc->base + regs->read_cntcv_hi);
+	lo = readl_relaxed(tsc->base + regs->read_cntcv_lo);

[Severity: High]
Can read_cntcv_lo roll over between reading read_cntcv_hi and read_cntcv_lo? If the lower word wraps between the two 32-bit reads, the old upper word is paired with the post-rollover lower word, returning a timestamp that jumps backward by 1 second (when rollover is true) or ~4.295 seconds (when rollover is false). Because qcom_tsc_settime() and qcom_tsc_update_offset() call qcom_tsc_read_time() to compute the delta or new counter value written back to the hardware, a torn read during settime64() or adjtime() also permanently shifts the hardware clock. Re-reading read_cntcv_hi in a loop until two consecutive upper-word reads match would avoid this.

[ ... ]

Quoted 17 lines
drivers/ptp/ptp_qcom_tsc.c new file +17 -0
+static int qcom_tsc_enable_clocks(struct qcom_tsc *tsc)
+{
+	int ret;
+
+	if (tsc->clocks_enabled)
+		return 0;
+
+	ret = clk_prepare_enable(tsc->ahb_clk);
+	if (ret)
+		return ret;
+
+	ret = devm_add_action_or_reset(tsc->dev, qcom_tsc_clk_disable, tsc->ahb_clk);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(tsc->cntr_clk);
+	if (ret)

drivers/ptp/ptp_qcom_tsc.c line 181

Quoted 10 lines
drivers/ptp/ptp_qcom_tsc.c new file +10 -0
+		return ret;
+
+	ret = devm_add_action_or_reset(tsc->dev, qcom_tsc_clk_disable, tsc->cntr_clk);
+	if (ret)
+		return ret;
+
+	tsc->clocks_enabled = true;
+
+	return 0;
+}

[Severity: Medium]
If enabling tsc->cntr_clk or registering its devm action fails here, does tsc->ahb_clk remain enabled with tsc->clocks_enabled still false? Because qcom_tsc_enable_clocks() runs from the runtime .settime64 callback rather than probe, returning an error does not unwind devres actions on tsc->dev, and each subsequent qcom_tsc_settime() call will prepare_enable tsc->ahb_clk and queue another devres action again.

[ ... ]

Quoted 22 lines
drivers/ptp/ptp_qcom_tsc.c new file +22 -0
+static int qcom_tsc_drift_correction(struct qcom_tsc *tsc, long scaled_ppm)
+{
+	const struct qcom_tsc_soc_data *soc = tsc->soc;
+	const struct qcom_tsc_regs *regs = soc->reg_layout;
+	long ppb = scaled_ppm_to_ppb(scaled_ppm);
+	u64 period, incval = 0;
+	u32 regval = 0, subperiod;
+
+	if (ppb == 0)
+		return 0;
+
+	if (ppb < 0) {
+		ppb = -ppb;
+		regval &= ~DRIFT_JUMP_SWALLOW;
+
+		period = div_u64(ppb, soc->cntr_res);
+		if (period >= DRIFT_MAX_RES)
+			period = DRIFT_MAX_RES;
+	} else {
+		regval |= DRIFT_JUMP_SWALLOW;
+
+		period = div_u64(ppb, soc->cntr_res);

drivers/ptp/ptp_qcom_tsc.c line 319

Quoted 10 lines
drivers/ptp/ptp_qcom_tsc.c new file +10 -0
+		if (period >= DRIFT_MAX_RES) {
+			period = DRIFT_MAX_RES;
+			incval = soc->cntr_res * 2;
+		} else if (ppb < soc->cntr_res) {
+			incval = soc->cntr_res + ppb;
+			period = 1;
+		} else {
+			incval = soc->cntr_res * 2;
+		}
+	}

[Severity: High]
Does the negative ppb branch truncate period to 0 when 0 < -ppb < soc->cntr_res (for example, -63 <= ppb <= -1 on SA8775P where cntr_res is 64)? Unlike the positive branch, which clamps period to 1 and adjusts incval when ppb < soc->cntr_res, the negative branch leaves period = 0 and incval = 0 and triggers drift_correct_cmd with a zero period, dropping fine negative frequency adjustments during PTP synchronization.

[ ... ]

Quoted 2 lines
drivers/ptp/ptp_qcom_tsc.c new file +2 -0
+static int qcom_ptp_tsc_probe(struct platform_device *pdev)
+{

[ ... ]

drivers/ptp/ptp_qcom_tsc.c line 567

Quoted 12 lines
drivers/ptp/ptp_qcom_tsc.c new file +12 -0
+	/* Both clocks are enabled on first use, when the counter is set */
+	tsc->ahb_clk = devm_clk_get(&pdev->dev, "ahb");
+	if (IS_ERR(tsc->ahb_clk))
+		return PTR_ERR(tsc->ahb_clk);
+
+	tsc->cntr_clk = devm_clk_get(&pdev->dev, "cntr");
+	if (IS_ERR(tsc->cntr_clk))
+		return PTR_ERR(tsc->cntr_clk);
+
+	tsc->ptp_info = qcom_ptp_info;
+
+	tsc->ptp = ptp_clock_register(&tsc->ptp_info, &pdev->dev);

[Severity: Medium]
Should the clocks and hardware counter be initialized before ptp_clock_register() exposes the PHC? Because tsc->clocks_enabled starts as false and the counter is only enabled in qcom_tsc_settime(), any gettime64(), adjtime(), adjfine(), or virtual clock creation (n_vclocks_store() -> ptp_vclock_register()) fails with -EINVAL until userspace calls clock_settime(). In addition, if BIT(0) in control_cntcr is already set at probe (from firmware or a prior driver bind/unbind, since qcom_ptp_tsc_remove() does not disable the counter), the first qcom_tsc_settime() call sees qcom_tsc_is_enabled(tsc) == true and takes the qcom_tsc_update_offset() path without programming PULSE_WIDTH_MASK or ROLLOVER_VAL:

drivers/ptp/ptp_qcom_tsc.c:qcom_tsc_settime() {
    ...
	if (qcom_tsc_is_enabled(tsc)) {
		qcom_tsc_read_time(tsc, &tod);
		ret = qcom_tsc_update_offset(tsc, timespec64_sub(*ts, tod));
		mutex_unlock(&tsc->lock);
		return ret;
	}

	/* Configure and enable the TSC counter */
	regval = readl_relaxed(tsc->base + regs->control_cntcr);
	regval &= ~PULSE_WIDTH_MASK;
	regval |= FIELD_PREP(PULSE_WIDTH_MASK, tsc->soc->pulse_width);
	writel_relaxed(regval, tsc->base + regs->control_cntcr);

	if (tsc->soc->rollover)
		writel_relaxed(ROLLOVER_VAL, tsc->base + regs->rollover_val);
    ...
}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#18 lore raw

PATCH v2 5/10 arm64: defconfig: Enable Qualcomm TSC driver

In reply to Imran Shaik

Enable PTP_QCOM_TSC as a module to support the Timestamp Counter (TSC) synchronization functionality on Qualcomm Lemans, Monaco and QDU1000 platforms.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 7b4985b29b21..9af55787b236 100644
@@ -689,6 +689,7 @@ CONFIG_SPI_SPIDEV=m
 CONFIG_SPMI=y
 CONFIG_SPMI_APPLE=m
 CONFIG_SPMI_MTK_PMIF=m
+CONFIG_PTP_QCOM_TSC=m
 CONFIG_PINCTRL_APPLE_GPIO=m
 CONFIG_PINCTRL_DA9062=m
 CONFIG_PINCTRL_MAX77620=y
Signature · 1 line
2.34.1
#19 lore raw

PATCH v2 6/10 arm64: dts: qcom: lemans: Add support for TSCSS node

In reply to Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Lemans SoCs.

---
 arch/arm64/boot/dts/qcom/lemans.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/lemans.dtsi +12 -0
index 1fdb72fa5518..4c76c820cacb 100644
@@ -3022,6 +3022,18 @@ pcie1_phy: phy@1c14000 {
 			status = "disabled";
 		};
 
+		ptp@1c80000 {
+			compatible = "qcom,sa8775p-tscss";
+			reg = <0x0 0x01c80000 0x0 0x2000>;
+			reg-names = "tsc";
+			clocks = <&gcc GCC_TSCSS_AHB_CLK>,
+				 <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
+				 <&gcc GCC_TSCSS_ETU_CLK>;
+			clock-names = "ahb", "cntr", "etu";
+			assigned-clocks = <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>;
+			assigned-clock-rates = <15625000>;
+		};
+
 		ufs_mem_hc: ufshc@1d84000 {
 			compatible = "qcom,sa8775p-ufshc", "qcom,ufshc", "jedec,ufs-2.0";
 			reg = <0x0 0x01d84000 0x0 0x3000>;
Signature · 1 line
2.34.1
#20 lore raw

Re: [PATCH v2 06/10] arm64: dts: qcom: lemans: Add support for TSCSS node

Quoted 13 lines · Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Lemans SoCs.

---
 arch/arm64/boot/dts/qcom/lemans.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/lemans.dtsi +0 -0
index 1fdb72fa5518..4c76c820cacb 100644

arch/arm64/boot/dts/qcom/lemans.dtsi pcie1_phy: phy@1c14000 { · line 3027

Quoted 6 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +3 -0
@@ -3022,6 +3022,18 @@ pcie1_phy: phy@1c14000 {
 			status = "disabled";
 		};
 
+		ptp@1c80000 {
+			compatible = "qcom,sa8775p-tscss";
+			reg = <0x0 0x01c80000 0x0 0x2000>;

Where is the rest of PTP devices? Your binding clearly said there are PTP with one and with two address spaces.

Best regards,
Krzysztof

#21 lore raw

Re: [PATCH v2 06/10] arm64: dts: qcom: lemans: Add support for TSCSS node

Quoted 17 lines · Krzysztof Kozlowski
Quoted 16 lines · Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Lemans SoCs.

---
  arch/arm64/boot/dts/qcom/lemans.dtsi | 12 ++++++++++++
  1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/lemans.dtsi +0 -0
index 1fdb72fa5518..4c76c820cacb 100644
@@ -3022,6 +3022,18 @@ pcie1_phy: phy@1c14000 {
  			status = "disabled";
  		};
 
Quoted 7 lines

arch/arm64/boot/dts/qcom/lemans.dtsi pcie1_phy: phy@1c14000 { · line 3027

Quoted 3 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +3 -0
+		ptp@1c80000 {
+			compatible = "qcom,sa8775p-tscss";
+			reg = <0x0 0x01c80000 0x0 0x2000>;

Where is the rest of PTP devices? Your binding clearly said there are PTP with one and with two address spaces.

As updated in the bindings patch1, will add the ETU reg also by default for all the SoCs, and will take care of constraints handling based on the "qcom,etu-slice" property.

Thanks,
Imran

#22 lore raw

Re: [PATCH v2 06/10] arm64: dts: qcom: lemans: Add support for TSCSS node

In reply to Imran Shaik
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] arm64: dts: qcom: lemans: missing CX power-domain and OPP in ptp@1c80000 --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] arm64: dts: qcom: lemans: missing CX power-domain and OPP in ptp@1c80000
--

commit 75dd9885f6f6ae470214655cb90edbd903d34847
Author: Imran Shaik <[email protected]>

arm64: dts: qcom: lemans: Add support for TSCSS node

This commit adds the Timestamp Counter Subsystem node to the Qualcomm Lemans SoC devicetree.

Quoted 9 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +1 -0
index 1fdb72fa55184..4c76c820cacb1 100644
@@ -3022,6 +3022,18 @@ pcie1_phy: phy@1c14000 {
 			status = "disabled";
 		};
 
+		ptp@1c80000 {

arch/arm64/boot/dts/qcom/lemans.dtsi pcie1_phy: phy@1c14000 { · line 3035

Quoted 10 lines
arch/arm64/boot/dts/qcom/lemans.dtsi +10 -0
+			compatible = "qcom,sa8775p-tscss";
+			reg = <0x0 0x01c80000 0x0 0x2000>;
+			reg-names = "tsc";
+			clocks = <&gcc GCC_TSCSS_AHB_CLK>,
+				 <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
+				 <&gcc GCC_TSCSS_ETU_CLK>;
+			clock-names = "ahb", "cntr", "etu";
+			assigned-clocks = <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>;
+			assigned-clock-rates = <15625000>;
+		};

[Severity: Medium]
As reported by Konrad Dybcio on v1 [1], does ptp@1c80000 need power-domains = <&rpmhpd SA8775P_CX> and required-opps = <&rpmhpd_opp_svs_l1>?

Running the counter clock at 15.625 MHz requires the rpmhpd_opp_svs_l1 performance state, and rpmhpd_opp_table defines rpmhpd_opp_min_svs, rpmhpd_opp_low_svs, and rpmhpd_opp_svs below it. Once rpmhpd_sync_state() completes, the CX power domain can drop to one of those lower corners when other consumers vote lower levels or are idle, operating the counter clock below its required voltage corner.

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

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
#23 lore raw

PATCH v2 7/10 arm64: dts: qcom: monaco: Add support for TSCSS node

In reply to Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Monaco SoCs.

---
 arch/arm64/boot/dts/qcom/monaco.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/monaco.dtsi +12 -0
index 35fbee63d4c6..b87ba4b3a5a6 100644
@@ -2628,6 +2628,18 @@ pcie1_phy: phy@1c14000 {
 			status = "disabled";
 		};
 
+		ptp@1c80000 {
+			compatible = "qcom,qcs8300-tscss", "qcom,sa8775p-tscss";
+			reg = <0x0 0x01c80000 0x0 0x2000>;
+			reg-names = "tsc";
+			clocks = <&gcc GCC_TSCSS_AHB_CLK>,
+				 <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
+				 <&gcc GCC_TSCSS_ETU_CLK>;
+			clock-names = "ahb", "cntr", "etu";
+			assigned-clocks = <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>;
+			assigned-clock-rates = <15625000>;
+		};
+
 		ufs_mem_hc: ufs@1d84000 {
 			compatible = "qcom,qcs8300-ufshc", "qcom,ufshc", "jedec,ufs-2.0";
 			reg = <0x0 0x01d84000 0x0 0x3000>;
Signature · 1 line
2.34.1
#24 lore raw

PATCH v2 8/10 arm64: dts: qcom: qdu1000: Add support for TSCSS node

In reply to Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm QDU1000 SoCs.

---
 arch/arm64/boot/dts/qcom/qdu1000.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/qcom/qdu1000.dtsi +13 -0
index 3a25b5100836..0f4028c41b2f 100644
@@ -877,6 +877,19 @@ system_noc: interconnect@1640000 {
 			#interconnect-cells = <2>;
 		};
 
+		ptp@1da0000 {
+			compatible = "qcom,qdu1000-tscss";
+			reg = <0x0 0x01da0000 0x0 0x2000>;
+			reg-names = "tsc";
+
+			clocks = <&gcc GCC_TSC_CFG_AHB_CLK>,
+				 <&gcc GCC_TSC_CNTR_CLK>,
+				 <&gcc GCC_TSC_ETU_CLK>;
+			clock-names = "ahb", "cntr", "etu";
+			assigned-clocks = <&gcc GCC_TSC_CNTR_CLK>;
+			assigned-clock-rates = <500000000>;
+		};
+
 		tcsr_mutex: hwlock@1f40000 {
 			compatible = "qcom,tcsr-mutex";
 			reg = <0x0 0x1f40000 0x0 0x20000>;
Signature · 1 line
2.34.1
#25 lore raw

Re: [PATCH v2 08/10] arm64: dts: qcom: qdu1000: Add support for TSCSS node

Quoted 13 lines · Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm QDU1000 SoCs.

---
 arch/arm64/boot/dts/qcom/qdu1000.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/qcom/qdu1000.dtsi +0 -0
index 3a25b5100836..0f4028c41b2f 100644

arch/arm64/boot/dts/qcom/qdu1000.dtsi system_noc: interconnect@1640000 { · line 883

Quoted 7 lines
arch/arm64/boot/dts/qcom/qdu1000.dtsi +4 -0
@@ -877,6 +877,19 @@ system_noc: interconnect@1640000 {
 			#interconnect-cells = <2>;
 		};
 
+		ptp@1da0000 {
+			compatible = "qcom,qdu1000-tscss";
+			reg = <0x0 0x01da0000 0x0 0x2000>;
+			reg-names = "tsc";

I see only one PTP, what about the rest?

Best regards,
Krzysztof

#26 lore raw

PATCH v2 9/10 arm64: dts: qcom: shikra: Add support for TSCSS node

In reply to Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Shikra SoCs.

---
 arch/arm64/boot/dts/qcom/shikra.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/shikra.dtsi +12 -0
index 2623e139196f..09aabbf447e0 100644
@@ -2481,6 +2481,18 @@ compute-cb@6 {
 			};
 		};
 
+		ptp@4b00000 {
+			compatible = "qcom,shikra-tscss", "qcom,nord-tscss";
+			reg = <0x0 0x04b00000 0x0 0x2000>;
+			reg-names = "tsc";
+			clocks = <&gcc GCC_TSCSS_AHB_CLK>,
+				 <&gcc GCC_TSCSS_CNTR_CLK>,
+				 <&gcc GCC_TSCSS_ETU_CLK>;
+			clock-names = "ahb", "cntr", "etu";
+			assigned-clocks = <&gcc GCC_TSCSS_CNTR_CLK>;
+			assigned-clock-rates = <250000000>;
+		};
+
 		usb_2: usb@4c00000 {
 			compatible = "qcom,shikra-dwc3", "qcom,snps-dwc3";
 			reg = <0x0 0x04c00000 0x0 0xfc100>;
Signature · 1 line
2.34.1
#27 lore raw

PATCH v2 10/10 arm64: dts: qcom: nord: Add support for TSCSS node

In reply to Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Nord SoCs.

---
 arch/arm64/boot/dts/qcom/nord-embedded.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +14 -0
index 1ab7d9bc3cfe..1d5f27336f73 100644
@@ -736,6 +736,20 @@ pcie_data_inbound: interconnect@1c00000 {
 		qcom,bcm-voters = <&apps_bcm_voter>;
 	};
 
+	ptp@1c80000 {
+		compatible = "qcom,nord-tscss";
+		reg = <0x0 0x01c80000 0x0 0x2000>;
+		reg-names = "tsc";
+
+		clocks = <&segcc SE_GCC_TSCSS_AHB_CLK>,
+			 <&segcc SE_GCC_TSCSS_CNTR_CLK>,
+			 <&segcc SE_GCC_TSCSS_ETU_CLK>;
+		clock-names = "ahb", "cntr", "etu";
+
+		assigned-clocks = <&segcc SE_GCC_TSCSS_CNTR_CLK>;
+		assigned-clock-rates = <250000000>;
+	};
+
 	ufs_mem_phy: phy@1d40000 {
 		compatible = "qcom,nord-qmp-ufs-phy",
 			     "qcom,sm8650-qmp-ufs-phy";
Signature · 1 line
2.34.1
#28 lore raw

Re: [PATCH v2 10/10] arm64: dts: qcom: nord: Add support for TSCSS node

Quoted 13 lines · Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Nord SoCs.

---
 arch/arm64/boot/dts/qcom/nord-embedded.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +0 -0
index 1ab7d9bc3cfe..1d5f27336f73 100644

arch/arm64/boot/dts/qcom/nord-embedded.dtsi pcie_data_inbound: interconnect@1c00000 { · line 742

Quoted 7 lines
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +4 -0
@@ -736,6 +736,20 @@ pcie_data_inbound: interconnect@1c00000 {
 		qcom,bcm-voters = <&apps_bcm_voter>;
 	};
 
+	ptp@1c80000 {
+		compatible = "qcom,nord-tscss";
+		reg = <0x0 0x01c80000 0x0 0x2000>;
+		reg-names = "tsc";

The node should probably go to nord.dtsi with nord-embedded.dtsi supplementing Embedded specific resources like clocks.

Shawn

Quoted 18 lines
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +10 -0
+
+		clocks = <&segcc SE_GCC_TSCSS_AHB_CLK>,
+			 <&segcc SE_GCC_TSCSS_CNTR_CLK>,
+			 <&segcc SE_GCC_TSCSS_ETU_CLK>;
+		clock-names = "ahb", "cntr", "etu";
+
+		assigned-clocks = <&segcc SE_GCC_TSCSS_CNTR_CLK>;
+		assigned-clock-rates = <250000000>;
+	};
+
 	ufs_mem_phy: phy@1d40000 {
 		compatible = "qcom,nord-qmp-ufs-phy",
 			     "qcom,sm8650-qmp-ufs-phy";
Signature · 2 lines
-- 
2.34.1
#29 lore raw

Re: [PATCH v2 10/10] arm64: dts: qcom: nord: Add support for TSCSS node

Quoted 17 lines · Shawn Guo
Quoted 16 lines · Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Nord SoCs.

---
  arch/arm64/boot/dts/qcom/nord-embedded.dtsi | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +0 -0
index 1ab7d9bc3cfe..1d5f27336f73 100644
@@ -736,6 +736,20 @@ pcie_data_inbound: interconnect@1c00000 {
  		qcom,bcm-voters = <&apps_bcm_voter>;
  	};
 
Quoted 8 lines

arch/arm64/boot/dts/qcom/nord-embedded.dtsi pcie_data_inbound: interconnect@1c00000 { · line 742

Quoted 4 lines
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +4 -0
+	ptp@1c80000 {
+		compatible = "qcom,nord-tscss";
+		reg = <0x0 0x01c80000 0x0 0x2000>;
+		reg-names = "tsc";

The node should probably go to nord.dtsi with nord-embedded.dtsi supplementing Embedded specific resources like clocks.

Sure, I will check and move this node to nord.dtsi in next series.

Thanks,
Imran

#30 lore raw

Re: [PATCH v2 10/10] arm64: dts: qcom: nord: Add support for TSCSS node

In reply to Imran Shaik
Quoted 13 lines · Imran Shaik

Add Timestamp Counter Subsystem (TSCSS) node support on Qualcomm Nord SoCs.

---
 arch/arm64/boot/dts/qcom/nord-embedded.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +0 -0
index 1ab7d9bc3cfe..1d5f27336f73 100644

arch/arm64/boot/dts/qcom/nord-embedded.dtsi pcie_data_inbound: interconnect@1c00000 { · line 742

Quoted 7 lines
arch/arm64/boot/dts/qcom/nord-embedded.dtsi +4 -0
@@ -736,6 +736,20 @@ pcie_data_inbound: interconnect@1c00000 {
 		qcom,bcm-voters = <&apps_bcm_voter>;
 	};
 
+	ptp@1c80000 {
+		compatible = "qcom,nord-tscss";
+		reg = <0x0 0x01c80000 0x0 0x2000>;
+		reg-names = "tsc";

And the rest of the devices or entries here? Are you sure you are adding complete DTS for this device?

Best regards,
Krzysztof