From: Weijie Gao Date: Wed, 19 Jul 2023 09:17:03 +0000 (+0800) Subject: net: mediatek: fix direct MDIO clause 45 access via SoC X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=c94ad0091714602b8dcff24763f80600a72bc8d1;p=u-boot.git net: mediatek: fix direct MDIO clause 45 access via SoC The original direct MDIO clause 45 access via SoC is missing the data output. This patch adds it back to ensure MDIO clause 45 can work properly for external PHYs. Signed-off-by: Weijie Gao --- diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c index cd72070ff6..61a1c29e36 100644 --- a/drivers/net/mtk_eth.c +++ b/drivers/net/mtk_eth.c @@ -198,7 +198,7 @@ static int mtk_mii_rw(struct mtk_eth_priv *priv, u8 phy, u8 reg, u16 data, (((u32)phy << MDIO_PHY_ADDR_S) & MDIO_PHY_ADDR_M) | (((u32)reg << MDIO_REG_ADDR_S) & MDIO_REG_ADDR_M); - if (cmd == MDIO_CMD_WRITE) + if (cmd == MDIO_CMD_WRITE || cmd == MDIO_CMD_ADDR) val |= data & MDIO_RW_DATA_M; mtk_gmac_write(priv, GMAC_PIAC_REG, val | PHY_ACS_ST); @@ -210,7 +210,7 @@ static int mtk_mii_rw(struct mtk_eth_priv *priv, u8 phy, u8 reg, u16 data, return ret; } - if (cmd == MDIO_CMD_READ) { + if (cmd == MDIO_CMD_READ || cmd == MDIO_CMD_READ_C45) { val = mtk_gmac_read(priv, GMAC_PIAC_REG); return val & MDIO_RW_DATA_M; }