mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 13:43:28 +00:00
net: introduce a helper to determine whether to use in-band autoneg
Certain serial SERDES protocols like 1000base-x, 2500base-x, SGMII, USXGMII can operate either in a mode where the PHY (be it on-board or inside an SFP module) passes the link parameters (speed, duplex, pause) to the MAC through in-band through control words standardized by IEEE 802.3 clause 37, or in a mode where the MAC must configure (force) its link parameters based on information obtained out-of-band (MDIO reads, guesswork etc). In Linux, the OF node property named "managed" is parsed by the phylink framework, and the convention is that if a driver uses phylink, then the presence of this property means that in-band autoneg should be enabled, otherwise it shouldn't. To be compatible with the OF node bindings of drivers that use phylink in Linux, introduce parsing support for this property in U-Boot too. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
0783b16509
commit
2dd6acb795
2 changed files with 26 additions and 0 deletions
|
@ -155,3 +155,15 @@ bool ofnode_phy_is_fixed_link(ofnode eth_node, ofnode *phy_node)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ofnode_eth_uses_inband_aneg(ofnode eth_node)
|
||||
{
|
||||
bool inband_aneg = false;
|
||||
const char *managed;
|
||||
|
||||
managed = ofnode_read_string(eth_node, "managed");
|
||||
if (managed && !strcmp(managed, "in-band-status"))
|
||||
inband_aneg = true;
|
||||
|
||||
return inband_aneg;
|
||||
}
|
||||
|
|
|
@ -114,4 +114,18 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type,
|
|||
*/
|
||||
bool ofnode_phy_is_fixed_link(ofnode eth_node, ofnode *phy_node);
|
||||
|
||||
/**
|
||||
* ofnode_eth_uses_inband_aneg() - Detect whether MAC should use in-band autoneg
|
||||
*
|
||||
* This function detects whether the Ethernet controller should use IEEE 802.3
|
||||
* clause 37 in-band autonegotiation for serial protocols such as 1000base-x,
|
||||
* SGMII, USXGMII, etc. The property is relevant when the Ethernet controller
|
||||
* is connected to an on-board PHY or an SFP cage, and is not relevant when it
|
||||
* has a fixed link (in that case, in-band autoneg should not be used).
|
||||
*
|
||||
* @param eth_node ofnode belonging to the Ethernet controller
|
||||
* @return true if in-band autoneg should be used, false otherwise
|
||||
*/
|
||||
bool ofnode_eth_uses_inband_aneg(ofnode eth_node);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue