xref: /openbmc/linux/include/linux/pcs/pcs-xpcs.h (revision b97b5331)
12fa4e4b7SAndrew Lunn /* SPDX-License-Identifier: GPL-2.0 */
22fa4e4b7SAndrew Lunn /*
32fa4e4b7SAndrew Lunn  * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates.
42fa4e4b7SAndrew Lunn  * Synopsys DesignWare XPCS helpers
52fa4e4b7SAndrew Lunn  */
62fa4e4b7SAndrew Lunn 
72fa4e4b7SAndrew Lunn #ifndef __LINUX_PCS_XPCS_H
82fa4e4b7SAndrew Lunn #define __LINUX_PCS_XPCS_H
92fa4e4b7SAndrew Lunn 
102fa4e4b7SAndrew Lunn #include <linux/phy.h>
112fa4e4b7SAndrew Lunn #include <linux/phylink.h>
122fa4e4b7SAndrew Lunn 
1307a4bc51SOng Boon Leong /* AN mode */
1407a4bc51SOng Boon Leong #define DW_AN_C73			1
15*b97b5331SOng Boon Leong #define DW_AN_C37_SGMII			2
1607a4bc51SOng Boon Leong 
172fa4e4b7SAndrew Lunn struct mdio_xpcs_args {
182fa4e4b7SAndrew Lunn 	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
192fa4e4b7SAndrew Lunn 	struct mii_bus *bus;
202fa4e4b7SAndrew Lunn 	int addr;
2107a4bc51SOng Boon Leong 	int an_mode;
222fa4e4b7SAndrew Lunn };
232fa4e4b7SAndrew Lunn 
242fa4e4b7SAndrew Lunn struct mdio_xpcs_ops {
252fa4e4b7SAndrew Lunn 	int (*validate)(struct mdio_xpcs_args *xpcs,
262fa4e4b7SAndrew Lunn 			unsigned long *supported,
272fa4e4b7SAndrew Lunn 			struct phylink_link_state *state);
282fa4e4b7SAndrew Lunn 	int (*config)(struct mdio_xpcs_args *xpcs,
292fa4e4b7SAndrew Lunn 		      const struct phylink_link_state *state);
302fa4e4b7SAndrew Lunn 	int (*get_state)(struct mdio_xpcs_args *xpcs,
312fa4e4b7SAndrew Lunn 			 struct phylink_link_state *state);
322fa4e4b7SAndrew Lunn 	int (*link_up)(struct mdio_xpcs_args *xpcs, int speed,
332fa4e4b7SAndrew Lunn 		       phy_interface_t interface);
342fa4e4b7SAndrew Lunn 	int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
352fa4e4b7SAndrew Lunn };
362fa4e4b7SAndrew Lunn 
372fa4e4b7SAndrew Lunn #if IS_ENABLED(CONFIG_PCS_XPCS)
382fa4e4b7SAndrew Lunn struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
392fa4e4b7SAndrew Lunn #else
402fa4e4b7SAndrew Lunn static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
412fa4e4b7SAndrew Lunn {
422fa4e4b7SAndrew Lunn 	return NULL;
432fa4e4b7SAndrew Lunn }
442fa4e4b7SAndrew Lunn #endif
452fa4e4b7SAndrew Lunn 
462fa4e4b7SAndrew Lunn #endif /* __LINUX_PCS_XPCS_H */
47