[linux-next-v2,1/5] arm64: dts: rockchip: Fix gmac phy mode to rgmii on Rock 3A SBC.
Message ID | 20221116200150.4657-2-linux.amoon@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp38629wrr; Wed, 16 Nov 2022 12:06:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Smw33y9lwQfAe0WVXK09vytmnSaBtmsPiTmmEgIBhpUgql8CCX1mvsHXq4aXLz62z74sh X-Received: by 2002:aa7:df0d:0:b0:467:c68b:b06c with SMTP id c13-20020aa7df0d000000b00467c68bb06cmr13665507edy.428.1668629181709; Wed, 16 Nov 2022 12:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668629181; cv=none; d=google.com; s=arc-20160816; b=Z71keL8mc3H5Whh+n3LeumwBCnzOrNEp7d8e6A+W31fdC4M36ziVZAERu0KcTVKqwt 0/M0nzCRUM7jbjMEzwvO4EW3DYn/3HXcvs0v2SDey+SvnkiRo4NN9MJ2/OK2ydvV2jWx jndQbQbFKF7BvV1KUx7qmU0s53MrUFQURr4eduVPHI3qHFH0+C3zUurn0TWmmNqNA7g6 LC8J6Ii91cmnrcYZfpsBICjUuID5rwt5gceSBbRWWMSbRFuWD+I9imN2Sb0PiM94+3A5 VfvI43LDwRlhFTCMKCBiJdAOfJ7b/TWUGF/Xe++Ik7sLnu6NLWEph2rHFnpbEYwJFGe6 QL5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gWHeg8M1ItPKLADHrX13a52utCw4BMmhpRsIIQk2Fck=; b=IfZg4X87yEEcLYVMzkLWCTgFm7qQ4YeQkyLmcTJ9INk65Sa3HtVlk6O+lPNuUoEb+F D22uAtaAbEMdvOYMdhYUu16ISHh6GqBg0XLQIA6so72Rh2p32w7V0dsSuANtZkoi07tr qKV96uZUHNI+G8YF/VORDJUTrs/BxJASfFERG4jPawf6Qxt5BJ3NgNNraLUt+3/NOUwu Ndw4ulE/91MvIDpsCq5dhET79ncFq+U5t6kg05+CmLGKom7F9HB5P4n6Y3k6i/0kBUqU JsIdtCqgcGKy3ytzibUK+OoltHvJFtt5Tn6tjOB8sYcvSNy4JO3Oa91/xZ9Qk8NBBNaV lroQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XMsHoBVw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd30-20020a1709076e1e00b00791a37e665esi16320494ejc.10.2022.11.16.12.05.57; Wed, 16 Nov 2022 12:06:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XMsHoBVw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233670AbiKPUCh (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 15:02:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238603AbiKPUC0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 15:02:26 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BC9A63CCD; Wed, 16 Nov 2022 12:02:25 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id h14so17496154pjv.4; Wed, 16 Nov 2022 12:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gWHeg8M1ItPKLADHrX13a52utCw4BMmhpRsIIQk2Fck=; b=XMsHoBVwkTCzyxRUnxAnS4OFKDbb1cNra2uUSHWdYCfwL9DGCbnSB80aMn0s2RiSv/ dzgPX4ZLZz7WWLKdqaz/iMX3PYvnXcUaA+GfcKYixqUqO1KRF6V8B041ZZiWqWvWJyRs KjxLQ3Vfcjq7dCBSBret8vz3d2bVmpMplOdSDnlrtGBX7rhcfTReRFbwKa2w6z8qipXe oNNaCNmgrlR5CcasYxh5HGGqk8bm9yBmpMm224JG/biPZESuByYdmSlCtPPPHnZAyWmS e1T9vGJOgXrxPr/+rnxsgCAuWmUYP8EJHeiZxmeC2YJN+4J1NmjeQn3fX8/s2XEpeBfr XUHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gWHeg8M1ItPKLADHrX13a52utCw4BMmhpRsIIQk2Fck=; b=3hOI/UAI3J1wm7eT9Os5Rt41CTr8EFUFEq1glQefAxWBEauWPfZ3SpzWWqka+mxKDC sG1yqUog2c/9oQzIHvRoOOJbsGaBWruiv3AJVzeeQ2YBSVun2UR7AzKkJVR15HIscJbM goJvJyFzbXPUoXOn9jukw+41s0rYcID3Kf9Rgb1JiX7nNrxiGid4Vdph3SXgtvdNG+lD Pw9WrYBlMqEEc65ZEGTwYbFfvvArTc/fPCjdSJoakt21rNlgreIj+1K4+teghIg1J5E+ nILY/Zy/lkUO0Ab6oNCS/IWo9lODyBa0lNVlcz4gBEUGIBsudFneUZN4tO5WhEV1ysKf ukDw== X-Gm-Message-State: ANoB5pmxxK3fN69fihBZA9FVCeSvZe+jNt9eb1kw24yqv8mpVRxrmkSG D90zhmxccK80uHv15bIZUx1AIyfAwhn9Pg== X-Received: by 2002:a17:902:c94f:b0:188:712f:dfa5 with SMTP id i15-20020a170902c94f00b00188712fdfa5mr10049999pla.140.1668628945118; Wed, 16 Nov 2022 12:02:25 -0800 (PST) Received: from localhost.localdomain ([103.51.72.182]) by smtp.gmail.com with ESMTPSA id s18-20020a170903215200b00186a6b6350esm12423950ple.268.2022.11.16.12.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 12:02:24 -0800 (PST) From: Anand Moon <linux.amoon@gmail.com> To: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Heiko Stuebner <heiko@sntech.de> Cc: Anand Moon <linux.amoon@gmail.com>, Chukun Pan <amadeus@jmu.edu.cn>, Michael Riesch <michael.riesch@wolfvision.net>, Peter Geis <pgwipeout@gmail.com>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [linux-next-v2 1/5] arm64: dts: rockchip: Fix gmac phy mode to rgmii on Rock 3A SBC. Date: Wed, 16 Nov 2022 20:01:43 +0000 Message-Id: <20221116200150.4657-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116200150.4657-1-linux.amoon@gmail.com> References: <20221116200150.4657-1-linux.amoon@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749684512706787111?= X-GMAIL-MSGID: =?utf-8?q?1749684512706787111?= |
Series |
[linux-next-v2,1/5] arm64: dts: rockchip: Fix gmac phy mode to rgmii on Rock 3A SBC.
|
|
Commit Message
Anand Moon
Nov. 16, 2022, 8:01 p.m. UTC
On rk356x ethernet phy support reduced media independent interface (RMII)
and reduced gigabit media independent interface (RGMII).
So set the phy mode to rgmii to support clock delay, also
add TX and RX delay for phy-mode.
Fix following warning
[ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay.
[ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30
[ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay.
[ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
V2: Fix commit message and added the RX and TX clock delay.
---
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Wed, Nov 16, 2022 at 3:02 PM Anand Moon <linux.amoon@gmail.com> wrote: > > On rk356x ethernet phy support reduced media independent interface (RMII) > and reduced gigabit media independent interface (RGMII). > So set the phy mode to rgmii to support clock delay, also > add TX and RX delay for phy-mode. Controller based clock delay, the various rgmii-id modes (rgmii-txid and rgmii-rxid are also valid) apply the delays in the phy. They are usually at a fixed amount, but some phys support variable delays. You want your commit message to accurately describe the problem, such as "In rgmii-id mode, the phy on the rock-3a is unreliable due to incorrect delays. Switch to rgmii mode in order to handle the delays in the controller." > > Fix following warning > > [ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay. > [ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30 > [ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay. > [ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10 I've been meaning to make this a dev_debug message, because in the various rgmii-id modes it is feasible for these to be non-existent in the device-tree. In rgmii-id mode these are disabled, no matter what they are set to in the dt. > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > --- > V2: Fix commit message and added the RX and TX clock delay. > --- > arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > index ea74ba32fbbd..e1c75532dcee 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > @@ -253,13 +253,16 @@ &gmac1 { > assigned-clock-rates = <0>, <125000000>; > clock_in_out = "output"; > phy-handle = <&rgmii_phy1>; > - phy-mode = "rgmii-id"; > + phy-mode = "rgmii"; > pinctrl-names = "default"; > pinctrl-0 = <&gmac1m1_miim > &gmac1m1_tx_bus2 > &gmac1m1_rx_bus2 > &gmac1m1_rgmii_clk > &gmac1m1_rgmii_bus>; > + > + tx_delay = <0x4f>; > + rx_delay = <0x26>; These are pretty far off from the default, have you verified the upper and lower bounds for the rock-3a? These should be roughly in the middle of that range. > status = "okay"; > }; > > -- > 2.38.1 >
Hi Peter On Thu, 17 Nov 2022 at 02:06, Peter Geis <pgwipeout@gmail.com> wrote: > > On Wed, Nov 16, 2022 at 3:02 PM Anand Moon <linux.amoon@gmail.com> wrote: > > > > On rk356x ethernet phy support reduced media independent interface (RMII) > > and reduced gigabit media independent interface (RGMII). > > So set the phy mode to rgmii to support clock delay, also > > add TX and RX delay for phy-mode. > > Controller based clock delay, the various rgmii-id modes (rgmii-txid > and rgmii-rxid are also valid) apply the delays in the phy. They are > usually at a fixed amount, but some phys support variable delays. > > You want your commit message to accurately describe the problem, such > as "In rgmii-id mode, the phy on the rock-3a is unreliable due to > incorrect delays. Switch to rgmii mode in order to handle the delays > in the controller." > > > > > Fix following warning > > > > [ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay. > > [ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30 > > [ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay. > > [ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10 > > I've been meaning to make this a dev_debug message, because in the > various rgmii-id modes it is feasible for these to be non-existent in > the device-tree. In rgmii-id mode these are disabled, no matter what > they are set to in the dt. As per the public datasheet share by Radxa below [0] https://dl.radxa.com/rock3/docs/hw/datasheet/RTL8211F-CG-Datasheet.pdf This Ethernet controller supports RGMII mode. > > > > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > > --- > > V2: Fix commit message and added the RX and TX clock delay. > > --- > > arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > > index ea74ba32fbbd..e1c75532dcee 100644 > > --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > > +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > > @@ -253,13 +253,16 @@ &gmac1 { > > assigned-clock-rates = <0>, <125000000>; > > clock_in_out = "output"; > > phy-handle = <&rgmii_phy1>; > > - phy-mode = "rgmii-id"; > > + phy-mode = "rgmii"; > > pinctrl-names = "default"; > > pinctrl-0 = <&gmac1m1_miim > > &gmac1m1_tx_bus2 > > &gmac1m1_rx_bus2 > > &gmac1m1_rgmii_clk > > &gmac1m1_rgmii_bus>; > > + > > + tx_delay = <0x4f>; > > + rx_delay = <0x26>; > > These are pretty far off from the default, have you verified the upper > and lower bounds for the rock-3a? These should be roughly in the > middle of that range. > No I have not tested this way but as per the datasheet, it supports TXDLY Add 2ns delay to RXC for RXD latching (via 4.7k-ohm to DVDD_RG) RXDLY Add 2ns delay to RXC for RXD latching (via 4.7k-ohm to DVDD_RG) I feel I should ignore the above warning and add it below. rx-internal-delay-ps = <2000>; tx-internal-delay-ps = <2000>; Thanks -Anand > > status = "okay"; > > }; > > > > -- > > 2.38.1 > >
Hi Anand, On 11/16/22 21:01, Anand Moon wrote: > On rk356x ethernet phy support reduced media independent interface (RMII) > and reduced gigabit media independent interface (RGMII). > So set the phy mode to rgmii to support clock delay, also > add TX and RX delay for phy-mode. Based on this commit message I still don't understand what you are actually trying to fix here. If you encounter network problems/stability issues, please let me know what test triggers the faulty behavior. Please describe the problem you are facing in detail here or in the cover letter. > Fix following warning > > [ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay. > [ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30 > [ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay. > [ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10 If the only purpose of this patch is to get rid of this warnings, it may make sense to set them to dev_dbg as Peter pointed out. Best regards, Michael > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > --- > V2: Fix commit message and added the RX and TX clock delay. > --- > arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > index ea74ba32fbbd..e1c75532dcee 100644 > --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > @@ -253,13 +253,16 @@ &gmac1 { > assigned-clock-rates = <0>, <125000000>; > clock_in_out = "output"; > phy-handle = <&rgmii_phy1>; > - phy-mode = "rgmii-id"; > + phy-mode = "rgmii"; > pinctrl-names = "default"; > pinctrl-0 = <&gmac1m1_miim > &gmac1m1_tx_bus2 > &gmac1m1_rx_bus2 > &gmac1m1_rgmii_clk > &gmac1m1_rgmii_bus>; > + > + tx_delay = <0x4f>; > + rx_delay = <0x26>; > status = "okay"; > }; >
Hi Michael, On Fri, 18 Nov 2022 at 12:33, Michael Riesch <michael.riesch@wolfvision.net> wrote: > > Hi Anand, > > On 11/16/22 21:01, Anand Moon wrote: > > On rk356x ethernet phy support reduced media independent interface (RMII) > > and reduced gigabit media independent interface (RGMII). > > So set the phy mode to rgmii to support clock delay, also > > add TX and RX delay for phy-mode. > > Based on this commit message I still don't understand what you are > actually trying to fix here. If you encounter network problems/stability > issues, please let me know what test triggers the faulty behavior. > Please describe the problem you are facing in detail here or in the > cover letter. > Ok, Ethernet does not work on my Radxa 3A see boot logs. [0] https://gist.github.com/moonlinux/bb56c787031226fbb9f69121564e76a2 Please find this updated commit message. As per the schematic and datasheet PHY mode is RGMII Use 2ns clock delay to RXC for RXD and TXC for TXD latching. > > Fix the following warning > > > > [ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay. > > [ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30 > > [ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay. > > [ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10 > > If the only purpose of this patch is to get rid of this warnings, it may No, the intent is to fix the PHY mode to RGMII and fix the delay. [ 7.066357] rk_gmac-dwmac fe010000.ethernet: init for RGMII_ID > make sense to set them to dev_dbg as Peter pointed out. > Ok, will update this in the next version. > Best regards, > Michael > Thanks -Anand
On Fri, Nov 18, 2022 at 4:35 AM Anand Moon <linux.amoon@gmail.com> wrote: > > Hi Michael, > > On Fri, 18 Nov 2022 at 12:33, Michael Riesch > <michael.riesch@wolfvision.net> wrote: > > > > Hi Anand, > > > > On 11/16/22 21:01, Anand Moon wrote: > > > On rk356x ethernet phy support reduced media independent interface (RMII) > > > and reduced gigabit media independent interface (RGMII). > > > So set the phy mode to rgmii to support clock delay, also > > > add TX and RX delay for phy-mode. > > > > Based on this commit message I still don't understand what you are > > actually trying to fix here. If you encounter network problems/stability > > issues, please let me know what test triggers the faulty behavior. > > Please describe the problem you are facing in detail here or in the > > cover letter. > > > > Ok, Ethernet does not work on my Radxa 3A see boot logs. > > [0] https://gist.github.com/moonlinux/bb56c787031226fbb9f69121564e76a2 > > Please find this updated commit message. > > As per the schematic and datasheet PHY mode is RGMII > Use 2ns clock delay to RXC for RXD and TXC for TXD latching. rgmii-id mode does exactly this in the phy (your realtek chip). By setting the mode to rgmii, you're telling the phy that delays are set elsewhere, either in hardware or in the controller. You're then handling them in the controller. While the delays aren't documented in the TRM, I've long suspected that the defaults of 0x30 and 0x10 equate to the standard 2ns delay. So you're setting the delays much higher than the default means you need to add *more* than the standard 2ns delay for your device to work. This is why I've been asking if you have tested these. You need to set each value and find the lowest and highest possible values that work, then take the median value between those two. > > > > Fix the following warning > > > > > > [ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay. > > > [ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30 > > > [ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay. > > > [ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10 > > > > If the only purpose of this patch is to get rid of this warnings, it may > > No, the intent is to fix the PHY mode to RGMII and fix the delay. > [ 7.066357] rk_gmac-dwmac fe010000.ethernet: init for RGMII_ID > > > make sense to set them to dev_dbg as Peter pointed out. > > > Ok, will update this in the next version. > > > Best regards, > > Michael > > > Thanks > -Anand
Hi Peter / Michael On Fri, 18 Nov 2022 at 23:43, Peter Geis <pgwipeout@gmail.com> wrote: > > On Fri, Nov 18, 2022 at 4:35 AM Anand Moon <linux.amoon@gmail.com> wrote: > > > > Hi Michael, > > > > On Fri, 18 Nov 2022 at 12:33, Michael Riesch > > <michael.riesch@wolfvision.net> wrote: > > > > > > Hi Anand, > > > > > > On 11/16/22 21:01, Anand Moon wrote: > > > > On rk356x ethernet phy support reduced media independent interface (RMII) > > > > and reduced gigabit media independent interface (RGMII). > > > > So set the phy mode to rgmii to support clock delay, also > > > > add TX and RX delay for phy-mode. > > > > > > Based on this commit message I still don't understand what you are > > > actually trying to fix here. If you encounter network problems/stability > > > issues, please let me know what test triggers the faulty behavior. > > > Please describe the problem you are facing in detail here or in the > > > cover letter. > > > > > > > Ok, Ethernet does not work on my Radxa 3A see boot logs. > > > > [0] https://gist.github.com/moonlinux/bb56c787031226fbb9f69121564e76a2 > > > > Please find this updated commit message. > > > > As per the schematic and datasheet PHY mode is RGMII > > Use 2ns clock delay to RXC for RXD and TXC for TXD latching. > > rgmii-id mode does exactly this in the phy (your realtek chip). By > setting the mode to rgmii, you're telling the phy that delays are set > elsewhere, either in hardware or in the controller. You're then > handling them in the controller. While the delays aren't documented in > the TRM, I've long suspected that the defaults of 0x30 and 0x10 equate > to the standard 2ns delay. So you're setting the delays much higher > than the default means you need to add *more* than the standard 2ns > delay for your device to work. > TX and RX clock delay might have been updated for ID: 0x30, Synopsys ID: 0x51 DWMAC4/5 As per the schematic [0] https://dl.radxa.com/rock3/docs/hw/3a/rock3a_v1.3_sch.pdf Pull-up for additional 2ns delay to RXC for data latching Pull-up for additional 2ns delay to TXC for data latching As per the datasheet [1] https://dl.radxa.com/rock3/docs/hw/datasheet/RTL8211F-CG-Datasheet.pdf TXDLY RGMII Transmit Clock Timing Control. 1: Add 2ns delay to RXC for RXD latching (via 4.7k-ohm to DVDD_RG) 0: No delay (via 4.7k-ohm to GND) RXDLY RGMII Receive Clock Timing Control. 1: Add 2ns delay to RXC for RXD latching (via 4.7k-ohm to DVDD_RG) 0: No delay (via 4.7k-ohm to GND) tx_delay and rx_delay might be suitable for old DWMAC hence it does not apply to this new Ethernet controller. I have tested with remove these from the dts and adding the following as this is required for rgmii mode. rx-internal-delay-ps = <2000>; tx-internal-delay-ps = <2000>; I don't mind setting the defaults of 0x30 and 0x10 to equate to the standard 2ns delay. but it does not have any effect on the current ethernet controller. > This is why I've been asking if you have tested these. You need to set > each value and find the lowest and highest possible values that work, > then take the median value between those two. > Yes, I have tested with and without those values. Thanks -Anand > > > > > > Fix the following warning > > > > > > > > [ 7.365215] rk_gmac-dwmac fe010000.ethernet: Can not read property: tx_delay. > > > > [ 7.365219] rk_gmac-dwmac fe010000.ethernet: set tx_delay to 0x30 > > > > [ 7.365224] rk_gmac-dwmac fe010000.ethernet: Can not read property: rx_delay. > > > > [ 7.365228] rk_gmac-dwmac fe010000.ethernet: set rx_delay to 0x10 > > > > > > If the only purpose of this patch is to get rid of this warnings, it may > > > > No, the intent is to fix the PHY mode to RGMII and fix the delay. > > [ 7.066357] rk_gmac-dwmac fe010000.ethernet: init for RGMII_ID > > > > > make sense to set them to dev_dbg as Peter pointed out. > > > > > Ok, will update this in the next version. > > > > > Best regards, > > > Michael > > > > > Thanks > > -Anand
On Wed, 16 Nov 2022 20:01:43 +0000, Anand Moon wrote: > On rk356x ethernet phy support reduced media independent interface (RMII) > and reduced gigabit media independent interface (RGMII). > So set the phy mode to rgmii to support clock delay, also > add TX and RX delay for phy-mode. > > Fix following warning > > [...] Applied, thanks! [2/5] arm64: dts: rockchip: Add support of external clock to ethernet node on Rock 3A SBC commit: ef9f4b4a50206bedd931f45dd9fd57fd4c1714a6 [3/5] arm64: dts: rockchip: Add support of regulator for ethernet node on Rock 3A SBC commit: 79aa02ddc682558edb9bd56522ad841759c99201 Best regards,
diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts index ea74ba32fbbd..e1c75532dcee 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts @@ -253,13 +253,16 @@ &gmac1 { assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; phy-handle = <&rgmii_phy1>; - phy-mode = "rgmii-id"; + phy-mode = "rgmii"; pinctrl-names = "default"; pinctrl-0 = <&gmac1m1_miim &gmac1m1_tx_bus2 &gmac1m1_rx_bus2 &gmac1m1_rgmii_clk &gmac1m1_rgmii_bus>; + + tx_delay = <0x4f>; + rx_delay = <0x26>; status = "okay"; };