Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 1 | #ifndef __PHY_FIXED_H |
| 2 | #define __PHY_FIXED_H |
| 3 | |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 4 | struct fixed_phy_status { |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 5 | int link; |
| 6 | int speed; |
| 7 | int duplex; |
| 8 | int pause; |
| 9 | int asym_pause; |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 10 | }; |
| 11 | |
Thomas Petazzoni | a759512 | 2014-05-16 16:14:04 +0200 | [diff] [blame] | 12 | struct device_node; |
| 13 | |
David S. Miller | 6539c44 | 2014-12-16 14:30:09 -0500 | [diff] [blame] | 14 | #if IS_ENABLED(CONFIG_FIXED_PHY) |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 15 | extern int fixed_phy_add(unsigned int irq, int phy_id, |
Andrew Lunn | a559700 | 2015-08-31 15:56:53 +0200 | [diff] [blame] | 16 | struct fixed_phy_status *status, |
| 17 | int link_gpio); |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 18 | extern struct phy_device *fixed_phy_register(unsigned int irq, |
| 19 | struct fixed_phy_status *status, |
Andrew Lunn | a559700 | 2015-08-31 15:56:53 +0200 | [diff] [blame] | 20 | int link_gpio, |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 21 | struct device_node *np); |
Andrew Lunn | 5bcbe0f | 2016-03-12 00:01:40 +0100 | [diff] [blame] | 22 | extern void fixed_phy_unregister(struct phy_device *phydev); |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 23 | extern int fixed_phy_set_link_update(struct phy_device *phydev, |
| 24 | int (*link_update)(struct net_device *, |
| 25 | struct fixed_phy_status *)); |
Stas Sergeev | a3bebdc | 2015-04-01 20:30:31 +0300 | [diff] [blame] | 26 | extern int fixed_phy_update_state(struct phy_device *phydev, |
| 27 | const struct fixed_phy_status *status, |
| 28 | const struct fixed_phy_status *changed); |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 29 | #else |
| 30 | static inline int fixed_phy_add(unsigned int irq, int phy_id, |
Andrew Lunn | a559700 | 2015-08-31 15:56:53 +0200 | [diff] [blame] | 31 | struct fixed_phy_status *status, |
| 32 | int link_gpio) |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 33 | { |
| 34 | return -ENODEV; |
| 35 | } |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 36 | static inline struct phy_device *fixed_phy_register(unsigned int irq, |
| 37 | struct fixed_phy_status *status, |
Andrew Lunn | a559700 | 2015-08-31 15:56:53 +0200 | [diff] [blame] | 38 | int gpio_link, |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 39 | struct device_node *np) |
Thomas Petazzoni | a759512 | 2014-05-16 16:14:04 +0200 | [diff] [blame] | 40 | { |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 41 | return ERR_PTR(-ENODEV); |
Thomas Petazzoni | a759512 | 2014-05-16 16:14:04 +0200 | [diff] [blame] | 42 | } |
Andrew Lunn | 5bcbe0f | 2016-03-12 00:01:40 +0100 | [diff] [blame] | 43 | static inline void fixed_phy_unregister(struct phy_device *phydev) |
Konrad Zapalowicz | 46cfd6e | 2014-06-05 20:27:42 +0200 | [diff] [blame] | 44 | { |
Konrad Zapalowicz | 46cfd6e | 2014-06-05 20:27:42 +0200 | [diff] [blame] | 45 | } |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 46 | static inline int fixed_phy_set_link_update(struct phy_device *phydev, |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 47 | int (*link_update)(struct net_device *, |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 48 | struct fixed_phy_status *)) |
| 49 | { |
| 50 | return -ENODEV; |
| 51 | } |
Stas Sergeev | a3bebdc | 2015-04-01 20:30:31 +0300 | [diff] [blame] | 52 | static 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 Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 58 | #endif /* CONFIG_FIXED_PHY */ |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 59 | |
| 60 | #endif /* __PHY_FIXED_H */ |