kernel: bump 5.4 to 5.4.124
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 761-net-ethernet-mediatek-Refine-the-timing-of-GDM-PSE-s.patch
1 From: MarkLee <Mark-MC.Lee@mediatek.com>
2 Date: Wed, 13 Nov 2019 10:38:43 +0800
3 Subject: [PATCH] net: ethernet: mediatek: Refine the timing of GDM/PSE setup
4
5 Refine the timing of GDM/PSE setup, move it from mtk_hw_init
6 to mtk_open. This is recommended by the mt762x HW design to
7 do GDM/PSE setup only after PDMA has been started.
8
9 We exclude mt7628 in mtk_gdm_config function since it is a old IP
10 and there is no GDM/PSE block on it.
11
12 Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15
16 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
17 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
18 @@ -2236,6 +2236,9 @@ static void mtk_gdm_config(struct mtk_et
19 {
20 int i;
21
22 + if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
23 + return;
24 +
25 for (i = 0; i < MTK_MAC_COUNT; i++) {
26 u32 val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i));
27
28 @@ -2274,6 +2277,8 @@ static int mtk_open(struct net_device *d
29 if (err)
30 return err;
31
32 + mtk_gdm_config(eth, MTK_GDMA_TO_PDMA);
33 +
34 napi_enable(&eth->tx_napi);
35 napi_enable(&eth->rx_napi);
36 mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
37 @@ -2457,8 +2462,6 @@ static int mtk_hw_init(struct mtk_eth *e
38 mtk_w32(eth, MTK_RX_DONE_INT, MTK_QDMA_INT_GRP2);
39 mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
40
41 - mtk_gdm_config(eth, MTK_GDMA_TO_PDMA);
42 -
43 return 0;
44
45 err_disable_pm: