Skip to content

Commit

Permalink
dt-bindings: ptp: Convert ptp-qoirq to yaml format
Browse files Browse the repository at this point in the history
Convert ptp-qoirq from txt to yaml format.

Additional change:
- Fixed example interrupts proptery. Need only 1 irq by check MPC8313 spec.
- Move Reference clock context under clk,sel.
- Interrupts is not required property.
- Use low case for hex value.
- Check reference manual of MPC8313, p1010 and so on, which dts use more
than 1 irqs. Only 1 irq for each ptp device. Check driver code
(drivers/ptp/ptp_qoriq.c) and only 1 irq used. So original description is
wrong.
- Remove comments for compatible string.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240618-ls_fman-v2-1-f00a82623d8e@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Frank Li authored and Jakub Kicinski committed Jun 21, 2024
1 parent 08f116c commit 01479f1
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 90 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/fsl-fman.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Refer to Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml
============================================================================
FMan IEEE 1588 Node

Refer to Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
Refer to Documentation/devicetree/bindings/ptp/fsl,ptp.yaml

=============================================================================
FMan MDIO Node
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ Example:

* Gianfar PTP clock nodes

Refer to Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
Refer to Documentation/devicetree/bindings/ptp/fsl,ptp.yaml
144 changes: 144 additions & 0 deletions Documentation/devicetree/bindings/ptp/fsl,ptp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/ptp/fsl,ptp.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Freescale QorIQ 1588 timer based PTP clock

maintainers:
- Frank Li <Frank.Li@nxp.com>

properties:
compatible:
enum:
- fsl,etsec-ptp
- fsl,fman-ptp-timer
- fsl,dpaa2-ptp
- fsl,enetc-ptp

reg:
maxItems: 1

interrupts:
maxItems: 1

clocks:
maxItems: 1

fsl,cksel:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
Timer reference clock source.
Reference clock source is determined by the value, which is holded
in CKSEL bits in TMR_CTRL register. "fsl,cksel" property keeps the
value, which will be directly written in those bits, that is why,
according to reference manual, the next clock sources can be used:
For eTSEC,
<0> - external high precision timer reference clock (TSEC_TMR_CLK
input is used for this purpose);
<1> - eTSEC system clock;
<2> - eTSEC1 transmit clock;
<3> - RTC clock input.
For DPAA FMan,
<0> - external high precision timer reference clock (TMR_1588_CLK)
<1> - MAC system clock (1/2 FMan clock)
<2> - reserved
<3> - RTC clock oscillator
fsl,tclk-period:
$ref: /schemas/types.yaml#/definitions/uint32
description: Timer reference clock period in nanoseconds.

fsl,tmr-prsc:
$ref: /schemas/types.yaml#/definitions/uint32
description: Prescaler, divides the output clock.

fsl,tmr-add:
$ref: /schemas/types.yaml#/definitions/uint32
description: Frequency compensation value.

fsl,tmr-fiper1:
$ref: /schemas/types.yaml#/definitions/uint32
description: Fixed interval period pulse generator.

fsl,tmr-fiper2:
$ref: /schemas/types.yaml#/definitions/uint32
description: Fixed interval period pulse generator.

fsl,tmr-fiper3:
$ref: /schemas/types.yaml#/definitions/uint32
description:
Fixed interval period pulse generator.
Supported only on DPAA2 and ENETC hardware.

fsl,max-adj:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
Maximum frequency adjustment in parts per billion.
These properties set the operational parameters for the PTP
clock. You must choose these carefully for the clock to work right.
Here is how to figure good values:
TimerOsc = selected reference clock MHz
tclk_period = desired clock period nanoseconds
NominalFreq = 1000 / tclk_period MHz
FreqDivRatio = TimerOsc / NominalFreq (must be greater that 1.0)
tmr_add = ceil(2^32 / FreqDivRatio)
OutputClock = NominalFreq / tmr_prsc MHz
PulseWidth = 1 / OutputClock microseconds
FiperFreq1 = desired frequency in Hz
FiperDiv1 = 1000000 * OutputClock / FiperFreq1
tmr_fiper1 = tmr_prsc * tclk_period * FiperDiv1 - tclk_period
max_adj = 1000000000 * (FreqDivRatio - 1.0) - 1
The calculation for tmr_fiper2 is the same as for tmr_fiper1. The
driver expects that tmr_fiper1 will be correctly set to produce a 1
Pulse Per Second (PPS) signal, since this will be offered to the PPS
subsystem to synchronize the Linux clock.
When this attribute is not used, the IEEE 1588 timer reference clock
will use the eTSEC system clock (for Gianfar) or the MAC system
clock (for DPAA).
fsl,extts-fifo:
$ref: /schemas/types.yaml#/definitions/flag
description:
The presence of this property indicates hardware
support for the external trigger stamp FIFO

little-endian:
$ref: /schemas/types.yaml#/definitions/flag
description:
The presence of this property indicates the 1588 timer
support for the external trigger stamp FIFO.
IP block is little-endian mode. The default endian mode
is big-endian.

required:
- compatible
- reg

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
phc@24e00 {
compatible = "fsl,etsec-ptp";
reg = <0x24e00 0xb0>;
interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
interrupt-parent = <&ipic>;
fsl,cksel = <1>;
fsl,tclk-period = <10>;
fsl,tmr-prsc = <100>;
fsl,tmr-add = <0x999999a4>;
fsl,tmr-fiper1 = <0x3b9ac9f6>;
fsl,tmr-fiper2 = <0x00018696>;
fsl,max-adj = <659999998>;
};
87 changes: 0 additions & 87 deletions Documentation/devicetree/bindings/ptp/ptp-qoriq.txt

This file was deleted.

2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8816,7 +8816,7 @@ FREESCALE QORIQ PTP CLOCK DRIVER
M: Yangbo Lu <yangbo.lu@nxp.com>
L: netdev@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
F: Documentation/devicetree/bindings/ptp/fsl,ptp.yaml
F: drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp*
F: drivers/net/ethernet/freescale/dpaa2/dprtc*
F: drivers/net/ethernet/freescale/enetc/enetc_ptp.c
Expand Down

0 comments on commit 01479f1

Please sign in to comment.