diff options
| author | Biao Huang <biao.huang@mediatek.com> | 2019-06-02 21:58:06 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-06-05 20:03:14 -0400 |
| commit | ee326fd01e79dfa42014d55931260b68b9fa3273 (patch) | |
| tree | 20820c29c7113c5875ec86b9e3b6c83406a60e66 | |
| parent | d2facb4b3983425f6776c24dd678a82dbe673773 (diff) | |
net: stmmac: dwmac4: fix flow control issue
Current dwmac4_flow_ctrl will not clear
GMAC_RX_FLOW_CTRL_RFE/GMAC_RX_FLOW_CTRL_RFE bits,
so MAC hw will keep flow control on although expecting
flow control off by ethtool. Add codes to fix it.
Fixes: 477286b53f55 ("stmmac: add GMAC4 core support")
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 5e98da4e14f9..98b648b0f317 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | |||
| @@ -479,8 +479,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, | |||
| 479 | if (fc & FLOW_RX) { | 479 | if (fc & FLOW_RX) { |
| 480 | pr_debug("\tReceive Flow-Control ON\n"); | 480 | pr_debug("\tReceive Flow-Control ON\n"); |
| 481 | flow |= GMAC_RX_FLOW_CTRL_RFE; | 481 | flow |= GMAC_RX_FLOW_CTRL_RFE; |
| 482 | writel(flow, ioaddr + GMAC_RX_FLOW_CTRL); | ||
| 483 | } | 482 | } |
| 483 | writel(flow, ioaddr + GMAC_RX_FLOW_CTRL); | ||
| 484 | |||
| 484 | if (fc & FLOW_TX) { | 485 | if (fc & FLOW_TX) { |
| 485 | pr_debug("\tTransmit Flow-Control ON\n"); | 486 | pr_debug("\tTransmit Flow-Control ON\n"); |
| 486 | 487 | ||
| @@ -488,7 +489,7 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, | |||
| 488 | pr_debug("\tduplex mode: PAUSE %d\n", pause_time); | 489 | pr_debug("\tduplex mode: PAUSE %d\n", pause_time); |
| 489 | 490 | ||
| 490 | for (queue = 0; queue < tx_cnt; queue++) { | 491 | for (queue = 0; queue < tx_cnt; queue++) { |
| 491 | flow |= GMAC_TX_FLOW_CTRL_TFE; | 492 | flow = GMAC_TX_FLOW_CTRL_TFE; |
| 492 | 493 | ||
| 493 | if (duplex) | 494 | if (duplex) |
| 494 | flow |= | 495 | flow |= |
| @@ -496,6 +497,9 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, | |||
| 496 | 497 | ||
| 497 | writel(flow, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue)); | 498 | writel(flow, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue)); |
| 498 | } | 499 | } |
| 500 | } else { | ||
| 501 | for (queue = 0; queue < tx_cnt; queue++) | ||
| 502 | writel(0, ioaddr + GMAC_QX_TX_FLOW_CTRL(queue)); | ||
| 499 | } | 503 | } |
| 500 | } | 504 | } |
| 501 | 505 | ||
