Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp636537img; Thu, 28 Feb 2019 05:32:49 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibhxoyq/6ceRB1n2WDP4obsYFGr0bdajurXPtBpzAb44wjCjpZD+/U8dkoHG+XvYW0eaoF9 X-Received: by 2002:a63:6196:: with SMTP id v144mr8429346pgb.137.1551360769269; Thu, 28 Feb 2019 05:32:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551360769; cv=none; d=google.com; s=arc-20160816; b=jLnui8H7z3/KagCwDSF/Qbjz1TMg0mmjKB26syM9Mp3O9Q4DQC08I8mFHR0GzCy3jL zawJTqG8IQvyIXd3pPs82sn76j+DUP4KBzCKabwAw+wn9JtZV5a6vasb6BybdtQGopxE HnszyFDP5JdH8GgOj+8hkrAabAFEdej8LLhqqsEclSlr3Xv8bmOZfm1vxZt9/W0a9H9d rFUFlCnqiepmeftmQ+/oyJM0v53UIOHbOvoCPiJR+dfeYiS8T5XefedS1geJKNITqiJ+ bO68vFbB0OKyoJLMQbqk2B3XtGK0VVSKwjeIFq8vfsg8T/8hg8Ehx9s/7Z1hZ8I9K6jq dfrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Bz7JOZiW8HM4tccwTYZl/UmlgBlu7UquFKwWfp7cIPE=; b=FgzYLv+0TDehYSW3Xa64GoLp0Lv5vRrQrARaVF4KOUM1UVHFzmJ7ev5YNm885UzK9A 5BzoFCkVG35iPcbt/zWcQSor60Uh/l25m2R4Qh/GV6EgD7sS1Lfriv42SkijO8hDdILz yM/hRN4xWhi7izXS4QJpmg+IV6hXZYTBjk10hF0YV7TOTnCtMHQFB1S6cLkQz1mYGCmL +S5+cYfWG8TtyYA7jV8Fxg5buKctTzXulzMs9bnEoLetsHr38lx6QgT4WKnYmW/z/Vri U5XRZgXPXcIYoAWOsI+PPgOp74ho7yTXYn1aZhDSrJkT1lZd4O04twAkzjwvWGQMlbqw NQEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 72si17057212pgd.113.2019.02.28.05.32.33; Thu, 28 Feb 2019 05:32:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbfB1NZg (ORCPT + 99 others); Thu, 28 Feb 2019 08:25:36 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:59613 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732868AbfB1NZc (ORCPT ); Thu, 28 Feb 2019 08:25:32 -0500 X-Originating-IP: 90.88.147.150 Received: from localhost (aaubervilliers-681-1-27-150.w90-88.abo.wanadoo.fr [90.88.147.150]) (Authenticated sender: antoine.tenart@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6DF3D40015; Thu, 28 Feb 2019 13:25:28 +0000 (UTC) From: Antoine Tenart To: davem@davemloft.net, linux@armlinux.org.uk Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: [PATCH net-next 11/15] net: mvpp2: force the XLG MAC link up or down when not using in-band Date: Thu, 28 Feb 2019 14:21:24 +0100 Message-Id: <20190228132128.30154-12-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228132128.30154-1-antoine.tenart@bootlin.com> References: <20190228132128.30154-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch force the XLG MAC link state in the phylink link_up() and link_down() helpers when not using in-band auto-negotiation. This mimics what's already done for the GMAC and follows what's advised in the phylink documentation. Signed-off-by: Antoine Tenart --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 2 ++ .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 35 +++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index 687e011de5ef..c9edeac9ec01 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -430,6 +430,8 @@ #define MVPP22_XLG_CTRL0_REG 0x100 #define MVPP22_XLG_CTRL0_PORT_EN BIT(0) #define MVPP22_XLG_CTRL0_MAC_RESET_DIS BIT(1) +#define MVPP22_XLG_CTRL0_FORCE_LINK_DOWN BIT(2) +#define MVPP22_XLG_CTRL0_FORCE_LINK_PASS BIT(3) #define MVPP22_XLG_CTRL0_RX_FLOW_CTRL_EN BIT(7) #define MVPP22_XLG_CTRL0_TX_FLOW_CTRL_EN BIT(8) #define MVPP22_XLG_CTRL0_MIB_CNT_DIS BIT(14) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 59ee9e7545b0..9138baa392d8 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -4685,6 +4685,7 @@ static void mvpp2_mac_config(struct net_device *dev, unsigned int mode, /* Make sure the port is disabled when reconfiguring the mode */ mvpp2_port_disable(port); + if (port->priv->hw_version == MVPP22 && change_interface) { mvpp22_gop_mask_irq(port); @@ -4718,11 +4719,18 @@ static void mvpp2_mac_link_up(struct net_device *dev, unsigned int mode, struct mvpp2_port *port = netdev_priv(dev); u32 val; - if (!phylink_autoneg_inband(mode) && !mvpp2_is_xlg(interface)) { - val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); - val &= ~MVPP2_GMAC_FORCE_LINK_DOWN; - val |= MVPP2_GMAC_FORCE_LINK_PASS; - writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG); + if (!phylink_autoneg_inband(mode)) { + if (mvpp2_is_xlg(interface)) { + val = readl(port->base + MVPP22_XLG_CTRL0_REG); + val &= ~MVPP22_XLG_CTRL0_FORCE_LINK_DOWN; + val |= MVPP22_XLG_CTRL0_FORCE_LINK_PASS; + writel(val, port->base + MVPP22_XLG_CTRL0_REG); + } else { + val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); + val &= ~MVPP2_GMAC_FORCE_LINK_DOWN; + val |= MVPP2_GMAC_FORCE_LINK_PASS; + writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG); + } } mvpp2_port_enable(port); @@ -4738,11 +4746,18 @@ static void mvpp2_mac_link_down(struct net_device *dev, unsigned int mode, struct mvpp2_port *port = netdev_priv(dev); u32 val; - if (!phylink_autoneg_inband(mode) && !mvpp2_is_xlg(interface)) { - 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); + if (!phylink_autoneg_inband(mode)) { + if (mvpp2_is_xlg(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); + } } netif_tx_stop_all_queues(dev); -- 2.20.1