Hello Srinivas,
1. Please refer to the following source code drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c in Linux Kernel when CONFIG_FSL_DPAA_TS is enabled.
#ifdef CONFIG_FSL_DPAA_1588
if (priv->tsu && priv->tsu->valid && priv->tsu->hwts_tx_en_ioctl)
fd.cmd |= FM_FD_CMD_UPD;
#endif
#ifdef CONFIG_FSL_DPAA_TS
if (unlikely(priv->ts_tx_en &&
skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
fd.cmd |= FM_FD_CMD_UPD;
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
#endif /* CONFIG_FSL_DPAA_TS */
#ifdef CONFIG_FSL_DPAA_TS
if (priv->ts_rx_en)
dpa_get_ts(priv, RX, skb_hwtstamps(skb), vaddr);
#endif /*
2. In the latest Linux Kernel source code, there is a testptp tool in kernel source to set ptp clock time.
You can cross-compile tools/testing/selftests/ptp/testptp.c to use.
Here is example to use.
root@ls1028a:~# ./testptp -h
usage: testptp [options]
-a val request a one-shot alarm after 'val' seconds
-A val request a periodic alarm every 'val' seconds
-c query the ptp clock's capabilities
-d name device to open
-e val read 'val' external time stamp events
-f val adjust the ptp clock frequency by 'val' ppb
-g get the ptp clock time
-h prints this message
-i val index for event/trigger
-k val measure the time offset between system and phc clock
for 'val' times (Maximum 25)
-l list the current pin configuration
-L pin,val configure pin index 'pin' with function 'val'
the channel index is taken from the '-i' option
'val' specifies the auxiliary function:
0 - none
1 - external time stamp
2 - periodic output
-p val enable output with a period of 'val' nanoseconds
-P val enable or disable (val=1|0) the system clock PPS
-s set the ptp clock time from the system time
-S set the system time from the ptp clock time
-t val shift the ptp clock time by 'val' seconds
-T val set the ptp clock time to 'val' seconds
root@ls1028a:~# date
Tue Sep 25 11:21:54 UTC 2018
root@ls1028a:~# ./testptp /dev/ptp0 -g
clock time: 544.497962405 or Thu Jan 1 00:09:04 1970
root@ls1028a:~# ./testptp /dev/ptp0 -s
set time okay
root@ls1028a:~# ./testptp /dev/ptp0 -g
clock time: 1537874537.256845540 or Tue Sep 25 11:22:17 2018
root@ls1028a:~#
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------