• Kamil Alkhouri's avatar
    net: dsa: hellcreek: Add support for hardware timestamping · f0d4ba9e
    Kamil Alkhouri authored
    The switch has the ability to take hardware generated time stamps per port for
    PTPv2 event messages in Rx and Tx direction. That is useful for achieving needed
    time synchronization precision for TSN devices/switches. So add support for it.
    
    There are two directions:
    
     * RX
    
       The switch has a single register per port to capture a timestamp. That
       mechanism is not used due to correlation problems. If the software processing
       is too slow and a PTPv2 event message is received before the previous one has
       been processed, false timestamps will be captured. Therefore, the switch can
       do "inline" timestamping which means it can insert the nanoseconds part of
       the timestamp directly into the PTPv2 event message. The reserved field (4
       bytes) is leveraged for that. This might not be in accordance with (older)
       PTP standards, but is the only way to get reliable results.
    
     * TX
    
       In Tx direction there is no correlation problem, because the software and the
       driver has to ensure that only one event message is "on the fly". However,
       the switch provides also a mechanism to check whether a timestamp is
       lost. That can only happen when a timestamp is read and at this point another
       message is timestamped. So, that lost bit is checked just in case to indicate
       to the user that the driver or the software is somewhat buggy.
    Signed-off-by: default avatarKamil Alkhouri <kamil.alkhouri@hs-offenburg.de>
    Signed-off-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
    Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    f0d4ba9e
hellcreek.h 7.89 KB