Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3063950pxb; Mon, 19 Apr 2021 22:58:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbPbyGTwF33jx1PqtSo5OoSywldm9aNhraRuvkSvfHwfPR+ybfyDERw0kvlpLKbxlTrS4S X-Received: by 2002:a17:906:88b:: with SMTP id n11mr24865304eje.26.1618898290946; Mon, 19 Apr 2021 22:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618898290; cv=none; d=google.com; s=arc-20160816; b=NXIPTvBF99bU0IOoPG0YVu0ai09cm/MNA6WqGl+531/gicUChcRTJcULWuPGoDv2Pv O3ciRqHTr8EzEURcg1nTj4xsUytT2s6a7FNZ5TQqn7ky8rRnv6K5DpEu1vbe9zXfWLXk mvOINBTqronIIGs03XMmxTG9Yuu9wrNstnvNArz7Bpk8sS6vvjFIb7YRHO4cJTrYAUOA 4yiqAcyAAlYZg6RSDfuiYHafFL+zlDk9Lp1EN6qC02VRWk0FtjAsUW/3hnh6U2XcCNtB 124mciiwPAPR8xe2HKdf81SrbFNaa48hKamqs1rPObSTJpaL+cwhZes8EFb8h9PzJ4EJ yQwA== 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=ne4O4TBvoUM+CLhtSI+qVENjhJclpLm4Hwe8c1uloyg=; b=sgbnnop+5/q4kcvZ4kNVpyYiz65vn4BRLSr3Av+4R5QCB7FQ+jqdIWlyqK73fBRMtB 9eB6jqzAwUDIhxuU0Z+hz5NhVZ8SFyqwQs6mHCVwrAPHX/HVgmHH8BEeIS4xeiu7jnPd EhwoBLCW2OYj+AQu5uWSGM3FuAjIrhLzBei56Tq3CZSrYDoQUY4E84XK0hIfyTNodEBO rnHk9uL9KbDFBetTKLDUdI/DEM1DYEggXG4F/yhHYsHoOuqzjl3BUO2+HjHpe9YJPium DS3bPIr15yowU0UYUokzLd3Y1kjKTkgmSojDqPlp52kG6xzdbG4eiGIO8rcPou4jAve0 oQJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=C1JDFUbM; 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 lf11si15023773ejc.313.2021.04.19.22.57.47; Mon, 19 Apr 2021 22:58:10 -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=C1JDFUbM; 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 S230037AbhDTFye (ORCPT + 99 others); Tue, 20 Apr 2021 01:54:34 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:50509 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbhDTFyc (ORCPT ); Tue, 20 Apr 2021 01:54:32 -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=1618898042; x=1650434042; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZvCgV9eVozx0O2riMmwZl8ZdBJ84xKKq5cbsop8x1Ws=; b=C1JDFUbMafufuOcPaHUVdGRsnbNMEobYf5MPZozGQCsroKwrugGR4VK0 VE0LZDBeOrNNTQYjvN9k0PFx32qIGZaOThiqHoxlReKUGLsQVdpJfHZgc NufGOpIPvsaDXDhlPNZeZHqD3cf7e4Je7h4YHovTVshV/P+ka9GgpkoqG HHxAWk1oyqDZHCGN4KI+UL5DILmCys6IGmN1GXRq4je8VaeTRGNlkI256 N9WckJkfJRHtqB2l2R/u0OiQwXacMb+H9fOcBIQMcDqpc4S90IQmoLD1O f8XMTnRN0QKEVQT8H9S+RVuEuQQfYNcKZQgBOLX/skXbbpIcCkPZJkbFR w==; IronPort-SDR: rvOgPxmw97kUcWLv//lQt5Wz4qtQg2DP1WCNflEX9s5dfbjJxNnQ113nmF0DjNZAc1OD813msJ 8eWMhzkbLpyR3cbiFr/5AfdmVbWwWTppPjV9KNV5R1vKSNgh0KlBKayIDNAVj3Moas/46AzITB qonUOd34Ls22nLrt4/TSxIswoxYfupwuxGxAQVcyl9UZ+ZpVvCX3vYbU4qoVUJ3QbRS7Nb16dg l9Xn4Q1bazmvNFnCEsr08UTDpcQrnvr3iySbi0DWosdr0k2ALDxhNthRHBUELGTZWrmxHv/BUy KTw= X-IronPort-AV: E=Sophos;i="5.82,236,1613404800"; d="scan'208";a="166063859" 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 13:54:01 +0800 IronPort-SDR: TC1piOpen1fkFj8UXC2tZt/YKuA1/szdPzK9Vw9ZKxP7YrYJE3glnF2f48VlKoL/x5mSeO+wuZ j19Env1vpS52FW2A+n2Ag8Ah792QEWTogSXNFZYFmtMFONajxjguGvr0/W0kF8N/jwAiJ7sCxC oE552T3z1sb1aFLRmURtev3nsD+nArXgqj/MRely//Ri+l/YYde6cbuHOutx+1MKmh13luh498 4WBQRQazODfllOeYS/Nwk4GBgOY49YRC3pN+1Dwe92HwmBNfKy5P5lUHlL61Km4Phx0e6AcXgv 1F4MgREPp6vY7AMM5j6WNG9R 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; 19 Apr 2021 22:34:41 -0700 IronPort-SDR: brC9mzmUaNmjcemcaXfMYkx3U9LhKqXystImI44IstD23P/GMQk6tROmxcUCtRQyuhA7aSf1wX a0Lq0rEUs2763lrxvgJJT5d5p9EjLR4Gt1zwG1sOCJHhchmtdsGgkeaLYmZv9366wcsoYdm6/D lWtJBaW9PCo/Gqa1/GEb2tOflz3OyuSnGTTHGjqQg95qsgoLgvOrjXwLnBVca2UTa2YdEVz4lh o0+FONwCXMCuobyJ/8rLnpD0lQ2YnXECCaqcsATT7G33R0NwbSpQoEFCG9qlwqt/TfeaK9frcW 7yk= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Apr 2021 22:53:59 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org, Adrian Hunter Cc: linux-kernel@vger.kernel.org, Avri Altman Subject: [PATCH v3 2/2] mmc: block: Update ext_csd.cache_ctrl if it was written Date: Tue, 20 Apr 2021 08:53:06 +0300 Message-Id: <20210420055306.4858-3-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420055306.4858-1-avri.altman@wdc.com> References: <20210420055306.4858-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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 5b6501fc9fb7..8b07ed5e08de 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