xref: /linux/drivers/net/dsa/sja1105/sja1105_ptp.h (revision 61c77126278eb950010d2ed944c3bc09d10e0eb4)
1bb77f36aSVladimir Oltean /* SPDX-License-Identifier: GPL-2.0
2bb77f36aSVladimir Oltean  * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3bb77f36aSVladimir Oltean  */
4bb77f36aSVladimir Oltean #ifndef _SJA1105_PTP_H
5bb77f36aSVladimir Oltean #define _SJA1105_PTP_H
6bb77f36aSVladimir Oltean 
7bb77f36aSVladimir Oltean #if IS_ENABLED(CONFIG_NET_DSA_SJA1105_PTP)
8bb77f36aSVladimir Oltean 
9*61c77126SVladimir Oltean int sja1105_ptp_clock_register(struct dsa_switch *ds);
10bb77f36aSVladimir Oltean 
11*61c77126SVladimir Oltean void sja1105_ptp_clock_unregister(struct dsa_switch *ds);
12bb77f36aSVladimir Oltean 
13*61c77126SVladimir Oltean int sja1105_ptpegr_ts_poll(struct dsa_switch *ds, int port, u64 *ts);
1447ed985eSVladimir Oltean 
15*61c77126SVladimir Oltean int sja1105et_ptp_cmd(const struct dsa_switch *ds, const void *data);
16bb77f36aSVladimir Oltean 
17*61c77126SVladimir Oltean int sja1105pqrs_ptp_cmd(const struct dsa_switch *ds, const void *data);
18bb77f36aSVladimir Oltean 
19bb77f36aSVladimir Oltean int sja1105_get_ts_info(struct dsa_switch *ds, int port,
20bb77f36aSVladimir Oltean 			struct ethtool_ts_info *ts);
21bb77f36aSVladimir Oltean 
22*61c77126SVladimir Oltean u64 sja1105_tstamp_reconstruct(struct dsa_switch *ds, u64 now, u64 ts_partial);
2347ed985eSVladimir Oltean 
24*61c77126SVladimir Oltean int sja1105_ptp_reset(struct dsa_switch *ds);
25bb77f36aSVladimir Oltean 
26bb77f36aSVladimir Oltean #else
27bb77f36aSVladimir Oltean 
28*61c77126SVladimir Oltean static inline int sja1105_ptp_clock_register(struct dsa_switch *ds)
29bb77f36aSVladimir Oltean {
30bb77f36aSVladimir Oltean 	return 0;
31bb77f36aSVladimir Oltean }
32bb77f36aSVladimir Oltean 
33*61c77126SVladimir Oltean static inline void sja1105_ptp_clock_unregister(struct dsa_switch *ds) { }
34bb77f36aSVladimir Oltean 
3547ed985eSVladimir Oltean static inline int
36*61c77126SVladimir Oltean sja1105_ptpegr_ts_poll(struct dsa_switch *ds, int port, u64 *ts)
3747ed985eSVladimir Oltean {
3847ed985eSVladimir Oltean 	return 0;
3947ed985eSVladimir Oltean }
4047ed985eSVladimir Oltean 
41*61c77126SVladimir Oltean static inline u64 sja1105_tstamp_reconstruct(struct dsa_switch *ds,
4247ed985eSVladimir Oltean 					     u64 now, u64 ts_partial)
4347ed985eSVladimir Oltean {
4447ed985eSVladimir Oltean 	return 0;
4547ed985eSVladimir Oltean }
4647ed985eSVladimir Oltean 
47*61c77126SVladimir Oltean static inline int sja1105_ptp_reset(struct dsa_switch *ds)
48bb77f36aSVladimir Oltean {
49bb77f36aSVladimir Oltean 	return 0;
50bb77f36aSVladimir Oltean }
51bb77f36aSVladimir Oltean 
52bb77f36aSVladimir Oltean #define sja1105et_ptp_cmd NULL
53bb77f36aSVladimir Oltean 
54bb77f36aSVladimir Oltean #define sja1105pqrs_ptp_cmd NULL
55bb77f36aSVladimir Oltean 
56bb77f36aSVladimir Oltean #define sja1105_get_ts_info NULL
57bb77f36aSVladimir Oltean 
58bb77f36aSVladimir Oltean #endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_PTP) */
59bb77f36aSVladimir Oltean 
60bb77f36aSVladimir Oltean #endif /* _SJA1105_PTP_H */
61