summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-11-14 16:52:42 +0000
committerJohn Crispin <john@openwrt.org>2014-11-14 16:52:42 +0000
commit194ca6127ee18cd3a95da4d03f02e43b5428c0bb (patch)
treef15d3172d7782dec7ab548887c9ae6f8fbd3aa9d
parent0371dabc1347fd902b1a62b050dbe56064d23567 (diff)
downloadmtk-20170518-194ca6127ee18cd3a95da4d03f02e43b5428c0bb.zip
mtk-20170518-194ca6127ee18cd3a95da4d03f02e43b5428c0bb.tar.gz
mtk-20170518-194ca6127ee18cd3a95da4d03f02e43b5428c0bb.tar.bz2
ralink: improve mt7530 support
the SDK does a bit of extra init that we did not do yet when using an external mt7530. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43245
-rw-r--r--target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
index 74fe0bb..58c2098 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7620a.c
@@ -478,8 +478,22 @@ static void gsw_hw_init_mt7620(struct mt7620_gsw *gsw, struct device_node *np)
gsw_w32(gsw, gsw_r32(gsw, GSW_REG_CKGCR) & ~(0x3 << 4), GSW_REG_CKGCR);
if (of_property_read_bool(np, "mediatek,mt7530")) {
- gsw_w32(gsw, gsw_r32(gsw, GSW_REG_GPC1) | (0x1f << 24), GSW_REG_GPC1);
- pr_info("gsw: truning EPHY off\n");
+ u32 val;
+
+ /* turn off ephy and set phy base addr to 12 */
+ gsw_w32(gsw, gsw_r32(gsw, GSW_REG_GPC1) | (0x1f << 24) | (0xc << 16), GSW_REG_GPC1);
+
+ /* set MT7530 central align */
+ val = mt7530_mdio_r32(gsw, 0x7830);
+ val &= ~1;
+ val |= 1<<1;
+ mt7530_mdio_w32(gsw, 0x7830, val);
+
+ val = mt7530_mdio_r32(gsw, 0x7a40);
+ val &= ~(1<<30);
+ mt7530_mdio_w32(gsw, 0x7a40, val);
+
+ mt7530_mdio_w32(gsw, 0x7a78, 0x855);
} else {
/* EPHY1 fixup - only run if the ephy is enabled */