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 
7 #ifndef K3_CPTS_H_
8 #define K3_CPTS_H_
9 
10 #include <linux/device.h>
11 #include <linux/of.h>
12 
13 struct am65_cpts;
14 
15 #if IS_ENABLED(CONFIG_TI_K3_AM65_CPTS)
16 struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
17 				   struct device_node *node);
18 int am65_cpts_phc_index(struct am65_cpts *cpts);
19 void am65_cpts_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
20 void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts, struct sk_buff *skb);
21 void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en);
22 #else
23 static inline struct am65_cpts *am65_cpts_create(struct device *dev,
24 						 void __iomem *regs,
25 						 struct device_node *node)
26 {
27 	return ERR_PTR(-EOPNOTSUPP);
28 }
29 
30 static inline int am65_cpts_phc_index(struct am65_cpts *cpts)
31 {
32 	return -1;
33 }
34 
35 static inline void am65_cpts_tx_timestamp(struct am65_cpts *cpts,
36 					  struct sk_buff *skb)
37 {
38 }
39 
40 static inline void am65_cpts_prep_tx_timestamp(struct am65_cpts *cpts,
41 					       struct sk_buff *skb)
42 {
43 }
44 
45 static inline void am65_cpts_rx_enable(struct am65_cpts *cpts, bool en)
46 {
47 }
48 #endif
49 
50 #endif /* K3_CPTS_H_ */
51