kernel: Update kernel 4.9 to 4.9.70
[openwrt/openwrt.git] / target / linux / sunxi / patches-4.9 / 0050-stmmac-form-4-10.patch
index b88c19e2564e88e73e7226f38a3225b7c297d45c..ca2eb3ac8f2628d94e97329798d7950e4bc6f06d 100644 (file)
                        return ret;
                }
        }
-@@ -1798,33 +1793,36 @@ static int stmmac_open(struct net_device
+@@ -1799,33 +1794,36 @@ static int stmmac_open(struct net_device
  
        ret = alloc_dma_desc_resources(priv);
        if (ret < 0) {
                goto init_error;
        }
  
-@@ -1833,8 +1831,9 @@ static int stmmac_open(struct net_device
+@@ -1834,8 +1832,9 @@ static int stmmac_open(struct net_device
                ret = request_irq(priv->wol_irq, stmmac_interrupt,
                                  IRQF_SHARED, dev->name, dev);
                if (unlikely(ret < 0)) {
                        goto wolirq_error;
                }
        }
-@@ -1844,8 +1843,9 @@ static int stmmac_open(struct net_device
+@@ -1845,8 +1844,9 @@ static int stmmac_open(struct net_device
                ret = request_irq(priv->lpi_irq, stmmac_interrupt, IRQF_SHARED,
                                  dev->name, dev);
                if (unlikely(ret < 0)) {
                        goto lpiirq_error;
                }
        }
-@@ -1864,8 +1864,8 @@ wolirq_error:
+@@ -1865,8 +1865,8 @@ wolirq_error:
  init_error:
        free_dma_desc_resources(priv);
  dma_desc_error:
  
        return ret;
  }
-@@ -1884,10 +1884,9 @@ static int stmmac_release(struct net_dev
+@@ -1885,10 +1885,9 @@ static int stmmac_release(struct net_dev
                del_timer_sync(&priv->eee_ctrl_timer);
  
        /* Stop and disconnect the PHY */
        }
  
        netif_stop_queue(dev);
-@@ -1947,13 +1946,13 @@ static void stmmac_tso_allocator(struct
+@@ -1948,13 +1947,13 @@ static void stmmac_tso_allocator(struct
                priv->cur_tx = STMMAC_GET_ENTRY(priv->cur_tx, DMA_TX_SIZE);
                desc = priv->dma_tx + priv->cur_tx;
  
                        0, 0);
  
                tmp_len -= TSO_MAX_BUFF_SIZE;
-@@ -1998,8 +1997,6 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -1999,8 +1998,6 @@ static netdev_tx_t stmmac_tso_xmit(struc
        u8 proto_hdr_len;
        int i;
  
        /* Compute header lengths */
        proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
  
-@@ -2009,9 +2006,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2010,9 +2007,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
                if (!netif_queue_stopped(dev)) {
                        netif_stop_queue(dev);
                        /* This is a hard error, log it. */
                return NETDEV_TX_BUSY;
        }
  
-@@ -2049,11 +2047,11 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2050,11 +2048,11 @@ static netdev_tx_t stmmac_tso_xmit(struc
        priv->tx_skbuff_dma[first_entry].len = skb_headlen(skb);
        priv->tx_skbuff[first_entry] = skb;
  
  
        /* If needed take extra descriptors to fill the remaining payload */
        tmp_pay_len = pay_len - TSO_MAX_BUFF_SIZE;
-@@ -2082,8 +2080,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2083,8 +2081,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
        priv->cur_tx = STMMAC_GET_ENTRY(priv->cur_tx, DMA_TX_SIZE);
  
        if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) {
                netif_stop_queue(dev);
        }
  
-@@ -2127,7 +2125,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2128,7 +2126,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
         * descriptor and then barrier is needed to make sure that
         * all is coherent before granting the DMA engine.
         */
  
        if (netif_msg_pktdata(priv)) {
                pr_info("%s: curr=%d dirty=%d f=%d, e=%d, f_p=%p, nfrags %d\n",
-@@ -2146,11 +2144,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2147,11 +2145,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
        priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, priv->tx_tail_addr,
                                       STMMAC_CHAN0);
  
        dev_err(priv->device, "Tx dma map failed\n");
        dev_kfree_skb(skb);
        priv->dev->stats.tx_dropped++;
-@@ -2182,14 +2178,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2183,14 +2179,13 @@ static netdev_tx_t stmmac_xmit(struct sk
                        return stmmac_tso_xmit(skb, dev);
        }
  
                }
                return NETDEV_TX_BUSY;
        }
-@@ -2242,13 +2237,11 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2243,13 +2238,11 @@ static netdev_tx_t stmmac_xmit(struct sk
  
                priv->tx_skbuff[entry] = NULL;
  
  
                priv->tx_skbuff_dma[entry].map_as_page = true;
                priv->tx_skbuff_dma[entry].len = len;
-@@ -2266,9 +2259,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2267,9 +2260,10 @@ static netdev_tx_t stmmac_xmit(struct sk
        if (netif_msg_pktdata(priv)) {
                void *tx_head;
  
  
                if (priv->extend_desc)
                        tx_head = (void *)priv->dma_etx;
-@@ -2277,13 +2271,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2278,13 +2272,13 @@ static netdev_tx_t stmmac_xmit(struct sk
  
                priv->hw->desc->display_ring(tx_head, DMA_TX_SIZE, false);
  
                netif_stop_queue(dev);
        }
  
-@@ -2319,13 +2313,11 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2320,13 +2314,11 @@ static netdev_tx_t stmmac_xmit(struct sk
                if (dma_mapping_error(priv->device, des))
                        goto dma_map_err;
  
  
                priv->tx_skbuff_dma[first_entry].len = nopaged_len;
                priv->tx_skbuff_dma[first_entry].last_segment = last_segment;
-@@ -2346,7 +2338,7 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2347,7 +2339,7 @@ static netdev_tx_t stmmac_xmit(struct sk
                 * descriptor and then barrier is needed to make sure that
                 * all is coherent before granting the DMA engine.
                 */
        }
  
        netdev_sent_queue(dev, skb->len);
-@@ -2357,12 +2349,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2358,12 +2350,10 @@ static netdev_tx_t stmmac_xmit(struct sk
                priv->hw->dma->set_tx_tail_ptr(priv->ioaddr, priv->tx_tail_addr,
                                               STMMAC_CHAN0);
  
        dev_kfree_skb(skb);
        priv->dev->stats.tx_dropped++;
        return NETDEV_TX_OK;
-@@ -2433,16 +2423,16 @@ static inline void stmmac_rx_refill(stru
+@@ -2434,16 +2424,16 @@ static inline void stmmac_rx_refill(stru
                                           DMA_FROM_DEVICE);
                        if (dma_mapping_error(priv->device,
                                              priv->rx_skbuff_dma[entry])) {
                        }
                        if (priv->hw->mode->refill_desc3)
                                priv->hw->mode->refill_desc3(priv, p);
-@@ -2450,17 +2440,17 @@ static inline void stmmac_rx_refill(stru
+@@ -2451,17 +2441,17 @@ static inline void stmmac_rx_refill(stru
                        if (priv->rx_zeroc_thresh > 0)
                                priv->rx_zeroc_thresh--;
  
  
                entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
        }
-@@ -2484,7 +2474,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2485,7 +2475,7 @@ static int stmmac_rx(struct stmmac_priv
        if (netif_msg_rx_status(priv)) {
                void *rx_head;
  
                if (priv->extend_desc)
                        rx_head = (void *)priv->dma_erx;
                else
-@@ -2546,9 +2536,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2547,9 +2537,9 @@ static int stmmac_rx(struct stmmac_priv
                        unsigned int des;
  
                        if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
  
                        frame_len = priv->hw->desc->get_rx_frame_len(p, coe);
  
-@@ -2557,9 +2547,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2558,9 +2548,9 @@ static int stmmac_rx(struct stmmac_priv
                         *  ignored
                         */
                        if (frame_len > priv->dma_buf_sz) {
                                priv->dev->stats.rx_length_errors++;
                                break;
                        }
-@@ -2571,11 +2561,11 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2572,11 +2562,11 @@ static int stmmac_rx(struct stmmac_priv
                                frame_len -= ETH_FCS_LEN;
  
                        if (netif_msg_rx_status(priv)) {
                        }
  
                        /* The zero-copy is always used for all the sizes
-@@ -2612,8 +2602,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2613,8 +2603,9 @@ static int stmmac_rx(struct stmmac_priv
                        } else {
                                skb = priv->rx_skbuff[entry];
                                if (unlikely(!skb)) {
                                        priv->dev->stats.rx_dropped++;
                                        break;
                                }
-@@ -2629,7 +2620,8 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2630,7 +2621,8 @@ static int stmmac_rx(struct stmmac_priv
                        }
  
                        if (netif_msg_pktdata(priv)) {
                                print_pkt(skb->data, frame_len);
                        }
  
-@@ -2732,7 +2724,7 @@ static int stmmac_change_mtu(struct net_
+@@ -2733,7 +2725,7 @@ static int stmmac_change_mtu(struct net_
        int max_mtu;
  
        if (netif_running(dev)) {
                return -EBUSY;
        }
  
-@@ -2824,7 +2816,7 @@ static irqreturn_t stmmac_interrupt(int
+@@ -2825,7 +2817,7 @@ static irqreturn_t stmmac_interrupt(int
                pm_wakeup_event(priv->device, 0);
  
        if (unlikely(!dev)) {
                return IRQ_NONE;
        }
  
-@@ -2882,7 +2874,6 @@ static void stmmac_poll_controller(struc
+@@ -2883,7 +2875,6 @@ static void stmmac_poll_controller(struc
   */
  static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
  {
        int ret = -EOPNOTSUPP;
  
        if (!netif_running(dev))
-@@ -2892,9 +2883,9 @@ static int stmmac_ioctl(struct net_devic
+@@ -2893,9 +2884,9 @@ static int stmmac_ioctl(struct net_devic
        case SIOCGMIIPHY:
        case SIOCGMIIREG:
        case SIOCSMIIREG:
                break;
        case SIOCSHWTSTAMP:
                ret = stmmac_hwtstamp_ioctl(dev, rq);
-@@ -2922,14 +2913,17 @@ static void sysfs_display_ring(void *hea
+@@ -2923,14 +2914,17 @@ static void sysfs_display_ring(void *hea
                        x = *(u64 *) ep;
                        seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
                                   i, (unsigned int)virt_to_phys(ep),
                        p++;
                }
                seq_printf(seq, "\n");
-@@ -2961,6 +2955,8 @@ static int stmmac_sysfs_ring_open(struct
+@@ -2962,6 +2956,8 @@ static int stmmac_sysfs_ring_open(struct
        return single_open(file, stmmac_sysfs_ring_read, inode->i_private);
  }
  
  static const struct file_operations stmmac_rings_status_fops = {
        .owner = THIS_MODULE,
        .open = stmmac_sysfs_ring_open,
-@@ -2983,11 +2979,11 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -2984,11 +2980,11 @@ static int stmmac_sysfs_dma_cap_read(str
        seq_printf(seq, "\tDMA HW features\n");
        seq_printf(seq, "==============================\n");
  
                   (priv->dma_cap.half_duplex) ? "Y" : "N");
        seq_printf(seq, "\tHash Filter: %s\n",
                   (priv->dma_cap.hash_filter) ? "Y" : "N");
-@@ -3005,9 +3001,9 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -3006,9 +3002,9 @@ static int stmmac_sysfs_dma_cap_read(str
                   (priv->dma_cap.rmon) ? "Y" : "N");
        seq_printf(seq, "\tIEEE 1588-2002 Time Stamp: %s\n",
                   (priv->dma_cap.time_stamp) ? "Y" : "N");
                   (priv->dma_cap.eee) ? "Y" : "N");
        seq_printf(seq, "\tAV features: %s\n", (priv->dma_cap.av) ? "Y" : "N");
        seq_printf(seq, "\tChecksum Offload in TX: %s\n",
-@@ -3054,8 +3050,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3055,8 +3051,7 @@ static int stmmac_init_fs(struct net_dev
        priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);
  
        if (!priv->dbgfs_dir || IS_ERR(priv->dbgfs_dir)) {
  
                return -ENOMEM;
        }
-@@ -3067,7 +3062,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3068,7 +3063,7 @@ static int stmmac_init_fs(struct net_dev
                                    &stmmac_rings_status_fops);
  
        if (!priv->dbgfs_rings_status || IS_ERR(priv->dbgfs_rings_status)) {
                debugfs_remove_recursive(priv->dbgfs_dir);
  
                return -ENOMEM;
-@@ -3079,7 +3074,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3080,7 +3075,7 @@ static int stmmac_init_fs(struct net_dev
                                            dev, &stmmac_dma_cap_fops);
  
        if (!priv->dbgfs_dma_cap || IS_ERR(priv->dbgfs_dma_cap)) {
                debugfs_remove_recursive(priv->dbgfs_dir);
  
                return -ENOMEM;
-@@ -3151,11 +3146,11 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3152,11 +3147,11 @@ static int stmmac_hw_init(struct stmmac_
        } else {
                if (chain_mode) {
                        priv->hw->mode = &chain_mode_ops;
                        priv->mode = STMMAC_RING_MODE;
                }
        }
-@@ -3163,7 +3158,7 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3164,7 +3159,7 @@ static int stmmac_hw_init(struct stmmac_
        /* Get the HW capability (new GMAC newer than 3.50a) */
        priv->hw_cap_support = stmmac_get_hw_features(priv);
        if (priv->hw_cap_support) {
  
                /* We can override some gmac/dma configuration fields: e.g.
                 * enh_desc, tx_coe (e.g. that are passed through the
-@@ -3188,8 +3183,9 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3189,8 +3184,9 @@ static int stmmac_hw_init(struct stmmac_
                else if (priv->dma_cap.rx_coe_type1)
                        priv->plat->rx_coe = STMMAC_RX_COE_TYPE1;
  
  
        /* To use alternate (extended), normal or GMAC4 descriptor structures */
        if (priv->synopsys_id >= DWMAC_CORE_4_00)
-@@ -3199,20 +3195,20 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3200,20 +3196,20 @@ static int stmmac_hw_init(struct stmmac_
  
        if (priv->plat->rx_coe) {
                priv->hw->rx_csum = priv->plat->rx_coe;
  
        return 0;
  }
-@@ -3271,8 +3267,8 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3272,8 +3268,8 @@ int stmmac_dvr_probe(struct device *devi
  
        priv->stmmac_clk = devm_clk_get(priv->device, STMMAC_RESOURCE_NAME);
        if (IS_ERR(priv->stmmac_clk)) {
                /* If failed to obtain stmmac_clk and specific clk_csr value
                 * is NOT passed from the platform, probe fail.
                 */
-@@ -3321,7 +3317,7 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3322,7 +3318,7 @@ int stmmac_dvr_probe(struct device *devi
        if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) {
                ndev->hw_features |= NETIF_F_TSO;
                priv->tso = true;
        }
        ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
        ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
-@@ -3341,13 +3337,13 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3342,13 +3338,13 @@ int stmmac_dvr_probe(struct device *devi
         */
        if ((priv->synopsys_id >= DWMAC_CORE_3_50) && (!priv->plat->riwt_off)) {
                priv->use_riwt = 1;
  
        /* If a specific clk_csr value is passed from the platform
         * this means that the CSR Clock Range selection cannot be
-@@ -3368,15 +3364,17 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3369,15 +3365,17 @@ int stmmac_dvr_probe(struct device *devi
                /* MDIO bus Registration */
                ret = stmmac_mdio_register(ndev);
                if (ret < 0) {
                goto error_netdev_register;
        }
  
-@@ -3387,7 +3385,7 @@ error_netdev_register:
+@@ -3388,7 +3386,7 @@ error_netdev_register:
            priv->hw->pcs != STMMAC_PCS_TBI &&
            priv->hw->pcs != STMMAC_PCS_RTBI)
                stmmac_mdio_unregister(ndev);
        netif_napi_del(&priv->napi);
  error_hw_init:
        clk_disable_unprepare(priv->pclk);
-@@ -3411,7 +3409,7 @@ int stmmac_dvr_remove(struct device *dev
+@@ -3412,7 +3410,7 @@ int stmmac_dvr_remove(struct device *dev
        struct net_device *ndev = dev_get_drvdata(dev);
        struct stmmac_priv *priv = netdev_priv(ndev);
  
  
        priv->hw->dma->stop_rx(priv->ioaddr);
        priv->hw->dma->stop_tx(priv->ioaddr);
-@@ -3449,8 +3447,8 @@ int stmmac_suspend(struct device *dev)
+@@ -3450,8 +3448,8 @@ int stmmac_suspend(struct device *dev)
        if (!ndev || !netif_running(ndev))
                return 0;
  
  
        spin_lock_irqsave(&priv->lock, flags);
  
-@@ -3544,8 +3542,8 @@ int stmmac_resume(struct device *dev)
+@@ -3545,8 +3543,8 @@ int stmmac_resume(struct device *dev)
  
        spin_unlock_irqrestore(&priv->lock, flags);