diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2022-04-07 00:33:01 +0200 |
---|---|---|
committer | Ramon Fried <ramon@neureality.ai> | 2022-04-10 08:44:12 +0300 |
commit | 123ca114e07ecf28aa2538748d733e2b22d8b8b5 (patch) | |
tree | 0a5481e51e4e50b33daf4d10f37574f6f797b04f /net | |
parent | 9c06b4815ce1d663085c214133762614bba79fbe (diff) | |
download | u-boot-123ca114e07ecf28aa2538748d733e2b22d8b8b5.tar.gz |
net: introduce helpers to get PHY interface mode from a device/ofnode
Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the
"phy-mode" / "phy-connection-type" property. Add corresponding UT test.
Use them treewide.
This allows us to inline the phy_get_interface_by_name() into
ofnode_read_phy_mode(), since the former is not used anymore.
Signed-off-by: Marek BehĂșn <marek.behun@nic.cz>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mdio-uclass.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index bef8280e210..874f59413a2 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -15,11 +15,6 @@ #include <dm/uclass-internal.h> #include <linux/compat.h> -/* DT node properties for MAC-PHY interface */ -static const char * const phy_mode_str[] = { - "phy-mode", "phy-connection-type" -}; - void dm_mdio_probe_devices(void) { struct udevice *it; @@ -195,26 +190,15 @@ out: /* Connect to a PHY linked in eth DT node */ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) { - const char *if_str; phy_interface_t interface; struct phy_device *phy; - int i; if (!dev_has_ofnode(ethdev)) { debug("%s: supplied eth dev has no DT node!\n", ethdev->name); return NULL; } - interface = PHY_INTERFACE_MODE_NONE; - for (i = 0; i < ARRAY_SIZE(phy_mode_str); i++) { - if_str = dev_read_string(ethdev, phy_mode_str[i]); - if (if_str) { - interface = phy_get_interface_by_name(if_str); - break; - } - } - if (interface < 0) - interface = PHY_INTERFACE_MODE_NONE; + interface = dev_read_phy_mode(ethdev); if (interface == PHY_INTERFACE_MODE_NONE) dev_dbg(ethdev, "can't find interface mode, default to NONE\n"); |