0001
0002
0003
0004
0005
0006
0007 #ifndef K3_CPTS_H_
0008 #define K3_CPTS_H_
0009
0010 #include <linux/device.h>
0011 #include <linux/of.h>
0012
0013 struct am65_cpts;
0014
0015 struct am65_cpts_estf_cfg {
0016 u64 ns_period;
0017 u64 ns_start;
0018 };
0019
0020 #if IS_ENABLED(CONFIG_TI_K3_AM65_CPTS)
0021 struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
0022 struct device_node *node);
0023 int am65_cpts_phc_index(struct am65_cpts *cpts);
0024 void am65_cpts_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
0025 void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
0026 void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en);
0027 u64 am65_cpts_ns_gettime(struct am65_cpts *cpts);
0028 int am65_cpts_estf_enable(struct am65_cpts *cpts, int idx,
0029 struct am65_cpts_estf_cfg *cfg);
0030 void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx);
0031 #else
0032 static inline struct am65_cpts *am65_cpts_create(struct device *dev,
0033 void __iomem *regs,
0034 struct device_node *node)
0035 {
0036 return ERR_PTR(-EOPNOTSUPP);
0037 }
0038
0039 static inline int am65_cpts_phc_index(struct am65_cpts *cpts)
0040 {
0041 return -1;
0042 }
0043
0044 static inline void am65_cpts_tx_timestamp(struct am65_cpts *cpts,
0045 struct sk_buff *skb)
0046 {
0047 }
0048
0049 static inline void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts,
0050 struct sk_buff *skb)
0051 {
0052 }
0053
0054 static inline void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en)
0055 {
0056 }
0057
0058 static inline s64 am65_cpts_ns_gettime(struct am65_cpts *cpts)
0059 {
0060 return 0;
0061 }
0062
0063 static inline int am65_cpts_estf_enable(struct am65_cpts *cpts, int idx,
0064 struct am65_cpts_estf_cfg *cfg)
0065 {
0066 return 0;
0067 }
0068
0069 static inline void am65_cpts_estf_disable(struct am65_cpts *cpts, int idx)
0070 {
0071 }
0072 #endif
0073
0074 #endif