kernel: bump 4.9 to 4.9.125
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.9 / 706-fsl_ppfe-support-layercape.patch
index 844475adfefc8fe8b46c8fa8f3accad36604f4f3..01a24336f64c3a986874d0f2e660e55ed0303002 100644 (file)
@@ -1,9 +1,9 @@
-From 8b7935a883d42187716fe486c83352f24d01ddcd Mon Sep 17 00:00:00 2001
+From 79fb41b6040d00d3bdfca9eb70a7848441eb7447 Mon Sep 17 00:00:00 2001
 From: Yangbo Lu <yangbo.lu@nxp.com>
-Date: Thu, 19 Oct 2017 12:48:19 +0800
+Date: Wed, 17 Jan 2018 15:14:12 +0800
 Subject: [PATCH] fsl_ppfe: support layercape
 
-This is a integrated patch for layerscape pfe support.
+This is an integrated patch for layerscape pfe support.
 
 Calvin Johnson <calvin.johnson@nxp.com>
 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
@@ -25,24 +25,24 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  drivers/staging/fsl_ppfe/pfe_ctrl.h                |  112 +
  drivers/staging/fsl_ppfe/pfe_debugfs.c             |  111 +
  drivers/staging/fsl_ppfe/pfe_debugfs.h             |   25 +
- drivers/staging/fsl_ppfe/pfe_eth.c                 | 2434 ++++++++++++++++++++
+ drivers/staging/fsl_ppfe/pfe_eth.c                 | 2474 ++++++++++++++++++++
  drivers/staging/fsl_ppfe/pfe_eth.h                 |  184 ++
  drivers/staging/fsl_ppfe/pfe_firmware.c            |  314 +++
  drivers/staging/fsl_ppfe/pfe_firmware.h            |   32 +
  drivers/staging/fsl_ppfe/pfe_hal.c                 | 1516 ++++++++++++
  drivers/staging/fsl_ppfe/pfe_hif.c                 | 1072 +++++++++
  drivers/staging/fsl_ppfe/pfe_hif.h                 |  211 ++
- drivers/staging/fsl_ppfe/pfe_hif_lib.c             |  601 +++++
- drivers/staging/fsl_ppfe/pfe_hif_lib.h             |  239 ++
+ drivers/staging/fsl_ppfe/pfe_hif_lib.c             |  637 +++++
+ drivers/staging/fsl_ppfe/pfe_hif_lib.h             |  240 ++
  drivers/staging/fsl_ppfe/pfe_hw.c                  |  176 ++
  drivers/staging/fsl_ppfe/pfe_hw.h                  |   27 +
- drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c    |  394 ++++
+ drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c    |  385 +++
  drivers/staging/fsl_ppfe/pfe_mod.c                 |  141 ++
  drivers/staging/fsl_ppfe/pfe_mod.h                 |  112 +
  drivers/staging/fsl_ppfe/pfe_perfmon.h             |   38 +
  drivers/staging/fsl_ppfe/pfe_sysfs.c               |  818 +++++++
  drivers/staging/fsl_ppfe/pfe_sysfs.h               |   29 +
- 34 files changed, 10366 insertions(+)
+ 34 files changed, 10434 insertions(+)
  create mode 100644 drivers/staging/fsl_ppfe/Kconfig
  create mode 100644 drivers/staging/fsl_ppfe/Makefile
  create mode 100644 drivers/staging/fsl_ppfe/TODO
@@ -78,9 +78,6 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  create mode 100644 drivers/staging/fsl_ppfe/pfe_sysfs.c
  create mode 100644 drivers/staging/fsl_ppfe/pfe_sysfs.h
 
-diff --git a/drivers/staging/fsl_ppfe/Kconfig b/drivers/staging/fsl_ppfe/Kconfig
-new file mode 100644
-index 00000000..e4096435
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/Kconfig
 @@ -0,0 +1,20 @@
@@ -104,9 +101,6 @@ index 00000000..e4096435
 +      UTIL PE has to be enabled only if required.
 +
 +endif # FSL_PPFE
-diff --git a/drivers/staging/fsl_ppfe/Makefile b/drivers/staging/fsl_ppfe/Makefile
-new file mode 100644
-index 00000000..07cd351b
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/Makefile
 @@ -0,0 +1,19 @@
@@ -129,17 +123,11 @@ index 00000000..07cd351b
 +      pfe_debugfs.o \
 +      pfe_ls1012a_platform.o \
 +      pfe_hal.o
-diff --git a/drivers/staging/fsl_ppfe/TODO b/drivers/staging/fsl_ppfe/TODO
-new file mode 100644
-index 00000000..43c48ccd
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/TODO
 @@ -0,0 +1,2 @@
 +TODO:
 +      - provide pfe pe monitoring support
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus.h b/drivers/staging/fsl_ppfe/include/pfe/cbus.h
-new file mode 100644
-index 00000000..04503d28
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus.h
 @@ -0,0 +1,78 @@
@@ -221,9 +209,6 @@ index 00000000..04503d28
 +#define DDR_BUF_SIZE  BIT(DDR_BUF_SIZE_LN2)
 +
 +#endif /* _CBUS_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/bmu.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/bmu.h
-new file mode 100644
-index 00000000..87738ca3
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/bmu.h
 @@ -0,0 +1,55 @@
@@ -282,9 +267,6 @@ index 00000000..87738ca3
 +#define BMU2_MCAST_ALLOC_CTRL (BMU2_BASE_ADDR + BMU_MCAST_ALLOC_CTRL)
 +
 +#endif /* _BMU_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/class_csr.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/class_csr.h
-new file mode 100644
-index 00000000..e4dadff5
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/class_csr.h
 @@ -0,0 +1,289 @@
@@ -577,9 +559,6 @@ index 00000000..e4dadff5
 +};
 +
 +#endif /* _CLASS_CSR_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/emac_mtip.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/emac_mtip.h
-new file mode 100644
-index 00000000..9c5d7919
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/emac_mtip.h
 @@ -0,0 +1,242 @@
@@ -825,9 +804,6 @@ index 00000000..9c5d7919
 +#define EMAC_SPEC_ADDR_MAX    4
 +
 +#endif /* _EMAC_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/gpi.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/gpi.h
-new file mode 100644
-index 00000000..7b295830
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/gpi.h
 @@ -0,0 +1,86 @@
@@ -917,9 +893,6 @@ index 00000000..7b295830
 +#define EGPI_PAUSE_TIME               0x000007D0
 +#define EGPI_PAUSE_ENABLE     0x40000000
 +#endif /* _GPI_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/hif.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/hif.h
-new file mode 100644
-index 00000000..71cf81a7
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/hif.h
 @@ -0,0 +1,100 @@
@@ -1023,9 +996,6 @@ index 00000000..71cf81a7
 +#define PROC_ID(id)   ((id) << 18)
 +
 +#endif /* _HIF_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/hif_nocpy.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/hif_nocpy.h
-new file mode 100644
-index 00000000..3d4d43ce
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/hif_nocpy.h
 @@ -0,0 +1,50 @@
@@ -1079,9 +1049,6 @@ index 00000000..3d4d43ce
 +#define HIF_NOCPY_INT_COAL    (HIF_NOCPY_BASE_ADDR + 0x90)
 +
 +#endif /* _HIF_NOCPY_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/tmu_csr.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/tmu_csr.h
-new file mode 100644
-index 00000000..05f3d681
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/tmu_csr.h
 @@ -0,0 +1,168 @@
@@ -1253,9 +1220,6 @@ index 00000000..05f3d681
 +#define DEFAULT_TMU3_QDEPTH   127
 +
 +#endif /* _TMU_CSR_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/cbus/util_csr.h b/drivers/staging/fsl_ppfe/include/pfe/cbus/util_csr.h
-new file mode 100644
-index 00000000..ae623cda
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/cbus/util_csr.h
 @@ -0,0 +1,61 @@
@@ -1320,9 +1284,6 @@ index 00000000..ae623cda
 +};
 +
 +#endif /* _UTIL_CSR_H_ */
-diff --git a/drivers/staging/fsl_ppfe/include/pfe/pfe.h b/drivers/staging/fsl_ppfe/include/pfe/pfe.h
-new file mode 100644
-index 00000000..d93ae4c6
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/include/pfe/pfe.h
 @@ -0,0 +1,372 @@
@@ -1698,9 +1659,6 @@ index 00000000..d93ae4c6
 +}
 +
 +#endif /* _PFE_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_ctrl.c b/drivers/staging/fsl_ppfe/pfe_ctrl.c
-new file mode 100644
-index 00000000..dfa8547c
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_ctrl.c
 @@ -0,0 +1,238 @@
@@ -1942,9 +1900,6 @@ index 00000000..dfa8547c
 +{
 +      pr_info("%s\n", __func__);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_ctrl.h b/drivers/staging/fsl_ppfe/pfe_ctrl.h
-new file mode 100644
-index 00000000..22115c76
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_ctrl.h
 @@ -0,0 +1,112 @@
@@ -2060,9 +2015,6 @@ index 00000000..22115c76
 +int relax(unsigned long end);
 +
 +#endif /* _PFE_CTRL_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_debugfs.c b/drivers/staging/fsl_ppfe/pfe_debugfs.c
-new file mode 100644
-index 00000000..4156610d
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_debugfs.c
 @@ -0,0 +1,111 @@
@@ -2177,9 +2129,6 @@ index 00000000..4156610d
 +{
 +      debugfs_remove_recursive(pfe->dentry);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_debugfs.h b/drivers/staging/fsl_ppfe/pfe_debugfs.h
-new file mode 100644
-index 00000000..301d9fc2
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_debugfs.h
 @@ -0,0 +1,25 @@
@@ -2208,12 +2157,9 @@ index 00000000..301d9fc2
 +void pfe_debugfs_exit(struct pfe *pfe);
 +
 +#endif /* _PFE_DEBUGFS_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_eth.c b/drivers/staging/fsl_ppfe/pfe_eth.c
-new file mode 100644
-index 00000000..02cd7c52
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_eth.c
-@@ -0,0 +1,2434 @@
+@@ -0,0 +1,2474 @@
 +/*
 + * Copyright 2015-2016 Freescale Semiconductor, Inc.
 + * Copyright 2017 NXP
@@ -2509,10 +2455,10 @@ index 00000000..02cd7c52
 +      /* Initialize the default values */
 +
 +      /*
-+       * By default, packets without conntrack will use this default high
++       * By default, packets without conntrack will use this default low
 +       * priority queue
 +       */
-+      priv->default_priority = 15;
++      priv->default_priority = 0;
 +
 +      /* Create our sysfs files */
 +      err = device_create_file(&ndev->dev, &dev_attr_default_priority);
@@ -2793,7 +2739,9 @@ index 00000000..02cd7c52
 +      if (!phydev)
 +              return -ENODEV;
 +
-+      return phy_ethtool_ksettings_get(phydev, cmd);
++      phy_ethtool_ksettings_get(phydev, cmd);
++
++      return 0;
 +}
 +
 +/*
@@ -3137,7 +3085,8 @@ index 00000000..02cd7c52
 +                           struct ls1012a_mdio_platform_data *minfo)
 +{
 +      struct mii_bus *bus;
-+      int rc;
++      int rc, ii;
++      struct phy_device *phydev;
 +
 +      netif_info(priv, drv, priv->ndev, "%s\n", __func__);
 +      pr_info("%s\n", __func__);
@@ -3176,6 +3125,31 @@ index 00000000..02cd7c52
 +      }
 +
 +      priv->mii_bus = bus;
++
++      /* For clause 45 we need to call get_phy_device() with it's
++       * 3rd argument as true and then register the phy device
++       * via phy_device_register()
++       */
++
++      if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII) {
++              for (ii = 0; ii < NUM_GEMAC_SUPPORT; ii++) {
++                      phydev = get_phy_device(priv->mii_bus,
++                                      priv->einfo->phy_id + ii, true);
++                      if (!phydev || IS_ERR(phydev)) {
++                              rc = -EIO;
++                              netdev_err(priv->ndev, "fail to get device\n");
++                              goto err1;
++                      }
++                      rc = phy_device_register(phydev);
++                      if (rc) {
++                              phy_device_free(phydev);
++                              netdev_err(priv->ndev,
++                                      "phy_device_register() failed\n");
++                              goto err1;
++                      }
++              }
++      }
++
 +      pfe_eth_mdio_reset(bus);
 +
 +      return 0;
@@ -3361,8 +3335,9 @@ index 00000000..02cd7c52
 +      struct pfe_eth_priv_s *priv = pfe->eth.eth_priv[0];
 +      int sgmii_2500 = 0;
 +      struct mii_bus *bus = priv->mii_bus;
++      u16 value = 0;
 +
-+      if (priv->einfo->mii_config == PHY_INTERFACE_MODE_SGMII_2500)
++      if (priv->einfo->mii_config == PHY_INTERFACE_MODE_2500SGMII)
 +              sgmii_2500 = 1;
 +
 +      netif_info(priv, drv, ndev, "%s\n", __func__);
@@ -3378,14 +3353,16 @@ index 00000000..02cd7c52
 +              pfe_eth_mdio_write(bus, 0, 0x4, 0x4001);
 +              pfe_eth_mdio_write(bus, 0, 0x12, 0xa120);
 +              pfe_eth_mdio_write(bus, 0, 0x13, 0x7);
++              /* Autonegotiation need to be disabled for 2.5G SGMII mode*/
++              value = 0x0140;
++              pfe_eth_mdio_write(bus, 0, 0x0, value);
 +      } else {
 +              pfe_eth_mdio_write(bus, 0, 0x14, 0xb);
 +              pfe_eth_mdio_write(bus, 0, 0x4, 0x1a1);
 +              pfe_eth_mdio_write(bus, 0, 0x12, 0x400);
 +              pfe_eth_mdio_write(bus, 0, 0x13, 0x0);
++              pfe_eth_mdio_write(bus, 0, 0x0, 0x1140);
 +      }
-+
-+      pfe_eth_mdio_write(bus, 0, 0x0, 0x1140);
 +}
 +
 +/*
@@ -3411,7 +3388,7 @@ index 00000000..02cd7c52
 +      netif_info(priv, drv, ndev, "%s: %s\n", __func__, phy_id);
 +      interface = priv->einfo->mii_config;
 +      if ((interface == PHY_INTERFACE_MODE_SGMII) ||
-+          (interface == PHY_INTERFACE_MODE_SGMII_2500)) {
++          (interface == PHY_INTERFACE_MODE_2500SGMII)) {
 +              /*Configure SGMII PCS */
 +              if (pfe->scfg) {
 +                      /*Config MDIO from serdes */
@@ -3779,10 +3756,17 @@ index 00000000..02cd7c52
 +                               unsigned int n_segs)
 +{
 +      ktime_t kt;
++      int tried = 0;
 +
++try_again:
 +      if (unlikely((__hif_tx_avail(&pfe->hif) < n_desc) ||
-+                   (hif_lib_tx_avail(&priv->client, queuenum) < n_desc) ||
++      (hif_lib_tx_avail(&priv->client, queuenum) < n_desc) ||
 +      (hif_lib_tx_credit_avail(pfe, priv->id, queuenum) < n_segs))) {
++              if (!tried) {
++                      __hif_lib_update_credit(&priv->client, queuenum);
++                      tried = 1;
++                      goto try_again;
++              }
 +#ifdef PFE_ETH_TX_STATS
 +              if (__hif_tx_avail(&pfe->hif) < n_desc) {
 +                      priv->stop_queue_hif[queuenum]++;
@@ -3905,8 +3889,10 @@ index 00000000..02cd7c52
 +
 +      netif_info(priv, tx_done, priv->ndev, "%s\n", __func__);
 +
-+      for (ii = 0; ii < emac_txq_cnt; ii++)
++      for (ii = 0; ii < emac_txq_cnt; ii++) {
 +              pfe_eth_flush_txQ(priv, ii, 0, 0);
++              __hif_lib_update_credit(&priv->client, ii);
++      }
 +}
 +
 +void pfe_tx_get_req_desc(struct sk_buff *skb, unsigned int *n_desc, unsigned int
@@ -4648,9 +4634,6 @@ index 00000000..02cd7c52
 +      for (ii = NUM_GEMAC_SUPPORT - 1; ii >= 0; ii--)
 +              pfe_eth_exit_one(pfe->eth.eth_priv[ii]);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_eth.h b/drivers/staging/fsl_ppfe/pfe_eth.h
-new file mode 100644
-index 00000000..721bef3e
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_eth.h
 @@ -0,0 +1,184 @@
@@ -4838,9 +4821,6 @@ index 00000000..721bef3e
 +int pfe_eth_mdio_reset(struct mii_bus *bus);
 +
 +#endif /* _PFE_ETH_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_firmware.c b/drivers/staging/fsl_ppfe/pfe_firmware.c
-new file mode 100644
-index 00000000..47462b9f
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_firmware.c
 @@ -0,0 +1,314 @@
@@ -5158,9 +5138,6 @@ index 00000000..47462b9f
 +      util_disable();
 +#endif
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_firmware.h b/drivers/staging/fsl_ppfe/pfe_firmware.h
-new file mode 100644
-index 00000000..5ade848b
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_firmware.h
 @@ -0,0 +1,32 @@
@@ -5196,9 +5173,6 @@ index 00000000..5ade848b
 +void pfe_firmware_exit(struct pfe *pfe);
 +
 +#endif /* _PFE_FIRMWARE_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_hal.c b/drivers/staging/fsl_ppfe/pfe_hal.c
-new file mode 100644
-index 00000000..0915034b
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hal.c
 @@ -0,0 +1,1516 @@
@@ -6718,9 +6692,6 @@ index 00000000..0915034b
 +      hif_int &= HIF_RXPKT_INT_EN;
 +      writel(hif_int, HIF_INT_ENABLE);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_hif.c b/drivers/staging/fsl_ppfe/pfe_hif.c
-new file mode 100644
-index 00000000..6835e140
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hif.c
 @@ -0,0 +1,1072 @@
@@ -7796,9 +7767,6 @@ index 00000000..6835e140
 +      pfe_hif_release_buffers(hif);
 +      pfe_hif_free_descr(hif);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_hif.h b/drivers/staging/fsl_ppfe/pfe_hif.h
-new file mode 100644
-index 00000000..6e36f0c1
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hif.h
 @@ -0,0 +1,211 @@
@@ -8013,12 +7981,9 @@ index 00000000..6e36f0c1
 +#define __memcpy(dst, src, len)               memcpy(dst, src, len)
 +
 +#endif /* _PFE_HIF_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_hif_lib.c b/drivers/staging/fsl_ppfe/pfe_hif_lib.c
-new file mode 100644
-index 00000000..837eaa24
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hif_lib.c
-@@ -0,0 +1,601 @@
+@@ -0,0 +1,637 @@
 +/*
 + * Copyright 2015-2016 Freescale Semiconductor, Inc.
 + * Copyright 2017 NXP
@@ -8055,7 +8020,10 @@ index 00000000..837eaa24
 +
 +unsigned int lro_mode;
 +unsigned int page_mode;
-+unsigned int tx_qos;
++unsigned int tx_qos = 1;
++module_param(tx_qos, uint, 0444);
++MODULE_PARM_DESC(tx_qos, "0: disable ,\n"
++                       "1: enable (default), guarantee no packet drop at TMU level\n");
 +unsigned int pfe_pkt_size;
 +unsigned int pfe_pkt_headroom;
 +unsigned int emac_txq_cnt;
@@ -8586,6 +8554,39 @@ index 00000000..837eaa24
 +              }
 +}
 +
++/* __hif_lib_update_credit
++ *
++ * @param[in] client  hif client context
++ * @param[in] queue   queue number in match with TMU
++ */
++void __hif_lib_update_credit(struct hif_client_s *client, unsigned int queue)
++{
++      unsigned int tmu_tx_packets, tmp;
++
++      if (tx_qos) {
++              tmu_tx_packets = be32_to_cpu(pe_dmem_read(TMU0_ID +
++                      client->id, (TMU_DM_TX_TRANS + (queue * 4)), 4));
++
++              /* tx_packets counter overflowed */
++              if (tmu_tx_packets >
++                  pfe->tmu_credit.tx_packets[client->id][queue]) {
++                      tmp = UINT_MAX - tmu_tx_packets +
++                      pfe->tmu_credit.tx_packets[client->id][queue];
++
++                      pfe->tmu_credit.tx_credit[client->id][queue] =
++                      pfe->tmu_credit.tx_credit_max[client->id][queue] - tmp;
++              } else {
++              /* TMU tx <= pfe_eth tx, normal case or both OF since
++               * last time
++               */
++                      pfe->tmu_credit.tx_credit[client->id][queue] =
++                      pfe->tmu_credit.tx_credit_max[client->id][queue] -
++                      (pfe->tmu_credit.tx_packets[client->id][queue] -
++                      tmu_tx_packets);
++              }
++      }
++}
++
 +int pfe_hif_lib_init(struct pfe *pfe)
 +{
 +      int rc;
@@ -8620,12 +8621,9 @@ index 00000000..837eaa24
 +
 +      pfe_hif_shm_clean(pfe->hif.shm);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_hif_lib.h b/drivers/staging/fsl_ppfe/pfe_hif_lib.h
-new file mode 100644
-index 00000000..49e7b5f1
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hif_lib.h
-@@ -0,0 +1,239 @@
+@@ -0,0 +1,240 @@
 +/*
 + * Copyright 2015-2016 Freescale Semiconductor, Inc.
 + * Copyright 2017 NXP
@@ -8813,6 +8811,7 @@ index 00000000..49e7b5f1
 +void *hif_lib_receive_pkt(struct hif_client_s *client, int qno, int *len, int
 +                              *ofst, unsigned int *rx_ctrl,
 +                              unsigned int *desc_ctrl, void **priv_data);
++void __hif_lib_update_credit(struct hif_client_s *client, unsigned int queue);
 +void hif_lib_set_rx_cpu_affinity(struct hif_client_s *client, int cpu_id);
 +void hif_lib_set_tx_queue_nocpy(struct hif_client_s *client, int qno, int
 +                                      enable);
@@ -8865,9 +8864,6 @@ index 00000000..49e7b5f1
 +      })
 +
 +#endif /* _PFE_HIF_LIB_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_hw.c b/drivers/staging/fsl_ppfe/pfe_hw.c
-new file mode 100644
-index 00000000..16ea2c65
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hw.c
 @@ -0,0 +1,176 @@
@@ -9047,9 +9043,6 @@ index 00000000..16ea2c65
 +      bmu_disable(BMU2_BASE_ADDR);
 +      bmu_reset(BMU2_BASE_ADDR);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_hw.h b/drivers/staging/fsl_ppfe/pfe_hw.h
-new file mode 100644
-index 00000000..53b5fe14
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_hw.h
 @@ -0,0 +1,27 @@
@@ -9080,12 +9073,9 @@ index 00000000..53b5fe14
 +void pfe_hw_exit(struct pfe *pfe);
 +
 +#endif /* _PFE_HW_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-new file mode 100644
-index 00000000..c579eb58
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-@@ -0,0 +1,394 @@
+@@ -0,0 +1,385 @@
 +/*
 + * Copyright 2015-2016 Freescale Semiconductor, Inc.
 + * Copyright 2017 NXP
@@ -9257,13 +9247,7 @@ index 00000000..c579eb58
 +
 +      pfe->ddr_phys_baseaddr = res.start;
 +      pfe->ddr_size = resource_size(&res);
-+
 +      pfe->ddr_baseaddr = phys_to_virt(res.start);
-+      if (!pfe->ddr_baseaddr) {
-+              pr_err("ioremap() ddr failed\n");
-+              rc = -ENOMEM;
-+              goto err_ddr;
-+      }
 +
 +      pfe->scfg =
 +              syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
@@ -9345,8 +9329,6 @@ index 00000000..c579eb58
 +      iounmap(pfe->cbus_baseaddr);
 +
 +err_axi:
-+      iounmap(pfe->ddr_baseaddr);
-+
 +err_ddr:
 +      platform_set_drvdata(pdev, NULL);
 +
@@ -9369,7 +9351,6 @@ index 00000000..c579eb58
 +      rc = pfe_remove(pfe);
 +
 +      iounmap(pfe->cbus_baseaddr);
-+      iounmap(pfe->ddr_baseaddr);
 +
 +      platform_set_drvdata(pdev, NULL);
 +
@@ -9480,9 +9461,6 @@ index 00000000..c579eb58
 +MODULE_LICENSE("GPL");
 +MODULE_DESCRIPTION("PFE Ethernet driver");
 +MODULE_AUTHOR("NXP DNCPE");
-diff --git a/drivers/staging/fsl_ppfe/pfe_mod.c b/drivers/staging/fsl_ppfe/pfe_mod.c
-new file mode 100644
-index 00000000..d5ba56a3
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_mod.c
 @@ -0,0 +1,141 @@
@@ -9627,9 +9605,6 @@ index 00000000..d5ba56a3
 +
 +      return 0;
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_mod.h b/drivers/staging/fsl_ppfe/pfe_mod.h
-new file mode 100644
-index 00000000..3012f17f
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_mod.h
 @@ -0,0 +1,112 @@
@@ -9745,9 +9720,6 @@ index 00000000..3012f17f
 +#define BMU1_LMEM_SIZE                (LMEM_BUF_SIZE * BMU1_BUF_COUNT)
 +
 +#endif /* _PFE_MOD_H */
-diff --git a/drivers/staging/fsl_ppfe/pfe_perfmon.h b/drivers/staging/fsl_ppfe/pfe_perfmon.h
-new file mode 100644
-index 00000000..84908121
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_perfmon.h
 @@ -0,0 +1,38 @@
@@ -9789,9 +9761,6 @@ index 00000000..84908121
 +void pfe_perfmon_exit(struct pfe *pfe);
 +
 +#endif /* _PFE_PERFMON_H_ */
-diff --git a/drivers/staging/fsl_ppfe/pfe_sysfs.c b/drivers/staging/fsl_ppfe/pfe_sysfs.c
-new file mode 100644
-index 00000000..2a763844
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_sysfs.c
 @@ -0,0 +1,818 @@
@@ -10613,9 +10582,6 @@ index 00000000..2a763844
 +      device_remove_file(pfe->dev, &dev_attr_tmu);
 +      device_remove_file(pfe->dev, &dev_attr_class);
 +}
-diff --git a/drivers/staging/fsl_ppfe/pfe_sysfs.h b/drivers/staging/fsl_ppfe/pfe_sysfs.h
-new file mode 100644
-index 00000000..4fb39c93
 --- /dev/null
 +++ b/drivers/staging/fsl_ppfe/pfe_sysfs.h
 @@ -0,0 +1,29 @@
@@ -10648,6 +10614,3 @@ index 00000000..4fb39c93
 +void pfe_sysfs_exit(struct pfe *pfe);
 +
 +#endif /* _PFE_SYSFS_H_ */
--- 
-2.14.1
-