summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-01-05 16:47:39 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2017-07-07 16:12:14 +0100
commit13397c4d948d34e1811eea37acaac111e3766367 (patch)
tree31368e43ea6b1fc45c3834be263801e88eee5613 /include
parent0eb460ef9395eccc40dd2b488a38f52715ecbeab (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/phy.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index c715c76beaed..baf59fb5fa31 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -665,6 +665,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.