Commit cbc19515 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: dwmac1000: Add MAC loopback support

In preparation for the addition of stmmac selftests we implement the MAC
loopback callback in dwmac1000 core.
Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a05a7a3
...@@ -499,6 +499,18 @@ static void dwmac1000_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x, ...@@ -499,6 +499,18 @@ static void dwmac1000_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x,
x->mac_gmii_rx_proto_engine++; x->mac_gmii_rx_proto_engine++;
} }
static void dwmac1000_set_mac_loopback(void __iomem *ioaddr, bool enable)
{
u32 value = readl(ioaddr + GMAC_CONTROL);
if (enable)
value |= GMAC_CONTROL_LM;
else
value &= ~GMAC_CONTROL_LM;
writel(value, ioaddr + GMAC_CONTROL);
}
const struct stmmac_ops dwmac1000_ops = { const struct stmmac_ops dwmac1000_ops = {
.core_init = dwmac1000_core_init, .core_init = dwmac1000_core_init,
.set_mac = stmmac_set_mac, .set_mac = stmmac_set_mac,
...@@ -518,6 +530,7 @@ const struct stmmac_ops dwmac1000_ops = { ...@@ -518,6 +530,7 @@ const struct stmmac_ops dwmac1000_ops = {
.pcs_ctrl_ane = dwmac1000_ctrl_ane, .pcs_ctrl_ane = dwmac1000_ctrl_ane,
.pcs_rane = dwmac1000_rane, .pcs_rane = dwmac1000_rane,
.pcs_get_adv_lp = dwmac1000_get_adv_lp, .pcs_get_adv_lp = dwmac1000_get_adv_lp,
.set_mac_loopback = dwmac1000_set_mac_loopback,
}; };
int dwmac1000_setup(struct stmmac_priv *priv) int dwmac1000_setup(struct stmmac_priv *priv)
......
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