mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/chunkeey.git] / target / linux / generic / pending-5.4 / 770-06-net-ethernet-mtk_eth_soc-implement-dynamic-interrupt.patch
index 8720ab503cc93a493a7361492bab9a94c968410c..58128445b27145eb95a2a5ff2f18664b27bc33a6 100644 (file)
@@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
          MediaTek SoC family.
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -1228,12 +1228,13 @@ static void mtk_update_rx_cpu_idx(struct
+@@ -1249,12 +1249,13 @@ static void mtk_update_rx_cpu_idx(struct
  static int mtk_poll_rx(struct napi_struct *napi, int budget,
                       struct mtk_eth *eth)
  {
@@ -35,7 +35,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        while (done < budget) {
                struct net_device *netdev;
-@@ -1307,6 +1308,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -1328,6 +1329,7 @@ static int mtk_poll_rx(struct napi_struc
                else
                        skb_checksum_none_assert(skb);
                skb->protocol = eth_type_trans(skb, netdev);
@@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
                if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX &&
                    (trxd.rxd2 & RX_DMA_VTAG))
-@@ -1338,6 +1340,12 @@ rx_done:
+@@ -1359,6 +1361,12 @@ rx_done:
                mtk_update_rx_cpu_idx(eth);
        }
  
@@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        return done;
  }
  
-@@ -1430,6 +1438,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
+@@ -1451,6 +1459,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
  static int mtk_poll_tx(struct mtk_eth *eth, int budget)
  {
        struct mtk_tx_ring *ring = &eth->tx_ring;
@@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        unsigned int done[MTK_MAX_DEVS];
        unsigned int bytes[MTK_MAX_DEVS];
        int total = 0, i;
-@@ -1447,8 +1456,14 @@ static int mtk_poll_tx(struct mtk_eth *e
+@@ -1468,8 +1477,14 @@ static int mtk_poll_tx(struct mtk_eth *e
                        continue;
                netdev_completed_queue(eth->netdev[i], done[i], bytes[i]);
                total += done[i];
@@ -79,7 +79,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (mtk_queue_stopped(eth) &&
            (atomic_read(&ring->free_count) > ring->thresh))
                mtk_wake_queue(eth);
-@@ -2123,6 +2138,7 @@ static irqreturn_t mtk_handle_irq_rx(int
+@@ -2144,6 +2159,7 @@ static irqreturn_t mtk_handle_irq_rx(int
  {
        struct mtk_eth *eth = _eth;
  
@@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (likely(napi_schedule_prep(&eth->rx_napi))) {
                __napi_schedule(&eth->rx_napi);
                mtk_rx_irq_disable(eth, MTK_RX_DONE_INT);
-@@ -2135,6 +2151,7 @@ static irqreturn_t mtk_handle_irq_tx(int
+@@ -2156,6 +2172,7 @@ static irqreturn_t mtk_handle_irq_tx(int
  {
        struct mtk_eth *eth = _eth;
  
@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (likely(napi_schedule_prep(&eth->tx_napi))) {
                __napi_schedule(&eth->tx_napi);
                mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
-@@ -2311,6 +2328,9 @@ static int mtk_stop(struct net_device *d
+@@ -2332,6 +2349,9 @@ static int mtk_stop(struct net_device *d
        napi_disable(&eth->tx_napi);
        napi_disable(&eth->rx_napi);
  
@@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
                mtk_stop_dma(eth, MTK_QDMA_GLO_CFG);
        mtk_stop_dma(eth, MTK_PDMA_GLO_CFG);
-@@ -2360,6 +2380,64 @@ err_disable_clks:
+@@ -2381,6 +2401,64 @@ err_disable_clks:
        return ret;
  }
  
@@ -170,7 +170,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static int mtk_hw_init(struct mtk_eth *eth)
  {
        int i, val, ret;
-@@ -2381,9 +2459,6 @@ static int mtk_hw_init(struct mtk_eth *e
+@@ -2402,9 +2480,6 @@ static int mtk_hw_init(struct mtk_eth *e
                        goto err_disable_pm;
                }
  
@@ -180,7 +180,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                /* disable delay and normal interrupt */
                mtk_tx_irq_disable(eth, ~0);
                mtk_rx_irq_disable(eth, ~0);
-@@ -2422,11 +2497,10 @@ static int mtk_hw_init(struct mtk_eth *e
+@@ -2443,11 +2518,10 @@ static int mtk_hw_init(struct mtk_eth *e
        /* Enable RX VLan Offloading */
        mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
  
@@ -194,7 +194,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        mtk_tx_irq_disable(eth, ~0);
        mtk_rx_irq_disable(eth, ~0);
  
-@@ -2930,6 +3004,13 @@ static int mtk_probe(struct platform_dev
+@@ -2948,6 +3022,13 @@ static int mtk_probe(struct platform_dev
        spin_lock_init(&eth->page_lock);
        spin_lock_init(&eth->tx_irq_lock);
        spin_lock_init(&eth->rx_irq_lock);
@@ -260,7 +260,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  /* QDMA Interrupt grouping registers */
  #define MTK_QDMA_INT_GRP1     0x1a20
-@@ -892,6 +898,18 @@ struct mtk_eth {
+@@ -912,6 +918,18 @@ struct mtk_eth {
  
        const struct mtk_soc_data       *soc;