summaryrefslogtreecommitdiffstats
path: root/include/linux/phy.h
diff options
context:
space:
mode:
authorFlorian Fainelli2015-05-26 21:19:58 +0200
committerDavid S. Miller2015-05-27 06:27:35 +0200
commite463d88c36d42211aa72ed76d32fb8bf37820ef1 (patch)
treed420ecefce0c1d389b40146d1abbd641b6f15a3c /include/linux/phy.h
parentipv4: Fix fib_trie.c build, missing linux/vmalloc.h include. (diff)
downloadkernel-qcow2-linux-e463d88c36d42211aa72ed76d32fb8bf37820ef1.tar.gz
kernel-qcow2-linux-e463d88c36d42211aa72ed76d32fb8bf37820ef1.tar.xz
kernel-qcow2-linux-e463d88c36d42211aa72ed76d32fb8bf37820ef1.zip
net: phy: Add phy_interface_is_rgmii helper
RGMII interfaces come in 4 different flavors that the PHY library needs to care about: regular RGMII (no delays), RGMII with either RX or TX delay, and both. In order to avoid errors of checking only for one type of RGMII interface and miss the 3 others, introduce a convenience function which tests for all values. Suggested-by: David S. Miller <davem@davemloft.net> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r--include/linux/phy.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 701c7a3946e0..a26c3f84b8dd 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -678,6 +678,17 @@ static inline bool phy_is_internal(struct phy_device *phydev)
}
/**
+ * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
+ * is RGMII (all variants)
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
+{
+ return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
+ phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
+}
+
+/**
* phy_write_mmd - Convenience function for writing a register
* on an MMD on a given PHY.
* @phydev: The phy_device struct