diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-07-25 15:02:47 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-06 20:55:28 -0700 |
commit | 0ccb4fc65d2799a315d5ee8732d75f35a114379c (patch) | |
tree | 129d60d315cb50841aa088e45c36e8553907e674 /include/linux/phy.h | |
parent | da4625ac2637e4e5249dc08a10f8dce7643603d2 (diff) | |
download | lwn-0ccb4fc65d2799a315d5ee8732d75f35a114379c.tar.gz lwn-0ccb4fc65d2799a315d5ee8732d75f35a114379c.zip |
net: phy: move phy_lookup_setting() and guts of phy_supported_speeds() to phy-core
phy_lookup_setting() provides useful functionality in ethtool code
outside phylib. Move it to phy-core and allow it to be re-used (eg,
in phylink) rather than duplicated elsewhere. Note that this supports
the larger linkmode space.
As we move the phy settings table, we also need to move the guts of
phy_supported_speeds() as well.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r-- | include/linux/phy.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index e8264c78b75b..8a280257778c 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -670,6 +670,21 @@ struct phy_fixup { const char *phy_speed_to_str(int speed); const char *phy_duplex_to_str(unsigned int duplex); +/* A structure for mapping a particular speed and duplex + * combination to a particular SUPPORTED and ADVERTISED value + */ +struct phy_setting { + u32 speed; + u8 duplex; + u8 bit; +}; + +const struct phy_setting * +phy_lookup_setting(int speed, int duplex, const unsigned long *mask, + size_t maxbit, bool exact); +size_t phy_speeds(unsigned int *speeds, size_t size, + unsigned long *mask, size_t maxbit); + /** * phy_read_mmd - Convenience function for reading a register * from an MMD on a given PHY. |