Commit dceebd4c authored by David S. Miller's avatar David S. Miller

Merge branch 'dwmac-mediatek'

Biao Huang says:

====================
complete dwmac-mediatek driver and fix flow control issue

Changes in v2:
        patch#1: there is no extra action in mediatek_dwmac_remove, remove it

v1:
This series mainly complete dwmac-mediatek driver:
        1. add power on/off operations for dwmac-mediatek.
        2. disable rx watchdog to reduce rx path reponding time.
        3. change the default value of tx-frames from 25 to 1, so
           ptp4l will test pass by default.

and also fix the issue that flow control won't be disabled any more
once being enabled.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 478db1f1 ee326fd0
...@@ -261,7 +261,7 @@ struct stmmac_safety_stats { ...@@ -261,7 +261,7 @@ struct stmmac_safety_stats {
#define STMMAC_COAL_TX_TIMER 1000 #define STMMAC_COAL_TX_TIMER 1000
#define STMMAC_MAX_COAL_TX_TICK 100000 #define STMMAC_MAX_COAL_TX_TICK 100000
#define STMMAC_TX_MAX_FRAMES 256 #define STMMAC_TX_MAX_FRAMES 256
#define STMMAC_TX_FRAMES 25 #define STMMAC_TX_FRAMES 1
/* Packets types */ /* Packets types */
enum packets_types { enum packets_types {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/stmmac.h> #include <linux/stmmac.h>
...@@ -298,6 +299,9 @@ static int mediatek_dwmac_init(struct platform_device *pdev, void *priv) ...@@ -298,6 +299,9 @@ static int mediatek_dwmac_init(struct platform_device *pdev, void *priv)
return ret; return ret;
} }
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
return 0; return 0;
} }
...@@ -307,6 +311,9 @@ static void mediatek_dwmac_exit(struct platform_device *pdev, void *priv) ...@@ -307,6 +311,9 @@ static void mediatek_dwmac_exit(struct platform_device *pdev, void *priv)
const struct mediatek_dwmac_variant *variant = plat->variant; const struct mediatek_dwmac_variant *variant = plat->variant;
clk_bulk_disable_unprepare(variant->num_clks, plat->clks); clk_bulk_disable_unprepare(variant->num_clks, plat->clks);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
} }
static int mediatek_dwmac_probe(struct platform_device *pdev) static int mediatek_dwmac_probe(struct platform_device *pdev)
...@@ -349,6 +356,7 @@ static int mediatek_dwmac_probe(struct platform_device *pdev) ...@@ -349,6 +356,7 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)
plat_dat->has_gmac4 = 1; plat_dat->has_gmac4 = 1;
plat_dat->has_gmac = 0; plat_dat->has_gmac = 0;
plat_dat->pmt = 0; plat_dat->pmt = 0;
plat_dat->riwt_off = 1;
plat_dat->maxmtu = ETH_DATA_LEN; plat_dat->maxmtu = ETH_DATA_LEN;
plat_dat->bsp_priv = priv_plat; plat_dat->bsp_priv = priv_plat;
plat_dat->init = mediatek_dwmac_init; plat_dat->init = mediatek_dwmac_init;
......
...@@ -479,8 +479,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, ...@@ -479,8 +479,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
if (fc & FLOW_RX) { if (fc & FLOW_RX) {
pr_debug("\tReceive Flow-Control ON\n"); pr_debug("\tReceive Flow-Control ON\n");
flow |= GMAC_RX_FLOW_CTRL_RFE; flow |= GMAC_RX_FLOW_CTRL_RFE;
writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
} }
writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
if (fc & FLOW_TX) { if (fc & FLOW_TX) {
pr_debug("\tTransmit Flow-Control ON\n"); pr_debug("\tTransmit Flow-Control ON\n");
...@@ -488,7 +489,7 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, ...@@ -488,7 +489,7 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
pr_debug("\tduplex mode: PAUSE %d\n", pause_time); pr_debug("\tduplex mode: PAUSE %d\n", pause_time);
for (queue = 0; queue < tx_cnt; queue++) { for (queue = 0; queue < tx_cnt; queue++) {
flow |= GMAC_TX_FLOW_CTRL_TFE; flow = GMAC_TX_FLOW_CTRL_TFE;
if (duplex) if (duplex)
flow |= flow |=
...@@ -496,6 +497,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, ...@@ -496,6 +497,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
writel(flow, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue)); writel(flow, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue));
} }
} else {
for (queue = 0; queue < tx_cnt; queue++)
writel(0, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue));
} }
} }
......
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