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 132fa4e4b7SAndrew Lunn struct mdio_xpcs_args { 142fa4e4b7SAndrew Lunn __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); 152fa4e4b7SAndrew Lunn struct mii_bus *bus; 162fa4e4b7SAndrew Lunn int addr; 172fa4e4b7SAndrew Lunn }; 182fa4e4b7SAndrew Lunn 192fa4e4b7SAndrew Lunn struct mdio_xpcs_ops { 202fa4e4b7SAndrew Lunn int (*validate)(struct mdio_xpcs_args *xpcs, 212fa4e4b7SAndrew Lunn unsigned long *supported, 222fa4e4b7SAndrew Lunn struct phylink_link_state *state); 232fa4e4b7SAndrew Lunn int (*config)(struct mdio_xpcs_args *xpcs, 242fa4e4b7SAndrew Lunn const struct phylink_link_state *state); 252fa4e4b7SAndrew Lunn int (*get_state)(struct mdio_xpcs_args *xpcs, 262fa4e4b7SAndrew Lunn struct phylink_link_state *state); 272fa4e4b7SAndrew Lunn int (*link_up)(struct mdio_xpcs_args *xpcs, int speed, 282fa4e4b7SAndrew Lunn phy_interface_t interface); 292fa4e4b7SAndrew Lunn int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface); 302fa4e4b7SAndrew Lunn }; 312fa4e4b7SAndrew Lunn 322fa4e4b7SAndrew Lunn #if IS_ENABLED(CONFIG_PCS_XPCS) 332fa4e4b7SAndrew Lunn struct mdio_xpcs_ops *mdio_xpcs_get_ops(void); 342fa4e4b7SAndrew Lunn #else 352fa4e4b7SAndrew Lunn static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void) 362fa4e4b7SAndrew Lunn { 372fa4e4b7SAndrew Lunn return NULL; 382fa4e4b7SAndrew Lunn } 392fa4e4b7SAndrew Lunn #endif 402fa4e4b7SAndrew Lunn 412fa4e4b7SAndrew Lunn #endif /* __LINUX_PCS_XPCS_H */ 42