xref: /openbmc/linux/include/linux/pcs/pcs-xpcs.h (revision f629acc6)
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 
13dd0721eaSVladimir Oltean #define NXP_SJA1105_XPCS_ID		0x00000010
14f7380bbaSVladimir Oltean #define NXP_SJA1110_XPCS_ID		0x00000020
15dd0721eaSVladimir Oltean 
1607a4bc51SOng Boon Leong /* AN mode */
1707a4bc51SOng Boon Leong #define DW_AN_C73			1
18b97b5331SOng Boon Leong #define DW_AN_C37_SGMII			2
19f27abde3SVoon Weifeng #define DW_2500BASEX			3
20b47aec88SOng Boon Leong #define DW_AN_C37_1000BASEX		4
21af8de1e3SJiawen Wu #define DW_10GBASER			5
2207a4bc51SOng Boon Leong 
23d55595f0SJiawen Wu /* device vendor OUI */
24d55595f0SJiawen Wu #define DW_OUI_WX			0x0018fc80
25d55595f0SJiawen Wu 
26d55595f0SJiawen Wu /* dev_flag */
27d55595f0SJiawen Wu #define DW_DEV_TXGBE			BIT(0)
28d55595f0SJiawen Wu 
299900074eSVladimir Oltean struct xpcs_id;
309900074eSVladimir Oltean 
315673ef86SVladimir Oltean struct dw_xpcs {
322cac15daSVladimir Oltean 	struct mdio_device *mdiodev;
339900074eSVladimir Oltean 	const struct xpcs_id *id;
3411059740SVladimir Oltean 	struct phylink_pcs pcs;
35*f629acc6SJiawen Wu 	phy_interface_t interface;
36d55595f0SJiawen Wu 	int dev_flag;
372fa4e4b7SAndrew Lunn };
382fa4e4b7SAndrew Lunn 
395673ef86SVladimir Oltean int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);
40a3a47cfbSRussell King (Oracle) void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
41a853c68eSVladimir Oltean 		  phy_interface_t interface, int speed, int duplex);
42a853c68eSVladimir Oltean int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
43a3a47cfbSRussell King (Oracle) 		   const unsigned long *advertising, unsigned int neg_mode);
44be6ec5b7SRussell King (Oracle) void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces);
455673ef86SVladimir Oltean int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
4614b517cbSVladimir Oltean 		    int enable);
479a5d500cSRussell King (Oracle) struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr,
489a5d500cSRussell King (Oracle) 				    phy_interface_t interface);
495673ef86SVladimir Oltean void xpcs_destroy(struct dw_xpcs *xpcs);
502fa4e4b7SAndrew Lunn 
512fa4e4b7SAndrew Lunn #endif /* __LINUX_PCS_XPCS_H */
52