openwrt/target/linux/ramips
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
..
base-files/etc ramips: remove model name from LED labels 2020-10-02 14:51:57 +02:00
dts ramips: mt7620: remove useless GMAC nodes 2022-04-19 14:48:21 +02:00
files/drivers ramips: mt7620: allow both internal and external PHYs 2022-04-19 14:48:21 +02:00
image ramips: add support for the Wavlink WL-WN579X3 2022-04-19 14:48:21 +02:00
mt76x8 ramips: fix tl-mr3020-v3 switch topology to configure vlans via luci 2021-12-05 13:54:20 +01:00
mt7620 ramips: add support for the Wavlink WL-WN579X3 2022-04-19 14:48:21 +02:00
mt7621 ramips: Add support for SERCOMM NA502 2021-06-10 17:09:35 +02:00
patches-5.4 ramips: mt7621: do memory detection on KSEG1 2022-02-22 20:48:46 +08:00
rt288x ramips: remove set_wifi_led function in 01_leds 2020-10-02 14:51:57 +02:00
rt305x ramips: add support for ZTE MF283+ 2021-06-02 21:29:16 +02:00
rt3883 ramips: remove generic profiles 2021-01-27 21:31:20 +01:00
Makefile target: use SPDX license identifiers on Makefiles 2021-02-10 15:47:18 +01:00
modules.mk ramips: rename mtk-hsdma to hsdma-mt7621 2021-03-15 10:32:53 -10:00