xref: /openbmc/linux/include/linux/pcs/pcs-xpcs.h (revision e3211e41)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates.
4  * Synopsys DesignWare XPCS helpers
5  */
6 
7 #ifndef __LINUX_PCS_XPCS_H
8 #define __LINUX_PCS_XPCS_H
9 
10 #include <linux/phy.h>
11 #include <linux/phylink.h>
12 
13 /* AN mode */
14 #define DW_AN_C73			1
15 #define DW_AN_C37_SGMII			2
16 
17 struct mdio_xpcs_args {
18 	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
19 	struct mii_bus *bus;
20 	int addr;
21 	int an_mode;
22 };
23 
24 struct mdio_xpcs_ops {
25 	int (*validate)(struct mdio_xpcs_args *xpcs,
26 			unsigned long *supported,
27 			struct phylink_link_state *state);
28 	int (*config)(struct mdio_xpcs_args *xpcs,
29 		      const struct phylink_link_state *state);
30 	int (*get_state)(struct mdio_xpcs_args *xpcs,
31 			 struct phylink_link_state *state);
32 	int (*link_up)(struct mdio_xpcs_args *xpcs, int speed,
33 		       phy_interface_t interface);
34 	int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
35 };
36 
37 #if IS_ENABLED(CONFIG_PCS_XPCS)
38 struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
39 #else
40 static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
41 {
42 	return NULL;
43 }
44 #endif
45 
46 #endif /* __LINUX_PCS_XPCS_H */
47