gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / net / ethernet / aquantia / atlantic / aq_ptp.h
blob231906431a488ecae3c133ac9c7b749a17139de4
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Aquantia Corporation Network Driver
3 * Copyright (C) 2014-2019 Aquantia Corporation. All rights reserved
4 */
6 /* File aq_ptp.h: Declaration of PTP functions.
7 */
8 #ifndef AQ_PTP_H
9 #define AQ_PTP_H
11 #include <linux/net_tstamp.h>
13 #if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
15 /* Common functions */
16 int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec);
18 void aq_ptp_unregister(struct aq_nic_s *aq_nic);
19 void aq_ptp_free(struct aq_nic_s *aq_nic);
21 int aq_ptp_irq_alloc(struct aq_nic_s *aq_nic);
22 void aq_ptp_irq_free(struct aq_nic_s *aq_nic);
24 int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic);
25 void aq_ptp_ring_free(struct aq_nic_s *aq_nic);
27 int aq_ptp_ring_init(struct aq_nic_s *aq_nic);
28 int aq_ptp_ring_start(struct aq_nic_s *aq_nic);
29 void aq_ptp_ring_stop(struct aq_nic_s *aq_nic);
30 void aq_ptp_ring_deinit(struct aq_nic_s *aq_nic);
32 void aq_ptp_service_task(struct aq_nic_s *aq_nic);
34 void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic, unsigned int mbps);
36 void aq_ptp_clock_init(struct aq_nic_s *aq_nic);
38 /* Traffic processing functions */
39 int aq_ptp_xmit(struct aq_nic_s *aq_nic, struct sk_buff *skb);
40 void aq_ptp_tx_hwtstamp(struct aq_nic_s *aq_nic, u64 timestamp);
42 /* Must be to check available of PTP before call */
43 void aq_ptp_hwtstamp_config_get(struct aq_ptp_s *aq_ptp,
44 struct hwtstamp_config *config);
45 int aq_ptp_hwtstamp_config_set(struct aq_ptp_s *aq_ptp,
46 struct hwtstamp_config *config);
48 /* Return either ring is belong to PTP or not*/
49 bool aq_ptp_ring(struct aq_nic_s *aq_nic, struct aq_ring_s *ring);
51 u16 aq_ptp_extract_ts(struct aq_nic_s *aq_nic, struct sk_buff *skb, u8 *p,
52 unsigned int len);
54 struct ptp_clock *aq_ptp_get_ptp_clock(struct aq_ptp_s *aq_ptp);
56 int aq_ptp_link_change(struct aq_nic_s *aq_nic);
58 #else
60 static inline int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
62 return 0;
65 static inline void aq_ptp_unregister(struct aq_nic_s *aq_nic) {}
67 static inline void aq_ptp_free(struct aq_nic_s *aq_nic)
71 static inline int aq_ptp_irq_alloc(struct aq_nic_s *aq_nic)
73 return 0;
76 static inline void aq_ptp_irq_free(struct aq_nic_s *aq_nic)
80 static inline int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic)
82 return 0;
85 static inline void aq_ptp_ring_free(struct aq_nic_s *aq_nic) {}
87 static inline int aq_ptp_ring_init(struct aq_nic_s *aq_nic)
89 return 0;
92 static inline int aq_ptp_ring_start(struct aq_nic_s *aq_nic)
94 return 0;
97 static inline void aq_ptp_ring_stop(struct aq_nic_s *aq_nic) {}
98 static inline void aq_ptp_ring_deinit(struct aq_nic_s *aq_nic) {}
99 static inline void aq_ptp_service_task(struct aq_nic_s *aq_nic) {}
100 static inline void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic,
101 unsigned int mbps) {}
102 static inline void aq_ptp_clock_init(struct aq_nic_s *aq_nic) {}
103 static inline int aq_ptp_xmit(struct aq_nic_s *aq_nic, struct sk_buff *skb)
105 return -EOPNOTSUPP;
108 static inline void aq_ptp_tx_hwtstamp(struct aq_nic_s *aq_nic, u64 timestamp) {}
109 static inline void aq_ptp_hwtstamp_config_get(struct aq_ptp_s *aq_ptp,
110 struct hwtstamp_config *config) {}
111 static inline int aq_ptp_hwtstamp_config_set(struct aq_ptp_s *aq_ptp,
112 struct hwtstamp_config *config)
114 return 0;
117 static inline bool aq_ptp_ring(struct aq_nic_s *aq_nic, struct aq_ring_s *ring)
119 return false;
122 static inline u16 aq_ptp_extract_ts(struct aq_nic_s *aq_nic,
123 struct sk_buff *skb, u8 *p,
124 unsigned int len)
126 return 0;
129 static inline struct ptp_clock *aq_ptp_get_ptp_clock(struct aq_ptp_s *aq_ptp)
131 return NULL;
134 static inline int aq_ptp_link_change(struct aq_nic_s *aq_nic)
136 return 0;
138 #endif
140 #endif /* AQ_PTP_H */