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 struct mdio_xpcs_args {
14 	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
15 	struct mii_bus *bus;
16 	int addr;
17 };
18 
19 struct mdio_xpcs_ops {
20 	int (*validate)(struct mdio_xpcs_args *xpcs,
21 			unsigned long *supported,
22 			struct phylink_link_state *state);
23 	int (*config)(struct mdio_xpcs_args *xpcs,
24 		      const struct phylink_link_state *state);
25 	int (*get_state)(struct mdio_xpcs_args *xpcs,
26 			 struct phylink_link_state *state);
27 	int (*link_up)(struct mdio_xpcs_args *xpcs, int speed,
28 		       phy_interface_t interface);
29 	int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
30 };
31 
32 #if IS_ENABLED(CONFIG_PCS_XPCS)
33 struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
34 #else
mdio_xpcs_get_ops(void)35 static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
36 {
37 	return NULL;
38 }
39 #endif
40 
41 #endif /* __LINUX_PCS_XPCS_H */
42