diff options
author | Pawel Dembicki <paweldembicki@gmail.com> | 2018-10-29 17:30:22 +0000 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2019-06-20 08:48:19 +0200 |
commit | c02a9a2514c488d25db1445b747b7ed51f3630fe (patch) | |
tree | fd4da4fa1826df627fcd03520fd47a6ab81a4979 /target/linux/ramips/files-4.14 | |
parent | f96c7f697f948d521f00c37bfcb8a8aa9b94d735 (diff) | |
download | upstream-c02a9a2514c488d25db1445b747b7ed51f3630fe.tar.gz upstream-c02a9a2514c488d25db1445b747b7ed51f3630fe.tar.bz2 upstream-c02a9a2514c488d25db1445b747b7ed51f3630fe.zip |
ramips: mt7620: fix external PHY autopolling
The port initialisation is based on assumption that phy address and
port number is the same. SoC allow different numbers and some board
have it.
Use phy address instead the port number to make sure that correct
addresses are polled.
In situation when only one PHY with address 0x0 is conected to
port 4, autopolling is broken.
This patch make autopolling correct when port number and phy address
are different.
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Diffstat (limited to 'target/linux/ramips/files-4.14')
-rw-r--r-- | target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c index da8e71c21e..fb2d45a56e 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c @@ -118,7 +118,7 @@ static void mt7620_set_mac(struct fe_priv *priv, unsigned char *mac) spin_unlock_irqrestore(&priv->page_lock, flags); } -static void mt7620_auto_poll(struct mt7620_gsw *gsw) +static void mt7620_auto_poll(struct mt7620_gsw *gsw, int port) { int phy; int lsb = -1, msb = 0; @@ -129,7 +129,9 @@ static void mt7620_auto_poll(struct mt7620_gsw *gsw) msb = phy; } - if (lsb == msb) + if (lsb == msb && port == 4) + msb++; + else if (lsb == msb && port == 5) lsb--; mtk_switch_w32(gsw, PHY_AN_EN | PHY_PRE_EN | PMY_MDC_CONF(5) | @@ -242,8 +244,8 @@ static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) mtk_switch_w32(gsw, val, GSW_REG_PORT_PMCR(id)); fe_connect_phy_node(priv, priv->phy->phy_node[id], id); - gsw->autopoll |= BIT(id); - mt7620_auto_poll(gsw); + gsw->autopoll |= BIT(be32_to_cpup(phy_addr)); + mt7620_auto_poll(gsw,id); return; } } |