[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFqtB3WLD5A+5SesyOArbbVaZROdeu23FwFDy667h0M6eQ@mail.gmail.com>
Date: Tue, 2 Mar 2021 11:39:04 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Seunghui Lee <sh043.lee@...sung.com>
Cc: Pali Rohár <pali@...nel.org>,
Yue Hu <huyue2@...ong.com>, Tian Tao <tiantao6@...ilicon.com>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
grant.jung@...sung.com, jt77.jang@...sung.com,
DooHyun Hwang <dh0421.hwang@...sung.com>,
junwoo80.lee@...sung.com, jangsub.yi@...sung.com,
Chanwoo Lee <cw9316.lee@...sung.com>, sh8267.baek@...sung.com,
wkon.kim@...sung.com
Subject: Re: [PATCH] mmc: core: set read only with permanent write protect
On Mon, 22 Feb 2021 at 09:15, Seunghui Lee <sh043.lee@...sung.com> wrote:
>
> Some of SD cards sets permanent write protection
> due to lifespan or internal problem.
> Host can find out it's protected permanantly during initialization.
> Once set read only during initialization,
> it could prevent unnecessary write operation in it.
>
> Signed-off-by: Seunghui Lee <sh043.lee@...sung.com>
Applied for next and by adding a stable tag, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/core/sd.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 6fa51a6ed058..2c48d6504101 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -135,6 +135,9 @@ static int mmc_decode_csd(struct mmc_card *card)
> csd->erase_size = UNSTUFF_BITS(resp, 39, 7) + 1;
> csd->erase_size <<= csd->write_blkbits - 9;
> }
> +
> + if (UNSTUFF_BITS(resp, 13, 1))
> + mmc_card_set_readonly(card);
> break;
> case 1:
> /*
> @@ -169,6 +172,9 @@ static int mmc_decode_csd(struct mmc_card *card)
> csd->write_blkbits = 9;
> csd->write_partial = 0;
> csd->erase_size = 1;
> +
> + if (UNSTUFF_BITS(resp, 13, 1))
> + mmc_card_set_readonly(card);
> break;
> default:
> pr_err("%s: unrecognised CSD structure version %d\n",
> --
> 2.29.0
>
Powered by blists - more mailing lists