Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 2 | #ifndef __PHY_FIXED_H |
| 3 | #define __PHY_FIXED_H |
| 4 | |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 5 | struct fixed_phy_status { |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 6 | int link; |
| 7 | int speed; |
| 8 | int duplex; |
| 9 | int pause; |
| 10 | int asym_pause; |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 11 | }; |
| 12 | |
Thomas Petazzoni | a759512 | 2014-05-16 16:14:04 +0200 | [diff] [blame] | 13 | struct device_node; |
| 14 | |
David S. Miller | 6539c44 | 2014-12-16 14:30:09 -0500 | [diff] [blame] | 15 | #if IS_ENABLED(CONFIG_FIXED_PHY) |
Joakim Tjernlund | b3e5464 | 2018-12-14 15:17:05 +0100 | [diff] [blame] | 16 | extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier); |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 17 | extern int fixed_phy_add(unsigned int irq, int phy_id, |
Linus Walleij | 5468e82 | 2019-02-04 11:26:18 +0100 | [diff] [blame] | 18 | struct fixed_phy_status *status); |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 19 | extern struct phy_device *fixed_phy_register(unsigned int irq, |
| 20 | struct fixed_phy_status *status, |
| 21 | struct device_node *np); |
Moritz Fischer | 71bd106 | 2019-02-07 09:52:10 -0800 | [diff] [blame] | 22 | |
| 23 | extern struct phy_device * |
| 24 | fixed_phy_register_with_gpiod(unsigned int irq, |
| 25 | struct fixed_phy_status *status, |
| 26 | struct gpio_desc *gpiod); |
| 27 | |
Andrew Lunn | 5bcbe0f | 2016-03-12 00:01:40 +0100 | [diff] [blame] | 28 | extern void fixed_phy_unregister(struct phy_device *phydev); |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 29 | extern int fixed_phy_set_link_update(struct phy_device *phydev, |
| 30 | int (*link_update)(struct net_device *, |
| 31 | struct fixed_phy_status *)); |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 32 | #else |
| 33 | static inline int fixed_phy_add(unsigned int irq, int phy_id, |
Linus Walleij | 5468e82 | 2019-02-04 11:26:18 +0100 | [diff] [blame] | 34 | struct fixed_phy_status *status) |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 35 | { |
| 36 | return -ENODEV; |
| 37 | } |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 38 | static inline struct phy_device *fixed_phy_register(unsigned int irq, |
| 39 | struct fixed_phy_status *status, |
| 40 | struct device_node *np) |
Thomas Petazzoni | a759512 | 2014-05-16 16:14:04 +0200 | [diff] [blame] | 41 | { |
Petri Gynther | fd2ef0b | 2014-10-06 11:38:30 -0700 | [diff] [blame] | 42 | return ERR_PTR(-ENODEV); |
Thomas Petazzoni | a759512 | 2014-05-16 16:14:04 +0200 | [diff] [blame] | 43 | } |
Moritz Fischer | 71bd106 | 2019-02-07 09:52:10 -0800 | [diff] [blame] | 44 | |
| 45 | static inline struct phy_device * |
| 46 | fixed_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 Lunn | 5bcbe0f | 2016-03-12 00:01:40 +0100 | [diff] [blame] | 53 | static inline void fixed_phy_unregister(struct phy_device *phydev) |
Konrad Zapalowicz | 46cfd6e | 2014-06-05 20:27:42 +0200 | [diff] [blame] | 54 | { |
Konrad Zapalowicz | 46cfd6e | 2014-06-05 20:27:42 +0200 | [diff] [blame] | 55 | } |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 56 | static inline int fixed_phy_set_link_update(struct phy_device *phydev, |
Vitaly Bordug | a79d8e9 | 2007-12-07 01:51:22 +0300 | [diff] [blame] | 57 | int (*link_update)(struct net_device *, |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 58 | struct fixed_phy_status *)) |
| 59 | { |
| 60 | return -ENODEV; |
| 61 | } |
Joakim Tjernlund | b3e5464 | 2018-12-14 15:17:05 +0100 | [diff] [blame] | 62 | static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier) |
| 63 | { |
| 64 | return -EINVAL; |
| 65 | } |
Florian Fainelli | 464c366 | 2014-08-27 17:04:48 -0700 | [diff] [blame] | 66 | #endif /* CONFIG_FIXED_PHY */ |
Vitaly Bordug | 7c32f47 | 2007-08-10 14:05:16 -0700 | [diff] [blame] | 67 | |
| 68 | #endif /* __PHY_FIXED_H */ |