mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: phy: Add phy loopback support in net phy framework
This patch add set_loopback in phy_driver, which is used by MAC driver to enable or disable phy loopback. it also add a generic genphy_loopback function, which use BMCR loopback bit to enable or disable loopback. Signed-off-by: Lin Yun Sheng <linyunsheng@huawei.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6992c6c5dd
commit
f0f9b4ed23
3 changed files with 57 additions and 0 deletions
|
@ -372,6 +372,7 @@ struct phy_c45_device_ids {
|
|||
* has_fixups: Set to true if this phy has fixups/quirks.
|
||||
* suspended: Set to true if this phy has been suspended successfully.
|
||||
* sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
|
||||
* loopback_enabled: Set true if this phy has been loopbacked successfully.
|
||||
* state: state of the PHY for management purposes
|
||||
* dev_flags: Device-specific flags used by the PHY driver.
|
||||
* link_timeout: The number of timer firings to wait before the
|
||||
|
@ -409,6 +410,7 @@ struct phy_device {
|
|||
bool has_fixups;
|
||||
bool suspended;
|
||||
bool sysfs_links;
|
||||
bool loopback_enabled;
|
||||
|
||||
enum phy_state state;
|
||||
|
||||
|
@ -648,6 +650,7 @@ struct phy_driver {
|
|||
int (*set_tunable)(struct phy_device *dev,
|
||||
struct ethtool_tunable *tuna,
|
||||
const void *data);
|
||||
int (*set_loopback)(struct phy_device *dev, bool enable);
|
||||
};
|
||||
#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
|
||||
struct phy_driver, mdiodrv)
|
||||
|
@ -793,6 +796,7 @@ void phy_device_remove(struct phy_device *phydev);
|
|||
int phy_init_hw(struct phy_device *phydev);
|
||||
int phy_suspend(struct phy_device *phydev);
|
||||
int phy_resume(struct phy_device *phydev);
|
||||
int phy_loopback(struct phy_device *phydev, bool enable);
|
||||
struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,
|
||||
phy_interface_t interface);
|
||||
struct phy_device *phy_find_first(struct mii_bus *bus);
|
||||
|
@ -847,6 +851,7 @@ int genphy_update_link(struct phy_device *phydev);
|
|||
int genphy_read_status(struct phy_device *phydev);
|
||||
int genphy_suspend(struct phy_device *phydev);
|
||||
int genphy_resume(struct phy_device *phydev);
|
||||
int genphy_loopback(struct phy_device *phydev, bool enable);
|
||||
int genphy_soft_reset(struct phy_device *phydev);
|
||||
static inline int genphy_no_soft_reset(struct phy_device *phydev)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue