Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp575001ybn; Thu, 3 Oct 2019 09:04:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkvJyo0puk2kpjIb9kMGGwDvXXwI+1OYMGiBtFZeEmEW+BnvF2JxBznu3aiHjHJyzgU7uL X-Received: by 2002:aa7:dc55:: with SMTP id g21mr10249339edu.210.1570118672472; Thu, 03 Oct 2019 09:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570118672; cv=none; d=google.com; s=arc-20160816; b=Q893BfMTPjl8UJOW2RX56fUarnNTJ8ZKC9wmV+Z5V9zeYK25M35eHBxrkCArKL2WpU /j0j/vPDfFMER79mnPYNnaj2+Ooq0kfM7AQotDiNDo3L18s6E3D8I/WuIwajQRw5lHjb togbcOj6ux7N4PHkT/6OgCkOC6HUZPNng4F5HS5TKy8sII6ES72osAgp8yA5ra0SncR8 ACYWx1CCSlEMT/TkBPckIiaK1Q3JBoSi+i24INnTr8XXsYNtEEyk+8X8E3/yTjZ0cAZq /F5kaHtKe8YQscqgcN5RFMYN1tLrvhPlNTGcyiXNNFlyLqsD52KgSdh5eZH/hfUlE1UX PQ0Q== 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=D3gSkaLJo3n9SauDcfKnfxnKCyUQZ8kJIQLqzL7rIHY=; b=FyZY/4/IFNim+B64747bwKTG1VIRmYUyRrS8dVEcXRazL3wPCGoGePtrGur1DWKYBj i8Zs1VoRJ9hOtUAWI2u/Ic13VrJ/you+GOUiTSvsiQDH2zmE/h/m8KS14kbeuw7hHR9W XmB4kc8oM7gKjoW2gDsbiuUn7/rsnITx+40NnqndqNz13Tk3ALLBTIazLKgHUjzZQDlQ Ak7RDZ7eU0OL9iY2dVBlSIWvJmTSe0jwMJEbfD8zlQWIDe0UXWErInp/KhNuQtJK8+NH q3qiHxIr0YkCcQdyemW8dmcN0aKEemAfvHzXDnVSAl3BZpVBYCz6x7HCMCdL9kQ5ONTz lzPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ag3dHIYW; 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 i13si1663376edv.182.2019.10.03.09.04.07; Thu, 03 Oct 2019 09:04:32 -0700 (PDT) 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=Ag3dHIYW; 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 S1730037AbfJCP6s (ORCPT + 99 others); Thu, 3 Oct 2019 11:58:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731288AbfJCP6q (ORCPT ); Thu, 3 Oct 2019 11:58:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B96D9222C9; Thu, 3 Oct 2019 15:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118325; bh=fuQVCnZpD/kZPOjogsugRHIBxW76GMvJxErOmtJ5zVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ag3dHIYWAcTY1MezTPBdtGnaMGQJ+351QztDSoIOFX5xGA+YBQGRBwjyu5som2cVy f0aDlzVT3QCt0t0+1Wdz8Eo9/hJJLyqH+WGADm5oKVCuanl6/fubDMUVZSJThrQjOh F5fCBaTSQHB4/0VzJdDGOeGLyEjFe1xV2yYO2C8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Al Cooper , Ulf Hansson , Sasha Levin Subject: [PATCH 4.4 70/99] mmc: sdhci: Fix incorrect switch to HS mode Date: Thu, 3 Oct 2019 17:53:33 +0200 Message-Id: <20191003154331.105083591@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154252.297991283@linuxfoundation.org> References: <20191003154252.297991283@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Al Cooper [ Upstream commit c894e33ddc1910e14d6f2a2016f60ab613fd8b37 ] When switching from any MMC speed mode that requires 1.8v (HS200, HS400 and HS400ES) to High Speed (HS) mode, the system ends up configured for SDR12 with a 50MHz clock which is an illegal mode. This happens because the SDHCI_CTRL_VDD_180 bit in the SDHCI_HOST_CONTROL2 register is left set and when this bit is set, the speed mode is controlled by the SDHCI_CTRL_UHS field in the SDHCI_HOST_CONTROL2 register. The SDHCI_CTRL_UHS field will end up being set to 0 (SDR12) by sdhci_set_uhs_signaling() because there is no UHS mode being set. The fix is to change sdhci_set_uhs_signaling() to set the SDHCI_CTRL_UHS field to SDR25 (which is the same as HS) for any switch to HS mode. This was found on a new eMMC controller that does strict checking of the speed mode and the corresponding clock rate. It caused the switch to HS400 mode to fail because part of the sequence to switch to HS400 requires a switch from HS200 to HS before going to HS400. Suggested-by: Adrian Hunter Signed-off-by: Al Cooper Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 62d37d2ac557b..1d6dfde1104d1 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1452,7 +1452,9 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing) ctrl_2 |= SDHCI_CTRL_UHS_SDR104; else if (timing == MMC_TIMING_UHS_SDR12) ctrl_2 |= SDHCI_CTRL_UHS_SDR12; - else if (timing == MMC_TIMING_UHS_SDR25) + else if (timing == MMC_TIMING_SD_HS || + timing == MMC_TIMING_MMC_HS || + timing == MMC_TIMING_UHS_SDR25) ctrl_2 |= SDHCI_CTRL_UHS_SDR25; else if (timing == MMC_TIMING_UHS_SDR50) ctrl_2 |= SDHCI_CTRL_UHS_SDR50; -- 2.20.1