net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock
authorChristian Eggers <ceggers@arri.de>
Tue, 10 Jan 2023 08:49:21 +0000 (14:19 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Jan 2023 08:40:40 +0000 (08:40 +0000)
commitbb01ad30570b09eb83438093cd7d29f04410b12e
tree3f476058a6c0a371f1e66bd7d84025e03707e164
parentc2977c61f32e0d54319d158a04cad5fd82c2afcf
net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock

This patch is used for reconstructing the absolute time from the 32bit
hardware time stamping value. The do_aux ioctl is used for reading the
ptp hardware clock and store it to global variable.
The timestamped value in tail tag during rx and register during tx are
32 bit value (2 bit seconds and 30 bit nanoseconds). The time taken to
read entire ptp clock will be time consuming. In order to speed up, the
software clock is maintained. This clock time will be added to 32 bit
timestamp to get the absolute time stamp.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Co-developed-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/microchip/ksz_ptp.c
drivers/net/dsa/microchip/ksz_ptp.h