xref: /linux/drivers/net/ethernet/ti/icssg/icss_iep.h (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Texas Instruments ICSSG Industrial Ethernet Peripheral (IEP) Driver
3  *
4  * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
5  *
6  */
7 
8 #ifndef __NET_TI_ICSS_IEP_H
9 #define __NET_TI_ICSS_IEP_H
10 
11 #include <linux/mutex.h>
12 #include <linux/ptp_clock_kernel.h>
13 #include <linux/regmap.h>
14 
15 struct icss_iep;
16 extern const struct icss_iep_clockops prueth_iep_clockops;
17 
18 /* Firmware specific clock operations */
19 struct icss_iep_clockops {
20 	void (*settime)(void *clockops_data, u64 ns);
21 	void (*adjtime)(void *clockops_data, s64 delta);
22 	u64 (*gettime)(void *clockops_data, struct ptp_system_timestamp *sts);
23 	int (*perout_enable)(void *clockops_data,
24 			     struct ptp_perout_request *req, int on,
25 			     u64 *cmp);
26 	int (*extts_enable)(void *clockops_data, u32 index, int on);
27 };
28 
29 struct icss_iep *icss_iep_get(struct device_node *np);
30 struct icss_iep *icss_iep_get_idx(struct device_node *np, int idx);
31 void icss_iep_put(struct icss_iep *iep);
32 int icss_iep_init(struct icss_iep *iep, const struct icss_iep_clockops *clkops,
33 		  void *clockops_data, u32 cycle_time_ns);
34 int icss_iep_exit(struct icss_iep *iep);
35 int icss_iep_get_count_low(struct icss_iep *iep);
36 int icss_iep_get_count_hi(struct icss_iep *iep);
37 int icss_iep_get_ptp_clock_idx(struct icss_iep *iep);
38 void icss_iep_init_fw(struct icss_iep *iep);
39 void icss_iep_exit_fw(struct icss_iep *iep);
40 
41 #endif /* __NET_TI_ICSS_IEP_H */
42