ptp_fc3.h 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * PTP hardware clock driver for the FemtoClock3 family of timing and
  4. * synchronization devices.
  5. *
  6. * Copyright (C) 2023 Integrated Device Technology, Inc., a Renesas Company.
  7. */
  8. #ifndef PTP_IDTFC3_H
  9. #define PTP_IDTFC3_H
  10. #include <linux/ktime.h>
  11. #include <linux/ptp_clock.h>
  12. #include <linux/regmap.h>
  13. #define FW_FILENAME "idtfc3.bin"
  14. #define MAX_FFO_PPB (244000)
  15. #define TDC_GET_PERIOD (10)
  16. struct idtfc3 {
  17. struct ptp_clock_info caps;
  18. struct ptp_clock *ptp_clock;
  19. struct device *dev;
  20. /* Mutex to protect operations from being interrupted */
  21. struct mutex *lock;
  22. struct device *mfd;
  23. struct regmap *regmap;
  24. struct idtfc3_hw_param hw_param;
  25. u32 sub_sync_count;
  26. u32 ns_per_sync;
  27. int tdc_offset_sign;
  28. u64 tdc_apll_freq;
  29. u32 time_ref_freq;
  30. u16 fod_n;
  31. u8 lpf_mode;
  32. /* Time counter */
  33. u32 last_counter;
  34. s64 ns;
  35. u32 ns_per_counter;
  36. u32 tc_update_period;
  37. u32 tc_write_timeout;
  38. s64 tod_write_overhead;
  39. };
  40. #endif /* PTP_IDTFC3_H */