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 28D10C7EE22 for ; Tue, 9 May 2023 11:59:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B5353854CF; Tue, 9 May 2023 13:59:11 +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 8B42E85021; Tue, 9 May 2023 13:59:09 +0200 (CEST) Received: from mail-m11879.qiye.163.com (mail-m11879.qiye.163.com [115.236.118.79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A48E28121A for ; Tue, 9 May 2023 13:59:06 +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.0.116] (unknown [112.49.211.222]) by mail-m11879.qiye.163.com (Hmail) with ESMTPA id 1D9876805B9; Tue, 9 May 2023 19:58:45 +0800 (CST) Message-ID: <87577214-1b2b-286c-9f5d-31bbcef018b6@rock-chips.com> Date: Tue, 9 May 2023 19:58:44 +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 2/8] 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: <20230422181943.889436-1-jonas@kwiboo.se> <20230422181943.889436-3-jonas@kwiboo.se> From: Kever Yang In-Reply-To: <20230422181943.889436-3-jonas@kwiboo.se> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkaTBlLVk8dSh9MQkIYHkgdHlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKSVVPQlVJSkpVSUlJWVdZFhoPEhUdFFlBWU9LSFVKTkxJSklVSktLVUpCWQY+ X-HM-Tid: 0a880060d1de2eb5kusn1d9876805b9 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Kz46URw*ST0WHSsWLTIcODQx DE0wCjJVSlVKTUNITUhITklOTk1JVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlKSklVT0JVSUpKVUlJSVlXWQgBWUFISUNJNwY+ 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/4/23 02:19, 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. > > Signed-off-by: Jonas Karlman > --- > 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 225af400ba70..a5b900f95981 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); Why remove this udelay? This may help the power stable before we can access pcie phy. Thanks, - Kever > - > 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; > }