mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 05:24:47 +08:00
net: mtk_eth_soc: move MAC_MCR setting to mac_finish()
[ Upstream commit0e37ad71b2
] Move the setting of the MTK_MAC_MCR register from the end of mac_config into the phylink mac_finish() method, to keep it as the very last write that is done during configuration. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of:f1b85ef15a
("net: mediatek: mtk_eth_soc: clear MAC_MCR_FORCE_LINK only when MAC is up") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a809bbfd0e
commit
c5c0760adc
@ -223,8 +223,8 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
|
||||
struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
||||
phylink_config);
|
||||
struct mtk_eth *eth = mac->hw;
|
||||
u32 mcr_cur, mcr_new, sid, i;
|
||||
int val, ge_mode, err = 0;
|
||||
u32 sid, i;
|
||||
|
||||
/* MT76x8 has no hardware settings between for the MAC */
|
||||
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
|
||||
@ -359,6 +359,25 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
err_phy:
|
||||
dev_err(eth->dev, "%s: GMAC%d mode %s not supported!\n", __func__,
|
||||
mac->id, phy_modes(state->interface));
|
||||
return;
|
||||
|
||||
init_err:
|
||||
dev_err(eth->dev, "%s: GMAC%d mode %s err: %d!\n", __func__,
|
||||
mac->id, phy_modes(state->interface), err);
|
||||
}
|
||||
|
||||
static int mtk_mac_finish(struct phylink_config *config, unsigned int mode,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
||||
phylink_config);
|
||||
u32 mcr_cur, mcr_new;
|
||||
|
||||
/* Setup gmac */
|
||||
mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||
mcr_new = mcr_cur;
|
||||
@ -370,16 +389,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
|
||||
if (mcr_new != mcr_cur)
|
||||
mtk_w32(mac->hw, mcr_new, MTK_MAC_MCR(mac->id));
|
||||
|
||||
return;
|
||||
|
||||
err_phy:
|
||||
dev_err(eth->dev, "%s: GMAC%d mode %s not supported!\n", __func__,
|
||||
mac->id, phy_modes(state->interface));
|
||||
return;
|
||||
|
||||
init_err:
|
||||
dev_err(eth->dev, "%s: GMAC%d mode %s err: %d!\n", __func__,
|
||||
mac->id, phy_modes(state->interface), err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mtk_mac_pcs_get_state(struct phylink_config *config,
|
||||
@ -562,6 +572,7 @@ static const struct phylink_mac_ops mtk_phylink_ops = {
|
||||
.mac_pcs_get_state = mtk_mac_pcs_get_state,
|
||||
.mac_an_restart = mtk_mac_an_restart,
|
||||
.mac_config = mtk_mac_config,
|
||||
.mac_finish = mtk_mac_finish,
|
||||
.mac_link_down = mtk_mac_link_down,
|
||||
.mac_link_up = mtk_mac_link_up,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user