[][kernel][common][eth][Add reset callback function to mii_bus for bus level reset]
[Description]
Add reset callback function to mii_bus for bus level reset.
If without this patch, kernel is not able to wait PHY device ready before reading PHY ID.
[Release-log]
N/A
Change-Id: Idcf3b77cac7db3d1bdfc1c0e9eedbafbe6429615
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6375779
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index bd70441..6955aad 100755
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -188,6 +188,16 @@
return _mtk_mdio_read(eth, phy_addr, phy_reg);
}
+static int mtk_mdio_reset(struct mii_bus *bus)
+{
+ /* The mdiobus_register will trigger a reset pulse when enabling Bus reset,
+ * we just need to wait until device ready.
+ */
+ mdelay(20);
+
+ return 0;
+}
+
static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth,
phy_interface_t interface)
{
@@ -626,6 +636,7 @@
eth->mii_bus->name = "mdio";
eth->mii_bus->read = mtk_mdio_read;
eth->mii_bus->write = mtk_mdio_write;
+ eth->mii_bus->reset = mtk_mdio_reset;
eth->mii_bus->priv = eth;
eth->mii_bus->parent = eth->dev;