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 13*07a4bc51SOng Boon Leong /* AN mode */ 14*07a4bc51SOng Boon Leong #define DW_AN_C73 1 15*07a4bc51SOng Boon Leong 162fa4e4b7SAndrew Lunn struct mdio_xpcs_args { 172fa4e4b7SAndrew Lunn __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); 182fa4e4b7SAndrew Lunn struct mii_bus *bus; 192fa4e4b7SAndrew Lunn int addr; 20*07a4bc51SOng Boon Leong int an_mode; 212fa4e4b7SAndrew Lunn }; 222fa4e4b7SAndrew Lunn 232fa4e4b7SAndrew Lunn struct mdio_xpcs_ops { 242fa4e4b7SAndrew Lunn int (*validate)(struct mdio_xpcs_args *xpcs, 252fa4e4b7SAndrew Lunn unsigned long *supported, 262fa4e4b7SAndrew Lunn struct phylink_link_state *state); 272fa4e4b7SAndrew Lunn int (*config)(struct mdio_xpcs_args *xpcs, 282fa4e4b7SAndrew Lunn const struct phylink_link_state *state); 292fa4e4b7SAndrew Lunn int (*get_state)(struct mdio_xpcs_args *xpcs, 302fa4e4b7SAndrew Lunn struct phylink_link_state *state); 312fa4e4b7SAndrew Lunn int (*link_up)(struct mdio_xpcs_args *xpcs, int speed, 322fa4e4b7SAndrew Lunn phy_interface_t interface); 332fa4e4b7SAndrew Lunn int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface); 342fa4e4b7SAndrew Lunn }; 352fa4e4b7SAndrew Lunn 362fa4e4b7SAndrew Lunn #if IS_ENABLED(CONFIG_PCS_XPCS) 372fa4e4b7SAndrew Lunn struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); 382fa4e4b7SAndrew Lunn #else 392fa4e4b7SAndrew Lunn static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void) 402fa4e4b7SAndrew Lunn { 412fa4e4b7SAndrew Lunn return NULL; 422fa4e4b7SAndrew Lunn } 432fa4e4b7SAndrew Lunn #endif 442fa4e4b7SAndrew Lunn 452fa4e4b7SAndrew Lunn #endif /* __LINUX_PCS_XPCS_H */ 46