Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp636049img; Thu, 28 Feb 2019 05:32:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IYtwrQwH5WICYYAs8JLZg1+JVfBQNEvxZp9vTEYyQMrELhkY5nSEIIxDGxVCwIWHfyrvFgV X-Received: by 2002:a63:4962:: with SMTP id y34mr8702063pgk.425.1551360740812; Thu, 28 Feb 2019 05:32:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551360740; cv=none; d=google.com; s=arc-20160816; b=NoxYdhAfW7KaFYEbLEnTC3s80Fry1NA4S75KOUynoPrfdLzktOpAbfI2pZazAwDnfZ 2kRD2DW3bIHGi0wUXa81sForREI9vgwli2we7/5aVv7DgQSD/pq9Gw5KKHqSTdEfLjJY vAQO2sXYQtni21lWtIhiaHVeCv5I3rbiBhc4dfwVUwH3T6AvmvMVLxNzzL3SYurrKcxl YA76GIJLOuQt5nMs2/W5Z2GQs8ug1nEF+jBnZg6TXNTUd+safTEhqn8ArXL5CyU6wkY4 AbJFq5rC+3EsyNL/7S3w7HTRRsonnWrf0AxaBAjAyXDjdN3kfxS5WzMqvQ848kCYeVSu mmKg== 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=yGatTfJrQw7KgQsCzl5i0+HCN6WFYR35/P2tIsO9dXI=; b=ieEafb9mWHEnSC/EVt+B0A2oPYTP9Mqitkn4pWEpPrK5bsFcXA2vQeQfLQ9AvqrBfG aG0NnJR+5UrP9y6G4IoQoXXUQ59E5hHR8BnT+G82QAuCX6xBWK3TuoERqpUBCOK9rDvT LyDv/TU0fr7R12hxt7Z+IFYMvN734zKf69UrtsRTPQyz9fS+mSKeCquo/TRrUruwHThA GBVs39zgmcNn2DvV9x12MP8KFC+VfeUtL9l9my1QMdGuXysHUMhmPKhWcgDtY4m8+7ab UH0UckIriDpEuiA1PrxUH+PoZm+9HL2gVldp5mCiQ38IzsfNktRN/2LlqQtJ7O7I/Xlb jfCw== 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 q189si5984980pgq.240.2019.02.28.05.32.06; Thu, 28 Feb 2019 05:32:20 -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 S1732851AbfB1NZ1 (ORCPT + 99 others); Thu, 28 Feb 2019 08:25:27 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:46781 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732669AbfB1NZ0 (ORCPT ); Thu, 28 Feb 2019 08:25:26 -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 relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 0CCC724000E; Thu, 28 Feb 2019 13:25:20 +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 08/15] net: mvpp2: some AN fields require the link to be down when updated Date: Thu, 28 Feb 2019 14:21:21 +0100 Message-Id: <20190228132128.30154-9-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 The GMAC configuration helper modifies values in the auto-negotiation register. Some of its values require the port to be forced down when modifying their values. This patches fixes the check made on the bit to be updated in this register, so that the port is forced down when needed. This fix cases where some of those parameters were updated, but not taken into account, such as when using RGMII interfaces. Fixes: d14e078f23cc ("net: marvell: mvpp2: only reprogram what is necessary on mac_config") Signed-off-by: Antoine Tenart --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 9c6200a59910..11284918d907 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -4627,9 +4627,19 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, } } +/* Some fields of the auto-negotiation register require the port to be down when + * their value is updated. + */ +#define MVPP2_GMAC_AN_PORT_DOWN_MASK \ + (MVPP2_GMAC_IN_BAND_AUTONEG | \ + MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS | \ + MVPP2_GMAC_CONFIG_MII_SPEED | MVPP2_GMAC_CONFIG_GMII_SPEED | \ + MVPP2_GMAC_AN_SPEED_EN | MVPP2_GMAC_CONFIG_FULL_DUPLEX | \ + MVPP2_GMAC_AN_DUPLEX_EN) + if ((old_ctrl0 ^ ctrl0) & MVPP2_GMAC_PORT_TYPE_MASK || (old_ctrl2 ^ ctrl2) & MVPP2_GMAC_INBAND_AN_MASK || - (old_an ^ an) & MVPP2_GMAC_IN_BAND_AUTONEG) { + (old_an ^ an) & MVPP2_GMAC_AN_PORT_DOWN_MASK) { /* Force link down */ old_an &= ~MVPP2_GMAC_FORCE_LINK_PASS; old_an |= MVPP2_GMAC_FORCE_LINK_DOWN; -- 2.20.1