aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Vadapalli2023-05-28 23:29:58 -0500
committerVignesh Raghavendra2023-05-31 05:13:37 -0500
commit7a71b2f9daddfb6e57aa317a5aa8dac0e7a18252 (patch)
treead6b3b426f8b09ca7cfdd0867bcc7cba1e3c736f
parent0f9677ed08dd3538d23347cf048b5a95f9f9b6d6 (diff)
downloadti-linux-kernel-7a71b2f9daddfb6e57aa317a5aa8dac0e7a18252.tar.gz
ti-linux-kernel-7a71b2f9daddfb6e57aa317a5aa8dac0e7a18252.tar.xz
ti-linux-kernel-7a71b2f9daddfb6e57aa317a5aa8dac0e7a18252.zip
arm64: dts: ti: k3-j721e-common-proc-board: Add MCU CPSW CPTS PPS support
The CPTS driver is capable of configuring GENFy (Periodic Signal Generator Function) present in the CPTS module, to generate periodic output signals with a custom time period. In order to generate a PPS signal on the GENFy output, the device-tree property "ti,pps" has to be used. The "ti,pps" property is used to declare the mapping between the CPTS HWx_TS_PUSH (Hardware Timestamp trigger) input and the GENFy output that is configured to generate a PPS signal. The mapping is of the form: <x-1 y> where the value x corresponds to HWx_TS_PUSH input (1-based indexing) and the value y corresponds to GENFy (0-based indexing). To verify that the signal is a PPS signal, the GENFy output signal is fed into the CPTS HWx_TS_PUSH input, which generates a timestamp event on the rising edge of the GENFy signal. The GENFy output signal can be routed to the HWx_TS_PUSH input by using the Time Sync Router. This is done by mentioning the mapping between the GENFy output and the HWx_TS_PUSH input within the "timesync_router" device-tree node. The Input Sources to the Time Sync Router are documented at: [0] The Output Destinations of the Time Sync Router are documented at: [1] The ptp clock corresponding to the am65-cpsw-nuss driver for the MCU CPSW instance has to be used to test PPS signal generation. Use the command: # readlink -f /sys/class/ptp/ptp*/device/driver in order to identify the ptp clock instance corresponding to the am65-cpsw-nuss driver. Enable PPS signal generation on GENF1. Use HW4_TS_PUSH Timestamp trigger input to verify the PPS signal. The PPS signal can be verified using testptp and ppstest tools as follows: # ./testptp -d /dev/ptp0 -P 1 pps for system time request okay # ./ppstest /dev/pps0 trying PPS source "/dev/pps0" found PPS source "/dev/pps0" ok, found 1 source(s), now start fetching data... source 0 - assert 62.000000015, sequence: 6 - clear 0.000000000, sequence: 0 source 0 - assert 63.000000015, sequence: 7 - clear 0.000000000, sequence: 0 source 0 - assert 64.000000015, sequence: 8 - clear 0.000000000, sequence: 0 source 0 - assert 65.000000015, sequence: 9 - clear 0.000000000, sequence: 0 source 0 - assert 66.000000015, sequence: 10 - clear 0.000000000, sequence: 0 source 0 - assert 67.000000015, sequence: 11 - clear 0.000000000, sequence: 0 [0] Link: https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j721e/interrupt_cfg.html#timesync-intrtr0-interrupt-router-input-sources [1] Link: https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j721e/interrupt_cfg.html#timesync-intrtr0-interrupt-router-output-destinations Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Acked-by: Ravi Gunasekaran <r-gunasekaran@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
-rw-r--r--arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
index c5cde8ee7b0d..5c81c2e47a2f 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
+++ b/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
@@ -693,6 +693,11 @@
693&mcu_cpsw { 693&mcu_cpsw {
694 pinctrl-names = "default"; 694 pinctrl-names = "default";
695 pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>; 695 pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
696
697 cpts@3d000 {
698 /* Map HW4_TS_PUSH to GENF1 */
699 ti,pps = <3 1>;
700 };
696}; 701};
697 702
698&davinci_mdio { 703&davinci_mdio {
@@ -968,3 +973,19 @@
968&dphy1 { 973&dphy1 {
969 status = "okay"; 974 status = "okay";
970}; 975};
976
977#define K3_TS_OFFSET(pa, val) (0x4+(pa)*4) (0x10000 | val)
978
979&timesync_router {
980 status = "okay";
981 pinctrl-names = "default";
982 pinctrl-0 = <&mcu_cpsw_cpts>;
983
984 /* Use Time Sync Router to map GENF1 input to HW4_TS_PUSH output */
985 mcu_cpsw_cpts: mcu-cpsw-cpts {
986 pinctrl-single,pins = <
987 /* pps [mcu cpsw cpts genf1] in17 -> out25 [mcu cpsw cpts hw4_push] */
988 K3_TS_OFFSET(25, 17)
989 >;
990 };
991};