Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp13294imu; Thu, 8 Nov 2018 13:56:03 -0800 (PST) X-Google-Smtp-Source: AJdET5cY1bqChIp1TE8NkacM1QYrHmnlRovDBRPvdB1qFZrVvAaaunz0zaX+15DEWHiZHMR5iMxw X-Received: by 2002:a17:902:768b:: with SMTP id m11-v6mr2631809pll.322.1541714163344; Thu, 08 Nov 2018 13:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541714163; cv=none; d=google.com; s=arc-20160816; b=hyE29GzswLBzd3ov4AnOoTvXrIb9U8n0Ja0ESvcd5r4gEjtnqR2GtnhCIJ0/fdlPVE REhfH/tEp3ng/CgYJ9rlQss6z9ynck5WBgysjLDoS53YjCqxqaygWI0SjN95qYlatEWP MJk2eZxBx7IbOhTxXdIOnCTMLBdC0BwKj+JaDpQ+9CJy4yBSXahVB3HMEiUnbA5l9TiE wYYbFM3CHJT6vyj438w0MrUA0aA3WByOR0WcvgkdITbsjMXVJOiZX3Kjnwb/r/PVwzzB RnuyNBdGqW2xqYOKIhYuE5TLB7GseDyi+g1NtfZUrfsCJRrD69QvvuG6hMifiE2CiWyt Rgmw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sEoNh1B4uLni0cYu7bAmkShZ9o1YnjD57gqrVml8BLM=; b=XaS0INnTRF0aX+1+RSF31f9aUp6cq/KAWkDGnTRg+RfgS18FFmTW04TpAddSSDH5rs tgXEOPYPW0WoYQw/J4BS6EyZMaOian1Ety+okW89K7BxxfUCnA9ymcGCKrTPcPlxKScx o0zjfMcNnU/8cxEu0W+2tpk33pbreogNWzk1TxY+rSkJiAH2/WQrAkm+2LVZp9fs/cME w2DN+XBsJykkokBdPUq79wq2sXpbSWH8J8uOqh+xMqGlU7bJhTADCF9qKZjDKKRknVFH gt9stpGaaqWZvpVn2mC6W6uqoHUOiJtc4X+XJ0VbLORe3kdkUYLzUWG8Y+WUtY5ihyKz fQCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xU3lpBMh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p22si4551240pgl.340.2018.11.08.13.55.48; Thu, 08 Nov 2018 13:56:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xU3lpBMh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728490AbeKIHcW (ORCPT + 99 others); Fri, 9 Nov 2018 02:32:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:47434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728358AbeKIHcW (ORCPT ); Fri, 9 Nov 2018 02:32:22 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D27CF21104; Thu, 8 Nov 2018 21:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714094; bh=FI+E/0K28wiLQyrGKQEJCfK002ZteUBrfsFay7j3Hho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xU3lpBMhU6ApYRteH/887wpY1ZoDkCgsAWwZI0UwN1+gNW8T37abXB6yoHsONRkgd BuRYoE9cZZQOt+UHrLp4r4LjPVF+c8scg93aUxKKQuUuTTOQrnfL2LOwOr8gUsSXoV eLiSnbIvqSg7PqxHMar+rPMqAtNSVeC25vQPkzDw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , Ludovic Desroches , Ulf Hansson , Sasha Levin Subject: [PATCH 3.18 038/144] mmc: sdhci: restore behavior when setting VDD via external regulator Date: Thu, 8 Nov 2018 13:50:09 -0800 Message-Id: <20181108215057.615363616@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 918f4cbd4340ddd1eb389cd8efa3b07ac74ec4c0 ] After commit 52221610dd84 ("mmc: sdhci: Improve external VDD regulator support"), for the VDD is supplied via external regulators, we ignore the code to convert a VDD voltage request into one of the standard SDHCI voltage levels, then program it in the SDHCI_POWER_CONTROL. This brings two issues: 1. SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON quirk isn't handled properly any more. 2. What's more, once SDHCI_POWER_ON bit is set, some controllers such as the sdhci-pxav3 used in marvell berlin SoCs require the voltage levels programming in the SDHCI_POWER_CONTROL register, even the VDD is supplied by external regulator. So the host in marvell berlin SoCs still works fine after the commit. However, commit 3cbc6123a93d ("mmc: sdhci: Set SDHCI_POWER_ON with external vmmc") sets the SDHCI_POWER_ON bit, this would make the host in marvell berlin SoCs won't work any more with external vmmc. This patch restores the behavior when setting VDD through external regulator by moving the call of mmc_regulator_set_ocr() to the end of sdhci_set_power() function. After this patch, the sdcard on Marvell Berlin SoC boards work again. Signed-off-by: Jisheng Zhang Fixes: 52221610dd84 ("mmc: sdhci: Improve external VDD ...") Reviewed-by: Ludovic Desroches Tested-by: Ludovic Desroches Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 56578504fd24..2295bf6e94a1 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1248,19 +1248,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, struct mmc_host *mmc = host->mmc; u8 pwr = 0; - if (!IS_ERR(mmc->supply.vmmc)) { - spin_unlock_irq(&host->lock); - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); - spin_lock_irq(&host->lock); - - if (mode != MMC_POWER_OFF) - sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); - else - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); - - return; - } - if (mode != MMC_POWER_OFF) { switch (1 << vdd) { case MMC_VDD_165_195: @@ -1319,6 +1306,12 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER) mdelay(10); } + + if (!IS_ERR(mmc->supply.vmmc)) { + spin_unlock_irq(&host->lock); + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); + spin_lock_irq(&host->lock); + } } /*****************************************************************************\ -- 2.17.1