1
2
3
4
5
6
7#ifndef K3_CPTS_H_
8#define K3_CPTS_H_
9
10#include <linux/device.h>
11#include <linux/of.h>
12
13struct am65_cpts;
14
15struct am65_cpts_estf_cfg {
16 u64 ns_period;
17 u64 ns_start;
18};
19
20#if IS_ENABLED(CONFIG_TI_K3_AM65_CPTS)
21struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
22 struct device_node *node);
23int am65_cpts_phc_index(struct am65_cpts *cpts);
24void am65_cpts_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
25void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
26void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en);
27u64 am65_cpts_ns_gettime(struct am65_cpts *cpts);
28int am65_cpts_estf_enable(struct am65_cpts *cpts, int idx,
29 struct am65_cpts_estf_cfg *cfg);
30void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx);
31#else
32static inline struct am65_cpts *am65_cpts_create(struct device *dev,
33 void __iomem *regs,
34 struct device_node *node)
35{
36 return ERR_PTR(-EOPNOTSUPP);
37}
38
39static inline int am65_cpts_phc_index(struct am65_cpts *cpts)
40{
41 return -1;
42}
43
44static inline void am65_cpts_tx_timestamp(struct am65_cpts *cpts,
45 struct sk_buff *skb)
46{
47}
48
49static inline void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts,
50 struct sk_buff *skb)
51{
52}
53
54static inline void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en)
55{
56}
57
58static inline s64 am65_cpts_ns_gettime(struct am65_cpts *cpts)
59{
60 return 0;
61}
62
63static inline int am65_cpts_estf_enable(struct am65_cpts *cpts, int idx,
64 struct am65_cpts_estf_cfg *cfg)
65{
66 return 0;
67}
68
69static inline void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx)
70{
71}
72#endif
73
74#endif
75