Merge tag 'jfs-5.2' of git://github.com/kleikamp/linux-shaggy
[sfrench/cifs-2.6.git] / include / linux / phy_fixed.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PHY_FIXED_H
3 #define __PHY_FIXED_H
4
5 struct fixed_phy_status {
6         int link;
7         int speed;
8         int duplex;
9         int pause;
10         int asym_pause;
11 };
12
13 struct device_node;
14
15 #if IS_ENABLED(CONFIG_FIXED_PHY)
16 extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
17 extern int fixed_phy_add(unsigned int irq, int phy_id,
18                          struct fixed_phy_status *status);
19 extern struct phy_device *fixed_phy_register(unsigned int irq,
20                                              struct fixed_phy_status *status,
21                                              struct device_node *np);
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
28 extern void fixed_phy_unregister(struct phy_device *phydev);
29 extern int fixed_phy_set_link_update(struct phy_device *phydev,
30                         int (*link_update)(struct net_device *,
31                                            struct fixed_phy_status *));
32 #else
33 static inline int fixed_phy_add(unsigned int irq, int phy_id,
34                                 struct fixed_phy_status *status)
35 {
36         return -ENODEV;
37 }
38 static inline struct phy_device *fixed_phy_register(unsigned int irq,
39                                                 struct fixed_phy_status *status,
40                                                 struct device_node *np)
41 {
42         return ERR_PTR(-ENODEV);
43 }
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
53 static inline void fixed_phy_unregister(struct phy_device *phydev)
54 {
55 }
56 static inline int fixed_phy_set_link_update(struct phy_device *phydev,
57                         int (*link_update)(struct net_device *,
58                                            struct fixed_phy_status *))
59 {
60         return -ENODEV;
61 }
62 static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
63 {
64         return -EINVAL;
65 }
66 #endif /* CONFIG_FIXED_PHY */
67
68 #endif /* __PHY_FIXED_H */