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 6EE65C7EE22 for ; Wed, 17 May 2023 22:54:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2A13E86282; Thu, 18 May 2023 00:53:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="nQWs9oYA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 88B97862A0; Thu, 18 May 2023 00:53:47 +0200 (CEST) Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4A3D886272 for ; Thu, 18 May 2023 00:53:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=rj8mAEUWyPBKlSMBgSqsg9wXZricGmheCyw0ZkiJbNw=; b=nQWs9oYA3reYH3HRanMIA9ziXCGemu8ktH54jIZ5Qxf3fO1aO7vcDI/pV9J4GBJ58F9s 3mYyRkRJ6tDPaSCvq2k6s8f2UPrJifGTQIl0DIyx2imcA+NYh5uHSJvEacHLb5qC4Vn4/7 WqOjtW2NxE/7143RLJO9Jnmyk++EdGMtzINahrIpCle49VzMFqq5CgQCtZgvGrH2iOltyM J9gYSIOlQJvTErfrvVS2AwEduFZ2A9UIeFGeoBIX0TA74LJTr17AMyihluYyedZzzOXF5J hGaZGVI7grQjhh+tqQiS1ZuOdbMjIxPApTKNGDBARui3HMaKDLUmnBx3UO8JMgLg== Received: by filterdrecv-66949dbc98-p7b6v with SMTP id filterdrecv-66949dbc98-p7b6v-1-64655AF6-2A 2023-05-17 22:53:42.749534865 +0000 UTC m=+602036.801166904 Received: from bionic.localdomain (unknown) by geopod-ismtpd-10 (SG) with ESMTP id lNt7SZyMSd6Tpi5TnEQiPQ Wed, 17 May 2023 22:53:42.561 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 3/9] pci: pcie_dw_rockchip: Use regulator_set_enable_if_allowed Date: Wed, 17 May 2023 22:53:42 +0000 (UTC) Message-Id: <20230517225337.2089287-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230517225337.2089287-1-jonas@kwiboo.se> References: <20230517225337.2089287-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h8QTBf3peTyKTRDpV?= =?us-ascii?Q?kJpBMYLaSJR2potHIzrD4dTc40HMQDkeT8Mg2xo?= =?us-ascii?Q?wI793t13ce7g+iLl0fQvWioh6sA3q3gWOdX6T6r?= =?us-ascii?Q?2R1Go58rnXgoRgMl3Ynq8FxH8y=2F2ZcpCOoADLtZ?= =?us-ascii?Q?2D2AP2d37W=2FJBTipNS0+kphRv6rAJIttIQYgIF?= To: Kever Yang , Simon Glass , Philipp Tomsich Cc: Eugen Hristev , u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii 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 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 --- 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; } -- 2.40.1