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