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>
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 5e0d0bc..1ffe9e2 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -954,17 +954,6 @@
 	return 0;
 }
 #else /* CONFIG_DM_ETH */
-#ifdef CONFIG_PHYLIB
-phy_interface_t fman_read_sys_if(struct udevice *dev)
-{
-	const char *if_str;
-
-	if_str = ofnode_read_string(dev_ofnode(dev), "phy-connection-type");
-	debug("MAC system interface mode %s\n", if_str);
-
-	return phy_get_interface_by_name(if_str);
-}
-#endif
 
 static int fm_eth_bind(struct udevice *dev)
 {
@@ -1038,7 +1027,7 @@
 	reg = (void *)(uintptr_t)dev_read_addr(dev);
 	fm_eth->mac_type = dev_get_driver_data(dev);
 #ifdef CONFIG_PHYLIB
-	fm_eth->enet_if = fman_read_sys_if(dev);
+	fm_eth->enet_if = dev_read_phy_mode(dev);
 #else
 	fm_eth->enet_if = PHY_INTERFACE_MODE_SGMII;
 	printf("%s: warning - unable to determine interface type\n", __func__);