Skip to content

Commit dceebd4

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents 478db1f + ee326fd commit dceebd4

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ struct stmmac_safety_stats {
261261
#define STMMAC_COAL_TX_TIMER 1000
262262
#define STMMAC_MAX_COAL_TX_TICK 100000
263263
#define STMMAC_TX_MAX_FRAMES 256
264-
#define STMMAC_TX_FRAMES 25
264+
#define STMMAC_TX_FRAMES 1
265265

266266
/* Packets types */
267267
enum packets_types {

drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/of.h>
1010
#include <linux/of_device.h>
1111
#include <linux/of_net.h>
12+
#include <linux/pm_runtime.h>
1213
#include <linux/regmap.h>
1314
#include <linux/stmmac.h>
1415

@@ -298,6 +299,9 @@ static int mediatek_dwmac_init(struct platform_device *pdev, void *priv)
298299
return ret;
299300
}
300301

302+
pm_runtime_enable(&pdev->dev);
303+
pm_runtime_get_sync(&pdev->dev);
304+
301305
return 0;
302306
}
303307

@@ -307,6 +311,9 @@ static void mediatek_dwmac_exit(struct platform_device *pdev, void *priv)
307311
const struct mediatek_dwmac_variant *variant = plat->variant;
308312

309313
clk_bulk_disable_unprepare(variant->num_clks, plat->clks);
314+
315+
pm_runtime_put_sync(&pdev->dev);
316+
pm_runtime_disable(&pdev->dev);
310317
}
311318

312319
static int mediatek_dwmac_probe(struct platform_device *pdev)
@@ -349,6 +356,7 @@ static int mediatek_dwmac_probe(struct platform_device *pdev)
349356
plat_dat->has_gmac4 = 1;
350357
plat_dat->has_gmac = 0;
351358
plat_dat->pmt = 0;
359+
plat_dat->riwt_off = 1;
352360
plat_dat->maxmtu = ETH_DATA_LEN;
353361
plat_dat->bsp_priv = priv_plat;
354362
plat_dat->init = mediatek_dwmac_init;

drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,23 +479,27 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
479479
if (fc & FLOW_RX) {
480480
pr_debug("\tReceive Flow-Control ON\n");
481481
flow |= GMAC_RX_FLOW_CTRL_RFE;
482-
writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
483482
}
483+
writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
484+
484485
if (fc & FLOW_TX) {
485486
pr_debug("\tTransmit Flow-Control ON\n");
486487

487488
if (duplex)
488489
pr_debug("\tduplex mode: PAUSE %d\n", pause_time);
489490

490491
for (queue = 0; queue < tx_cnt; queue++) {
491-
flow |= GMAC_TX_FLOW_CTRL_TFE;
492+
flow = GMAC_TX_FLOW_CTRL_TFE;
492493

493494
if (duplex)
494495
flow |=
495496
(pause_time << GMAC_TX_FLOW_CTRL_PT_SHIFT);
496497

497498
writel(flow, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue));
498499
}
500+
} else {
501+
for (queue = 0; queue < tx_cnt; queue++)
502+
writel(0, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue));
499503
}
500504
}
501505

0 commit comments

Comments
 (0)