Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __PHY_FIXED_H
0003 #define __PHY_FIXED_H
0004 
0005 #include <linux/types.h>
0006 
0007 struct fixed_phy_status {
0008     int link;
0009     int speed;
0010     int duplex;
0011     int pause;
0012     int asym_pause;
0013 };
0014 
0015 struct device_node;
0016 struct gpio_desc;
0017 struct net_device;
0018 
0019 #if IS_ENABLED(CONFIG_FIXED_PHY)
0020 extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
0021 extern int fixed_phy_add(unsigned int irq, int phy_id,
0022              struct fixed_phy_status *status);
0023 extern struct phy_device *fixed_phy_register(unsigned int irq,
0024                          struct fixed_phy_status *status,
0025                          struct device_node *np);
0026 
0027 extern struct phy_device *
0028 fixed_phy_register_with_gpiod(unsigned int irq,
0029                   struct fixed_phy_status *status,
0030                   struct gpio_desc *gpiod);
0031 
0032 extern void fixed_phy_unregister(struct phy_device *phydev);
0033 extern int fixed_phy_set_link_update(struct phy_device *phydev,
0034             int (*link_update)(struct net_device *,
0035                        struct fixed_phy_status *));
0036 #else
0037 static inline int fixed_phy_add(unsigned int irq, int phy_id,
0038                 struct fixed_phy_status *status)
0039 {
0040     return -ENODEV;
0041 }
0042 static inline struct phy_device *fixed_phy_register(unsigned int irq,
0043                         struct fixed_phy_status *status,
0044                         struct device_node *np)
0045 {
0046     return ERR_PTR(-ENODEV);
0047 }
0048 
0049 static inline struct phy_device *
0050 fixed_phy_register_with_gpiod(unsigned int irq,
0051                   struct fixed_phy_status *status,
0052                   struct gpio_desc *gpiod)
0053 {
0054     return ERR_PTR(-ENODEV);
0055 }
0056 
0057 static inline void fixed_phy_unregister(struct phy_device *phydev)
0058 {
0059 }
0060 static inline int fixed_phy_set_link_update(struct phy_device *phydev,
0061             int (*link_update)(struct net_device *,
0062                        struct fixed_phy_status *))
0063 {
0064     return -ENODEV;
0065 }
0066 static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
0067 {
0068     return -EINVAL;
0069 }
0070 #endif /* CONFIG_FIXED_PHY */
0071 
0072 #endif /* __PHY_FIXED_H */