[PATCH v2 0/2] Fix bridge gmii2rgmii

When taken in use U-Boot v2023.04 one our board's ethernet stop to work in U-Boot, which was working in v2022.01.
In v2022.01 the gmii2rgmii was called before PHY was created.
This patch change back the order and fix the problem. Also the ethernet-phy-id driver is taken in use in gmii2rgmii driver.
(no changes since v1)
Tapio Reijonen (2): net: phy: Let gmiitorgmii converter create additional PHY net: phy: gmii2rgmii: Add support for phy ethernet id configuration
drivers/net/phy/phy.c | 8 ++++---- drivers/net/phy/xilinx_gmii2rgmii.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-)

Change the order to connect gmiitorgmii before PHY creation. The gmiitorgmii create additional in DTS configured PHY during it's configuration. This ensures, that converter sits between the MAC and the external phy MAC <==> GMII2RGMII <==> RGMII_PHY.
Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset") Signed-off-by: Tapio Reijonen tapio.reijonen@vaisala.com
---
(no changes since v1)
--- drivers/net/phy/phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 716a1d461115..740533adecac 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -939,14 +939,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false); #endif
-#ifdef CONFIG_PHY_ETHERNET_ID +#ifdef CONFIG_PHY_XILINX_GMII2RGMII if (!phydev) - phydev = phy_connect_phy_id(bus, dev, addr); + phydev = phy_connect_gmii2rgmii(bus, dev); #endif
-#ifdef CONFIG_PHY_XILINX_GMII2RGMII +#ifdef CONFIG_PHY_ETHERNET_ID if (!phydev) - phydev = phy_connect_gmii2rgmii(bus, dev); + phydev = phy_connect_phy_id(bus, dev, addr); #endif
if (!phydev)

On 1/22/25 10:22, Tapio Reijonen wrote:
Change the order to connect gmiitorgmii before PHY creation. The gmiitorgmii create additional in DTS configured PHY during it's configuration. This ensures, that converter sits between the MAC and the external phy MAC <==> GMII2RGMII <==> RGMII_PHY.
as I said please extend commit message to describe reasons behind this and using that dt config as you use.
Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset")
And we can discuss if this is a fix of this commit. It is more or less workaround for Linux kernel limitation and not actual fix. Because with correct DT binding existing code should work. Obviously correct way to handle it would be to fix Linux kernel driver not to convince U-Boot to use Linux kernel dt binding.
M
Signed-off-by: Tapio Reijonen tapio.reijonen@vaisala.com
(no changes since v1)
drivers/net/phy/phy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 716a1d461115..740533adecac 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -939,14 +939,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false); #endif
-#ifdef CONFIG_PHY_ETHERNET_ID +#ifdef CONFIG_PHY_XILINX_GMII2RGMII if (!phydev)
phydev = phy_connect_phy_id(bus, dev, addr);
#endifphydev = phy_connect_gmii2rgmii(bus, dev);
-#ifdef CONFIG_PHY_XILINX_GMII2RGMII +#ifdef CONFIG_PHY_ETHERNET_ID if (!phydev)
phydev = phy_connect_gmii2rgmii(bus, dev);
phydev = phy_connect_phy_id(bus, dev, addr);
#endif
if (!phydev)

When Kconfig PHY_ETHERNET_ID is set, create external PHY using via ethernet-phy-id driver to support using strapping resistors of the external PHY.
Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset") Signed-off-by: Tapio Reijonen tapio.reijonen@vaisala.com ---
Changes in v2: - Fixing inside 80 chars per line
--- drivers/net/phy/xilinx_gmii2rgmii.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index e44b7b75bd58..d860f4c37856 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,14 @@ 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;
participants (2)
-
Michal Simek
-
Tapio Reijonen