Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527725pxf; Mon, 15 Mar 2021 11:33:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqFu4BLNBTPnfzhgHkB8O2GYFhDSpGdNA6q0s8erVlLOq1BcXxKZb9eKnntgC1i+x7nYZc X-Received: by 2002:a17:906:b4c:: with SMTP id v12mr25484499ejg.330.1615833182525; Mon, 15 Mar 2021 11:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833182; cv=none; d=google.com; s=arc-20160816; b=Mpvevt0C2HjYYaKqZLYLjHTdqjK1Jep8Zpy/4xLYIk2gaZ9spRQlliTLIDQUCCoNy+ HKaULdyv0x8Z4pMZpbB4ONPzScefcsL0WzthIu5zGHkjIAe/zSziF0vzwRlcrepgsJ5l A+rTD+CcOgqNBFd6ahpAtI6n9amGEDvqntj0Cgii1w04UBOGLkzj2duZ7WrQAGQaCuRr wIeE4ftOBdzD6iyLoK1FuB+GexzZxYMLs8W0BPdmr//s4IHUlt/p4r2OCq3NZuTz/gPG tjHx+E1WR/UsEUkbiFBSTpypZiBQjgc8oYjIa/BaZtUptp6gCkOjvbhR1vWDjRjEE3rP lfQw== 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=DI43257uVRcU9MccZPZEA71nGW1Wdzdb6j5c6DSgwXc0Xp6dZk/gLOSk+9b2wUjFpq p0XwhgCb0FA5I8CZ4R/23neUx7mDvrLcy+PJpToHAELi8tK868H1FdoA2j4EnHFv0iRI 5k/qqvGXGsC9uM8836Ytlp5dLQuJepuBKlxXk88SSQj5OzdtK3LKdwmNsEaeQX9CqDjt D7zjJf8oUcp74tEFi6yMSAsgAXWDMiBopZzxCfPla9mncb6NGiz2ipwiycRnB2NAson3 DHmK4U4gC1BXtXKztoOCureJjaB0iR1sbCtgEy7L8TUett7c3iJk+r6OeLGvYL/C7ja+ YoEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wb2WvRcn; 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 r6si11885146eda.292.2021.03.15.11.32.39; Mon, 15 Mar 2021 11:33:02 -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=wb2WvRcn; 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 S233298AbhCOOig (ORCPT + 99 others); Mon, 15 Mar 2021 10:38:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:48942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233664AbhCOOCR (ORCPT ); Mon, 15 Mar 2021 10:02:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D9BEB64F1A; Mon, 15 Mar 2021 14:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816931; bh=PTIV3Q+ldmGS5yR7bJr3pPecoqqWfaeNBLeyEKfVCc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wb2WvRcnoQQfkrzfP8Z61Iv9VJWTupQFsq+IyJLKG+DbqzI0sccqhXZnkUwl2Sn1W H1mnUT+amr+DhVhRZ1oITzE9vaSIrZp1i4rPGrHjKVzKzOjLHB9jUBf0XWE4uULeTB SPwomhGBnyOo0JCymuGcw+uDMPIbO4h/AVPAxaVA= 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.10 194/290] mmc: core: Fix partition switch time for eMMC Date: Mon, 15 Mar 2021 14:54:47 +0100 Message-Id: <20210315135548.468880398@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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],