Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp631698pxv; Thu, 15 Jul 2021 12:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBMQfmlgJU4NBJHeP8Wda1Vg1N6VSifgysc8cp+hrKRwvOkMXQol18rKh/kmJKT7i0ulGw X-Received: by 2002:a92:2911:: with SMTP id l17mr3556554ilg.263.1626375671735; Thu, 15 Jul 2021 12:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375671; cv=none; d=google.com; s=arc-20160816; b=GanMnm5uysajfZDKaNTLZ1HDT3HeNfAz5Zk0hpYc/+4IT2xHU9GpDXdfAhzcoJPqus Ay/0iL4jAoYTNwbrzudTA90fkpaXdrNEGhoCaDPHKRNBG9/Bvda0YVCV51UuluhyJ8B/ 0lKCTfAkG+wRN0bpiN4Hn9e9bgkCxmmlbn0eoaCWGKsD3FfYMg8fxCwJTDh8Tu36KjNV Qe9kf/ez18nllYdQhq7GJCGRhwzko4AejealRREckycAnoVgTkoygyGCIrXE8E67FmU2 gjPFZuOJjCyBIQW8oawj8F8tA9+O8oO0ZjffnlD9okzEAwJ7+G7YeUvqm/T//8rVDYi/ ghyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w3OxbXDwvbtEVgLRm5gnlfKsp+3DUj/W/hIyi3zNn0k=; b=HysR4uwt45wGeu/mFqTl0FDXzpZ2t98++U092c7wHCXo99r3cKlxpJE8zz/rh7O6vK dRBBzQJVpFNbbmtoW/XS2JG/vgAzxtU0aMol+AFOYI+jetIlmBRHjlJLEYPp92raTIF9 jn2QD4u5RGji6SZdefDVRMl8mkgqiQDS+nnXLtG2urwD/QdJrmwkZ3VM09DJLpiujlo5 FrQczMHbpN7zpHFWyRVPISGV2vDJJww8KcghNzj23W1BYB7KtYwRDeCsU5VoasDg8qUx WCaGjCJ4N9xP+ZGcwDna3zUjc8fQ2Q6JIgF5J9xsLOqiBCkwTVBrliMznmOTMajTDXhc eY7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vyO0uf15; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si8324623ilu.68.2021.07.15.12.00.58; Thu, 15 Jul 2021 12:01:11 -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=@linuxfoundation.org header.s=korg header.b=vyO0uf15; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235738AbhGOTCm (ORCPT + 99 others); Thu, 15 Jul 2021 15:02:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:59132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242140AbhGOSyv (ORCPT ); Thu, 15 Jul 2021 14:54:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B9FEC610C7; Thu, 15 Jul 2021 18:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375118; bh=WjFGojON94nyQhXVbDVrPG9n1lsvX6KpwqMvV6Swfso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vyO0uf15YZxUihafutWzdSx6rM55us+T+/fSBJhR/1ULYPOv1nzZNDypjwORfgTwi ypwkZ6torfYcjy6tOzMeMeDj74kdaNgITPzolbeO5n9dP0+0A7BHwKvUL5KdG/uCx7 +3XCgSXjNbsFlF166o8mqGpPp4ZdhhHUV+d57FIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Cooper , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.10 167/215] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode Date: Thu, 15 Jul 2021 20:38:59 +0200 Message-Id: <20210715182629.111648222@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Cooper commit d0244847f9fc5e20df8b7483c8a4717fe0432d38 upstream. When an eMMC device is being run in HS400 mode, any access to the RPMB device will cause the error message "mmc1: Invalid UHS-I mode selected". This happens as a result of tuning being disabled before RPMB access and then re-enabled after the RPMB access is complete. When tuning is re-enabled, the system has to switch from HS400 to HS200 to do the tuning and then back to HS400. As part of sequence to switch from HS400 to HS200 the system is temporarily put into HS mode. When switching to HS mode, sdhci_get_preset_value() is called and does not have support for HS mode and prints the warning message and returns the preset for SDR12. The fix is to add support for MMC and SD HS modes to sdhci_get_preset_value(). This can be reproduced on any system running eMMC in HS400 mode (not HS400ES) by using the "mmc" utility to run the following command: "mmc rpmb read-counter /dev/mmcblk0rpmb". Signed-off-by: Al Cooper Acked-by: Adrian Hunter Fixes: 52983382c74f ("mmc: sdhci: enhance preset value function") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210624163045.33651-1-alcooperx@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci.c | 4 ++++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 5 insertions(+) --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1813,6 +1813,10 @@ static u16 sdhci_get_preset_value(struct u16 preset = 0; switch (host->timing) { + case MMC_TIMING_MMC_HS: + case MMC_TIMING_SD_HS: + preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED); + break; case MMC_TIMING_UHS_SDR12: preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12); break; --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -253,6 +253,7 @@ /* 60-FB reserved */ +#define SDHCI_PRESET_FOR_HIGH_SPEED 0x64 #define SDHCI_PRESET_FOR_SDR12 0x66 #define SDHCI_PRESET_FOR_SDR25 0x68 #define SDHCI_PRESET_FOR_SDR50 0x6A