Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3525588pxf; Mon, 15 Mar 2021 11:30:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW99l+YBNefvJV/dYaj3wcfTBHLhXXe8MkaOqd/JrHr2SEL2IjEss2KD2bQ+Zq6shNE1dj X-Received: by 2002:aa7:cb82:: with SMTP id r2mr31668224edt.209.1615833015331; Mon, 15 Mar 2021 11:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833015; cv=none; d=google.com; s=arc-20160816; b=XGLicstKwtd0QfeiTsZJvpIakyQEyPgHmrNMNiw2buPxoPkcneuodjC7YQDuXSTvFw WbyR3WJBSJMXudrSs8SZxRXI9aB1QVjkbGRFYEbvk3EcjRhXG1gL6ch8OVG49gquVmso rYMN/d0JVDLiTcVYsob/+uCWPljT9lkyV2sX5Jqh6s6qaYIddh/RpgLzPYwi13pzBLDK ihn5lEeb/r1gFhiaMvrTvSUbfSZle3A9H/3T60KEtKjDUhz1Jsr5c8ZIXS7orYOvrZ/p xo7Y0S3r7wrxzfFY0RuF/Fkw5sJNd4ZNjbEUfAXquPhLNHm8/AEhOL4cV/9fCmAr4tYZ TLFg== 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=PXyHOSAMe2L9GsH7Njm7lwXt2Ou2vqoXs3Cjj9zjOVk=; b=XhctsbR9J/wdoSW5wRZKb+df9qL6C5+YrxVn/DjLHgWnTwADBzuxc76j4xSQbEXvDd gvMSV6UtcFtDlxOv+1THVtzk8tVqjFJSKJ4utDqBZi5OwozydWgHqxHRiorEnV35xEAp IY+AIHihorvVC4qoGJz8BdacO2xeRWe8Y9MRnLTgbF8bUkhDY7vZHBmer1uAXh+XEhkX sFNL/4G/XWi4mMd9zTRq5RPNnD7G6otCoQz/mq4sGc2egrgJ1P4qm7nGU/gjKwyOZW7g nWGAp7IvwL09DUkDJ4G7D9wjTTHNgrAirWF9/niyKerK+T2mkTcgC1+EzFHSkr/nr6Jr 16xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2LMJCaxf; 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 n18si12648871ejg.224.2021.03.15.11.29.52; Mon, 15 Mar 2021 11:30:15 -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=2LMJCaxf; 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 S230338AbhCOOg3 (ORCPT + 99 others); Mon, 15 Mar 2021 10:36:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:37670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233470AbhCOOBo (ORCPT ); Mon, 15 Mar 2021 10:01:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC13F64E89; Mon, 15 Mar 2021 14:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816900; bh=PTIV3Q+ldmGS5yR7bJr3pPecoqqWfaeNBLeyEKfVCc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LMJCaxfzuZHZOsyrMQmSeYAbfxpUQAs4+ttHGLHYs6NXeYbtddfA7VD6Km6gB7JU lrT60E5XIJLMEAPrVlHXzqdFnz19SuYQ0wDctJ0iL28iylCq5tTeFMaH4tLXUsZ+Wu hb4BKxaQKFPv6nyXH/6W2AYHXKoPli4fG3dFHVyo= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Fertser , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.11 190/306] mmc: core: Fix partition switch time for eMMC Date: Mon, 15 Mar 2021 14:54:13 +0100 Message-Id: <20210315135514.031728471@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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: Greg Kroah-Hartman From: Adrian Hunter commit 66fbacccbab91e6e55d9c8f1fc0910a8eb6c81f7 upstream. Avoid the following warning by always defining partition switch time: [ 3.209874] mmc1: unspecified timeout for CMD6 - use generic [ 3.222780] ------------[ cut here ]------------ [ 3.233363] WARNING: CPU: 1 PID: 111 at drivers/mmc/core/mmc_ops.c:575 __mmc_switch+0x200/0x204 Reported-by: Paul Fertser Fixes: 1c447116d017 ("mmc: mmc: Fix partition switch timeout for some eMMCs") Signed-off-by: Adrian Hunter Link: https://lore.kernel.org/r/168bbfd6-0c5b-5ace-ab41-402e7937c46e@intel.com Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/mmc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -423,10 +423,6 @@ static int mmc_decode_ext_csd(struct mmc /* EXT_CSD value is in units of 10ms, but we store in ms */ card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME]; - /* Some eMMC set the value too low so set a minimum */ - if (card->ext_csd.part_time && - card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME) - card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME; /* Sleep / awake timeout in 100ns units */ if (sa_shift > 0 && sa_shift <= 0x17) @@ -616,6 +612,17 @@ static int mmc_decode_ext_csd(struct mmc card->ext_csd.data_sector_size = 512; } + /* + * GENERIC_CMD6_TIME is to be used "unless a specific timeout is defined + * when accessing a specific field", so use it here if there is no + * PARTITION_SWITCH_TIME. + */ + if (!card->ext_csd.part_time) + card->ext_csd.part_time = card->ext_csd.generic_cmd6_time; + /* Some eMMC set the value too low so set a minimum */ + if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME) + card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME; + /* eMMC v5 or later */ if (card->ext_csd.rev >= 7) { memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION],