1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Microchip KSZ PTP Implementation 3 * 4 * Copyright (C) 2020 ARRI Lighting 5 * Copyright (C) 2022 Microchip Technology Inc. 6 */ 7 8 #ifndef _NET_DSA_DRIVERS_KSZ_PTP_H 9 #define _NET_DSA_DRIVERS_KSZ_PTP_H 10 11 #if IS_ENABLED(CONFIG_NET_DSA_MICROCHIP_KSZ_PTP) 12 13 #include <linux/ptp_clock_kernel.h> 14 15 struct ksz_ptp_data { 16 struct ptp_clock_info caps; 17 struct ptp_clock *clock; 18 /* Serializes all operations on the PTP hardware clock */ 19 struct mutex lock; 20 }; 21 22 int ksz_ptp_clock_register(struct dsa_switch *ds); 23 24 void ksz_ptp_clock_unregister(struct dsa_switch *ds); 25 26 int ksz_get_ts_info(struct dsa_switch *ds, int port, 27 struct ethtool_ts_info *ts); 28 int ksz_hwtstamp_get(struct dsa_switch *ds, int port, struct ifreq *ifr); 29 int ksz_hwtstamp_set(struct dsa_switch *ds, int port, struct ifreq *ifr); 30 31 #else 32 33 struct ksz_ptp_data { 34 /* Serializes all operations on the PTP hardware clock */ 35 struct mutex lock; 36 }; 37 38 static inline int ksz_ptp_clock_register(struct dsa_switch *ds) 39 { 40 return 0; 41 } 42 43 static inline void ksz_ptp_clock_unregister(struct dsa_switch *ds) { } 44 45 #define ksz_get_ts_info NULL 46 47 #define ksz_hwtstamp_get NULL 48 49 #define ksz_hwtstamp_set NULL 50 51 #endif /* End of CONFIG_NET_DSA_MICROCHIP_KSZ_PTP */ 52 53 #endif 54