aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phy.h
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2015-08-31 09:56:46 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-31 17:48:01 -0400
commit5a11dd7d9649149f336ca72069d56ce52b21567f (patch)
tree0310f837c5e63c9af75e31b0d290d24aa54ee458 /include/linux/phy.h
parent6ea3c9d5b042edf14eac1e21af21c41f81f3491e (diff)
net: phy: Allow PHY devices to identify themselves as Ethernet switches, etc.
Some Ethernet MAC drivers using the PHY library require the hardcoding of link parameters when interfaced to a switch device, SFP module, switch to switch port, etc. This has typically lead to various ad-hoc implementations looking like this: - using a "fixed PHY" emulated device, which will provide link indication towards the Ethernet MAC driver and hardware - pretend there is no PHY and hardcode link parameters, ala mv643x_eth Based on that, it is desireable to have the PHY drivers advertise the correct link parameters, just like regular Ethernet PHYs towards their CPU Ethernet MAC drivers, however, Ethernet MAC drivers should be able to tell whether this link should be monitored or not. In the context of an Ethernet switch, SFP module, switch to switch link, we do not need to monitor this link since it should be always up. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-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.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index e5fb1d415961..962387a192f1 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -330,6 +330,7 @@ struct phy_c45_device_ids {
330 * c45_ids: 802.3-c45 Device Identifers if is_c45. 330 * c45_ids: 802.3-c45 Device Identifers if is_c45.
331 * is_c45: Set to true if this phy uses clause 45 addressing. 331 * is_c45: Set to true if this phy uses clause 45 addressing.
332 * is_internal: Set to true if this phy is internal to a MAC. 332 * is_internal: Set to true if this phy is internal to a MAC.
333 * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc.
333 * has_fixups: Set to true if this phy has fixups/quirks. 334 * has_fixups: Set to true if this phy has fixups/quirks.
334 * suspended: Set to true if this phy has been suspended successfully. 335 * suspended: Set to true if this phy has been suspended successfully.
335 * state: state of the PHY for management purposes 336 * state: state of the PHY for management purposes
@@ -368,6 +369,7 @@ struct phy_device {
368 struct phy_c45_device_ids c45_ids; 369 struct phy_c45_device_ids c45_ids;
369 bool is_c45; 370 bool is_c45;
370 bool is_internal; 371 bool is_internal;
372 bool is_pseudo_fixed_link;
371 bool has_fixups; 373 bool has_fixups;
372 bool suspended; 374 bool suspended;
373 375
@@ -688,6 +690,16 @@ static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
688{ 690{
689 return phydev->interface >= PHY_INTERFACE_MODE_RGMII && 691 return phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
690 phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID; 692 phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
693};
694
695/*
696 * phy_is_pseudo_fixed_link - Convenience function for testing if this
697 * PHY is the CPU port facing side of an Ethernet switch, or similar.
698 * @phydev: the phy_device struct
699 */
700static inline bool phy_is_pseudo_fixed_link(struct phy_device *phydev)
701{
702 return phydev->is_pseudo_fixed_link;
691} 703}
692 704
693/** 705/**