162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __PHY_FIXED_H
362306a36Sopenharmony_ci#define __PHY_FIXED_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/types.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_cistruct fixed_phy_status {
862306a36Sopenharmony_ci	int link;
962306a36Sopenharmony_ci	int speed;
1062306a36Sopenharmony_ci	int duplex;
1162306a36Sopenharmony_ci	int pause;
1262306a36Sopenharmony_ci	int asym_pause;
1362306a36Sopenharmony_ci};
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct device_node;
1662306a36Sopenharmony_cistruct gpio_desc;
1762306a36Sopenharmony_cistruct net_device;
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_FIXED_PHY)
2062306a36Sopenharmony_ciextern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
2162306a36Sopenharmony_ciextern int fixed_phy_add(unsigned int irq, int phy_id,
2262306a36Sopenharmony_ci			 struct fixed_phy_status *status);
2362306a36Sopenharmony_ciextern struct phy_device *fixed_phy_register(unsigned int irq,
2462306a36Sopenharmony_ci					     struct fixed_phy_status *status,
2562306a36Sopenharmony_ci					     struct device_node *np);
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciextern struct phy_device *
2862306a36Sopenharmony_cifixed_phy_register_with_gpiod(unsigned int irq,
2962306a36Sopenharmony_ci			      struct fixed_phy_status *status,
3062306a36Sopenharmony_ci			      struct gpio_desc *gpiod);
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciextern void fixed_phy_unregister(struct phy_device *phydev);
3362306a36Sopenharmony_ciextern int fixed_phy_set_link_update(struct phy_device *phydev,
3462306a36Sopenharmony_ci			int (*link_update)(struct net_device *,
3562306a36Sopenharmony_ci					   struct fixed_phy_status *));
3662306a36Sopenharmony_ci#else
3762306a36Sopenharmony_cistatic inline int fixed_phy_add(unsigned int irq, int phy_id,
3862306a36Sopenharmony_ci				struct fixed_phy_status *status)
3962306a36Sopenharmony_ci{
4062306a36Sopenharmony_ci	return -ENODEV;
4162306a36Sopenharmony_ci}
4262306a36Sopenharmony_cistatic inline struct phy_device *fixed_phy_register(unsigned int irq,
4362306a36Sopenharmony_ci						struct fixed_phy_status *status,
4462306a36Sopenharmony_ci						struct device_node *np)
4562306a36Sopenharmony_ci{
4662306a36Sopenharmony_ci	return ERR_PTR(-ENODEV);
4762306a36Sopenharmony_ci}
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cistatic inline struct phy_device *
5062306a36Sopenharmony_cifixed_phy_register_with_gpiod(unsigned int irq,
5162306a36Sopenharmony_ci			      struct fixed_phy_status *status,
5262306a36Sopenharmony_ci			      struct gpio_desc *gpiod)
5362306a36Sopenharmony_ci{
5462306a36Sopenharmony_ci	return ERR_PTR(-ENODEV);
5562306a36Sopenharmony_ci}
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cistatic inline void fixed_phy_unregister(struct phy_device *phydev)
5862306a36Sopenharmony_ci{
5962306a36Sopenharmony_ci}
6062306a36Sopenharmony_cistatic inline int fixed_phy_set_link_update(struct phy_device *phydev,
6162306a36Sopenharmony_ci			int (*link_update)(struct net_device *,
6262306a36Sopenharmony_ci					   struct fixed_phy_status *))
6362306a36Sopenharmony_ci{
6462306a36Sopenharmony_ci	return -ENODEV;
6562306a36Sopenharmony_ci}
6662306a36Sopenharmony_cistatic inline int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier)
6762306a36Sopenharmony_ci{
6862306a36Sopenharmony_ci	return -EINVAL;
6962306a36Sopenharmony_ci}
7062306a36Sopenharmony_ci#endif /* CONFIG_FIXED_PHY */
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#endif /* __PHY_FIXED_H */
73