[PATCH v1 2/2] net: phy: gmii2rgmii: Add support for phy ethernet id configuration
Tapio Reijonen
tapio.reijonen at vaisala.com
Thu Jan 16 06:43:24 CET 2025
When Kconfig PHY_ETHERNET_ID is set, create external PHY using via
ethernet-phy-id driver to support using starpping resistors
of the external PHY.
Fixes: commit a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset")
Signed-off-by: Tapio Reijonen <tapio.reijonen at vaisala.com>
---
drivers/net/phy/xilinx_gmii2rgmii.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index e44b7b75bd5..1d6d204b228 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -18,7 +18,7 @@ DECLARE_GLOBAL_DATA_PTR;
static int xilinxgmiitorgmii_config(struct phy_device *phydev)
{
ofnode node = phy_get_ofnode(phydev);
- struct phy_device *ext_phydev;
+ struct phy_device *ext_phydev = NULL;
struct ofnode_phandle_args phandle;
int ext_phyaddr = -1;
int ret;
@@ -40,8 +40,13 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)
return ret;
ext_phyaddr = ofnode_read_u32_default(phandle.node, "reg", -1);
- ext_phydev = phy_find_by_mask(phydev->bus,
- 1 << ext_phyaddr);
+
+ if (IS_ENABLED(CONFIG_PHY_ETHERNET_ID))
+ ext_phydev = phy_connect_phy_id(phydev->bus, phydev->dev, ext_phyaddr);
+
+ if (!ext_phydev)
+ ext_phydev = phy_find_by_mask(phydev->bus,
+ 1 << ext_phyaddr);
if (!ext_phydev) {
printf("%s, No external phy device found\n", __func__);
return -EINVAL;
--
2.39.5
More information about the U-Boot
mailing list