Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp56325ybg; Mon, 8 Jun 2020 16:18:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2Cwc9Nl8tWc25Cx13/ReXdm+4IIKLZt6Lu/orlNj19lqqV6ESRxCChQMxg2QbJhugwsHZ X-Received: by 2002:a50:e881:: with SMTP id f1mr23353977edn.98.1591658300408; Mon, 08 Jun 2020 16:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658300; cv=none; d=google.com; s=arc-20160816; b=DtnfSbc7ORy+aUyBMT7UZ8TiW0mSRE89amssOSVg9+fxyx84j2bCmQ9gEUDZ99JGwo iOuQQeB2jzqVZkCrGqSbwbrczQca+TktAiWNSeZJ7laj/7VnAepW8mr/aXdtREhSjyG/ r+akT1K/ysujIkwYcxm/zPAC/OyY7YsMx2E/BtgIHTQ7SJ5WXCrHVYWJyWJ2Xl1h7D9A rrdF2uybjAWBVY+MojiEKihtR8t0MZv7+vC1L7avWl3LluDNcX63MpxcXHgvD18E//ji ZKQAvOgkW5CatzuyShST52U9xoe2Amxx0khWDvyAieTNqLKsIPIffc+F1YGyEFqPiudP sEgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YhUQC3iWlMsLjDAdvdJIslBtQAVWEpmrqPI+tOGg0Q4=; b=xgrf7Utx8BGUCxOceuZtvVa/LNmjP2HNcyxamBhTfldg5XC1RjY4Sxy5lpe2G5OWTn ZaDZbFJkf9/VaXnbkCHlfWnW/gQT3RwzdASS5FKDHqADuVbj2r+hvmEfjzPlVKsqZMah rQ6WXh90v2xcz8QPkgucDUY05epnJQKm/DSP47RDT/O7pEgG07xy0nVrB8jrUEh/rP4r iMTMY8aEVB01L6VZAiGZB5a1mDCR+5emcZ0MZ0Q1qdW7t+zmDGk6wRegBWoPOkxM3C6R cDGQ8vUQl/ygH6DtYMqBXkEyhZH8XcTsEXr1yTVHjkfV42XwoTHztqyDbZB0ABJpP0tc p3mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q9ok72UT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si9718556ejb.697.2020.06.08.16.17.52; Mon, 08 Jun 2020 16:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q9ok72UT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729585AbgFHXNq (ORCPT + 99 others); Mon, 8 Jun 2020 19:13:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:58418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728908AbgFHXL3 (ORCPT ); Mon, 8 Jun 2020 19:11:29 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02E8220897; Mon, 8 Jun 2020 23:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657889; bh=8ytuBy4b62zsfobpy3ImeP8JbnWVrWV3o5vABkvCtmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9ok72UT3eWh5tiCYk/2OMepss5v+ki2yWhrgP3HCrYb3LFDpU2Evyqx3d5dRUrV1 maugMZN1MAMgQ2U35/RKJNhxyuu6FmnxQM3DXuRr//NiGx1jl8FBTuHk+wBIn8uv2z So0+FI10zfIiOMWT1Y7GVBUpvXnpRPqLxMplvCkQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marek Vasut , Ulf Hansson , Sasha Levin , linux-mmc@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 245/274] mmc: mmci: Switch to mmc_regulator_set_vqmmc() Date: Mon, 8 Jun 2020 19:05:38 -0400 Message-Id: <20200608230607.3361041-245-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Vasut [ Upstream commit 3e09a81e166c0a5544832459be17561a6b231ac7 ] Instead of reimplementing the logic in mmc_regulator_set_vqmmc(), use the mmc code function directly. This also allows us to fix a related issue on STM32MP1, when a voltage switch of 1.8V is done for the eMMC, but the current level is already set to 1.8V. More precisely, in this scenario the call to the ->post_sig_volt_switch() hangs, indefinitely waiting for the voltage switch to complete. Fix this problem by checking if mmc_regulator_set_vqmmc() returned 1 and then skip invoking the callback. Signed-off-by: Marek Vasut Link: https://lore.kernel.org/r/20200416163649.336967-3-marex@denx.de [Ulf: Updated the commit message] Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/mmci.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 647567def612..a69d6a0c2e15 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1861,31 +1861,17 @@ static int mmci_get_cd(struct mmc_host *mmc) static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) { struct mmci_host *host = mmc_priv(mmc); - int ret = 0; - - if (!IS_ERR(mmc->supply.vqmmc)) { + int ret; - switch (ios->signal_voltage) { - case MMC_SIGNAL_VOLTAGE_330: - ret = regulator_set_voltage(mmc->supply.vqmmc, - 2700000, 3600000); - break; - case MMC_SIGNAL_VOLTAGE_180: - ret = regulator_set_voltage(mmc->supply.vqmmc, - 1700000, 1950000); - break; - case MMC_SIGNAL_VOLTAGE_120: - ret = regulator_set_voltage(mmc->supply.vqmmc, - 1100000, 1300000); - break; - } + ret = mmc_regulator_set_vqmmc(mmc, ios); - if (!ret && host->ops && host->ops->post_sig_volt_switch) - ret = host->ops->post_sig_volt_switch(host, ios); + if (!ret && host->ops && host->ops->post_sig_volt_switch) + ret = host->ops->post_sig_volt_switch(host, ios); + else if (ret) + ret = 0; - if (ret) - dev_warn(mmc_dev(mmc), "Voltage switch failed\n"); - } + if (ret < 0) + dev_warn(mmc_dev(mmc), "Voltage switch failed\n"); return ret; } -- 2.25.1