Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3520626pxf; Mon, 15 Mar 2021 11:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzHzNmZV71ujH/OpdgoAeNz4ivQSEnzS6EW3FhJPmV2xAF4dL+0bwNl+Oe0O78nZrYjP+7 X-Received: by 2002:a05:6402:4301:: with SMTP id m1mr32442279edc.210.1615832594488; Mon, 15 Mar 2021 11:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832594; cv=none; d=google.com; s=arc-20160816; b=pw6gDHOWGFWFIhCYSdl+sMSSqZjQdONGgZSr5PZ58MxcFp8RXB9HMccMFajnJOY1cc LfN2ttODLjd4F00ozND/QPcxK8GfdACRypYF3zzUNQ0XRRoU96hDuVShpQxBdugRl216 g+Vdy21r9gyzJk9kiaDNVu1kz1jTzZCoJg0lIzs7aRMHjsXgxkThpYN0U3+uOv+jYkGC ZKFG4OIkMrA14zsKintQLIVw3uDWNXjLXm7KwW4jR1NBcV6DR+2u3Z4ojYep86xXFBNS E6Aujxspgb3jW0Vi/ZWV1jkQHYxRy6ZS9NuANSMbdxFLIsLoVeKRfmO+n/WUhiemIEdG 6RKg== 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=DgI50y8jWoUcRyvUShThD1Dg2Yhbr/dl0FpFkLy4QQRJ2EUKL3SiaagpY8YROgvYuD NF8FqimX33zc4MCOlvmKK6KoPANn5rmlWYeKsziuLwDT0ZFxM6LrPtnlXR5fx/AJu5jx sWy1Gi9f+MqPwgSs1VBAp116KJlLcZXUEYU23dBrWZbtL0nVL9iB5TT5eiq6bBhRuMIM mMqucdEQ2qsvhLovt6e/2KKuAcNXiQPKOn3TwJ4195PHnx9JlUDeubh/eqplRV9DwWjA w40S5J9wZiOg8SRyl0IaHGEvuB24LqFhuV6IRgUSGEPFwG3nUjYHG6OQ99seMemVHqM6 Lsgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mAEBkGzp; 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 cb23si11016030ejb.496.2021.03.15.11.22.52; Mon, 15 Mar 2021 11:23:14 -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=mAEBkGzp; 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 S230124AbhCOOU1 (ORCPT + 99 others); Mon, 15 Mar 2021 10:20:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232775AbhCON74 (ORCPT ); Mon, 15 Mar 2021 09:59:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5D8464EF0; Mon, 15 Mar 2021 13:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816775; bh=PTIV3Q+ldmGS5yR7bJr3pPecoqqWfaeNBLeyEKfVCc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAEBkGzpJx3VISrMOSW2YyzgXQ9hvTnGed/ixntMFwWnFMvYT5MK9KiLxSmQ3AGv+ wJuIVpBfif1A82IdEaG4w3D+9xsSrSo0RsVL0ef0iGhJKLhptFp2Pug5R3GvcVBe4S 3bEA+xRRjuEUGn2bqSwO9lkhiFP3nkvmue3u2jrE= 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.4 101/168] mmc: core: Fix partition switch time for eMMC Date: Mon, 15 Mar 2021 14:55:33 +0100 Message-Id: <20210315135553.695158157@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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],