aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ldpaa_eth/ldpaa_eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ldpaa_eth/ldpaa_eth.c')
-rw-r--r--drivers/net/ldpaa_eth/ldpaa_eth.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 725173f627..c775598b91 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -1120,31 +1120,14 @@ static uint32_t ldpaa_eth_get_dpmac_id(struct udevice *dev)
return fdtdec_get_uint(gd->fdt_blob, port_node, "reg", -1);
}
-static const char *ldpaa_eth_get_phy_mode_str(struct udevice *dev)
-{
- int port_node = dev_of_offset(dev);
- const char *phy_mode_str;
-
- phy_mode_str = fdt_getprop(gd->fdt_blob, port_node,
- "phy-connection-type", NULL);
- if (phy_mode_str)
- return phy_mode_str;
-
- phy_mode_str = fdt_getprop(gd->fdt_blob, port_node, "phy-mode", NULL);
- return phy_mode_str;
-}
-
static int ldpaa_eth_bind(struct udevice *dev)
{
- const char *phy_mode_str = NULL;
uint32_t dpmac_id;
char eth_name[16];
int phy_mode = -1;
- phy_mode_str = ldpaa_eth_get_phy_mode_str(dev);
- if (phy_mode_str)
- phy_mode = phy_get_interface_by_name(phy_mode_str);
- if (phy_mode == -1) {
+ phy_mode = dev_read_phy_mode(dev);
+ if (phy_mode == PHY_INTERFACE_MODE_NONE) {
dev_err(dev, "incorrect phy mode\n");
return -EINVAL;
}
@@ -1155,7 +1138,8 @@ static int ldpaa_eth_bind(struct udevice *dev)
return -EINVAL;
}
- sprintf(eth_name, "DPMAC%d@%s", dpmac_id, phy_mode_str);
+ sprintf(eth_name, "DPMAC%d@%s", dpmac_id,
+ phy_string_for_interface(phy_mode));
device_set_name(dev, eth_name);
return 0;
@@ -1164,11 +1148,9 @@ static int ldpaa_eth_bind(struct udevice *dev)
static int ldpaa_eth_of_to_plat(struct udevice *dev)
{
struct ldpaa_eth_priv *priv = dev_get_priv(dev);
- const char *phy_mode_str;
priv->dpmac_id = ldpaa_eth_get_dpmac_id(dev);
- phy_mode_str = ldpaa_eth_get_phy_mode_str(dev);
- priv->phy_mode = phy_get_interface_by_name(phy_mode_str);
+ priv->phy_mode = dev_read_phy_mode(dev);
return 0;
}