Commit ee326fd0 authored by Biao Huang's avatar Biao Huang Committed by David S. Miller

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: 477286b5 ("stmmac: add GMAC4 core support")
Signed-off-by: default avatarBiao Huang <biao.huang@mediatek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2facb4b
...@@ -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