diff options
author | Bin Meng | 2021-03-14 20:14:46 +0800 |
---|---|---|
committer | Priyanka Jain | 2021-04-15 14:22:17 +0530 |
commit | 173c66bf9c0cfefd0ff69f0939c95900340d0988 (patch) | |
tree | 68c250b142404cca1dfa1b582243fe5160e1b919 /include/dm/of_extra.h | |
parent | 1c196b308aeb226ae1849d49082d43a5f7617b35 (diff) |
of: extra: Introduce ofnode_phy_is_fixed_link() API
Introduce a helper API ofnode_phy_is_fixed_link() to detect whether
the ethernet controller connects to a fixed-link pseudo-PHY device.
Note there are two ways to describe a fixed PHY attached to an
Ethernet device:
- the new DT binding, where 'fixed-link' is a sub-node of the
Ethernet device
- the old DT binding, where 'fixed-link' is a property with 5
cells encoding various information about the fixed PHY
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'include/dm/of_extra.h')
-rw-r--r-- | include/dm/of_extra.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/dm/of_extra.h b/include/dm/of_extra.h index fc4f9743196..f0d205491c1 100644 --- a/include/dm/of_extra.h +++ b/include/dm/of_extra.h @@ -94,4 +94,24 @@ int ofnode_decode_memory_region(ofnode config_node, const char *mem_type, const char *suffix, fdt_addr_t *basep, fdt_size_t *sizep); +/** + * ofnode_phy_is_fixed_link() - Detect fixed-link pseudo-PHY device + * + * This function detects whether the ethernet controller connects to a + * fixed-link pseudo-PHY device. + * + * This function supports the following two DT bindings: + * - the new DT binding, where 'fixed-link' is a sub-node of the + * Ethernet device + * - the old DT binding, where 'fixed-link' is a property with 5 + * cells encoding various information about the fixed PHY + * + * If both new and old bindings exist, the new one is preferred. + * + * @param eth_node ofnode containing the fixed-link subnode/property + * @param phy_node if fixed-link PHY detected, containing the PHY ofnode + * @return true if a fixed-link pseudo-PHY device exists, false otherwise + */ +bool ofnode_phy_is_fixed_link(ofnode eth_node, ofnode *phy_node); + #endif |