xref: /linux/drivers/net/phy/nxp-c45-tja11xx.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* NXP C45 PHY driver header file
3  * Copyright 2023 NXP
4  * Author: Radu Pirea <radu-nicolae.pirea@oss.nxp.com>
5  */
6 
7 #include <linux/ptp_clock_kernel.h>
8 
9 #define VEND1_PORT_FUNC_ENABLES		0x8048
10 
11 struct nxp_c45_macsec;
12 
13 struct nxp_c45_phy {
14 	const struct nxp_c45_phy_data *phy_data;
15 	struct phy_device *phydev;
16 	struct mii_timestamper mii_ts;
17 	struct ptp_clock *ptp_clock;
18 	struct ptp_clock_info caps;
19 	struct sk_buff_head tx_queue;
20 	struct sk_buff_head rx_queue;
21 	/* used to access the PTP registers atomic */
22 	struct mutex ptp_lock;
23 	int hwts_tx;
24 	int hwts_rx;
25 	u32 tx_delay;
26 	u32 rx_delay;
27 	struct timespec64 extts_ts;
28 	int extts_index;
29 	bool extts;
30 	struct nxp_c45_macsec *macsec;
31 	u32 flags;
32 };
33 
34 #if IS_ENABLED(CONFIG_MACSEC)
35 int nxp_c45_macsec_config_init(struct phy_device *phydev);
36 int nxp_c45_macsec_probe(struct phy_device *phydev);
37 void nxp_c45_macsec_remove(struct phy_device *phydev);
38 void nxp_c45_handle_macsec_interrupt(struct phy_device *phydev,
39 				     irqreturn_t *ret);
40 #else
41 static inline
42 int nxp_c45_macsec_config_init(struct phy_device *phydev)
43 {
44 	return 0;
45 }
46 
47 static inline
48 int nxp_c45_macsec_probe(struct phy_device *phydev)
49 {
50 	return 0;
51 }
52 
53 static inline
54 void nxp_c45_macsec_remove(struct phy_device *phydev)
55 {
56 }
57 
58 static inline
59 void nxp_c45_handle_macsec_interrupt(struct phy_device *phydev,
60 				     irqreturn_t *ret)
61 {
62 }
63 #endif
64