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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C94D8C7EE25 for ; Thu, 18 May 2023 03:51:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 191EF86124; Thu, 18 May 2023 05:51:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 55A5186131; Thu, 18 May 2023 05:51:36 +0200 (CEST) Received: from mail-m11879.qiye.163.com (mail-m11879.qiye.163.com [115.236.118.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0252A860A7 for ; Thu, 18 May 2023 05:51:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@rock-chips.com Received: from [192.168.60.65] (unknown [103.29.142.67]) by mail-m11879.qiye.163.com (Hmail) with ESMTPA id 73FF1680166; Thu, 18 May 2023 11:51:20 +0800 (CST) Message-ID: Date: Thu, 18 May 2023 11:51:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 3/9] pci: pcie_dw_rockchip: Use regulator_set_enable_if_allowed Content-Language: en-US To: Jonas Karlman , Simon Glass , Philipp Tomsich Cc: Eugen Hristev , u-boot@lists.denx.de References: <20230517225337.2089287-1-jonas@kwiboo.se> <20230517225337.2089287-4-jonas@kwiboo.se> From: Kever Yang In-Reply-To: <20230517225337.2089287-4-jonas@kwiboo.se> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlDSUtPVkpPT04ZT0IfQx5NTlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpLSFVJQlVKT0lVTUxZV1kWGg8SFR0UWUFZT0tIVUpKS0hKTFVKS0tVS1kG X-HM-Tid: 0a882cfbd1be2eb5kusn73ff1680166 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NyI6Ggw5MT0XQhEiFBgIDCEs KkJPFAFVSlVKTUNPSENKQ0NKSE5LVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlKS0hVSUJVSk9JVU1MWVdZCAFZQUhOT083Bg++ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi Jonas, On 2023/5/18 06:53, Jonas Karlman wrote: > The vpcie3v3 regulator is typically a fixed regulator controlled using > gpio. Change to use enable and disable calls on the regulator instead > of trying to set a voltage value. > > Also remove the delay to match linux driver, for a fixed regulator the > startup-delay-us prop can be used in case a startup delay is needed. > Limited testing on ROCK 3A, ROCK 5B, Quartz64, Odroid-M1 has shown that > this delay was not needed. > > Signed-off-by: Jonas Karlman Reviewed-by: Kever Yang Thanks, - Kever > --- > v2: > - Update commit message > > drivers/pci/pcie_dw_rockchip.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c > index 83737e62bc6a..1b8a1409f6df 100644 > --- a/drivers/pci/pcie_dw_rockchip.c > +++ b/drivers/pci/pcie_dw_rockchip.c > @@ -288,21 +288,16 @@ static int rockchip_pcie_init_port(struct udevice *dev) > struct rk_pcie *priv = dev_get_priv(dev); > > /* Set power and maybe external ref clk input */ > - if (priv->vpcie3v3) { > - ret = regulator_set_value(priv->vpcie3v3, 3300000); > - if (ret) { > - dev_err(priv->dw.dev, "failed to enable vpcie3v3 (ret=%d)\n", > - ret); > - return ret; > - } > + ret = regulator_set_enable_if_allowed(priv->vpcie3v3, true); > + if (ret && ret != -ENOSYS) { > + dev_err(dev, "failed to enable vpcie3v3 (ret=%d)\n", ret); > + return ret; > } > > - udelay(MACRO_US * 1000); > - > ret = generic_phy_init(&priv->phy); > if (ret) { > dev_err(dev, "failed to init phy (ret=%d)\n", ret); > - return ret; > + goto err_disable_regulator; > } > > ret = generic_phy_power_on(&priv->phy); > @@ -345,6 +340,8 @@ err_power_off_phy: > generic_phy_power_off(&priv->phy); > err_exit_phy: > generic_phy_exit(&priv->phy); > +err_disable_regulator: > + regulator_set_enable_if_allowed(priv->vpcie3v3, false); > > return ret; > }