Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1589878ybv; Thu, 20 Feb 2020 23:51:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxwYRrHUotCEmJn2lMziBGAooq+mt8ZK9HpxlyRznAq1zq4kqHnY8pmC8DVpKbqPfa+kaza X-Received: by 2002:a9d:170a:: with SMTP id i10mr26725764ota.284.1582271512006; Thu, 20 Feb 2020 23:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582271511; cv=none; d=google.com; s=arc-20160816; b=ROTQg2FPiid8gujA++c7vaaFDiAGBy4sBhbnER7Zu+jbSMWrDuMIHpqTfMptQbVAtP hZ9Nq27EQYYaePViAFneAtTvo5vsxfjtXl3TsQVGMklmVoiND/+Wja1/8HchTIIdFgUu Q/yKL6VrCNYytFGPZcn2fm7o0eAKK3HoKFYptcUAiC9RwKPl+YH6INcwYkoxx6pZhuKE tbnZBtoWwG9+Ivgo37EA8pSGBCTfT62cREvr2QM/xtZbMwqLMrm7w/8g53JKb7TlAO1S OPFPeJuPj99eMrCC4XYKxP7qt0di745KdiP9bavMN+3p9sirZOvNq2pQvZE6mCmbREeE rNIg== 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=I7NsbwoPNseAvRtaeN77N44KF6XlryQ8kBSn6LaiYQ0=; b=kn2lXkqQEUgSw4LurOQgETePxfQWxa70Ntj8+3lXuZoP/eEcXwEUl4yxfC2Cw+qPXo I3YbGK1QgVzkbzkFnDyJ8h9k9CZiDKJNaNghQwRZn/GMft1IhrFKO7rJDR+ocuODObTw 6wuuWoW11USupGgHnrlY37S9FOut3VxuqGaShx3SarkjZSzbOQ8qy70PotytWdHx95vp hqMLZ087bNeF687JKVszA0NAtuzx8mAVnuwreuQU0XqobOS+LKEjLlgjPblviIQ7Osfg Npvl7AK6QR0K/tzk/urXaS6y+bFh38eUxUcEz9OfP0NSQEliOu4SWHss2HUJExl5rf91 GIGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z7wjN85I; 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 w207si436861oia.226.2020.02.20.23.51.40; Thu, 20 Feb 2020 23:51:51 -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=z7wjN85I; 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 S1729431AbgBUHvi (ORCPT + 99 others); Fri, 21 Feb 2020 02:51:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:49046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729326AbgBUHvh (ORCPT ); Fri, 21 Feb 2020 02:51:37 -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 3147E2073A; Fri, 21 Feb 2020 07:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271496; bh=WbO+uEKXoG/iwhQ7nd5kQE3ky3wQoI1Lapj7wUubyT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z7wjN85Ivel6B7jLJGwNNDiH98yNZ5USiW8kuX8H+5J/2yQ1TYTkvv7j3lTTRogDF j1YXdCeZivq73XUBwFUvuZnq5UzZHtua7q4ZQehhakhWHd7Ovcy1ZIXzS68BuF1Dc8 uxVe/COP0nL1I9zVkMTd5Q7i4gdYZUBCLsaOqGnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.5 187/399] net: phy: realtek: add logging for the RGMII TX delay configuration Date: Fri, 21 Feb 2020 08:38:32 +0100 Message-Id: <20200221072420.996253867@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@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: Martin Blumenstingl [ Upstream commit 3aec743d69822d22d4a5b60deb9518ed8be6fa67 ] RGMII requires a delay of 2ns between the data and the clock signal. There are at least three ways this can happen. One possibility is by having the PHY generate this delay. This is a common source for problems (for example with slow TX speeds or packet loss when sending data). The TX delay configuration of the RTL8211F PHY can be set either by pin-strappping the RXD1 pin (HIGH means enabled, LOW means disabled) or through configuring a paged register. The setting from the RXD1 pin is also reflected in the register. Add debug logging to the TX delay configuration on RTL8211F so it's easier to spot these issues (for example if the TX delay is enabled for both, the RTL8211F PHY and the MAC). This is especially helpful because there is no public datasheet for the RTL8211F PHY available with all the RX/TX delay specifics. Signed-off-by: Martin Blumenstingl Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/realtek.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 476db5345e1af..879ca37c85081 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -171,7 +171,9 @@ static int rtl8211c_config_init(struct phy_device *phydev) static int rtl8211f_config_init(struct phy_device *phydev) { + struct device *dev = &phydev->mdio.dev; u16 val; + int ret; /* enable TX-delay for rgmii-{id,txid}, and disable it for rgmii and * rgmii-rxid. The RX-delay can be enabled by the external RXDLY pin. @@ -189,7 +191,22 @@ static int rtl8211f_config_init(struct phy_device *phydev) return 0; } - return phy_modify_paged(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, val); + ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, + val); + if (ret < 0) { + dev_err(dev, "Failed to update the TX delay register\n"); + return ret; + } else if (ret) { + dev_dbg(dev, + "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n", + val ? "Enabling" : "Disabling"); + } else { + dev_dbg(dev, + "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n", + val ? "enabled" : "disabled"); + } + + return 0; } static int rtl8211e_config_init(struct phy_device *phydev) -- 2.20.1