Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1511197pxk; Fri, 25 Sep 2020 17:42:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIs+o7wqhGq+Xp41Zr2hNJl1nzbGCjLqsUQavOLBWFJbSMsZlU1oqPbIX6JEF48OTHjDWp X-Received: by 2002:a17:907:417c:: with SMTP id oe20mr5198085ejb.322.1601080975197; Fri, 25 Sep 2020 17:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601080975; cv=none; d=google.com; s=arc-20160816; b=yHybyfzpaiNf+9u4nBa/QL9mbWhD1J0y6Cutll2BhIFul+CFaPUQFofuy35O4DJUmX ZD5iNBctK7OD7RMfF9KCAgbkO/+ccusExvW3x2zXDUWRvAAHFODeYBf7m7O3Y2Tl0sHG d4j4r1v4dSd2nzhgOdR4bVgX55gEUukGASyonzYp1YnVqvRz6NvxXMqs3h7wmsR9MhDl ipgQ1BnLPhBmWHKZ9BNoTEg6daR8xiIK47ar8b9jSFPVkvbRqY0sJGGA2LSqJgB+x4cm GJwR12rmukLbKxy6R4vUEK5CCZMHnPleS/GIUCHwHKHolphxH8w37Z8XxIlUkJ/E8Fba Hf4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ZN7MM5WhC9MCR4VCe4qTK+GR+06R3YftfiUA++4HJ+c=; b=tOnz1ugRc0XhX4DD03JcXPlZ5opp8wl/bV+092VqRm7jbi2IH+VVpnOF3lGPEkG2SE qdG+uLcAkuBpf3gXdFgV4C/iOczR4vzlZVsWPrzeEwwY/FARw8PkH8t8pfmQpDvM9COW nWUtHgg33QDP6gEd3VdAF/N131+as4tBJ25JfCKxDsozlgTXGX8B3mGFbPCXtLVUwVj4 6xob6KZpZtIXY8QdrEw88wg/Y942RPLcYEOBtlgsCtNtzdy9NeLwDZ125M5VM1DGoZiC 2lTjDMeXRYujxFHJnhRl4gyNosWoqjBRYUPGwgeoOf9aJjUlxDkP/gOY8Xrc6et2BZSo 1E1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h19si3068346edq.571.2020.09.25.17.42.31; Fri, 25 Sep 2020 17:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729798AbgIZAle (ORCPT + 99 others); Fri, 25 Sep 2020 20:41:34 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:56296 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725208AbgIZAle (ORCPT ); Fri, 25 Sep 2020 20:41:34 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kLyHJ-00GE3z-Mg; Sat, 26 Sep 2020 02:41:29 +0200 Date: Sat, 26 Sep 2020 02:41:29 +0200 From: Andrew Lunn To: Martin Blumenstingl Cc: netdev@vger.kernel.org, linux-amlogic@lists.infradead.org, alexandre.torgue@st.com, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, joabreu@synopsys.com, kuba@kernel.org, peppe.cavallaro@st.com, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Subject: Re: RGMII timing calibration (on 12nm Amlogic SoCs) - integration into dwmac-meson8b Message-ID: <20200926004129.GC3850848@lunn.ch> References: <20200925221403.GE3856392@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > The reference code I linked tries to detect the RGMII interface mode. > However, for each board we know the phy-mode as well as the RX and TX > delay - so I'm not trying to port the RGMII interface detection part > to the mainline driver. > > on X96 Air (which I'm using for testing) Amlogic configures phy-mode > "rgmii" with a 2ns TX delay provided by the MAC and 0ns RX delay > anywhere (so I'm assuming that the board adds the 2ns RX delay) Hi Martin It would be unusual to have an asymmetric design in the PCB. So i would try to prove that assumption. It could be the PHY driver is broken, and although it is configured to use RGMII, it is actually inserting a delay on RX. Also check if the PHY has any strapping. > I am aware that the recommendation is to let the PHY generate the delay. > For now I'm trying to get the same configuration working which is used > by Amlogic's vendor kernel and u-boot. > > > Is there any documentation as to what the calibration values mean? I > > would just hard code it to whatever means 0uS delay, and be done. The > > only time the MAC needs to add delays is when the PHY is not capable > > of doing it, and generally, they all are. > This calibration is not the RGMII RX or TX delay - we have other > registers for that and already know how to program these. O.K. so maybe this is just fine tuning. Some PHYs also allow this. > What I can say is that u-boot programs calibration value 0xf (the > maximum value) on my X96 Air board. With this I cannot get Ethernet > working - regardless of how I change the RX or TX delays. > If I leave everything as-is (2ns TX delay generated by the MAC, 0ns RX > delay, ...) and change the calibration value to 0x0 or 0x3 (the latter > is set by the vendor kernel) then Ethernet starts working. So there is just one calibration value? So it assumes the calibration is symmetric for both RX and TX. What PHY is it using? https://dpaste.com/2WJF9EN suggests it is a RTL8211F. This device does have stripping to set the default delay. Can you check if there are pull ups on pins 24 and 25? What i find interesting is in the driver is: ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY, val_txdly); ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY, val_rxdly); Different registers, 0x11 vs 0x15. In the datasheets i found with google, none describe any of these bits, but at least register 0x15 is mentioned, where as register 0x11 is not. Git blame shows you added this! Are you sure about this? It seems odd they are in different registers. Andrew