Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5276541rdb; Wed, 13 Dec 2023 04:26:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRXwxLTyjNQ4NaTLtiiYmGzHu2t70bYXZLs0y5Uejbk0kciRsF9RU9FcGLI/Qmb5Cy7CU/ X-Received: by 2002:a17:902:728e:b0:1d0:a35b:8cf0 with SMTP id d14-20020a170902728e00b001d0a35b8cf0mr3967631pll.132.1702470363311; Wed, 13 Dec 2023 04:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702470363; cv=none; d=google.com; s=arc-20160816; b=DP432giYuP21g14+m4tEyPcdsrWpfnEoZnD2ZjdiCqoTFNWxDeW6cNn45fosf1mDUG OeFOwq98A/jo0qvUTy6xzmyqvz4yJw73jH4xmY1/1ZVTCGgjFn03Q96fPfYfQJqolhUe CzUR7zhcDynP7pOiOX/qUbS9vIrTrmacaasT3wc54jt/vOQMD2SWv+4AI6A4qQ3FVvU2 hV/e5V137kVjRN6J4Gi8Qjsm8w5FYLszn+Un2r+95H7oKpFrxDtWylViqsQzAZxkEBvV h3kNxjgeXfkkA4msbKt8jzWVPHXTLykKSl4JisDg0c/QhhhVGc4fk4Z6xGHqysmxQZ3r GMxQ== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=8tGa5F+WkgvK7JazPX+c6Qz06SeQ5uo/fqphqr2sn1E=; fh=MxHP9U5CJDYEtlS5R+D8rc8BPTni9fd+ef++RzdrGKI=; b=zEMB89bpYa7kvdLLGC2HLsqyc2eJXYxjpdiJM3rRchkWqqjjoRosZRaNo22EHu5hwm 3ayyMA1HOoc9cyrqru6UCO3Z4DjiitY8eVD4+L3tjj+gRLE8RQdz2I2eWD0+bRYD03IC siDbePqCmSHyqr4Ggv5z3jaDPvZKtZ4bKoOkCJmoJxWotFITQGoMCRAzzQw2yBfpSLei WE3k2fDWmFppmkwJg6IKFzo3tGn1KWC/iKiaxP+H+XjeQ91oUpmCn/203XoEMq9X14/z NBAhyv/aPhehgSCui68iNkHx3muDcAuHkSbjlrHuh1vuIo+6ix30HyajxCy42QZz+PEA mKtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t18-20020a1709028c9200b001cf677b6c20si9278394plo.594.2023.12.13.04.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:26:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A22CE80BE0B0; Wed, 13 Dec 2023 04:25:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377651AbjLMMZX (ORCPT + 99 others); Wed, 13 Dec 2023 07:25:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377400AbjLMMZW (ORCPT ); Wed, 13 Dec 2023 07:25:22 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 40E8ACD; Wed, 13 Dec 2023 04:25:28 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 08FB4C15; Wed, 13 Dec 2023 04:26:14 -0800 (PST) Received: from donnerap.manchester.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E4BE3F762; Wed, 13 Dec 2023 04:25:26 -0800 (PST) Date: Wed, 13 Dec 2023 12:25:23 +0000 From: Andre Przywara To: Anne Macedo Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Allwinner sunXi SoC support" , "open list:ARM/Allwinner sunXi SoC support" , open list , Corentin Labbe Subject: Re: [PATCH] arm64: dts: allwinner: Orange Pi One Plus PHY support Message-ID: <20231213122523.219cbfc0@donnerap.manchester.arm.com> In-Reply-To: References: <20231212122835.10850-2-retpolanne@posteo.net> <20231212162200.10b3868b@donnerap.manchester.arm.com> <20231213013544.2fc7e0d1@minigeek.lan> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 04:25:41 -0800 (PST) On Wed, 13 Dec 2023 11:02:39 +0000 Anne Macedo wrote: Hi Anne, > On Wed, Dec 13, 2023 at 01:35:44AM +0000, Andre Przywara wrote: > > On Tue, 12 Dec 2023 19:27:14 +0000 > > Anne Macedo wrote: > > > > Hi Anne, > > > > > On Tue, Dec 12, 2023 at 04:22:00PM +0000, Andre Przywara wrote: > > > > On Tue, 12 Dec 2023 12:28:30 +0000 > > > > Anne Macedo wrote: > > > > > > > > Hi Anne, > > > > > > > > > Adds compatible values to mdio subnodes for Ethernet PHY representing > > > > > Realtek 8211 PHY to Orange Pi One Plus. > > > > > > > > So can you state why this would be needed? This is the RTL8211 ID, > > > > > > Apologies, I completely forgot to include some context. > > > > > > > right? Which should be autodetected via MDIO. Looking back in my inbox > > > > you proposed this change before, for U-Boot, specifically, but I fail to > > > > find a solution or explanation what really happens here. Two Renesas .dts > > > > files have the same compatible, and the commit message talks about the > > > > reset line there, is this related? > > > > > > > > So can you please give some more background and explanation? That would be > > > > part of a good commit message anyway ("why", not "what"). > > > > > > Should I resend the commit with a more meaningful explanation? The > > > context is the following: > > > > > > currently, ethernet doesn't seem to work on both u-boot and Linux on the > > > Orange Pi One Plus board. > > > > > > On the kernel, this error shows up: > > > > > > Configuring network interfaces... [ 5.992589] dwmac-sun8i 5020000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 > > > [ 6.000823] dwmac-sun8i 5020000.ethernet eth0: __stmmac_open: Cannot attach to PHY (error: -19) > > > > > > After applying this fix, the PHY gets attached: > > > > > > Configuring network interfaces... [ 6.060020] dwmac-sun8i 5020000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 > > > [ 6.069460] dwmac-sun8i 5020000.ethernet eth0: PHY [stmmac-0:01] driver [RTL8211E Gigabit Ethernet] (irq=POLL) > > > > > > The previous compatible list that had ethernet-phy-ieee802.3-c22 fails > > > to find a PHY, so this patch includes the correct PHY ID with the > > > RTL8211 ID. > > > > > > The behaviour is described on [1]. > > > > So this is all an observation, but no real explanation, isn't it? > > I've made some analysis on [3] on this bug, but it was based solely on > u-boot. I was having trouble with the regulator and on u-boot nothing > would trigger the GPIO PD6 and the vcc-gmac-3v3 regulator, so the NIC > was completely dead. Next I did an analysis based on [2] because the > u-boot PHY initialization was flaky. > > > To cite [1]: "If the PHY reports an incorrect ID (or none at all) ...". > > I am pretty sure this is not the case here, instead we are looking at > > some missing platform bits, like a missing clock, reset, or most likely > > regulator. Or one of the existing resources is wrongly assigned or > > As I mentioned, PHY initialization is flaky on u-boot, so maybe that > assumption is correct. > > > configured? If the PHY is not (yet?) powered correctly when the code > > does the auto-detection via the MDIO bus, then the initialisation would > > If I recall correctly (I don't know if I kept it in my notes :c), that > could be the case. regulator-boot-on makes the NIC work (LEDs blink, at > least) but it doesn't get initialized. > > > fail. But since it works when overriding the auto-detection, I feel > > like we are papering over something here. > > Do you have the schematics for this board? I can only find the one for > > the Orange Pi Plus 2E, and I don't know how similar those two are. This > > shows *two* regulators, but both are activated by the same GPIO. > > I do. It's available on [4] Oh damn it, I got lost in Orange Pi's naming maze again - and was looking for the wrong board! So thanks for the link, and this clears things up! So yes, the Orange Pi *One* Plus, much like the Orange Pi 3, uses *two* regulators for Ethernet: one 3.3V from the PMIC's ALDO2 rail to power the PHY, and a discrete 2.5V regulator, enabled by GPIO PD6, for the voltage level on the MDIO lines. On top of this there is a reset line for the PHY, though this is held up by a pull-up resistor, so it *should* work, although we should describe this in the DT. So the DT looks wrong then: The reg_gmac_3v3 is actually a 2.5V regulator, and phy-supply is aldo2. I think it was done the way it is to somehow make it work with the current DT binding and code, which just supports one regulator. And aldo2 is referenced as the source of reg_gmac_3v3, which smells like another hack to me. > > It would also be interesting to see if any of Corentin's work for the > > Orange Pi 3 helps here? > > Adding [5] for reference here, thanks! Will check it out. This is an older version, there are actually updates. And he also mentions your board as well, so I think it just can sail in the wake of the OPi 3 Ethernet enablement. Can you try if this change, just applied to your .dts instead, works? https://github.com/montjoie/linux/commit/cf6e192eca1d59be630e6729d2cef9e897b3da8c Cheers, Andre P.S. Is there any chance where I can reply/comment on your blog? It seems like I can clear some things up... > [3] https://blog.retpolanne.com/hardware/embedded/2023/07/07/embedded-phy.html > [4] https://linux-sunxi.org/images/7/7c/OrangePi_OnePlus_Schematics_v2.0.pdf > [5] https://lore.kernel.org/netdev/20220509074857.195302-1-clabbe@baylibre.com/ > > Regards, Anne