Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3363946pxb; Tue, 20 Apr 2021 06:48:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkKPoqccoaP5IXgqsx3p/DqD0T/JF6QX3tUcstWEDdUq/UuPtoVOW73u0HbC9DAoRON3MW X-Received: by 2002:a17:902:6a87:b029:e6:6a3d:29e8 with SMTP id n7-20020a1709026a87b02900e66a3d29e8mr28177560plk.10.1618926495589; Tue, 20 Apr 2021 06:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618926495; cv=none; d=google.com; s=arc-20160816; b=TBskzWTQukUmwWINLhdSKOel6S96Acma6GipzYUXLCktq3YJeT0gqqOxfIKln1PrGu m42bAO19U9XY93C886tHlDcZAEuz51EtYz8ia6bQz+K9wocedFXONhnHkitGhN/P6nVR iDXa4ZLtOQxpSkae31RzKuChmDBXA6pANCe0IEA/YtkYsqaNT0DgO+VwlgQpO6WJkR00 ncIcGSTtzTf8I/fyP5IK63Lz16jyLRangkX0O99wsaJicMgsGaYiiGpPQ4Gvt0OqrjAw rn6sqVwZxxGxvGX5nL/36uFZzC32OhA1ZRTezP0rtvB5pHa4skbwpgNed8idui7J2miY cVNA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :wdcironportexception:ironport-sdr:ironport-sdr:ironport-sdr :dkim-signature; bh=uNNkb6i0bFwB/48hqWxsWtg1+BeY0VlfP6womDCmP9A=; b=fQnC5oj6dr+RhZdFz+fna203ZnTjmLfPiERIee+osi4c9qTSFdLpmI7r6fvF2RIMgM wMPKWHSBwx3SKmxFJ87vilJykpwESMzq89BeX6bK4+UL2nvRqi5yHEkJDMeCHNrPf2/O CcysRC9tnx/+YkfAFMlmD0SxMGmttIck+FUOYg7blZEc4fFuY5My3SbhRIKVE/XWcA0/ +BlaGH0ILreueujn2RqbBLd12gDwFE5qOdxWEVZ86S+GHAX0yifgEw1kbNbvCBGIh4f7 V3OqdE0j5KhyBEenkgY9yAWNV5Cgt22KQYFOs5BWLjBJIB8FKk4HVX2l1HH1nj1erHnH 9lQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=NeDEQcaI; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si25815379pgc.506.2021.04.20.06.48.02; Tue, 20 Apr 2021 06:48: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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=NeDEQcaI; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232666AbhDTNr3 (ORCPT + 99 others); Tue, 20 Apr 2021 09:47:29 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:53204 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbhDTNr3 (ORCPT ); Tue, 20 Apr 2021 09:47:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1618926418; x=1650462418; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ipml8iOydkUV2w1EzEnIa2R8H0R7xsUvGTaVaAgpxG8=; b=NeDEQcaIiBang4Nq59wPl5JsKK3lEfvSIPlO9BP7YQrVCZVD9O+myq7n /teWLxam+dTKDdpBdyIJYHZu1b8Mx+oU7r8i5MGP6MwyyOjHa3jau3Bm+ yop58lC5QPwm7D4aRDx8IVJzjvwEZ7QOxxt1QynMmKAwTE9R+eoYFFQ7j BFljqu/gHpAmEUZ2u5ulGRUfHYBRWYLaThZZdzWs+xXeaGpIasaL7upzf wD7+pR5tNhBopf6VThp8/aXtiCjjCx2RVeqyH1YHbVU8zEX7pGMk4ssVz n9wgn3/rWhdvtMc8gcJsXyTmIHFcuUldyi5rrbMbvC3PEh78G+UrDKd/f g==; IronPort-SDR: KBc8VeQWBVleVgW361+pD6t1gAHQmwa79VWMFxirsROckRR2GMrV/eaemFjjKjL8vMdlBAdLyQ +LotodBceEm8XXKTwtzKh715LZwo3uQy4y1VzVbADB9ERRt05Cr6ZW2RUo+mTGvQ8STJXXqwdU 7B8wMduT51yyH1K48lUnBkgugmcuejxjVM4WwiQmOsNX6oGWXuFtdhkL75TBj2bEGM0WZbF4VO qpaupayCYjHkjmGlIPTBpqJnt6/BbvsnB5LC+JkMaLZh97rFTxkmqaCY8VAWr1WJSFjMZBd5nW ZCk= X-IronPort-AV: E=Sophos;i="5.82,237,1613404800"; d="scan'208";a="164889879" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Apr 2021 21:46:57 +0800 IronPort-SDR: dZZCk0Zd0HfCnJykZY5Sj4sE50IkL8LfoQAUb9w4qzbfgUy9v4HB5I060Ybk4GZf5N+66NpXfz fJ1AmP2fTEO3jzoOxfGJq88Qis3zxLjLof47W3BQbqY6JD5sBBwY/qxM7/Dn/y4btuPH1UcjWb vLodl/yeWbcKtVM3525iQRvai9chqYD/Nc6zx+LQRJOODnHUGwLFsC/3fYedOh514zMz+9KtVF pYX72k6krCrKn86w7sDuMYB98riR6rfBjHbcEcCQvQV1l805mIEkw2fCBtcVMV/9BR49uBw7yz zGGtYcwXaOu3yiIMNXmtKRnU Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 06:27:37 -0700 IronPort-SDR: I/0onkIN50qRsxElpUknz1zAn5cHFyVbcY0cIz2vMw/8GTBrAStULyPV+X9r1e0HzK+xpVdk2R DuCmAWievpW/0UpmLbuAvGLmie6IcaZAk9iYqLjXq1Ulb7DWl1Ib5FtR62UwJff1FbEUKifRFl yQ/6/7bpATuUCl0mAK2UzuZEJjgdsHhm3Zzo2dmCeVE6n7AmHxVI30Ark99Rp6UWT1WK2NtFuq SC4k0H+0CIuJxqx8fEdQKTfQBVzYzWeOwxTN9pfwoj5a/tTVnfs2sjL9z6WXB1O3PRJfIypYAS YAU= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Apr 2021 06:46:57 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org, Adrian Hunter Cc: linux-kernel@vger.kernel.org, Avri Altman Subject: [PATCH v4 2/2] mmc: block: Update ext_csd.cache_ctrl if it was written Date: Tue, 20 Apr 2021 16:46:41 +0300 Message-Id: <20210420134641.57343-3-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420134641.57343-1-avri.altman@wdc.com> References: <20210420134641.57343-1-avri.altman@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cache function can be turned ON and OFF by writing to the CACHE_CTRL byte (EXT_CSD byte [33]). However, card->ext_csd.cache_ctrl is only set on init if cache size > 0. Fix that by explicitly setting ext_csd.cache_ctrl on ext-csd write. Signed-off-by: Avri Altman Acked-by: Adrian Hunter --- drivers/mmc/core/block.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 24e1ecbdd510..7e70f11e85e2 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -572,6 +572,18 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, main_md->part_curr = value & EXT_CSD_PART_CONFIG_ACC_MASK; } + /* + * Make sure to update CACHE_CTRL in case it was changed. The cache + * will get turned back on if the card is re-initialized, e.g. + * suspend/resume or hw reset in recovery. + */ + if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_CACHE_CTRL) && + (cmd.opcode == MMC_SWITCH)) { + u8 value = MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg) & 1; + + card->ext_csd.cache_ctrl = value; + } + /* * According to the SD specs, some commands require a delay after * issuing the command. -- 2.25.1