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 2A12BEB64DC for ; Sat, 22 Jul 2023 13:31:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6A52886281; Sat, 22 Jul 2023 15:30:38 +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="eqlKdw6r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3684863B0; Sat, 22 Jul 2023 15:30:22 +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 17B53863B9 for ; Sat, 22 Jul 2023 15:30:19 +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=r/eru2/FxUdWizN6Ey1Ohhv4pTKMvU1ymc8xTF1i+j8=; b=eqlKdw6rmHGh0VxxDX4/ZRoPoO5cH03ytuoXUHEkqitLx4r/b+z5UT4jWDn3tXEuBAdA TTss8yjzK4GUnOeodlmNI3NmCU6V8zvz40JI52+kqz8e5Z0s1C9K65zK8NtSyVGpTEw5MT VGHXVuOIkiMosKNu+W7duTKU+PSfJ+KzAwcvOj5IyEzEj45HBRADShzeIrFQkI1lcHIw62 xB453YrSw5rEjVKUfl17UslsGgnk15RehB6AmP+6MsEYaV8kpSLBkl+xuVKW+NbAMg6QCl GF9YJh/BYE83ZhLAayYxpjwsQFhizjVqAS3Anpe0voAGn2ptD0I4QRIELoraRCUg== Received: by filterdrecv-84b96456cb-qhzcj with SMTP id filterdrecv-84b96456cb-qhzcj-1-64BBD9E9-64 2023-07-22 13:30:18.017590645 +0000 UTC m=+6270706.156428629 Received: from bionic.localdomain (unknown) by geopod-ismtpd-10 (SG) with ESMTP id vor0-JKoQ7mUf314IFKBhw Sat, 22 Jul 2023 13:30:17.704 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v4 3/9] pci: pcie_dw_rockchip: Use regulator_set_enable_if_allowed Date: Sat, 22 Jul 2023 13:30:18 +0000 (UTC) Message-ID: <20230722133012.1838083-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230722133012.1838083-1-jonas@kwiboo.se> References: <20230722133012.1838083-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h6yMv2ktVXzPXmvz6?= =?us-ascii?Q?UJFL=2FpGB5uuvjIwrYLnTqiX=2FthJGoDeuS0p8LDS?= =?us-ascii?Q?SPTYyYBUKZolt8NqQlnSLTqTcf6zOSkX1fXCB+W?= =?us-ascii?Q?Dlf75uezud2Y3LvKjg+gJ8vvu0fEolyMCUMo9iU?= =?us-ascii?Q?ojJQIZ7fISG9iEEk3bdtwiwhvCC0gcL642jEVI?= To: Kever Yang , Simon Glass , Philipp Tomsich Cc: Eugen Hristev , Jon 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 --- v4: - No change 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