xref: /linux/drivers/net/dsa/sja1105/sja1105_ptp.h (revision 52338415)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3  */
4 #ifndef _SJA1105_PTP_H
5 #define _SJA1105_PTP_H
6 
7 #if IS_ENABLED(CONFIG_NET_DSA_SJA1105_PTP)
8 
9 int sja1105_ptp_clock_register(struct sja1105_private *priv);
10 
11 void sja1105_ptp_clock_unregister(struct sja1105_private *priv);
12 
13 int sja1105_ptpegr_ts_poll(struct sja1105_private *priv, int port, u64 *ts);
14 
15 int sja1105et_ptp_cmd(const void *ctx, const void *data);
16 
17 int sja1105pqrs_ptp_cmd(const void *ctx, const void *data);
18 
19 int sja1105_get_ts_info(struct dsa_switch *ds, int port,
20 			struct ethtool_ts_info *ts);
21 
22 u64 sja1105_tstamp_reconstruct(struct sja1105_private *priv, u64 now,
23 			       u64 ts_partial);
24 
25 int sja1105_ptp_reset(struct sja1105_private *priv);
26 
27 #else
28 
29 static inline int sja1105_ptp_clock_register(struct sja1105_private *priv)
30 {
31 	return 0;
32 }
33 
34 static inline void sja1105_ptp_clock_unregister(struct sja1105_private *priv)
35 {
36 	return;
37 }
38 
39 static inline int
40 sja1105_ptpegr_ts_poll(struct sja1105_private *priv, int port, u64 *ts)
41 {
42 	return 0;
43 }
44 
45 static inline u64 sja1105_tstamp_reconstruct(struct sja1105_private *priv,
46 					     u64 now, u64 ts_partial)
47 {
48 	return 0;
49 }
50 
51 static inline int sja1105_ptp_reset(struct sja1105_private *priv)
52 {
53 	return 0;
54 }
55 
56 #define sja1105et_ptp_cmd NULL
57 
58 #define sja1105pqrs_ptp_cmd NULL
59 
60 #define sja1105_get_ts_info NULL
61 
62 #endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_PTP) */
63 
64 #endif /* _SJA1105_PTP_H */
65