Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5646452img; Wed, 27 Mar 2019 12:21:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTrEJyM/7zJukfRv61YRqwxDSBimEsEhx2a5vIq+ieK82DNtb1elH3Ct+GApxLHf/MLT0N X-Received: by 2002:a63:f24f:: with SMTP id d15mr2576426pgk.410.1553714515035; Wed, 27 Mar 2019 12:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714515; cv=none; d=google.com; s=arc-20160816; b=NppmhGIIlSu4CMfcTtC4LsCPz0iHF3buRpv4WfkeGzDLeHT3AkzqNSZ4awQFLdpusB /zofScYnPNfYFHHD+s1aJJz9wfXymfin2kizIXU7oycWHueQ/orXBpgxRZu/4/RXLG1F fa4SsyABntPn3UV4fWjM/U7DviNqlVzEIJ00YFjqd+Ung1Fg3APvIAGTpOxiWvAdbWms I+E9N7tntbHlN/Ry+xe3xMoRFS7VcRwokC60Kw2sWlGkCYaMFjZ+zArBtimUMrkQfFKM SowHMlMCxRQxylIE3F4XmuEfSzSaG/hG76/X5U+F/qOy7aVtWbEeR+f+Gk2onYdrqAzX D+dg== 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 :dkim-signature; bh=pqiS3EjfZwebU274FzJRz3k0afkzhN72KATo847APbM=; b=UP3YyhSX4Gb6Pe0rvRoP71nP3Swz37FQYnEYPzgLZ0x2oav4hXkXcNx5y6h/LR93eH qmPeomPW37QlhNzK4pCwamVj5/tvDWaMFyJ8omD6aAd4vAF9nc+flJ0ILv9pVDKmL0wb X2y+bxEK+gSsfHQzkBkDOvfuoVZGMHdFxEWOVXbjeSus4i+nV9qUNf+d1b/DGk62PZEn 7frLu33Kb1FIJT2UmAqtRKnKd5hnCdzfYuTq8xLE82lk7evj4C/WTL57Bv8vTPJB0mtc HXjnlHi4HPf3OwHhn2Ac0iRsOTjBtFcMCb8vWt8ZxNYqvA0CG7sI2vAWnZGcUpqTZI9K ejIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ws3OEMlj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si1121213pgv.441.2019.03.27.12.21.40; Wed, 27 Mar 2019 12:21:55 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ws3OEMlj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388144AbfC0SHS (ORCPT + 99 others); Wed, 27 Mar 2019 14:07:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388110AbfC0SHO (ORCPT ); Wed, 27 Mar 2019 14:07:14 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D44021734; Wed, 27 Mar 2019 18:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710033; bh=/qgWYDLeMFWwL0C5FYRRMoxmwYrH5ceDB/8PKmQ5AHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ws3OEMljyowhB7vJEX87gXE8lpd/dxiTe95bLvLthdPBmK5gZPjspKd3i9zL9tj5p bnH0u4udfwfGR+xf7+Q1e9Y7w04d8ZAB8HRTDQMcne9PmJHRy6/8WzexZfiVfCxuM8 FdkavRiA+43nr9/KIaU7orYGPCx/F7lDuoIbONTY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Russell King , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 165/262] net: marvell: mvpp2: fix stuck in-band SGMII negotiation Date: Wed, 27 Mar 2019 14:00:20 -0400 Message-Id: <20190327180158.10245-165-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King [ Upstream commit 316734fdcf70900a83065360cff11a5826919067 ] It appears that the mvpp22 can get stuck with SGMII negotiation. The symptoms are that in-band negotiation never completes and the partner (eg, PHY) never reports SGMII link up, or if it supports negotiation bypass, goes into negotiation bypass mode (which will happen when the PHY sees that the MAC is alive but gets no response.) Triggering the PHY end of the link to re-negotiate results in the bypass bit clearing on the PHY, and then re-setting - indicating that the problem is at the mvpp22 GMAC end. Asserting the GMAC reset and de-asserting it resolves the issue. Arrange to assert the GMAC reset at probe time, and deassert it only after we have configured the GMAC for the appropriate mode. This resolves the issue. Tested-by: Sven Auhagen Signed-off-by: Russell King Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 16066c2d5b3a..931beac3359d 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1380,13 +1380,9 @@ static void mvpp2_port_reset(struct mvpp2_port *port) for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++) mvpp2_read_count(port, &mvpp2_ethtool_regs[i]); - val = readl(port->base + MVPP2_GMAC_CTRL_2_REG) & - ~MVPP2_GMAC_PORT_RESET_MASK; + val = readl(port->base + MVPP2_GMAC_CTRL_2_REG) | + MVPP2_GMAC_PORT_RESET_MASK; writel(val, port->base + MVPP2_GMAC_CTRL_2_REG); - - while (readl(port->base + MVPP2_GMAC_CTRL_2_REG) & - MVPP2_GMAC_PORT_RESET_MASK) - continue; } /* Change maximum receive size of the port */ @@ -4543,12 +4539,15 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, const struct phylink_link_state *state) { u32 an, ctrl0, ctrl2, ctrl4; + u32 old_ctrl2; an = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); ctrl0 = readl(port->base + MVPP2_GMAC_CTRL_0_REG); ctrl2 = readl(port->base + MVPP2_GMAC_CTRL_2_REG); ctrl4 = readl(port->base + MVPP22_GMAC_CTRL_4_REG); + old_ctrl2 = ctrl2; + /* Force link down */ an &= ~MVPP2_GMAC_FORCE_LINK_PASS; an |= MVPP2_GMAC_FORCE_LINK_DOWN; @@ -4621,6 +4620,12 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, writel(ctrl2, port->base + MVPP2_GMAC_CTRL_2_REG); writel(ctrl4, port->base + MVPP22_GMAC_CTRL_4_REG); writel(an, port->base + MVPP2_GMAC_AUTONEG_CONFIG); + + if (old_ctrl2 & MVPP2_GMAC_PORT_RESET_MASK) { + while (readl(port->base + MVPP2_GMAC_CTRL_2_REG) & + MVPP2_GMAC_PORT_RESET_MASK) + continue; + } } static void mvpp2_mac_config(struct net_device *dev, unsigned int mode, -- 2.19.1