blob: 52bc8e487ef7d3442b562ffd9907027e53a310c4 [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;
Moritz Fischerebe26ac2019-09-03 11:46:52 -070014struct gpio_desc;
Thomas Petazzonia7595122014-05-16 16:14:04 +020015
David S. Miller6539c442014-12-16 14:30:09 -050016#if IS_ENABLED(CONFIG_FIXED_PHY)
Joakim Tjernlundb3e54642018-12-14 15:17:05 +010017extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
Vitaly Borduga79d8e92007-12-07 01:51:22 +030018extern int fixed_phy_add(unsigned int irq, int phy_id,
Linus Walleij5468e822019-02-04 11:26:18 +010019 struct fixed_phy_status *status);
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070020extern struct phy_device *fixed_phy_register(unsigned int irq,
21 struct fixed_phy_status *status,
22 struct device_node *np);
Moritz Fischer71bd1062019-02-07 09:52:10 -080023
24extern struct phy_device *
25fixed_phy_register_with_gpiod(unsigned int irq,
26 struct fixed_phy_status *status,
27 struct gpio_desc *gpiod);
28
Andrew Lunn5bcbe0f2016-03-12 00:01:40 +010029extern void fixed_phy_unregister(struct phy_device *phydev);
Florian Fainelli464c3662014-08-27 17:04:48 -070030extern int fixed_phy_set_link_update(struct phy_device *phydev,
31 int (*link_update)(struct net_device *,
32 struct fixed_phy_status *));
Vitaly Borduga79d8e92007-12-07 01:51:22 +030033#else
34static inline int fixed_phy_add(unsigned int irq, int phy_id,
Linus Walleij5468e822019-02-04 11:26:18 +010035 struct fixed_phy_status *status)
Vitaly Borduga79d8e92007-12-07 01:51:22 +030036{
37 return -ENODEV;
38}
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070039static inline struct phy_device *fixed_phy_register(unsigned int irq,
40 struct fixed_phy_status *status,
41 struct device_node *np)
Thomas Petazzonia7595122014-05-16 16:14:04 +020042{
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070043 return ERR_PTR(-ENODEV);
Thomas Petazzonia7595122014-05-16 16:14:04 +020044}
Moritz Fischer71bd1062019-02-07 09:52:10 -080045
46static inline struct phy_device *
47fixed_phy_register_with_gpiod(unsigned int irq,
48 struct fixed_phy_status *status,
49 struct gpio_desc *gpiod)
50{
51 return ERR_PTR(-ENODEV);
52}
53
Andrew Lunn5bcbe0f2016-03-12 00:01:40 +010054static inline void fixed_phy_unregister(struct phy_device *phydev)
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020055{
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020056}
Florian Fainelli464c3662014-08-27 17:04:48 -070057static inline int fixed_phy_set_link_update(struct phy_device *phydev,
Vitaly Borduga79d8e92007-12-07 01:51:22 +030058 int (*link_update)(struct net_device *,
Florian Fainelli464c3662014-08-27 17:04:48 -070059 struct fixed_phy_status *))
60{
61 return -ENODEV;
62}
Joakim Tjernlundb3e54642018-12-14 15:17:05 +010063static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
64{
65 return -EINVAL;
66}
Florian Fainelli464c3662014-08-27 17:04:48 -070067#endif /* CONFIG_FIXED_PHY */
Vitaly Bordug7c32f472007-08-10 14:05:16 -070068
69#endif /* __PHY_FIXED_H */