[PATCH net-next 11/13] net: mvpp2: reset the XLG MAC in port_reset

From: Antoine Tenart
Date: Fri Feb 15 2019 - 10:35:34 EST


The mvpp2_port_reset helper resets the GMAC but not the XLG MAC, which
is used on PPv2.2 when using the port 0. This patch fixes it, so that
the two MAC are set in reset when needed. In addition, the XLG
configuration function sets the XLG MAC out of reset when called.

Signed-off-by: Antoine Tenart <antoine.tenart@xxxxxxxxxxx>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 5d05306e79a8..80406195a255 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1384,6 +1384,17 @@ static void mvpp2_port_reset(struct mvpp2_port *port)
val = readl(port->base + MVPP2_GMAC_CTRL_2_REG) |
MVPP2_GMAC_PORT_RESET_MASK;
writel(val, port->base + MVPP2_GMAC_CTRL_2_REG);
+
+ if (port->priv->hw_version == MVPP22 && port->gop_id == 0) {
+ /* Set the XLG MAC in reset */
+ val = readl(port->base + MVPP22_XLG_CTRL0_REG) &
+ ~MVPP22_XLG_CTRL0_MAC_RESET_DIS;
+ writel(val, port->base + MVPP22_XLG_CTRL0_REG);
+
+ while (readl(port->base + MVPP22_XLG_CTRL0_REG) &
+ MVPP22_XLG_CTRL0_MAC_RESET_DIS)
+ continue;
+ }
}

/* Change maximum receive size of the port */
@@ -4512,6 +4523,8 @@ static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode,
ctrl0 = readl(port->base + MVPP22_XLG_CTRL0_REG);
ctrl4 = readl(port->base + MVPP22_XLG_CTRL4_REG);

+ ctrl0 |= MVPP22_XLG_CTRL0_MAC_RESET_DIS;
+
if (state->pause & MLO_PAUSE_TX)
ctrl0 |= MVPP22_XLG_CTRL0_TX_FLOW_CTRL_EN;
else
--
2.20.1