ENGR00288569: net:fec_ptp: fix the potential issue for storing timestamp
The timestamps generated in the i.MX drivers are generated by the
nanoseconds part coming from the 1588 clock. But the number of seconds
are maintained in a private structure of the interface. Those are
updated in a 1588 clock rollover interrupt.
The timestamp is generated right before a rollover of a second and the
timestamp value is constructed afterwards. Therefore the bigger part of
the timestamp is wrong (the second).
commit:
54181c1d83e04b18e63c7723ac80f974b760e019
Suggested solution (pseudo-code):
If( actual-time.nsec < timestamp.nsec )
Timestamp.sec = fpp->prtc -1;
Else
Timestamp.sec = fpp->prtc;
But it is not perfect and there still exist potenitial second sync issue.
So, the patch Suggested solution (pseudo-code):
If( actual-time.nsec < timestamp.nsec &&
!FEC_IEVENT[TS_TIMER] )
Timestamp.sec = fpp->prtc -1;
Else
Timestamp.sec = fpp->prtc;
Signed-off-by: Fugang Duan <B38611@freescale.com>