Commit b4c5f83a authored by Rusaimi Amira Ruslan's avatar Rusaimi Amira Ruslan Committed by David S. Miller

stmmac: intel: Adding ref clock 1us tic for LPI cntr

Adding reference clock (1us tic) for all LPI timer on Intel platforms.
The reference clock is derived from ptp clk. This also enables all LPI
counter.
Signed-off-by: default avatarRusaimi Amira Ruslan <rusaimi.amira.rusaimi@intel.com>
Signed-off-by: default avatarVoon Weifeng <weifeng.voon@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f53094d
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/stmmac.h> #include <linux/stmmac.h>
#include "dwmac4.h"
#include "stmmac.h" #include "stmmac.h"
#include "stmmac_platform.h" #include "stmmac_platform.h"
...@@ -146,6 +147,14 @@ static int intel_eth_plat_probe(struct platform_device *pdev) ...@@ -146,6 +147,14 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
} }
plat_dat->bsp_priv = dwmac; plat_dat->bsp_priv = dwmac;
plat_dat->eee_usecs_rate = plat_dat->clk_ptp_rate;
if (plat_dat->eee_usecs_rate > 0) {
u32 tx_lpi_usec;
tx_lpi_usec = (plat_dat->eee_usecs_rate / 1000000) - 1;
writel(tx_lpi_usec, stmmac_res.addr + GMAC_1US_TIC_COUNTER);
}
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (ret) { if (ret) {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include "dwmac-intel.h" #include "dwmac-intel.h"
#include "dwmac4.h"
#include "stmmac.h" #include "stmmac.h"
struct intel_priv_data { struct intel_priv_data {
...@@ -295,6 +296,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, ...@@ -295,6 +296,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
plat->axi->axi_blen[2] = 16; plat->axi->axi_blen[2] = 16;
plat->ptp_max_adj = plat->clk_ptp_rate; plat->ptp_max_adj = plat->clk_ptp_rate;
plat->eee_usecs_rate = plat->clk_ptp_rate;
/* Set system clock */ /* Set system clock */
plat->stmmac_clk = clk_register_fixed_rate(&pdev->dev, plat->stmmac_clk = clk_register_fixed_rate(&pdev->dev,
...@@ -623,6 +625,13 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, ...@@ -623,6 +625,13 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
if (ret) if (ret)
return ret; return ret;
if (plat->eee_usecs_rate > 0) {
u32 tx_lpi_usec;
tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
}
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -200,5 +200,6 @@ struct plat_stmmacenet_data { ...@@ -200,5 +200,6 @@ struct plat_stmmacenet_data {
int has_xgmac; int has_xgmac;
bool vlan_fail_q_en; bool vlan_fail_q_en;
u8 vlan_fail_q; u8 vlan_fail_q;
unsigned int eee_usecs_rate;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment