mediatek: update patches
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.4 / 0094-net-next-mediatek-don-t-use-intermediate-variables-t.patch
1 From 441d87495f33fd444a2b2a16f6df07892dac3f89 Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Tue, 3 May 2016 04:12:35 +0200
4 Subject: [PATCH 094/102] net-next: mediatek: don't use intermediate variables
5 to store IRQ masks
6
7 The code currently uses variables to store and never modify the bit masks
8 of interrupts. This is legacy code from an early version of the driver
9 that supported MIPS based SoCs where the IRQ bits depended on the actual
10 SoC. As the bits are the same for all ARM based SoC using this driver we
11 can remove the intermediate variables.
12
13 Signed-off-by: John Crispin <john@phrozen.org>
14 ---
15 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 22 ++++++++++------------
16 1 file changed, 10 insertions(+), 12 deletions(-)
17
18 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 index 6a9fbde..13ee15f 100644
20 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
21 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
22 @@ -806,7 +806,7 @@ drop:
23 }
24
25 static int mtk_poll_rx(struct napi_struct *napi, int budget,
26 - struct mtk_eth *eth, u32 rx_intr)
27 + struct mtk_eth *eth)
28 {
29 struct mtk_rx_ring *ring = &eth->rx_ring;
30 int idx = ring->calc_idx;
31 @@ -894,7 +894,7 @@ release_desc:
32 }
33
34 if (done < budget)
35 - mtk_w32(eth, rx_intr, MTK_QMTK_INT_STATUS);
36 + mtk_w32(eth, MTK_RX_DONE_INT, MTK_QMTK_INT_STATUS);
37
38 return done;
39 }
40 @@ -977,28 +977,26 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again)
41 static int mtk_poll(struct napi_struct *napi, int budget)
42 {
43 struct mtk_eth *eth = container_of(napi, struct mtk_eth, rx_napi);
44 - u32 status, status2, mask, tx_intr, rx_intr, status_intr;
45 + u32 status, status2, mask;
46 int tx_done, rx_done;
47 bool tx_again = false;
48
49 status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
50 status2 = mtk_r32(eth, MTK_INT_STATUS2);
51 - tx_intr = MTK_TX_DONE_INT;
52 - rx_intr = MTK_RX_DONE_INT;
53 - status_intr = (MTK_GDM1_AF | MTK_GDM2_AF);
54 tx_done = 0;
55 rx_done = 0;
56 tx_again = 0;
57
58 - if (status & tx_intr)
59 + if (status & MTK_TX_DONE_INT)
60 tx_done = mtk_poll_tx(eth, budget, &tx_again);
61
62 - if (status & rx_intr)
63 - rx_done = mtk_poll_rx(napi, budget, eth, rx_intr);
64 + if (status & MTK_RX_DONE_INT)
65 + rx_done = mtk_poll_rx(napi, budget, eth);
66
67 - if (unlikely(status2 & status_intr)) {
68 + if (unlikely(status2 & (MTK_GDM1_AF | MTK_GDM2_AF))) {
69 mtk_stats_update(eth);
70 - mtk_w32(eth, status_intr, MTK_INT_STATUS2);
71 + mtk_w32(eth, (MTK_GDM1_AF | MTK_GDM2_AF),
72 + MTK_INT_STATUS2);
73 }
74
75 if (unlikely(netif_msg_intr(eth))) {
76 @@ -1016,7 +1014,7 @@ static int mtk_poll(struct napi_struct *napi, int budget)
77 return budget;
78
79 napi_complete(napi);
80 - mtk_irq_enable(eth, tx_intr | rx_intr);
81 + mtk_irq_enable(eth, MTK_RX_DONE_INT | MTK_RX_DONE_INT);
82
83 return rx_done;
84 }
85 --
86 1.7.10.4
87