Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6040558ybc; Wed, 27 Nov 2019 13:56:45 -0800 (PST) X-Google-Smtp-Source: APXvYqy9hNB12PuWjpV235dibfWA418aQnAiVnBwVpLPZziGAbilio5nbIJbU/RqqhyES6oD2CbJ X-Received: by 2002:a50:f612:: with SMTP id c18mr35252108edn.285.1574891805330; Wed, 27 Nov 2019 13:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574891805; cv=none; d=google.com; s=arc-20160816; b=dB+p/cSBBscSX/DSPCjXhqzGx+JRt02oqNoCUEPwrPhhdA4BIgk6fh863AwhYnPi/5 PDLhDgnWE5U4j5TlqJEPN0Dt7wD8DTZeH+poHPRzTtyV759DgsF8CZvPF6SzBhL83UfW +SQbymXr44LTTyZACHRC+e8FLzbDPjqrf/3ckI7AcH4I8kFcTB9NY1WX8FwRXYoN3awS UB506DIgYfjjTSsCyrMN4yc3uISfxrZmzm/SXNTxdh8bupNdq+GzQ5kqeXSV+oxcPB7Y wEaiezG/dXwHMjgTdYfiSapKxfsSXhtYkMDVmqfmwIOXHqxB4LOT3VCdjb0svM+D0Q8Z OBTQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rTu1FR7lTz9PjBPPRtQQuMHwNkXyP23cCP9MxYgjA10=; b=rjTRPdocuBnySd7HKJvIMw3iKcD5MsSEiwQdbUuzOdr9RfTHMucd+oEorcCVBvcWPh aNj5+sUWflF31jbXKwfBzhgqtAELNvTXUAXOZz7sVgcRkHek1AGH09x0KilAFuphvXRT EyslE8I+s32icbwpg/Wi9zqhJkgBz0y3OuOV/xbkxgakbzsoraKWDMC1TCME3jRhSS2C 8lUIxv4TLdPtlR8Qud8d856yuYdbfz4g9W1YRP2MJBWnNk1SXvEZCaiQ8GNltehrXQJT AA1x3Oakx+Kp02fqdqkDAv/pDao0ZWTwWonRVqqFC8h338fNNp7q6q8Te9JU7rd2Iq3z 8TPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GJZxlQPa; 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 v5si9969056eji.232.2019.11.27.13.56.20; Wed, 27 Nov 2019 13:56:45 -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; dkim=pass header.i=@kernel.org header.s=default header.b=GJZxlQPa; 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 S1732398AbfK0VGS (ORCPT + 99 others); Wed, 27 Nov 2019 16:06:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:60246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731779AbfK0VGP (ORCPT ); Wed, 27 Nov 2019 16:06:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C19921770; Wed, 27 Nov 2019 21:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888775; bh=50r3+lS2bYLKDE8An6J7pWIC2ESHw5CG8oao+HF9j7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJZxlQPabG/l2W7VkpWZoKzUgLsnencR/Ei3o7TAOgkJPNzNDb0JAjhcDPIhqzhZl r5mN4qPeEJXnNuIQFOl8IPHCRxObuZJrBCYyzjybIE56nTNpQAAUOEi1nYQqZ7E7eA B23MfJ7jEHYX00diIqY3u2D2FKJAnyGuZV1nR41Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Uvarov , Heiner Kallweit , Florian Fainelli , "David S. Miller" , Adrian Bunk Subject: [PATCH 4.19 263/306] net: phy: dp83867: increase SGMII autoneg timer duration Date: Wed, 27 Nov 2019 21:31:53 +0100 Message-Id: <20191127203134.051968917@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Max Uvarov commit 1a97a477e666cbdededab93bd3754e508f0c09d7 upstream. After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 are 01). That is not enough to finalize autonegatiation on some devices. Increase this timer duration to maximum supported 16ms. Signed-off-by: Max Uvarov Cc: Heiner Kallweit Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller [ adapted for kernels without phy_modify_mmd ] Signed-off-by: Adrian Bunk Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/dp83867.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -33,6 +33,12 @@ /* Extended Registers */ #define DP83867_CFG4 0x0031 +#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6)) +#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_2US (1 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_16MS (0 << 5) + #define DP83867_RGMIICTL 0x0032 #define DP83867_STRAP_STS1 0x006E #define DP83867_RGMIIDCTL 0x0086 @@ -311,6 +317,18 @@ static int dp83867_config_init(struct ph if (ret) return ret; + + /* After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 + * are 01). That is not enough to finalize autoneg on some + * devices. Increase this timer duration to maximum 16ms. + */ + val = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4); + val &= ~DP83867_CFG4_SGMII_ANEG_MASK; + val |= DP83867_CFG4_SGMII_ANEG_TIMER_16MS; + ret = phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, val); + + if (ret) + return ret; } /* Enable Interrupt output INT_OE in CFG3 register */