xref: /openbmc/linux/include/linux/pcs/pcs-xpcs.h (revision 9900074e)
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
15b97b5331SOng Boon Leong #define DW_AN_C37_SGMII			2
1607a4bc51SOng Boon Leong 
17*9900074eSVladimir Oltean struct xpcs_id;
18*9900074eSVladimir Oltean 
192fa4e4b7SAndrew Lunn struct mdio_xpcs_args {
202fa4e4b7SAndrew Lunn 	struct mii_bus *bus;
21*9900074eSVladimir Oltean 	const struct xpcs_id *id;
222fa4e4b7SAndrew Lunn 	int addr;
232fa4e4b7SAndrew Lunn };
242fa4e4b7SAndrew Lunn 
252fa4e4b7SAndrew Lunn struct mdio_xpcs_ops {
262fa4e4b7SAndrew Lunn 	int (*validate)(struct mdio_xpcs_args *xpcs,
272fa4e4b7SAndrew Lunn 			unsigned long *supported,
282fa4e4b7SAndrew Lunn 			struct phylink_link_state *state);
292fa4e4b7SAndrew Lunn 	int (*config)(struct mdio_xpcs_args *xpcs,
302fa4e4b7SAndrew Lunn 		      const struct phylink_link_state *state);
312fa4e4b7SAndrew Lunn 	int (*get_state)(struct mdio_xpcs_args *xpcs,
322fa4e4b7SAndrew Lunn 			 struct phylink_link_state *state);
332fa4e4b7SAndrew Lunn 	int (*link_up)(struct mdio_xpcs_args *xpcs, int speed,
342fa4e4b7SAndrew Lunn 		       phy_interface_t interface);
352fa4e4b7SAndrew Lunn 	int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
367617af3dSMichael Sit Wei Hong 	int (*config_eee)(struct mdio_xpcs_args *xpcs, int mult_fact_100ns,
377617af3dSMichael Sit Wei Hong 			  int enable);
382fa4e4b7SAndrew Lunn };
392fa4e4b7SAndrew Lunn 
40*9900074eSVladimir Oltean int xpcs_get_an_mode(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
412fa4e4b7SAndrew Lunn struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
422fa4e4b7SAndrew Lunn 
432fa4e4b7SAndrew Lunn #endif /* __LINUX_PCS_XPCS_H */
44