Commit bf253fb7 authored by Sean Wang's avatar Sean Wang Committed by David S. Miller

net: ethernet: mediatek: add mtk_hw_deinit call as the opposite to mtk_hw_init call

grouping things related to the deinitialization of what
mtk_hw_init call does that help to be reused by the reset
process and the error path handling.
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 85574dbf
...@@ -1477,6 +1477,16 @@ static int __init mtk_hw_init(struct mtk_eth *eth) ...@@ -1477,6 +1477,16 @@ static int __init mtk_hw_init(struct mtk_eth *eth)
return 0; return 0;
} }
static int mtk_hw_deinit(struct mtk_eth *eth)
{
clk_disable_unprepare(eth->clks[MTK_CLK_GP2]);
clk_disable_unprepare(eth->clks[MTK_CLK_GP1]);
clk_disable_unprepare(eth->clks[MTK_CLK_ESW]);
clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]);
return 0;
}
static int __init mtk_init(struct net_device *dev) static int __init mtk_init(struct net_device *dev)
{ {
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(dev);
...@@ -1926,10 +1936,7 @@ static int mtk_remove(struct platform_device *pdev) ...@@ -1926,10 +1936,7 @@ static int mtk_remove(struct platform_device *pdev)
mtk_stop(eth->netdev[i]); mtk_stop(eth->netdev[i]);
} }
clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]); mtk_hw_deinit(eth);
clk_disable_unprepare(eth->clks[MTK_CLK_ESW]);
clk_disable_unprepare(eth->clks[MTK_CLK_GP1]);
clk_disable_unprepare(eth->clks[MTK_CLK_GP2]);
netif_napi_del(&eth->tx_napi); netif_napi_del(&eth->tx_napi);
netif_napi_del(&eth->rx_napi); netif_napi_del(&eth->rx_napi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment