From patchwork Fri Jul 21 11:25:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Gonzalez X-Patchwork-Id: 9856747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0FD8C601C0 for ; Fri, 21 Jul 2017 11:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB84420243 for ; Fri, 21 Jul 2017 11:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E040E20373; Fri, 21 Jul 2017 11:53:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5565020243 for ; Fri, 21 Jul 2017 11:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XHByRzzB0TCE5AkErfls+t81+62Ylyjztl1Fg4naPj4=; b=aYKTgE+Q4tClPN QqtyC037ampUcaSG/n4lp1n+AuAjwZAS0CH0ecN8SYrgWcmQyFkqt4yh42cAVoOWLjMvDZXcJYOpR F3TpKZQSga3SIhNGQoKf2gLvhoolTMp9XX5gHmWsLZgDlRpLVUbWsp4dyV0xwwKvc+7q//PepFSYK Zl4wVKr0DQXkA2lrIRuZChvrw8xL4efLI6p9cmk66uBov9ZfYMu5MhfdolJlxG9FXXhny8i9FfTCi xmJjbcdBgbLjBkLazP4gwcNPx7K3WGzYmsBeWng4pCOeLbS6/Jtik8P9mSr9RtZWLX6jqzIvXjhsI lmRgTfBGvI4umjZyvGvQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dYWUw-0006gc-KT; Fri, 21 Jul 2017 11:53:34 +0000 Received: from us-smtp-delivery-107.mimecast.com ([216.205.24.107]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dYWUo-00069i-Tr for linux-arm-kernel@lists.infradead.org; Fri, 21 Jul 2017 11:53:28 +0000 Received: from CPH-EX1.SDESIGNS.COM (195-215-56-170-static.dk.customer.tdc.net [195.215.56.170]) (Using TLS) by us-smtp-1.mimecast.com with ESMTP id us-mta-59-GnmXrykeOO-S5TJ_9IW54g-1; Fri, 21 Jul 2017 07:53:03 -0400 Received: from [172.27.0.114] (172.27.0.114) by CPH-EX1.sdesigns.com (192.168.10.36) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 21 Jul 2017 13:52:59 +0200 Subject: [PATCH v2 1/4] net: phy: at803x: Document RGMII RX and TX clock delay issues From: Marc Gonzalez To: Florian Fainelli , Andrew Lunn , Mans Rullgard , Martin Blumenstingl , Grygorii Strashko , Fabio Estevam , Zefir Kurtisi , Timur Tabi , Daniel Mack References: <2617d673-ef81-5e7f-4730-ed3aa3f1c2c6@sigmadesigns.com> Message-ID: <051653a2-946f-6a0b-4cff-b403d1197038@sigmadesigns.com> Date: Fri, 21 Jul 2017 13:25:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.1 MIME-Version: 1.0 In-Reply-To: <2617d673-ef81-5e7f-4730-ed3aa3f1c2c6@sigmadesigns.com> X-Originating-IP: [172.27.0.114] X-MC-Unique: GnmXrykeOO-S5TJ_9IW54g-1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170721_045327_162751_7ED542D8 X-CRM114-Status: UNSURE ( 8.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev , Thibaud Cornic , "David S. Miller" , Linux ARM , Mason Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The current code supports enabling RGMII RX and TX clock delays. The unstated assumption is that these settings are disabled by default at reset, which is not the case. RX clock delay is enabled at reset. And TX clock delay "survives" across SW resets. Thus, if the bootloader enables TX clock delay, it will remain enabled at reset in Linux. Signed-off-by: Marc Gonzalez --- drivers/net/phy/at803x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index c1e52b9dc58d..7a0954513b91 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -283,6 +283,12 @@ static int at803x_config_init(struct phy_device *phydev) if (ret < 0) return ret; + /* + * NB: This code assumes that RGMII RX clock delay is disabled + * at reset, but actually, RX clock delay is enabled at reset. + * Disabling the delay if it has not been explicitly requested + * breaks boards that rely on the enabled-by-default behavior. + */ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { ret = at803x_enable_rx_delay(phydev); @@ -290,6 +296,12 @@ static int at803x_config_init(struct phy_device *phydev) return ret; } + /* + * NB: This code assumes that RGMII TX clock delay is disabled + * at reset, but actually, TX clock delay "survives" across SW + * resets. If the bootloader enables TX clock delay, Linux is + * stuck with that setting. + */ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { ret = at803x_enable_tx_delay(phydev);