mt7620: gsw: make IntPHY and ExtPHY share mdio addr 4 possible
[openwrt/staging/blocktrron.git] / target / linux / ramips / files-4.14 / drivers / net / ethernet / mediatek / gsw_mt7620.c
index 192603a68c89ca32e7b3425135434149f0812398..b1f1794bc98bb2ed27bd8e13b03fa3cbabad2345 100644 (file)
@@ -189,6 +189,12 @@ static void mt7620_hw_init(struct mt7620_gsw *gsw, int mdio_mode)
                _mt7620_mii_write(gsw, 4, 16, 0x1313);
                _mt7620_mii_write(gsw, 4, 0, 0x3100);
                pr_info("gsw: setting port4 to ephy mode\n");
+       } else if (!mdio_mode) {
+               u32 val = rt_sysc_r32(SYSC_REG_CFG1);
+
+               val &= ~(3 << 14);
+               rt_sysc_w32(val, SYSC_REG_CFG1);
+               pr_info("gsw: setting port4 to gmac mode\n");
        }
 }