blob: 9a841aa5982dc1ba7c63da6cb097802066a42804 [file] [log] [blame]
Jose Abreufcb26bd2020-03-09 09:36:26 +01001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates.
4 * Synopsys DesignWare XPCS helpers
5 */
6
7#ifndef __LINUX_MDIO_XPCS_H
8#define __LINUX_MDIO_XPCS_H
9
10#include <linux/phy.h>
11#include <linux/phylink.h>
12
13struct mdio_xpcs_args {
14 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
15 struct mii_bus *bus;
16 int addr;
17};
18
19struct mdio_xpcs_ops {
20 int (*validate)(struct mdio_xpcs_args *xpcs,
21 unsigned long *supported,
22 struct phylink_link_state *state);
23 int (*config)(struct mdio_xpcs_args *xpcs,
24 const struct phylink_link_state *state);
25 int (*get_state)(struct mdio_xpcs_args *xpcs,
26 struct phylink_link_state *state);
27 int (*link_up)(struct mdio_xpcs_args *xpcs, int speed,
28 phy_interface_t interface);
29 int (*probe)(struct mdio_xpcs_args *xpcs, phy_interface_t interface);
30};
31
32#if IS_ENABLED(CONFIG_MDIO_XPCS)
33struct mdio_xpcs_ops *mdio_xpcs_get_ops(void);
34#else
35static inline struct mdio_xpcs_ops *mdio_xpcs_get_ops(void)
36{
37 return NULL;
38}
39#endif
40
41#endif /* __LINUX_MDIO_XPCS_H */