Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3445284pxf; Mon, 22 Mar 2021 06:42:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX3CchOkxTy953KKt9J+pMdfrx1P84Pmi98ufK7HEMhxBYYWA+hQhqpp3jCzGJ3GBxSpaF X-Received: by 2002:a17:906:fc1c:: with SMTP id ov28mr19372024ejb.342.1616420527787; Mon, 22 Mar 2021 06:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616420527; cv=none; d=google.com; s=arc-20160816; b=zFdXSl+POzyv5wFLv7MUFqXhdi9y/VzJHqNW9WrEQ98cuQMB2g7cZDqfkE6A638fMh nQNX+V6m54Jsrm7dcXbKnvCm8JD/hcS72JRDYQlxFKubKB+/r/qfKlWkdkkcyr8WmwwY iejPPWAjsgY7O5I2663SHN7koo0dseA4a56kPoBg27GIyRCqj69gt2ISbwJIUMWCWsH3 lYcFargZKqMrWbmWgkLWEIGU+FscsRjkBnm78oryHwg5RZx/SnIMcYFzpt/QHUIERojq Ez/Qv89SJuQCW8EYnI18n3V9zun+W+oW26slnjz9xt7W3N6jNL9Td5H1sk1ZtqmJryYy hOdA== 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=JmUMkySFwd/guvHwDV3vcF8aoVcHZQM+H4Da9byPWhI=; b=efLPVU1lKPF/tE5nGbHm46vjKEHKrvUme+6Gf4/SJDycByhK3NkMDGhD83yH5qO23y pH49OYGoGefveavSDSZLL2tjg9WRrrWLO6twrP9EOM4bP+Wrx9i1HMzCYrkICek+dJoW +TwRQwBO/W/jmPtNVKY8j1yrPArH8/zzIAd5GNTafEAer7OraQwT9dx88N/GnZrbTQsU C8+8o0H/KlEbInSc5UxgWoUS81WYlFXe/5C5RGOYOVsHbEjFc0os96HqCwJDY1zBnns4 ow1u9/tru5I4BBjlxJKuBjNYi949f/zAPgdQObBTsug/qL/Xt+UN6QEtgtg2npy9zpAU ycBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=KnLTrQZt; 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 c9si11572830ejb.466.2021.03.22.06.41.43; Mon, 22 Mar 2021 06:42:07 -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=KnLTrQZt; 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 S231151AbhCVNiO (ORCPT + 99 others); Mon, 22 Mar 2021 09:38:14 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:57176 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbhCVNhy (ORCPT ); Mon, 22 Mar 2021 09:37:54 -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=1616420274; x=1647956274; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t/DXKWpQXaxw6CxRe4hbgo5MFUB8rwUKH45I5giLmoQ=; b=KnLTrQZt46owMQLbBPqV/FalL+GOznAA0n9HA0k0pZ/6CxjfPhO9DEJr 8xwFy8MDZ57uOq3p0pbjKgoA4O3rlofyg7ZXGlNGC5AWO3P/USsnbsB7/ osdoi8/uWLEzfBcafhiacC3CWStZMBpMASm3aNo60RchtV9wH5Bu/3mUi TwjaFBxvuzL87IijJ8nnY0v8OXs2AfWqfWDMHpV5q76W/ReOx0ztinKix U8ZOD3VaJcCOXGl2grXdw1uMk3vdf+EPn0y12MPLQwEfu8qzZlmljPs6U ukUrTzPEHKxB/d18q34aBvN6blUKPE2NtFjTgUSDZw9xCYf3R/9wTUUI0 A==; IronPort-SDR: 1SJ3r80m6Q6joNykuzlhGds8qEASG5MJX+SbNebsrv/CxSd5IFetg/NBdp9N02bsNd1jm1qkvt b2FNFBCkXM7PQYyZuZxuVjiXmgg7TpE7xzZy6o7SNXN11QG2TBRNXEZL3HF47lH/gr00LDlEa5 ESwngzcANQq/cOA6GcgsaycCIAfm02QJnV7i7y7E8sKRyxEhlMsgrYu92VCx3q7h6JYLBXbSpy oNGSB4ppDyHAmwgs01rvLibAH9mECZHG+LVMywoAu0Vt/prfgPwsG0oC7toNBJua8w4TlbqW+4 RuE= X-IronPort-AV: E=Sophos;i="5.81,269,1610380800"; d="scan'208";a="167184356" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 22 Mar 2021 21:37:52 +0800 IronPort-SDR: rs9E5qquxFNu3a0Go1bQrYDBAi9NuZ+Gjmi/mXdoC86CG1AMrq0Zb0/QKX5f5fILdRiSYdeu/q g9IgoYjsy5QoFMv+X0ZSIZmUXsNAWrq3O9hN9o6tvIcqArQhnJyQsRPfIE1SAuMtvXs5rE/0ao VIuWpKEBM1p8EacimgQ3ZRIUrjsKlXQGrOXoSBN9g+uJ2aspipd9lrGMJCw6GiH2vFt+sdFKw3 XfGLf7TZbg3h/ClZbFvtMsHeMOZzjW+fQJ5ySNkhhhs84ITZfVb5rRj7d2yD8B6zNbFNkN20XA +cjGDiFyR/qf/WTQsyRPX8aM Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2021 06:18:21 -0700 IronPort-SDR: PxW9nuiZ7KDBZF2jVI2d0GeIeoWRVIkygl9u/a2SiEFR5zLIQdbeOV6vN3eHVZgCjRs6KTczOJ 1/wSisd9udjYsjBnfgYRoXbUmB4LQAQKJ9E/po0yzDamEJV68viXxNciFUZsH5f1p4EQjl2Ym0 p4wDQDmA3huDnLebGOeBvKd5Cny7qtLloxRN5jtQcy5RDIvnxRelqyGW2Qa7YeP4iuUJyxlphm VcndSU3MD/iAl9HAQJYgrZ7fq17jV8DTzh6+s3w0yHvIjzrhvPJckkXNuUYCgkpgcuGgZ+xqgt P1U= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip02.wdc.com with ESMTP; 22 Mar 2021 06:37:47 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Adrian Hunter , linux-kernel@vger.kernel.org, Avri Altman Subject: [PATCH 2/2] mmc: block: Update ext_csd.cache_ctrl if it was written Date: Mon, 22 Mar 2021 15:36:45 +0200 Message-Id: <20210322133645.4901-3-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322133645.4901-1-avri.altman@wdc.com> References: <20210322133645.4901-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 --- drivers/mmc/core/block.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index a93c66aa91db..4c816d001ac1 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -571,6 +571,14 @@ 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 */ + 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