summaryrefslogtreecommitdiff
path: root/drivers/net/tsec.c
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2022-04-07 00:33:01 +0200
committerRamon Fried <ramon@neureality.ai>2022-04-10 08:44:12 +0300
commit123ca114e07ecf28aa2538748d733e2b22d8b8b5 (patch)
tree0a5481e51e4e50b33daf4d10f37574f6f797b04f /drivers/net/tsec.c
parent9c06b4815ce1d663085c214133762614bba79fbe (diff)
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 'drivers/net/tsec.c')
-rw-r--r--drivers/net/tsec.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index beca886b25..fec051ebb7 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -834,7 +834,6 @@ int tsec_probe(struct udevice *dev)
struct ofnode_phandle_args phandle_args;
u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE;
struct tsec_data *data;
- const char *phy_mode;
ofnode parent, child;
fdt_addr_t reg;
u32 max_speed;
@@ -894,12 +893,8 @@ int tsec_probe(struct udevice *dev)
priv->tbiaddr = tbiaddr;
- phy_mode = dev_read_prop(dev, "phy-connection-type", NULL);
- if (!phy_mode)
- phy_mode = dev_read_prop(dev, "phy-mode", NULL);
- if (phy_mode)
- pdata->phy_interface = phy_get_interface_by_name(phy_mode);
- if (pdata->phy_interface == -1)
+ pdata->phy_interface = dev_read_phy_mode(dev);
+ if (pdata->phy_interface == PHY_INTERFACE_MODE_NONE)
pdata->phy_interface = tsec_get_interface(priv);
priv->interface = pdata->phy_interface;