[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFr95yFAbYyRGZMg6UpsUXYxm4c8J0ZRqw2ASdf+bF1edg@mail.gmail.com>
Date: Fri, 23 Apr 2021 10:14:28 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Avri Altman <avri.altman@....com>
Cc: linux-mmc <linux-mmc@...r.kernel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 2/2] mmc: block: Update ext_csd.cache_ctrl if it was written
On Tue, 20 Apr 2021 at 15:46, Avri Altman <avri.altman@....com> wrote:
>
> 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 <avri.altman@....com>
> Acked-by: Adrian Hunter <adrian.hunter@...el.com>
This can go separate from patch 1, so I have applied this for next and
by adding a stable tag to it.
Thanks and kind regards
Uffe
> ---
> 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
>
Powered by blists - more mailing lists