Subject: [PATCHv2 2/4] net: ethernet: mediatek: do not force autonegiation at init

From: [email-masked]
Date: Mon, 14 Jan 2019 17:03:32 +1000

From: Greg Ungerer <[email-masked]>

Do not attempt to force a port phy auto-ngeotiation during the driver
init phase. It is not necessary and results in a warning at system
boot up:

mtk_soc_eth 1e100000.ethernet: generated random MAC address be:e7:d4:9d:7d:b0
mtk_soc_eth 1e100000.ethernet: connected mac 0 to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1 at drivers/net/phy/phy.c:548 phy_start_aneg+0xf0/0x1c0
called from state READY
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc1-00005-ge3368ed2e336-dirty #11
Stack : 0000007a 00000000 00000000 807e0000 80710000 8006fb04 8072db28 0000000b
        00000000 00000000 8072d368 87c3db74 80770000 00000001 87c3db08 2892b90e
        00000000 00000000 80820000 00000000 00000000 2d363333 0000007b 00000000
        2d316372 00000000 00000000 00000000 80770000 00000000 80715e70 00000009
        00000224 80716e38 87d6a800 80660334 00000001 80340714 00000004 807e0004
        ...
Call Trace:
[<8000cfe0>] show_stack+0x94/0x12c
[<8060de6c>] dump_stack+0x8c/0xd0
[<80028430>] __warn+0x10c/0x120
[<80028488>] warn_slowpath_fmt+0x44/0x68
[<803adf78>] phy_start_aneg+0xf0/0x1c0
[<807aed8c>] mtk_init+0x434/0x4a4
[<8047310c>] register_netdevice+0x94/0x6d0
[<8047376c>] register_netdev+0x24/0x40
[<803bf4c0>] mtk_probe+0x2a0/0x930
[<80352d24>] platform_drv_probe+0x40/0x9c
[<80350e48>] really_probe+0x1f0/0x35c
[<803513e4>] __driver_attach+0x10c/0x114
[<8034ec88>] bus_for_each_dev+0x70/0xd0
[<8035023c>] bus_add_driver+0x1f0/0x25c
[<80351c70>] driver_register+0x80/0x144
[<800015f4>] do_one_initcall+0x50/0x1ac
[<80795e48>] kernel_init_freeable+0x184/0x26c
[<8062bbd4>] kernel_init+0x14/0x110
[<80007198>] ret_from_kernel_thread+0x14/0x1c
---[ end trace 6e884e9f12ed14c0 ]---
mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 22

Signed-off-by: Greg Ungerer <[email-masked]>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 -
 1 file changed, 1 deletion(-)

v2: first patch in this series for this change

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index c7763a189619..e5a32d43a71c 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -356,7 +356,6 @@ static int mtk_phy_connect(struct net_device *dev)
 	linkmode_copy(dev->phydev->advertising, dev->phydev->supported);
 	linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
 			 dev->phydev->advertising);
-	phy_start_aneg(dev->phydev);
 
 	of_node_put(np);
 
-- 
2.17.1