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 B021BC0015E for ; Wed, 19 Jul 2023 21:21:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6E6B986792; Wed, 19 Jul 2023 23:21:11 +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="hJDGzSuX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CB1B86783; Wed, 19 Jul 2023 23:21:05 +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 04AEF86795 for ; Wed, 19 Jul 2023 23:21:01 +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=yUrw/TWLPabPc3QvjUpDYhSqVVOCRH8V76pJGzoeEVg=; b=hJDGzSuXabDnmor0Q90na73GkTzDNMOShcHi+toAf8Sv1flnB6IKS1ks6oOLfPZzvp/V tGPmGiz7rqLoHBQM0dPODrGSdkepP8tdmnUTKxSffZz/yoQQ/CzfO8WOBmvAyQu3C5f4r7 1kw71HzbKY8Hin3LJdmsjn5bk9TdKXjybCeDu4JcWMeCwClJzlo9cwd4PzDDd8CENJFzA/ MJJegZ0efFK8wRwrQxgWgE84iQ8YGodq50CnQgf//3A49+QmUVftAnBn4hi1RiWcCFfRBc FI0XWZxEyfYXbWSeo1LeEA51pZS0tYg7FapiazYJUudXsfueT+cmDOVENaQdy2dw== Received: by filterdrecv-77869f68cc-5zdvl with SMTP id filterdrecv-77869f68cc-5zdvl-1-64B853BC-13 2023-07-19 21:21:00.392929798 +0000 UTC m=+6039898.190785677 Received: from bionic.localdomain (unknown) by geopod-ismtpd-1 (SG) with ESMTP id Zo1vJ9Q2R6GO3j6PNGZ_FA Wed, 19 Jul 2023 21:21:00.182 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 5/5] mmc: dw_mmc: Keep vqmmc-supply enable count in balance Date: Wed, 19 Jul 2023 21:21:00 +0000 (UTC) Message-ID: <20230719212049.709358-6-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719212049.709358-1-jonas@kwiboo.se> References: <20230719212049.709358-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h=2Fg8UqMHLN3Bl3oxC?= =?us-ascii?Q?rmEJVhih9k13OxDwtit7TfVkQeR5DbQUv1RwIzE?= =?us-ascii?Q?iYySwDwi2CSyrCGOKnSaICGSv4zWh0iqLEIP5y6?= =?us-ascii?Q?oAGJEd62OsrKYAPC5qy4XhsWe=2FUQtvn0o5DRJp5?= =?us-ascii?Q?FJK07nxyNAuBq7o3pgTXF7KrMvCFXXPtNhOmx9?= To: Simon Glass , Marek Vasut , Peng Fan , Jaehoon Chung , Patrice Chotard Cc: Eugen Hristev , Svyatoslav Ryhel , 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 With the commit 4fcba5d556b4 ("regulator: implement basic reference counter"), keeping regulator enablement in balance become more important. Disable vqmmc-supply before signal voltage is changed to keep regulator enable counter in balance. Signed-off-by: Jonas Karlman --- drivers/mmc/dw_mmc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 5085a3b491da..400066fa99a2 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc) if (mmc->vqmmc_supply) { int ret; + ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false); + if (ret) + return ret; + if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180) regulator_set_value(mmc->vqmmc_supply, 1800000); else -- 2.41.0