blob: 52bc8e487ef7d3442b562ffd9907027e53a310c4 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __PHY_FIXED_H
3#define __PHY_FIXED_H
4
5struct fixed_phy_status {
6 int link;
7 int speed;
8 int duplex;
9 int pause;
10 int asym_pause;
11};
12
13struct device_node;
David Brazdil0f672f62019-12-10 10:32:29 +000014struct gpio_desc;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000015
16#if IS_ENABLED(CONFIG_FIXED_PHY)
David Brazdil0f672f62019-12-10 10:32:29 +000017extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000018extern int fixed_phy_add(unsigned int irq, int phy_id,
David Brazdil0f672f62019-12-10 10:32:29 +000019 struct fixed_phy_status *status);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000020extern struct phy_device *fixed_phy_register(unsigned int irq,
21 struct fixed_phy_status *status,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000022 struct device_node *np);
David Brazdil0f672f62019-12-10 10:32:29 +000023
24extern struct phy_device *
25fixed_phy_register_with_gpiod(unsigned int irq,
26 struct fixed_phy_status *status,
27 struct gpio_desc *gpiod);
28
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000029extern void fixed_phy_unregister(struct phy_device *phydev);
30extern int fixed_phy_set_link_update(struct phy_device *phydev,
31 int (*link_update)(struct net_device *,
32 struct fixed_phy_status *));
33#else
34static inline int fixed_phy_add(unsigned int irq, int phy_id,
David Brazdil0f672f62019-12-10 10:32:29 +000035 struct fixed_phy_status *status)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000036{
37 return -ENODEV;
38}
39static inline struct phy_device *fixed_phy_register(unsigned int irq,
40 struct fixed_phy_status *status,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000041 struct device_node *np)
42{
43 return ERR_PTR(-ENODEV);
44}
David Brazdil0f672f62019-12-10 10:32:29 +000045
46static inline struct phy_device *
47fixed_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 Scullb4b6d4a2019-01-02 15:54:55 +000054static inline void fixed_phy_unregister(struct phy_device *phydev)
55{
56}
57static inline int fixed_phy_set_link_update(struct phy_device *phydev,
58 int (*link_update)(struct net_device *,
59 struct fixed_phy_status *))
60{
61 return -ENODEV;
62}
David Brazdil0f672f62019-12-10 10:32:29 +000063static inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
64{
65 return -EINVAL;
66}
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000067#endif /* CONFIG_FIXED_PHY */
68
69#endif /* __PHY_FIXED_H */