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

net: ethernet: mtk-star-emac: enable half duplex hardware support

Current driver doesn't support half duplex correctly.
This patch enable half duplex capability in hardware.
Signed-off-by: default avatarBiao Huang <biao.huang@mediatek.com>
Signed-off-by: default avatarYinghua Pan <ot_yinghua.pan@mediatek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a8bd81f
...@@ -883,32 +883,26 @@ static void mtk_star_phy_config(struct mtk_star_priv *priv) ...@@ -883,32 +883,26 @@ static void mtk_star_phy_config(struct mtk_star_priv *priv)
val <<= MTK_STAR_OFF_PHY_CTRL1_FORCE_SPD; val <<= MTK_STAR_OFF_PHY_CTRL1_FORCE_SPD;
val |= MTK_STAR_BIT_PHY_CTRL1_AN_EN; val |= MTK_STAR_BIT_PHY_CTRL1_AN_EN;
if (priv->pause) {
val |= MTK_STAR_BIT_PHY_CTRL1_FORCE_FC_RX; val |= MTK_STAR_BIT_PHY_CTRL1_FORCE_FC_RX;
val |= MTK_STAR_BIT_PHY_CTRL1_FORCE_FC_TX; val |= MTK_STAR_BIT_PHY_CTRL1_FORCE_FC_TX;
/* Only full-duplex supported for now. */
val |= MTK_STAR_BIT_PHY_CTRL1_FORCE_DPX; val |= MTK_STAR_BIT_PHY_CTRL1_FORCE_DPX;
} else {
val &= ~MTK_STAR_BIT_PHY_CTRL1_FORCE_FC_RX;
val &= ~MTK_STAR_BIT_PHY_CTRL1_FORCE_FC_TX;
val &= ~MTK_STAR_BIT_PHY_CTRL1_FORCE_DPX;
}
regmap_write(priv->regs, MTK_STAR_REG_PHY_CTRL1, val); regmap_write(priv->regs, MTK_STAR_REG_PHY_CTRL1, val);
if (priv->pause) {
val = MTK_STAR_VAL_FC_CFG_SEND_PAUSE_TH_2K; val = MTK_STAR_VAL_FC_CFG_SEND_PAUSE_TH_2K;
val <<= MTK_STAR_OFF_FC_CFG_SEND_PAUSE_TH; val <<= MTK_STAR_OFF_FC_CFG_SEND_PAUSE_TH;
val |= MTK_STAR_BIT_FC_CFG_UC_PAUSE_DIR; val |= MTK_STAR_BIT_FC_CFG_UC_PAUSE_DIR;
} else {
val = 0;
}
regmap_update_bits(priv->regs, MTK_STAR_REG_FC_CFG, regmap_update_bits(priv->regs, MTK_STAR_REG_FC_CFG,
MTK_STAR_MSK_FC_CFG_SEND_PAUSE_TH | MTK_STAR_MSK_FC_CFG_SEND_PAUSE_TH |
MTK_STAR_BIT_FC_CFG_UC_PAUSE_DIR, val); MTK_STAR_BIT_FC_CFG_UC_PAUSE_DIR, val);
if (priv->pause) {
val = MTK_STAR_VAL_EXT_CFG_SND_PAUSE_RLS_1K; val = MTK_STAR_VAL_EXT_CFG_SND_PAUSE_RLS_1K;
val <<= MTK_STAR_OFF_EXT_CFG_SND_PAUSE_RLS; val <<= MTK_STAR_OFF_EXT_CFG_SND_PAUSE_RLS;
} else {
val = 0;
}
regmap_update_bits(priv->regs, MTK_STAR_REG_EXT_CFG, regmap_update_bits(priv->regs, MTK_STAR_REG_EXT_CFG,
MTK_STAR_MSK_EXT_CFG_SND_PAUSE_RLS, val); MTK_STAR_MSK_EXT_CFG_SND_PAUSE_RLS, val);
} }
......
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