Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3520125pxf; Mon, 15 Mar 2021 11:22:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6QeC6WStVQ4kV0vNpO3L68zWj4hkNbEAli0uEX7c2tqhASYxp9J5ILYyzYcT5XIfngIv9 X-Received: by 2002:a17:906:abcd:: with SMTP id kq13mr25835369ejb.477.1615832551224; Mon, 15 Mar 2021 11:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832551; cv=none; d=google.com; s=arc-20160816; b=XAmy37LfWM1EYosw/WsGcSGcbglYr4jKDBk/fEQX9nWpzJI7GKosDnrEVGOPE3I5h/ kPVc4yo9y+RrF+HZzXGCaLzrVfCYeOD1mz8NnPpIs9gLjdfjXfcwoO+ce5T1tdQsJ3Cx GkVHNhJpAU/UNBFF6VMoDq6jQFpNHbBuio8WJhoQWQYz8y5egORYMfu+RBFqeArTe5/z t6DuRlrDa9gN5HFDwHTCljgFKZcKYBNgnNZ8HMExHavEp9BpeHVtwXLiv5kDjsX6kz0J 7Iqofqu6d1V9IXcNUQh5DEsMChCHbX7oDk+Mxx9bX1pQmL2flGRgviZcVs3UEtxFC8Vd p0XA== 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=FlT9bceMrnqd5Of2Os7jjnrUYGxI9VfSsmXhVaMYahA=; b=LlJ8GQd7u99VWyBbFY23exUuSQuXuZSXtMlc0b6TOo3/Psl/I8f8PxDSoVdxHyC2sq Acsu9MUY40SMs7DadbkA+2e6Yz+r6YIzatq9T+N7XImj8mB1ARBtbRIsjg5yyvXFqqzF aliF5p+941GQRBrzcXg4Vaz5vt6v4+iu2gaciaY6E+qMQ/P5EZ1xRXadoo9YTftTHTKH klVfteonBY4dg7kI76sTtqM9kh/7M8LsvW3CYl4/vxvpv0U+sh4QW+XH/kDfC77KppCa QUQAHrK2W2a+ZQx+YuYnss6NYSq2C80pCsrTzdHIV6Bb448wciK3LDEy520p601dDx0d eNWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1cspSdNT; 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 ot6si12074034ejb.337.2021.03.15.11.22.09; Mon, 15 Mar 2021 11:22:31 -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=1cspSdNT; 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 S233018AbhCOOVr (ORCPT + 99 others); Mon, 15 Mar 2021 10:21:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbhCOOAF (ORCPT ); Mon, 15 Mar 2021 10:00:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 89D9164F58; Mon, 15 Mar 2021 13:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816788; bh=2kspGpLfUEBLgLAq1ZGvCCgsmP9b4EWHvwylP07uFQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1cspSdNTpwLoN3nVyqkXvL1HqPqc17rOnd87Og09NkI7gfFIToXZOvgzHSRRXmo7e 1MR59RRpwVViXD08hWpiP2MAl6p5lcNtSg3nE2T43vPos3Z37HSfyuHJnvaMZOn1dD uvgGq6swUUmNbks99ZNuC/A/EX4MtfXEVTfjAEQg= 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 4.19 068/120] mmc: core: Fix partition switch time for eMMC Date: Mon, 15 Mar 2021 14:56:59 +0100 Message-Id: <20210315135722.204924913@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -426,10 +426,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) @@ -619,6 +615,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],