From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 603BCEB64DD for ; Tue, 18 Jul 2023 13:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229984AbjGRNQT (ORCPT ); Tue, 18 Jul 2023 09:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbjGRNQQ (ORCPT ); Tue, 18 Jul 2023 09:16:16 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B05C0 for ; Tue, 18 Jul 2023 06:16:15 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qLkYW-0005P3-T3; Tue, 18 Jul 2023 15:15:56 +0200 Received: from mfe by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qLkYW-0002nJ-1f; Tue, 18 Jul 2023 15:15:56 +0200 Date: Tue, 18 Jul 2023 15:15:56 +0200 From: Marco Felsch To: Andrew Lunn Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: Re: [PATCH net-next 2/2] net: stmmac: platform: add support for phy-supply Message-ID: <20230718131556.bdp3sykrkkylp4pb@pengutronix.de> References: <20230717164307.2868264-1-m.felsch@pengutronix.de> <20230717164307.2868264-2-m.felsch@pengutronix.de> <20230718083504.r3znx6iixtq7vkjt@pengutronix.de> <427214fb-6206-47b3-bf5b-8b1cfc8b7677@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <427214fb-6206-47b3-bf5b-8b1cfc8b7677@lunn.ch> User-Agent: NeoMutt/20180716 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23-07-18, Andrew Lunn wrote: > On Tue, Jul 18, 2023 at 10:35:04AM +0200, Marco Felsch wrote: > > On 23-07-18, Andrew Lunn wrote: > > > On Mon, Jul 17, 2023 at 06:43:07PM +0200, Marco Felsch wrote: > > > > Add generic phy-supply handling support to control the phy regulator. > > > > Use the common stmmac_platform code path so all drivers using > > > > stmmac_probe_config_dt() and stmmac_pltfr_pm_ops can use it. > > > > > > > > Signed-off-by: Marco Felsch > > > > --- > > > > .../ethernet/stmicro/stmmac/stmmac_platform.c | 51 +++++++++++++++++++ > > > > include/linux/stmmac.h | 1 + > > > > 2 files changed, 52 insertions(+) > > > > > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > > > > index eb0b2898daa3d..6193d42b53fb7 100644 > > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > > > > @@ -10,6 +10,7 @@ > > > > > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -423,6 +424,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) > > > > if (plat->interface < 0) > > > > plat->interface = plat->phy_interface; > > > > > > > > + /* Optional regulator for PHY */ > > > > + plat->phy_regulator = devm_regulator_get_optional(&pdev->dev, "phy"); > > > > + if (IS_ERR(plat->phy_regulator)) { > > > > + if (PTR_ERR(plat->phy_regulator) == -EPROBE_DEFER) > > > > + return ERR_CAST(plat->phy_regulator); > > > > + dev_info(&pdev->dev, "No regulator found\n"); > > > > + plat->phy_regulator = NULL; > > > > + } > > > > + > > > > > > So this gets the regulator. When do you actually turn it on? > > > > During the suspend/resume logic like the rockchip, sun8i platform > > integrations did. > > So you are assuming the boot loader has turned it on? > > You also might have a difference between the actual state, and what > kernel thinks the state is, depending on how the regulator is > implemented. > > It would be better to explicitly turn it on before registering the > MDIO bus. You're right, I changed this. Thanks for the hint. Regards, Marco