openwrt/target/linux/ramips/files/drivers/net/ethernet/ralink
Michael Pratt 5d7805c78b ramips: mt7620: allow both internal and external PHYs
When the new variable ephy_base was introduced,
it was not applied to the if block for mdio_mode.

The first line in the mdio_mode if block
sets the EPHY base address to 12 in the SOC by writing a register,
but the corresponding variable in the driver
was still set to the default of 0.

This causes subsequent lines that write registers with the function
_mt7620_mii_write
to write to PHY addresses 0 through 4
while internal PHYs have been moved to addresses 12 through 16.

All of these lines are intended only for PHYs on the SOC internal switch,
however, they are being written to external ethernet switches
if they exist at those PHY addresses 0 through 4.
This causes some ethernet ports to be broken on boards with AR8327 or QCA8337 switch.

Other suggested fixes move those lines to the else block of mdio_mode,
but removing the else block completely also fixes it.

Therefore, move the lines to the mt7620_hw_init function main block,
and have only one instance of the function mtk_switch_w32
for writing the register with the EPHY base address.

In theory, this also allows for boards that have both external switches
and internal PHYs that lead to ethernet ports to be supported.

Fixes: 391df37829 ("ramips: mt7620: add EPHY base mdio address changing possibility")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit de5394a29d)
2022-04-19 14:48:21 +02:00
..
esw_rt3050.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
esw_rt3050.h ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
ethtool.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
ethtool.h ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
gsw_mt7620.c ramips: mt7620: allow both internal and external PHYs 2022-04-19 14:48:21 +02:00
gsw_mt7620.h ramips: mt7620: simplify DTS properties for GMAC 2022-04-19 14:48:21 +02:00
Kconfig ramips: remove legacy ethernet driver components for mt7621 2020-08-21 15:46:54 +02:00
Makefile ramips: remove legacy ethernet driver components for mt7621 2020-08-21 15:46:54 +02:00
mdio_mt7620.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
mdio_rt2880.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
mdio_rt2880.h ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
mdio.c ramips: mt7620: remove useless GMAC nodes 2022-04-19 14:48:21 +02:00
mdio.h ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
mt7530.c ramips: mt7530 swconfig: fix race condition in register access 2021-04-18 12:05:04 +02:00
mt7530.h ramips: remove further mt7621 code from local ethernet driver 2020-08-26 23:58:01 +02:00
mtk_eth_soc.c ramips: drop kernel version switches 2020-10-09 22:24:04 +02:00
mtk_eth_soc.h ramips: remove further mt7621 code from local ethernet driver 2020-08-26 23:58:01 +02:00
soc_mt7620.c ramips: mt7620: fix ethernet driver GMAC port init 2022-04-19 14:48:21 +02:00
soc_rt2880.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
soc_rt3050.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00
soc_rt3883.c ramips: move and rename out-of-tree mtk eth driver 2020-04-12 22:27:17 +08:00