blob: 2400d2ea4f34aa87790fbe2bfb8fb839377f67c9 [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);
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020022extern void fixed_phy_del(int phy_addr);
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}
Konrad Zapalowicz46cfd6e2014-06-05 20:27:42 +020043static inline int fixed_phy_del(int phy_addr)
44{
45 return -ENODEV;
46}
Florian Fainelli464c3662014-08-27 17:04:48 -070047static inline int fixed_phy_set_link_update(struct phy_device *phydev,
Vitaly Borduga79d8e92007-12-07 01:51:22 +030048 int (*link_update)(struct net_device *,
Florian Fainelli464c3662014-08-27 17:04:48 -070049 struct fixed_phy_status *))
50{
51 return -ENODEV;
52}
Stas Sergeeva3bebdc2015-04-01 20:30:31 +030053static inline int fixed_phy_update_state(struct phy_device *phydev,
54 const struct fixed_phy_status *status,
55 const struct fixed_phy_status *changed)
56{
57 return -ENODEV;
58}
Florian Fainelli464c3662014-08-27 17:04:48 -070059#endif /* CONFIG_FIXED_PHY */
Vitaly Bordug7c32f472007-08-10 14:05:16 -070060
61#endif /* __PHY_FIXED_H */