am65-cpts.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /* TI K3 AM65 CPTS driver interface
  3. *
  4. * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com
  5. */
  6. #ifndef K3_CPTS_H_
  7. #define K3_CPTS_H_
  8. #include <linux/device.h>
  9. #include <linux/of.h>
  10. struct am65_cpts;
  11. struct am65_cpts_estf_cfg {
  12. u64 ns_period;
  13. u64 ns_start;
  14. };
  15. #if IS_ENABLED(CONFIG_TI_K3_AM65_CPTS)
  16. void am65_cpts_release(struct am65_cpts *cpts);
  17. struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
  18. struct device_node *node);
  19. int am65_cpts_phc_index(struct am65_cpts *cpts);
  20. void am65_cpts_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
  21. void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
  22. void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en);
  23. u64 am65_cpts_ns_gettime(struct am65_cpts *cpts);
  24. int am65_cpts_estf_enable(struct am65_cpts *cpts, int idx,
  25. struct am65_cpts_estf_cfg *cfg);
  26. void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx);
  27. #else
  28. static inline void am65_cpts_release(struct am65_cpts *cpts)
  29. {
  30. }
  31. static inline struct am65_cpts *am65_cpts_create(struct device *dev,
  32. void __iomem *regs,
  33. struct device_node *node)
  34. {
  35. return ERR_PTR(-EOPNOTSUPP);
  36. }
  37. static inline int am65_cpts_phc_index(struct am65_cpts *cpts)
  38. {
  39. return -1;
  40. }
  41. static inline void am65_cpts_tx_timestamp(struct am65_cpts *cpts,
  42. struct sk_buff *skb)
  43. {
  44. }
  45. static inline void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts,
  46. struct sk_buff *skb)
  47. {
  48. }
  49. static inline void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en)
  50. {
  51. }
  52. static inline s64 am65_cpts_ns_gettime(struct am65_cpts *cpts)
  53. {
  54. return 0;
  55. }
  56. static inline int am65_cpts_estf_enable(struct am65_cpts *cpts, int idx,
  57. struct am65_cpts_estf_cfg *cfg)
  58. {
  59. return 0;
  60. }
  61. static inline void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx)
  62. {
  63. }
  64. #endif
  65. #endif /* K3_CPTS_H_ */