Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mtk_eth_soc: move restoration of SYSCFG0 to mac_finish()

The SGMIISYS configuration is performed while ETHSYS_SYSCFG0 is in a
disabled state. In order to preserve this when we switch to phylink_pcs
we need to move the restoration of this register to the mac_finish()
callback.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
21089867 0e37ad71

+10 -2
+9 -2
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 400 400 if (err) 401 401 goto init_err; 402 402 403 - regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, 404 - SYSCFG0_SGMII_MASK, val); 403 + /* Save the syscfg0 value for mac_finish */ 404 + mac->syscfg0 = val; 405 405 } else if (phylink_autoneg_inband(mode)) { 406 406 dev_err(eth->dev, 407 407 "In-band mode not supported in non SGMII mode!\n"); ··· 425 425 { 426 426 struct mtk_mac *mac = container_of(config, struct mtk_mac, 427 427 phylink_config); 428 + struct mtk_eth *eth = mac->hw; 428 429 u32 mcr_cur, mcr_new; 430 + 431 + /* Enable SGMII */ 432 + if (interface == PHY_INTERFACE_MODE_SGMII || 433 + phy_interface_mode_is_8023z(interface)) 434 + regmap_update_bits(eth->ethsys, ETHSYS_SYSCFG0, 435 + SYSCFG0_SGMII_MASK, mac->syscfg0); 429 436 430 437 /* Setup gmac */ 431 438 mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
+1
drivers/net/ethernet/mediatek/mtk_eth_soc.h
··· 1001 1001 struct mtk_hw_stats *hw_stats; 1002 1002 __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT]; 1003 1003 int hwlro_ip_cnt; 1004 + unsigned int syscfg0; 1004 1005 }; 1005 1006 1006 1007 /* the struct describing the SoC. these are declared in the soc_xyz.c files */