Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5952744rwb; Tue, 22 Nov 2022 07:03:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf54w8vH3CLMvuqWSRcvkF82MVrM2Zal47DAQwgR+Dt7NoyYWhAitnC9utV7b3ziaBY7EjUz X-Received: by 2002:a05:651c:1510:b0:277:75fb:1fc5 with SMTP id e16-20020a05651c151000b0027775fb1fc5mr7477236ljf.405.1669129425347; Tue, 22 Nov 2022 07:03:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669129425; cv=none; d=google.com; s=arc-20160816; b=DbR2JlJ5l+fM9GNZtP84tg7KEZ9/MYPh83nOgq70apOo2lmWmrcMazmqmnpr81iLAf QFFy7/Xnsg+bH0Xfz/0GiSpg7QeM0yMcYDY8PqPIGfTTcnPXBzI+uQU71YbYR82FqUOe ESHxPA2CkqaNfjqESLuYJw6yNrsDHMXPnfrYKap+OySW8swR9WYRoiUNVnj6Kn98AmRe UbGAvK2FxrGpFbFtGOD/86K49rok0Z2e7/x61LT/sC/5PEDJdzO6k93Ox7TwXe0sTJi/ 2WrvXwP8KTFncxKMDRg0QY8h4IJeIF1fAI79a515aWu331e9GxS9bgL0mEUU4f3CDUXD DTZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SHX+r3o3V3envxmtyDAC/DiXE+gGNoPNrnRmBhYS2YA=; b=0UH1ftd0oppdhyjLSXfespsa9zjLvf7uigeRcTOYWbuWBKqfcUUUyAqFJd4v1gAgUS WfLGah3+PKRJKEsKN7W8VONtWLuPWCjC9YEi/SNfmmvJEvN7AMFv8L53ofQWZtoz0aBV 3+ULqkxyVICcBwZ1kIhbNUHcb3QR3CiRKUxbM13RSLL5MRNY2Kws6mF3KYOiyjAAJtkn JQobv+8CmbCQkaYhOyoRKLXD9iOYkDw1WueTx/wgdyIUnIHIwOpsCEcbRKHSMmDaT3PP qSOQ+K45GwanwEJBYecEJPvIarvGIVI990dFscs73R1WFm6nGBjIMT98CcVvxcErFNld +zIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bzw6WcmW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a170906179400b007b27aecaf82si8002309eje.274.2022.11.22.07.03.09; Tue, 22 Nov 2022 07:03:45 -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=bzw6WcmW; 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 S232993AbiKVOVH (ORCPT + 90 others); Tue, 22 Nov 2022 09:21:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbiKVOVC (ORCPT ); Tue, 22 Nov 2022 09:21:02 -0500 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E0F67F67; Tue, 22 Nov 2022 06:21:00 -0800 (PST) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1431386d5bbso1385083fac.10; Tue, 22 Nov 2022 06:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SHX+r3o3V3envxmtyDAC/DiXE+gGNoPNrnRmBhYS2YA=; b=bzw6WcmW4gcZyahHz4St8lxqfPCy255jxjxESN3SysXIr3ahVwGGwNgvtfmVtfQu7R aXQnNpnA2TakLL5r4M4WVful2l4efeMrOwp78QWfyudl/8uGxO8SYnBMgbgfotwY8z0+ AFgGQF2Xquo/YRPkvjrb9TpOYk4wU0dCTdfXq90kTbT3Gw8fLYZ1j4OJFPWFjBBDlzSZ I5KMuxeGO/t3Ev3FtX4K2mXEigYm87FlxmOH1bcarcQmILnzDi5vIoRUrysVB/Zs97kG Yf18mV4B9rf/6V4SwPNTg6Lfsv0O5kH/VfLLy19giFCkv56y8GxrTr87y9DVbi4cEHvp 3PAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SHX+r3o3V3envxmtyDAC/DiXE+gGNoPNrnRmBhYS2YA=; b=k0FLz1BusZEXiHKQq4qNVQ5tia5b6yhjr2J4pizsjGRG3SV0TpHMMx6EURE+TXzwmN QO4jf3L/mDaR7K3QCfl05CDBQ+NWH2kce6qyLoSAzZpmAQ4XH3KBjS0tZMFuiVaVA56r FOAvgt63yU4O8W5HqkK6YG/Nfn24BVD0lHdpkJFYSpaNoaOnNRLGMhwkNe/ttMKoUPpC dQbzowa7svvkYtgoqIelpMtUvcGgXSUm5vRMSr8xomuFTW01WkoAW0dZ09hYeL2zt+L0 C3CKxtAlLGtLvT41ZaDCR+T1TEcxJb+TM9egIUkxqCgKiySW9LI9dmiNk6Z8UVHXwxm7 Hrog== X-Gm-Message-State: ANoB5pmQKiHEo64dE+ZlgCp6ReVjejRyShM8Ca/ABeKGoR/212hzR4gB 9lsd9sZ3Tux5GI3JzifVLZZxFHWRtktPA9qG54s= X-Received: by 2002:a05:6871:4407:b0:132:7fa0:41bb with SMTP id nd7-20020a056871440700b001327fa041bbmr12920126oab.260.1669126859346; Tue, 22 Nov 2022 06:20:59 -0800 (PST) MIME-Version: 1.0 References: <20221116200150.4657-1-linux.amoon@gmail.com> <20221116200150.4657-7-linux.amoon@gmail.com> <99849c5e-5bd9-386b-99c5-fbc8c8df9656@arm.com> In-Reply-To: From: Anand Moon Date: Tue, 22 Nov 2022 19:50:42 +0530 Message-ID: Subject: Re: [linux-next-v2 5/5] arm64: dts: rockchip: Add missing of ethernet-phy-id to reset the phy on Rock 3A SBC To: Peter Geis Cc: Robin Murphy , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Chukun Pan , Michael Riesch , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Fri, 18 Nov 2022 at 00:40, Peter Geis wrote: > > On Thu, Nov 17, 2022 at 9:56 AM Anand Moon wrote: > > > > Hi Robin > > > > On Thu, 17 Nov 2022 at 16:24, Robin Murphy wrote: > > > > > > On 2022-11-17 05:57, Anand Moon wrote: > > > > Hi Peter, > > > > > > > > On Thu, 17 Nov 2022 at 02:16, Peter Geis wrote: > > > >> > > > >> On Wed, Nov 16, 2022 at 3:02 PM Anand Moon wrote: > > > >>> > > > >>> Add MDIO description with ethernet-phy-id compatible string > > > >>> which enable calling reset of the phy. The PHY will then be probed, > > > >>> independent of if it can be found on the bus or not, > > > >>> and that probing will enable the GPIO. > > > >>> > > > >>> ethernet-phy-id is read from ethenet register dump reg2 and reg3. > > > >>> > > > >>> Fix following warning. > > > >>> [ 12.323417] rk_gmac-dwmac fe010000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 > > > >>> [ 12.324078] rk_gmac-dwmac fe010000.ethernet eth0: no phy at addr -1 > > > >>> [ 12.324099] rk_gmac-dwmac fe010000.ethernet eth0: __stmmac_open: Cannot attach to PHY (error: -19) > > > >>> > > > >>> Signed-off-by: Anand Moon > > > >>> --- > > > >>> V2: new to the patch series. > > > >>> > > > >>> alarm@rock-3a:~$ sudo ethtool -d eth0 > > > >>> [sudo] password for alarm: > > > >>> ST GMAC Registers > > > >>> GMAC Registers > > > >>> Reg0 0x08072203 > > > >>> Reg1 0x00000000 > > > >>> Reg2 0x00000404 > > > >>> Reg3 0x00000000 > > > >>> Reg4 0x00000002 > > > >>> --- > > > >>> arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 2 +- > > > >>> 1 file changed, 1 insertion(+), 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 9f84a23a8789..fe36156a5017 100644 > > > >>> --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > > > >>> +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts > > > >>> @@ -585,7 +585,7 @@ &i2s2_2ch { > > > >>> > > > >>> &mdio1 { > > > >>> rgmii_phy1: ethernet-phy@0 { > > > >>> - compatible = "ethernet-phy-ieee802.3-c22"; > > > >>> + compatible = "ethernet-phy-id0000.0404", "ethernet-phy-ieee802.3-c22"; > > > >>> reg = <0x0>; > > > >>> pinctrl-names = "default"; > > > >>> pinctrl-0 = <ð_phy_rst>, <ð_phy_int>; > > > >> > > > >> Have you tried instead moving the reset to the mdio bus? I've had > > > >> success with this, though you'll need to change the reset assert and > > > >> deassert timing handles, they are different for the bus. > > > >> > > > > No can you share some examples? > > > > If you got a better way to solve this issue please let me know. > > > > I will give this a try. > > > > > > Note that the Rock 3A schematic says the phy is configured for address > > > 1, not 0. From what I remember of adding the MDIO node for NanoiPi4, > > > that didn't work if I got the address wrong, despite the fact that the > > > auto-detection when the MDIO node is omitted claimed to find the same > > > phy on both addresses 0 and 1. > > > > > From the net-dev folk, mdio address 0 is a broadcast address. All > functional phys we have on the mdio bus should respond to it. The > problem I've run into is with the reset on the phy node the reset > triggers too late for the dwmac to detect the phy correctly. However > moving it to the mdio bus node makes the reset happen at roughly the > same time as the depreciated dwmac reset and the phy detects without > any weird hacks. > This is not a hack, we are already using mdio bus node. &gma1 { phy-handle=ethernet-phy } mdio1 { ethernet-phy { } } Actually, *ethernet-phy-id* is one of the binding properties (see below). we can find many examples in the device tree that used this property in the linux kernel and u-boot. [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/net/ethernet-phy.yaml?h=v6.1-rc6#n31 [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/net/ethernet-phy.yaml?h=v6.1-rc6#n211 Please check this phy reset section below. [2] https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration#RMII_with_25MHz_on_ETH_CLK_-28no_PHY_Crystal-29-2C_REF_CLK_from_PHY_-28Reference_clock_-28standard_RMII_clock_name-29_is_provided_by_a_PHY-29 If you have some other input please share I have tried but failed. Thanks -Anand