• Johannes Zink's avatar
    net: stmmac: correct MAC propagation delay · 20bf98c9
    Johannes Zink authored
    The IEEE1588 Standard specifies that the timestamps of Packets must be
    captured when the PTP message timestamp point (leading edge of first
    octet after the start of frame delimiter) crosses the boundary between
    the node and the network. As the MAC latches the timestamp at an
    internal point, the captured timestamp must be corrected for the
    additional path latency, as described in the publicly available
    datasheet [1].
    
    This patch only corrects for the MAC-Internal delay, which can be read
    out from the MAC_Ingress_Timestamp_Latency register, since the Phy
    framework currently does not support querying the Phy ingress and egress
    latency. The Closs Domain Crossing Circuits errors as indicated in [1]
    are already being accounted in the stmmac_get_tx_hwtstamp() function and
    are not corrected here.
    
    As the Latency varies for different link speeds and MII
    modes of operation, the correction value needs to be updated on each
    link state change.
    
    As the delay also causes a phase shift in the timestamp counter compared
    to the rest of the network, this correction will also reduce phase error
    when generating PPS outputs from the timestamp counter.
    
    [1] i.MX8MP Reference Manual, rev.1 Section 11.7.2.5.3 "Timestamp
    correction"
    Signed-off-by: default avatarJohannes Zink <j.zink@pengutronix.de>
    Link: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v2-1-3366f38ee9a6@pengutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    20bf98c9
hwif.h 30.5 KB