summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/microchip/ksz_ptp.h
diff options
context:
space:
mode:
authorChristian Eggers <ceggers@arri.de>2023-01-10 14:19:21 +0530
committerDavid S. Miller <davem@davemloft.net>2023-01-13 08:40:40 +0000
commitbb01ad30570b09eb83438093cd7d29f04410b12e (patch)
tree3f476058a6c0a371f1e66bd7d84025e03707e164 /drivers/net/dsa/microchip/ksz_ptp.h
parentc2977c61f32e0d54319d158a04cad5fd82c2afcf (diff)
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>
Diffstat (limited to 'drivers/net/dsa/microchip/ksz_ptp.h')
-rw-r--r--drivers/net/dsa/microchip/ksz_ptp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/dsa/microchip/ksz_ptp.h b/drivers/net/dsa/microchip/ksz_ptp.h
index 7bb3fde2dd14..2c29a0b604bb 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.h
+++ b/drivers/net/dsa/microchip/ksz_ptp.h
@@ -17,6 +17,9 @@ struct ksz_ptp_data {
struct ptp_clock *clock;
/* Serializes all operations on the PTP hardware clock */
struct mutex lock;
+ /* lock for accessing the clock_time */
+ spinlock_t clock_lock;
+ struct timespec64 clock_time;
};
int ksz_ptp_clock_register(struct dsa_switch *ds);