kernel: bump to 4.9.105
[openwrt/openwrt.git] / target / linux / sunxi / patches-4.9 / 0050-stmmac-form-4-10.patch
index e6ca1447ffd421da6807c2d66b21793cc005dd75..7549d4995a08d5f7c7f5d2f4a13078fc14a00218 100644 (file)
  
        priv->xstats.tx_clean++;
  
-@@ -1393,22 +1394,17 @@ static void stmmac_tx_clean(struct stmma
+@@ -1398,22 +1399,17 @@ static void stmmac_tx_clean(struct stmma
        netdev_completed_queue(priv->dev, pkts_compl, bytes_compl);
  
        if (unlikely(netif_queue_stopped(priv->dev) &&
  }
  
  static inline void stmmac_enable_dma_irq(struct stmmac_priv *priv)
-@@ -1512,7 +1508,7 @@ static void stmmac_mmc_setup(struct stmm
+@@ -1517,7 +1513,7 @@ static void stmmac_mmc_setup(struct stmm
                dwmac_mmc_ctrl(priv->mmcaddr, mode);
                memset(&priv->mmc, 0, sizeof(struct stmmac_counters));
        } else
  }
  
  /**
-@@ -1525,18 +1521,18 @@ static void stmmac_mmc_setup(struct stmm
+@@ -1530,18 +1526,18 @@ static void stmmac_mmc_setup(struct stmm
  static void stmmac_selec_desc_mode(struct stmmac_priv *priv)
  {
        if (priv->plat->enh_desc) {
                priv->hw->desc = &ndesc_ops;
        }
  }
-@@ -1577,8 +1573,8 @@ static void stmmac_check_ether_addr(stru
+@@ -1582,8 +1578,8 @@ static void stmmac_check_ether_addr(stru
                                             priv->dev->dev_addr, 0);
                if (!is_valid_ether_addr(priv->dev->dev_addr))
                        eth_hw_addr_random(priv->dev);
        }
  }
  
-@@ -1592,16 +1588,12 @@ static void stmmac_check_ether_addr(stru
+@@ -1597,16 +1593,12 @@ static void stmmac_check_ether_addr(stru
   */
  static int stmmac_init_dma_engine(struct stmmac_priv *priv)
  {
        }
  
        if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE))
-@@ -1613,8 +1605,8 @@ static int stmmac_init_dma_engine(struct
+@@ -1618,8 +1610,8 @@ static int stmmac_init_dma_engine(struct
                return ret;
        }
  
  
        if (priv->synopsys_id >= DWMAC_CORE_4_00) {
                priv->rx_tail_addr = priv->dma_rx_phy +
-@@ -1686,7 +1678,8 @@ static int stmmac_hw_setup(struct net_de
+@@ -1691,7 +1683,8 @@ static int stmmac_hw_setup(struct net_de
        /* DMA initialization and SW reset */
        ret = stmmac_init_dma_engine(priv);
        if (ret < 0) {
                return ret;
        }
  
-@@ -1715,7 +1708,7 @@ static int stmmac_hw_setup(struct net_de
+@@ -1720,7 +1713,7 @@ static int stmmac_hw_setup(struct net_de
  
        ret = priv->hw->mac->rx_ipc(priv->hw);
        if (!ret) {
                priv->plat->rx_coe = STMMAC_RX_COE_NONE;
                priv->hw->rx_csum = 0;
        }
-@@ -1740,10 +1733,11 @@ static int stmmac_hw_setup(struct net_de
+@@ -1745,10 +1738,11 @@ static int stmmac_hw_setup(struct net_de
  #ifdef CONFIG_DEBUG_FS
        ret = stmmac_init_fs(dev);
        if (ret < 0)
        priv->hw->dma->start_tx(priv->ioaddr);
        priv->hw->dma->start_rx(priv->ioaddr);
  
-@@ -1798,8 +1792,9 @@ static int stmmac_open(struct net_device
+@@ -1803,8 +1797,9 @@ static int stmmac_open(struct net_device
            priv->hw->pcs != STMMAC_PCS_RTBI) {
                ret = stmmac_init_phy(dev);
                if (ret) {
                        return ret;
                }
        }
-@@ -1814,33 +1809,36 @@ static int stmmac_open(struct net_device
+@@ -1819,33 +1814,36 @@ static int stmmac_open(struct net_device
  
        ret = alloc_dma_desc_resources(priv);
        if (ret < 0) {
                goto init_error;
        }
  
-@@ -1849,8 +1847,9 @@ static int stmmac_open(struct net_device
+@@ -1854,8 +1852,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;
                }
        }
-@@ -1860,8 +1859,9 @@ static int stmmac_open(struct net_device
+@@ -1865,8 +1864,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;
                }
        }
-@@ -1880,8 +1880,8 @@ wolirq_error:
+@@ -1885,8 +1885,8 @@ wolirq_error:
  init_error:
        free_dma_desc_resources(priv);
  dma_desc_error:
  
        return ret;
  }
-@@ -1900,10 +1900,9 @@ static int stmmac_release(struct net_dev
+@@ -1905,10 +1905,9 @@ static int stmmac_release(struct net_dev
                del_timer_sync(&priv->eee_ctrl_timer);
  
        /* Stop and disconnect the PHY */
        }
  
        netif_stop_queue(dev);
-@@ -1963,13 +1962,13 @@ static void stmmac_tso_allocator(struct
+@@ -1968,13 +1967,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;
-@@ -2014,8 +2013,6 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2019,8 +2018,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);
  
-@@ -2025,9 +2022,10 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2030,9 +2027,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;
        }
  
-@@ -2065,11 +2063,11 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2070,11 +2068,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;
-@@ -2098,8 +2096,8 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2103,8 +2101,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);
        }
  
-@@ -2143,7 +2141,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2155,7 +2153,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",
-@@ -2162,11 +2160,9 @@ static netdev_tx_t stmmac_tso_xmit(struc
+@@ -2174,11 +2172,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++;
-@@ -2198,14 +2194,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2210,14 +2206,13 @@ static netdev_tx_t stmmac_xmit(struct sk
                        return stmmac_tso_xmit(skb, dev);
        }
  
                }
                return NETDEV_TX_BUSY;
        }
-@@ -2258,13 +2253,11 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2270,13 +2265,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;
-@@ -2282,9 +2275,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2294,9 +2287,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;
-@@ -2293,13 +2287,13 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2305,13 +2299,13 @@ static netdev_tx_t stmmac_xmit(struct sk
  
                priv->hw->desc->display_ring(tx_head, DMA_TX_SIZE, false);
  
                netif_stop_queue(dev);
        }
  
-@@ -2335,13 +2329,11 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2347,13 +2341,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;
-@@ -2362,7 +2354,7 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2374,7 +2366,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);
-@@ -2373,12 +2365,10 @@ static netdev_tx_t stmmac_xmit(struct sk
+@@ -2385,12 +2377,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;
-@@ -2449,16 +2439,16 @@ static inline void stmmac_rx_refill(stru
+@@ -2461,16 +2451,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);
-@@ -2466,17 +2456,17 @@ static inline void stmmac_rx_refill(stru
+@@ -2478,17 +2468,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);
        }
-@@ -2500,7 +2490,7 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2512,7 +2502,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
-@@ -2562,9 +2552,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2574,9 +2564,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);
  
-@@ -2573,9 +2563,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2585,9 +2575,9 @@ static int stmmac_rx(struct stmmac_priv
                         *  ignored
                         */
                        if (frame_len > priv->dma_buf_sz) {
                                priv->dev->stats.rx_length_errors++;
                                break;
                        }
-@@ -2587,11 +2577,11 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2599,11 +2589,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
-@@ -2628,8 +2618,9 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2640,8 +2630,9 @@ static int stmmac_rx(struct stmmac_priv
                        } else {
                                skb = priv->rx_skbuff[entry];
                                if (unlikely(!skb)) {
                                        priv->dev->stats.rx_dropped++;
                                        break;
                                }
-@@ -2645,7 +2636,8 @@ static int stmmac_rx(struct stmmac_priv
+@@ -2657,7 +2648,8 @@ static int stmmac_rx(struct stmmac_priv
                        }
  
                        if (netif_msg_pktdata(priv)) {
                                print_pkt(skb->data, frame_len);
                        }
  
-@@ -2748,7 +2740,7 @@ static int stmmac_change_mtu(struct net_
+@@ -2760,7 +2752,7 @@ static int stmmac_change_mtu(struct net_
        int max_mtu;
  
        if (netif_running(dev)) {
                return -EBUSY;
        }
  
-@@ -2840,7 +2832,7 @@ static irqreturn_t stmmac_interrupt(int
+@@ -2852,7 +2844,7 @@ static irqreturn_t stmmac_interrupt(int
                pm_wakeup_event(priv->device, 0);
  
        if (unlikely(!dev)) {
                return IRQ_NONE;
        }
  
-@@ -2898,7 +2890,6 @@ static void stmmac_poll_controller(struc
+@@ -2910,7 +2902,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))
-@@ -2908,9 +2899,9 @@ static int stmmac_ioctl(struct net_devic
+@@ -2920,9 +2911,9 @@ static int stmmac_ioctl(struct net_devic
        case SIOCGMIIPHY:
        case SIOCGMIIREG:
        case SIOCSMIIREG:
                break;
        case SIOCSHWTSTAMP:
                ret = stmmac_hwtstamp_ioctl(dev, rq);
-@@ -2938,14 +2929,17 @@ static void sysfs_display_ring(void *hea
+@@ -2950,14 +2941,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");
-@@ -2977,6 +2971,8 @@ static int stmmac_sysfs_ring_open(struct
+@@ -2989,6 +2983,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,
-@@ -2999,11 +2995,11 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -3011,11 +3007,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");
-@@ -3021,9 +3017,9 @@ static int stmmac_sysfs_dma_cap_read(str
+@@ -3033,9 +3029,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",
-@@ -3070,8 +3066,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3082,8 +3078,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;
        }
-@@ -3083,7 +3078,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3095,7 +3090,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;
-@@ -3095,7 +3090,7 @@ static int stmmac_init_fs(struct net_dev
+@@ -3107,7 +3102,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;
-@@ -3167,11 +3162,11 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3179,11 +3174,11 @@ static int stmmac_hw_init(struct stmmac_
        } else {
                if (chain_mode) {
                        priv->hw->mode = &chain_mode_ops;
                        priv->mode = STMMAC_RING_MODE;
                }
        }
-@@ -3179,7 +3174,7 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3191,7 +3186,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
-@@ -3204,8 +3199,9 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3216,8 +3211,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)
-@@ -3215,20 +3211,20 @@ static int stmmac_hw_init(struct stmmac_
+@@ -3227,20 +3223,20 @@ static int stmmac_hw_init(struct stmmac_
  
        if (priv->plat->rx_coe) {
                priv->hw->rx_csum = priv->plat->rx_coe;
  
        return 0;
  }
-@@ -3287,8 +3283,8 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3299,8 +3295,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.
                 */
-@@ -3337,7 +3333,7 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3349,7 +3345,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);
-@@ -3357,13 +3353,13 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3369,13 +3365,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
-@@ -3384,15 +3380,17 @@ int stmmac_dvr_probe(struct device *devi
+@@ -3396,15 +3392,17 @@ int stmmac_dvr_probe(struct device *devi
                /* MDIO bus Registration */
                ret = stmmac_mdio_register(ndev);
                if (ret < 0) {
                goto error_netdev_register;
        }
  
-@@ -3403,7 +3401,7 @@ error_netdev_register:
+@@ -3415,7 +3413,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);
-@@ -3427,7 +3425,7 @@ int stmmac_dvr_remove(struct device *dev
+@@ -3439,7 +3437,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);
-@@ -3465,8 +3463,8 @@ int stmmac_suspend(struct device *dev)
+@@ -3477,8 +3475,8 @@ int stmmac_suspend(struct device *dev)
        if (!ndev || !netif_running(ndev))
                return 0;
  
  
        spin_lock_irqsave(&priv->lock, flags);
  
-@@ -3560,8 +3558,8 @@ int stmmac_resume(struct device *dev)
+@@ -3572,8 +3570,8 @@ int stmmac_resume(struct device *dev)
  
        spin_unlock_irqrestore(&priv->lock, flags);