Skip to contentSkip to conversation

net: mvpp2: disable force link UP during port init procedure

PATCH Applied [email protected] 3 participants 3 messages Dec 17, 2020 – Dec 19, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: mvpp2: disable force link UP during port init procedure

From: Stefan Chulski <[email protected]>

Force link UP can be enabled by bootloader during tftpboot and breaks NFS support.
Force link UP disabled during port init procedure.

Fixes f84bf386f395 ("net: mvpp2: initialize the GoP")

---

Changes in v3:
- Added Fixes tag.
Changes in v2:
- No changes.

 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +13 -1
index d2b0506..0ad3177 100644
@@ -5479,7 +5479,7 @@ static int mvpp2_port_init(struct mvpp2_port *port)
 	struct mvpp2 *priv = port->priv;
 	struct mvpp2_txq_pcpu *txq_pcpu;
 	unsigned int thread;
-	int queue, err;
+	int queue, err, val;
 
 	/* Checks for hardware constraints */
 	if (port->first_rxq + port->nrxqs >
@@ -5493,6 +5493,18 @@ static int mvpp2_port_init(struct mvpp2_port *port)
 	mvpp2_egress_disable(port);
 	mvpp2_port_disable(port);
 
+	if (mvpp2_is_xlg(port->phy_interface)) {
+		val = readl(port->base + MVPP22_XLG_CTRL0_REG);
+		val &= ~MVPP22_XLG_CTRL0_FORCE_LINK_PASS;
+		val |= MVPP22_XLG_CTRL0_FORCE_LINK_DOWN;
+		writel(val, port->base + MVPP22_XLG_CTRL0_REG);
+	} else {
+		val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+		val &= ~MVPP2_GMAC_FORCE_LINK_PASS;
+		val |= MVPP2_GMAC_FORCE_LINK_DOWN;
+		writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+	}
+
 	port->tx_time_coal = MVPP2_TXDONE_COAL_USEC;
 
 	port->txqs = devm_kcalloc(dev, port->ntxqs, sizeof(*port->txqs),
Signature · 1 line
1.9.1
Acked-by on v3 1/1
#1 lore raw

Hi Stefan,

czw., 17 gru 2020 o 15:54 <[email protected]> napisał(a):

Quoted 42 lines

From: Stefan Chulski <[email protected]>

Force link UP can be enabled by bootloader during tftpboot and breaks NFS support.
Force link UP disabled during port init procedure.

Fixes f84bf386f395 ("net: mvpp2: initialize the GoP")

---

Changes in v3:
- Added Fixes tag.
Changes in v2:
- No changes.

 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +7 -1
index d2b0506..0ad3177 100644
@@ -5479,7 +5479,7 @@ static int mvpp2_port_init(struct mvpp2_port *port)
        struct mvpp2 *priv = port->priv;
        struct mvpp2_txq_pcpu *txq_pcpu;
        unsigned int thread;
-       int queue, err;
+       int queue, err, val;
 
        /* Checks for hardware constraints */
        if (port->first_rxq + port->nrxqs >
@@ -5493,6 +5493,18 @@ static int mvpp2_port_init(struct mvpp2_port *port)
        mvpp2_egress_disable(port);
        mvpp2_port_disable(port);
 
+       if (mvpp2_is_xlg(port->phy_interface)) {
+               val = readl(port->base + MVPP22_XLG_CTRL0_REG);
+               val &= ~MVPP22_XLG_CTRL0_FORCE_LINK_PASS;
+               val |= MVPP22_XLG_CTRL0_FORCE_LINK_DOWN;
+               writel(val, port->base + MVPP22_XLG_CTRL0_REG);
+       } else {

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c static int mvpp2_port_init(struct mvpp2_port *port)

Quoted 10 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +6 -1
+               val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+               val &= ~MVPP2_GMAC_FORCE_LINK_PASS;
+               val |= MVPP2_GMAC_FORCE_LINK_DOWN;
+               writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+       }
+
        port->tx_time_coal = MVPP2_TXDONE_COAL_USEC;
 
        port->txqs = devm_kcalloc(dev, port->ntxqs, sizeof(*port->txqs),
--

I confirm the patch fixes issue - tested on CN913x-DB and RGMII port. Other boards there I see no regression.

Thanks,
Marcin

maintainer Applied
#2 lore raw
Quoted 8 lines · On Fri, 18 Dec 2020 04:36:18 +0100 Marcin Wojtas wrote:

czw., 17 gru 2020 o 15:54 <[email protected]> napisał(a):

Quoted 7 lines

From: Stefan Chulski <[email protected]>

Force link UP can be enabled by bootloader during tftpboot and breaks NFS support.
Force link UP disabled during port init procedure.

Quoted 7 lines
Quoted 2 lines
Fixes f84bf386f395 ("net: mvpp2: initialize the GoP")

I confirm the patch fixes issue - tested on CN913x-DB and RGMII port. Other boards there I see no regression.

Applied, thanks!