xref: /freebsd/sys/contrib/device-tree/Bindings/ptp/fsl,ptp.yaml (revision b2d2a78ad80ec68d4a17f5aef97d21686cb1e29b)
10e8011faSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
20e8011faSEmmanuel Vadot%YAML 1.2
30e8011faSEmmanuel Vadot---
40e8011faSEmmanuel Vadot$id: http://devicetree.org/schemas/ptp/fsl,ptp.yaml#
50e8011faSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
60e8011faSEmmanuel Vadot
70e8011faSEmmanuel Vadottitle: Freescale QorIQ 1588 timer based PTP clock
80e8011faSEmmanuel Vadot
90e8011faSEmmanuel Vadotmaintainers:
100e8011faSEmmanuel Vadot  - Frank Li <Frank.Li@nxp.com>
110e8011faSEmmanuel Vadot
120e8011faSEmmanuel Vadotproperties:
130e8011faSEmmanuel Vadot  compatible:
14*b2d2a78aSEmmanuel Vadot    oneOf:
15*b2d2a78aSEmmanuel Vadot      - enum:
160e8011faSEmmanuel Vadot          - fsl,etsec-ptp
170e8011faSEmmanuel Vadot          - fsl,fman-ptp-timer
180e8011faSEmmanuel Vadot          - fsl,dpaa2-ptp
19*b2d2a78aSEmmanuel Vadot      - items:
20*b2d2a78aSEmmanuel Vadot          - const: pci1957,ee02
21*b2d2a78aSEmmanuel Vadot          - const: fsl,enetc-ptp
220e8011faSEmmanuel Vadot
230e8011faSEmmanuel Vadot  reg:
240e8011faSEmmanuel Vadot    maxItems: 1
250e8011faSEmmanuel Vadot
260e8011faSEmmanuel Vadot  interrupts:
270e8011faSEmmanuel Vadot    maxItems: 1
280e8011faSEmmanuel Vadot
290e8011faSEmmanuel Vadot  clocks:
300e8011faSEmmanuel Vadot    maxItems: 1
310e8011faSEmmanuel Vadot
320e8011faSEmmanuel Vadot  fsl,cksel:
330e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
340e8011faSEmmanuel Vadot    description: |
350e8011faSEmmanuel Vadot      Timer reference clock source.
360e8011faSEmmanuel Vadot
370e8011faSEmmanuel Vadot      Reference clock source is determined by the value, which is holded
380e8011faSEmmanuel Vadot      in CKSEL bits in TMR_CTRL register. "fsl,cksel" property keeps the
390e8011faSEmmanuel Vadot      value, which will be directly written in those bits, that is why,
400e8011faSEmmanuel Vadot      according to reference manual, the next clock sources can be used:
410e8011faSEmmanuel Vadot
420e8011faSEmmanuel Vadot      For eTSEC,
430e8011faSEmmanuel Vadot      <0> - external high precision timer reference clock (TSEC_TMR_CLK
440e8011faSEmmanuel Vadot            input is used for this purpose);
450e8011faSEmmanuel Vadot      <1> - eTSEC system clock;
460e8011faSEmmanuel Vadot      <2> - eTSEC1 transmit clock;
470e8011faSEmmanuel Vadot      <3> - RTC clock input.
480e8011faSEmmanuel Vadot
490e8011faSEmmanuel Vadot      For DPAA FMan,
500e8011faSEmmanuel Vadot      <0> - external high precision timer reference clock (TMR_1588_CLK)
510e8011faSEmmanuel Vadot      <1> - MAC system clock (1/2 FMan clock)
520e8011faSEmmanuel Vadot      <2> - reserved
530e8011faSEmmanuel Vadot      <3> - RTC clock oscillator
540e8011faSEmmanuel Vadot
550e8011faSEmmanuel Vadot  fsl,tclk-period:
560e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
570e8011faSEmmanuel Vadot    description: Timer reference clock period in nanoseconds.
580e8011faSEmmanuel Vadot
590e8011faSEmmanuel Vadot  fsl,tmr-prsc:
600e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
610e8011faSEmmanuel Vadot    description: Prescaler, divides the output clock.
620e8011faSEmmanuel Vadot
630e8011faSEmmanuel Vadot  fsl,tmr-add:
640e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
650e8011faSEmmanuel Vadot    description: Frequency compensation value.
660e8011faSEmmanuel Vadot
670e8011faSEmmanuel Vadot  fsl,tmr-fiper1:
680e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
690e8011faSEmmanuel Vadot    description: Fixed interval period pulse generator.
700e8011faSEmmanuel Vadot
710e8011faSEmmanuel Vadot  fsl,tmr-fiper2:
720e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
730e8011faSEmmanuel Vadot    description: Fixed interval period pulse generator.
740e8011faSEmmanuel Vadot
750e8011faSEmmanuel Vadot  fsl,tmr-fiper3:
760e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
770e8011faSEmmanuel Vadot    description:
780e8011faSEmmanuel Vadot      Fixed interval period pulse generator.
790e8011faSEmmanuel Vadot      Supported only on DPAA2 and ENETC hardware.
800e8011faSEmmanuel Vadot
810e8011faSEmmanuel Vadot  fsl,max-adj:
820e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
830e8011faSEmmanuel Vadot    description: |
840e8011faSEmmanuel Vadot      Maximum frequency adjustment in parts per billion.
850e8011faSEmmanuel Vadot
860e8011faSEmmanuel Vadot      These properties set the operational parameters for the PTP
870e8011faSEmmanuel Vadot      clock. You must choose these carefully for the clock to work right.
880e8011faSEmmanuel Vadot      Here is how to figure good values:
890e8011faSEmmanuel Vadot
900e8011faSEmmanuel Vadot      TimerOsc     = selected reference clock   MHz
910e8011faSEmmanuel Vadot      tclk_period  = desired clock period       nanoseconds
920e8011faSEmmanuel Vadot      NominalFreq  = 1000 / tclk_period         MHz
930e8011faSEmmanuel Vadot      FreqDivRatio = TimerOsc / NominalFreq     (must be greater that 1.0)
940e8011faSEmmanuel Vadot      tmr_add      = ceil(2^32 / FreqDivRatio)
950e8011faSEmmanuel Vadot      OutputClock  = NominalFreq / tmr_prsc     MHz
960e8011faSEmmanuel Vadot      PulseWidth   = 1 / OutputClock            microseconds
970e8011faSEmmanuel Vadot      FiperFreq1   = desired frequency in Hz
980e8011faSEmmanuel Vadot      FiperDiv1    = 1000000 * OutputClock / FiperFreq1
990e8011faSEmmanuel Vadot      tmr_fiper1   = tmr_prsc * tclk_period * FiperDiv1 - tclk_period
1000e8011faSEmmanuel Vadot      max_adj      = 1000000000 * (FreqDivRatio - 1.0) - 1
1010e8011faSEmmanuel Vadot
1020e8011faSEmmanuel Vadot      The calculation for tmr_fiper2 is the same as for tmr_fiper1. The
1030e8011faSEmmanuel Vadot      driver expects that tmr_fiper1 will be correctly set to produce a 1
1040e8011faSEmmanuel Vadot      Pulse Per Second (PPS) signal, since this will be offered to the PPS
1050e8011faSEmmanuel Vadot      subsystem to synchronize the Linux clock.
1060e8011faSEmmanuel Vadot
1070e8011faSEmmanuel Vadot      When this attribute is not used, the IEEE 1588 timer reference clock
1080e8011faSEmmanuel Vadot      will use the eTSEC system clock (for Gianfar) or the MAC system
1090e8011faSEmmanuel Vadot      clock (for DPAA).
1100e8011faSEmmanuel Vadot
1110e8011faSEmmanuel Vadot  fsl,extts-fifo:
1120e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/flag
1130e8011faSEmmanuel Vadot    description:
1140e8011faSEmmanuel Vadot      The presence of this property indicates hardware
1150e8011faSEmmanuel Vadot      support for the external trigger stamp FIFO
1160e8011faSEmmanuel Vadot
1170e8011faSEmmanuel Vadot  little-endian:
1180e8011faSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/flag
1190e8011faSEmmanuel Vadot    description:
1200e8011faSEmmanuel Vadot      The presence of this property indicates the 1588 timer
1210e8011faSEmmanuel Vadot      support for the external trigger stamp FIFO.
1220e8011faSEmmanuel Vadot      IP block is little-endian mode. The default endian mode
1230e8011faSEmmanuel Vadot      is big-endian.
1240e8011faSEmmanuel Vadot
1250e8011faSEmmanuel Vadotrequired:
1260e8011faSEmmanuel Vadot  - compatible
1270e8011faSEmmanuel Vadot  - reg
1280e8011faSEmmanuel Vadot
129*b2d2a78aSEmmanuel VadotallOf:
130*b2d2a78aSEmmanuel Vadot  - if:
131*b2d2a78aSEmmanuel Vadot      properties:
132*b2d2a78aSEmmanuel Vadot        compatible:
133*b2d2a78aSEmmanuel Vadot          contains:
134*b2d2a78aSEmmanuel Vadot            const: fsl,enetc-ptp
135*b2d2a78aSEmmanuel Vadot    then:
136*b2d2a78aSEmmanuel Vadot      $ref: /schemas/pci/pci-device.yaml
137*b2d2a78aSEmmanuel Vadot
1380e8011faSEmmanuel VadotadditionalProperties: false
1390e8011faSEmmanuel Vadot
1400e8011faSEmmanuel Vadotexamples:
1410e8011faSEmmanuel Vadot  - |
1420e8011faSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
1430e8011faSEmmanuel Vadot
1440e8011faSEmmanuel Vadot    phc@24e00 {
1450e8011faSEmmanuel Vadot        compatible = "fsl,etsec-ptp";
1460e8011faSEmmanuel Vadot        reg = <0x24e00 0xb0>;
1470e8011faSEmmanuel Vadot        interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
1480e8011faSEmmanuel Vadot        interrupt-parent = <&ipic>;
1490e8011faSEmmanuel Vadot        fsl,cksel       = <1>;
1500e8011faSEmmanuel Vadot        fsl,tclk-period = <10>;
1510e8011faSEmmanuel Vadot        fsl,tmr-prsc    = <100>;
1520e8011faSEmmanuel Vadot        fsl,tmr-add     = <0x999999a4>;
1530e8011faSEmmanuel Vadot        fsl,tmr-fiper1  = <0x3b9ac9f6>;
1540e8011faSEmmanuel Vadot        fsl,tmr-fiper2  = <0x00018696>;
1550e8011faSEmmanuel Vadot        fsl,max-adj     = <659999998>;
1560e8011faSEmmanuel Vadot    };
157