]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
net: eqos: Register PTP callback at correct place
authorabhijit <abhijit@nvidia.com>
Mon, 29 May 2017 09:31:36 +0000 (15:01 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 19 Jun 2017 09:04:45 +0000 (02:04 -0700)
Issue: CAN HW timestamp information is incorrect in case one of the
Tegra is made PTP master.

Fix: CAN HW timestamp is based on get_ptp_hwtime function which is
exported by PTP notifier framework. Above function relies on callback
registered by eqos driver. This callack was registered when adjust
PTP time was called. But adjust is not called for PTP master. Moved
the callback registration to set HWTSTAMP ioctl which is required by
both PTP master and slave.

Bug 1887016

Change-Id: Iaad1d7cdff4fc2aaf3e015ddf7b8c5ef189add3f
Reviewed-on: http://git-master/r/1491662
(cherry picked from commit 1593119045757decc0e3d71fc733d678df8637aa)
Reviewed-on: http://git-master/r/1503233
GVS: Gerrit_Virtual_Submit
Tested-by: Abhijit . <abhijit@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
drivers/net/ethernet/nvidia/eqos/drv.c
drivers/net/ethernet/nvidia/eqos/ptp.c

index 9e095028c9397f70cf7b1707b36299f410b56e91..104775098a9866151273df3f108c14daf6fd4ceb 100644 (file)
@@ -3942,6 +3942,10 @@ static int eqos_handle_hwtstamp_ioctl(struct eqos_prv_data *pdata,
                /* initialize system time */
                getnstimeofday(&now);
                hw_if->init_systime(now.tv_sec, now.tv_nsec);
+
+               DBGPR_PTP("-->eqos registering get_ptp function\n");
+               /* Register broadcasting MAC timestamp to clients */
+               tegra_register_hwtime_source(hw_if->get_systime);
        }
 
        DBGPR_PTP("config.flags = %#x, tx_type = %#x, rx_filter = %#x\n",
index e79501ebcae4ebe43aeed1d25456a973a1740b4c..5d5e1962ee94d4e245653286834e4dc5b4ea2fbb 100644 (file)
@@ -137,9 +137,6 @@ static int eqos_adjust_time(struct ptp_clock_info *ptp, s64 delta)
 
        raw_spin_unlock(&pdata->ptp_lock);
 
-       /* Register broadcasting MAC timestamp to clients */
-       tegra_register_hwtime_source(hw_if->get_systime);
-
        DBGPR_PTP("<--eqos_adjust_time\n");
 
        return 0;