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 8614AEB64DA for ; Tue, 18 Jul 2023 07:56:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A667866E8; Tue, 18 Jul 2023 09:55:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none 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="fVWBP+52"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D1E1D866CE; Tue, 18 Jul 2023 09:55:42 +0200 (CEST) Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) (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 3FF278466A for ; Tue, 18 Jul 2023 09:55:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none 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=2AgC4hUT/oeeqsga7Zdjd46pnu1fMbIHiXnjm3ONBSo=; b=fVWBP+52nTQ+YsUh6dKL9M3gar9YTOf4aVEagvH/WhOtz0sB280bw8mMC6ekRDqI0N4f XxKGKfpGUcE/UqUd31DeogXMwykEAQYMxNX8NWxfzdCjDP2lPcf5dmNhcA1PagdHf30vJh CgS9uXzCmLjrCa10Ct7w5sejrAtZbDhtp5fRKT5eePUcoUjMndoXwqNemD7lkBhN/SMgeS lVVnddLkCh0BYXuSm91of8w4EuhFp+jqZZ13PYBJLvBDBX9EF6yKCUNLAKJ93KHQzB75iP Bhc5LDPgc2zGfMEK4hiAF868k+CmUzyAc3DWeg7DtVxn+yV12XZX/qO1q//JA7pA== Received: by filterdrecv-65f68489c8-4txpj with SMTP id filterdrecv-65f68489c8-4txpj-1-64B6457A-11 2023-07-18 07:55:38.56467152 +0000 UTC m=+5905173.492250819 Received: from bionic.localdomain (unknown) by geopod-ismtpd-7 (SG) with ESMTP id cTggC1dkRZ-azNWaocldsQ Tue, 18 Jul 2023 07:55:38.356 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v3 3/9] pci: pcie_dw_rockchip: Use regulator_set_enable_if_allowed Date: Tue, 18 Jul 2023 07:55:38 +0000 (UTC) Message-ID: <20230718075529.78776-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718075529.78776-1-jonas@kwiboo.se> References: <20230718075529.78776-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h9B7dqEOnRRq2cK54?= =?us-ascii?Q?0KpTJVk04fr+l32CQmcv0CwrWFzB=2FkeAQ9l=2Ftw3?= =?us-ascii?Q?P4Je6Pm59vrGdw3iwDsgqA59g3GzM003EsAoO5S?= =?us-ascii?Q?oObU9F+R3gi+Y5mTgSuSnoNFa2OSp7ewx5Ps5J2?= =?us-ascii?Q?84lEzA1El3Y97sLm3fX05HRrk5b=2FMpl9AolP4m?= To: Kever Yang , Simon Glass , Philipp Tomsich Cc: Eugen Hristev , Shawn Lin , 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 Reviewed-by: Kever Yang --- v3: - Collect r-b tag 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.41.0