aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips
diff options
context:
space:
mode:
authorChen Minqiang <ptpt52@gmail.com>2018-08-04 01:14:07 +0800
committerJohn Crispin <john@phrozen.org>2018-08-06 07:12:31 +0200
commitf6d81e2fa1f110d8025eaa434d67d0014aca1d42 (patch)
tree09b5c19ceee02c10f9fda50c5411b73a490f3cea /target/linux/ramips
parent379fe506729a20c5fdb072840cb662b032e90c36 (diff)
downloadupstream-f6d81e2fa1f110d8025eaa434d67d0014aca1d42.tar.gz
upstream-f6d81e2fa1f110d8025eaa434d67d0014aca1d42.tar.bz2
upstream-f6d81e2fa1f110d8025eaa434d67d0014aca1d42.zip
mt7620: gsw: make IntPHY and ExtPHY share mdio addr 4 possible
To share mdio addr for IntPHY and ExtPHY, as described in the documentation (MT7620_ProgrammingGuide.pdf). (refer: http://download.villagetelco.org/hardware/MT7620/MT7620_ProgrammingGuide.pdf) when port4 setup to work as gmac mode, dts like: &gsw { mediatek,port4 = "gmac"; }; we should set SYSCFG1.GE2_MODE==0x0 (RGMII). but SYSCFG1.GE2_MODE may have been set to 3(RJ-45) by uboot/default so we need to re-set it to 0x0 before this changes: gsw: 4FE + 2GE may not work correctly and MDIO addr 4 cannot be used by ExtPHY after this changes: gsw: 4FE + 2GE works and MDIO addr 4 can be used by ExtPHY Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Diffstat (limited to 'target/linux/ramips')
-rw-r--r--target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c
index 192603a68c..b1f1794bc9 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c
@@ -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");
}
}