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