blob: 1e5d86ebdaeb54cb5718ff10c8a8f74adc3a8efc [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Vitaly Bordug7c32f472007-08-10 14:05:16 -07002#ifndef __PHY_FIXED_H
3#define __PHY_FIXED_H
4
Vitaly Bordug7c32f472007-08-10 14:05:16 -07005struct fixed_phy_status {
Vitaly Borduga79d8e92007-12-07 01:51:22 +03006 int link;
7 int speed;
8 int duplex;
9 int pause;
10 int asym_pause;
Vitaly Bordug7c32f472007-08-10 14:05:16 -070011};
12
Thomas Petazzonia7595122014-05-16 16:14:04 +020013struct device_node;
14
David S. Miller6539c442014-12-16 14:30:09 -050015#if IS_ENABLED(CONFIG_FIXED_PHY)
Joakim Tjernlundb3e54642018-12-14 15:17:05 +010016extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
Vitaly Borduga79d8e92007-12-07 01:51:22 +030017extern int fixed_phy_add(unsigned int irq, int phy_id,
Linus Walleij5468e822019-02-04 11:26:18 +010018 struct fixed_phy_status *status);
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070019extern struct phy_device *fixed_phy_register(unsigned int irq,
20 struct fixed_phy_status *status,
21 struct device_node *np);
Moritz Fischer71bd1062019-02-07 09:52:10 -080022
23extern struct phy_device *
24fixed_phy_register_with_gpiod(unsigned int irq,
25 struct fixed_phy_status *status,
26 struct gpio_desc *gpiod);
27
Andrew Lunn5bcbe0f2016-03-12 00:01:40 +010028extern void fixed_phy_unregister(struct phy_device *phydev);
Florian Fainelli464c3662014-08-27 17:04:48 -070029extern int fixed_phy_set_link_update(struct phy_device *phydev,
30 int (*link_update)(struct net_device *,
31 struct fixed_phy_status *));
Vitaly Borduga79d8e92007-12-07 01:51:22 +030032#else
33static inline int fixed_phy_add(unsigned int irq, int phy_id,
Linus Walleij5468e822019-02-04 11:26:18 +010034 struct fixed_phy_status *status)
Vitaly Borduga79d8e92007-12-07 01:51:22 +030035{
36 return -ENODEV;
37}
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070038static inline struct phy_device *fixed_phy_register(unsigned int irq,
39 struct fixed_phy_status *status,
40 struct device_node *np)
Thomas Petazzonia7595122014-05-16 16:14:04 +020041{
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070042 return ERR_PTR(-ENODEV);
Thomas Petazzonia7595122014-05-16 16:14:04 +020043}
Moritz Fischer71bd1062019-02-07 09:52:10 -080044
45static inline struct phy_device *
46fixed_phy_register_with_gpiod(unsigned int irq,
47 struct fixed_phy_status *status,
48 struct gpio_desc *gpiod)
49{
50 return ERR_PTR(-ENODEV);
51}
52
Andrew Lunn5bcbe0f2016-03-12 00:01:40 +010053static inline void fixed_phy_unregister(struct phy_device *phydev)
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020054{
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020055}
Florian Fainelli464c3662014-08-27 17:04:48 -070056static inline int fixed_phy_set_link_update(struct phy_device *phydev,
Vitaly Borduga79d8e92007-12-07 01:51:22 +030057 int (*link_update)(struct net_device *,
Florian Fainelli464c3662014-08-27 17:04:48 -070058 struct fixed_phy_status *))
59{
60 return -ENODEV;
61}
Joakim Tjernlundb3e54642018-12-14 15:17:05 +010062static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
63{
64 return -EINVAL;
65}
Florian Fainelli464c3662014-08-27 17:04:48 -070066#endif /* CONFIG_FIXED_PHY */
Vitaly Bordug7c32f472007-08-10 14:05:16 -070067
68#endif /* __PHY_FIXED_H */