blob: 1d41ec44e39da375abd79c167c227a3daa5a3305 [file] [log] [blame]
Vitaly Bordug7c32f472007-08-10 14:05:16 -07001#ifndef __PHY_FIXED_H
2#define __PHY_FIXED_H
3
Vitaly Bordug7c32f472007-08-10 14:05:16 -07004struct fixed_phy_status {
Vitaly Borduga79d8e92007-12-07 01:51:22 +03005 int link;
6 int speed;
7 int duplex;
8 int pause;
9 int asym_pause;
Vitaly Bordug7c32f472007-08-10 14:05:16 -070010};
11
Thomas Petazzonia7595122014-05-16 16:14:04 +020012struct device_node;
13
David S. Miller6539c442014-12-16 14:30:09 -050014#if IS_ENABLED(CONFIG_FIXED_PHY)
Vitaly Borduga79d8e92007-12-07 01:51:22 +030015extern int fixed_phy_add(unsigned int irq, int phy_id,
Andrew Lunna5597002015-08-31 15:56:53 +020016 struct fixed_phy_status *status,
17 int link_gpio);
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070018extern struct phy_device *fixed_phy_register(unsigned int irq,
19 struct fixed_phy_status *status,
Andrew Lunna5597002015-08-31 15:56:53 +020020 int link_gpio,
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070021 struct device_node *np);
Andrew Lunn5bcbe0f2016-03-12 00:01:40 +010022extern void fixed_phy_unregister(struct phy_device *phydev);
Florian Fainelli464c3662014-08-27 17:04:48 -070023extern int fixed_phy_set_link_update(struct phy_device *phydev,
24 int (*link_update)(struct net_device *,
25 struct fixed_phy_status *));
Stas Sergeeva3bebdc2015-04-01 20:30:31 +030026extern int fixed_phy_update_state(struct phy_device *phydev,
27 const struct fixed_phy_status *status,
28 const struct fixed_phy_status *changed);
Vitaly Borduga79d8e92007-12-07 01:51:22 +030029#else
30static inline int fixed_phy_add(unsigned int irq, int phy_id,
Andrew Lunna5597002015-08-31 15:56:53 +020031 struct fixed_phy_status *status,
32 int link_gpio)
Vitaly Borduga79d8e92007-12-07 01:51:22 +030033{
34 return -ENODEV;
35}
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070036static inline struct phy_device *fixed_phy_register(unsigned int irq,
37 struct fixed_phy_status *status,
Andrew Lunna5597002015-08-31 15:56:53 +020038 int gpio_link,
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070039 struct device_node *np)
Thomas Petazzonia7595122014-05-16 16:14:04 +020040{
Petri Gyntherfd2ef0b2014-10-06 11:38:30 -070041 return ERR_PTR(-ENODEV);
Thomas Petazzonia7595122014-05-16 16:14:04 +020042}
Andrew Lunn5bcbe0f2016-03-12 00:01:40 +010043static inline void fixed_phy_unregister(struct phy_device *phydev)
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020044{
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020045}
Florian Fainelli464c3662014-08-27 17:04:48 -070046static inline int fixed_phy_set_link_update(struct phy_device *phydev,
Vitaly Borduga79d8e92007-12-07 01:51:22 +030047 int (*link_update)(struct net_device *,
Florian Fainelli464c3662014-08-27 17:04:48 -070048 struct fixed_phy_status *))
49{
50 return -ENODEV;
51}
Stas Sergeeva3bebdc2015-04-01 20:30:31 +030052static inline int fixed_phy_update_state(struct phy_device *phydev,
53 const struct fixed_phy_status *status,
54 const struct fixed_phy_status *changed)
55{
56 return -ENODEV;
57}
Florian Fainelli464c3662014-08-27 17:04:48 -070058#endif /* CONFIG_FIXED_PHY */
Vitaly Bordug7c32f472007-08-10 14:05:16 -070059
60#endif /* __PHY_FIXED_H */