net: phy: Add support for asking the PHY its abilities
authorAndrew Lunn <andrew@lunn.ch>
Sat, 9 Feb 2019 14:24:47 +0000 (15:24 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 Feb 2019 17:32:04 +0000 (09:32 -0800)
commitefbdfdc29bdd4dbf79ad4bddc8f7a5ac62c66bfe
tree91e7fe76b8d68927e68c7284dffbc720114ec965
parent92ed2eb7f4b73e9944b432e5c8c65ec3ec00eb9d
net: phy: Add support for asking the PHY its abilities

Add support for runtime determination of what the PHY supports, by
adding a new function to the phy driver. The get_features call should
set the phydev->supported member with the features the PHY supports.
It is only called if phydrv->features is NULL.

This requires minor changes to pause. The PHY driver should not set
pause abilities, except for when it has odd cause capabilities, e.g.
pause cannot be disabled. With this change, phydev->supported already
contains the drivers abilities, including pause. So rather than
considering phydrv->features, look at the phydev->supported, and
enable pause if neither of the pause bits are already set.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
[hkallweit1@gmail.com: fixed small checkpatch complaint in one comment]
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c
include/linux/phy.h