Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp196821pxb; Wed, 24 Feb 2021 23:20:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXeF1Wsf0QSbHsspDLbFbpbL1qgtSVkzFdq2Z0jcZ3CxcyfLcguNA/VUiM5r5Jc30+kZ09 X-Received: by 2002:a17:906:c0c9:: with SMTP id bn9mr1431789ejb.318.1614237619459; Wed, 24 Feb 2021 23:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614237619; cv=none; d=google.com; s=arc-20160816; b=LjfYu6yPs+CzXSWN3RsRY9CfP6dBzSWv3yir9RXFDI9NeMoRktAzFx8gGqyCPByqR3 EDDBGWDek+KlKpvGudiAHidDlGYFJee0IIIFmEuGBFxHCCDy9lUFjNwgK98dw5ARpvNY rDpB23VXSTujp/v20uz9WFuPnqGM/wkFYc6b352GExCabMDgfQpKCtDL9i5cp7g3yuxg 0cDnbcz2DokogdVdDfFB/hBu8FoXApeTExxlAGLG3BGNLVBptZ4uk7CUSz31uuJ7cOJQ uYkQQtqM5EWLxCqIGsXyFGtOnKDc/46HmbpgGI2lf+EqWhvjanWyCOCojkpuqa8Gpr4n uuTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:content-language :thread-index:content-transfer-encoding:mime-version:message-id:date :subject:in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=fJg0zRzkXEQMUG5OalYDqSfSccHgkY0ApL62phtZOXw=; b=f976o3Sb9zdVBTLSvef0fw/CuBCSaIAkkO/CZLD60s+sSCGarPXp7cqODiRn5ulEQQ iQkm5yoVTGLE4qGrBFGg0fIBE2JNTpcHdeFlEbePnLGpvEQYb59wXAKRWVLyF/sbWcbr rmQ13mHXWLqUiSAfav42GccawY/EVtk/Q7zfWC5nx31ewuQKxQvpb7sojFo7FUctdxZm IOphs8pMHtio3rmmpOhksQqLVUoKaCP2/jEjYoWP2yOFUc3T9fSck8KXw1eTodO/BgBm R6pBCjNg9Rb7du8OrYoYqepNFWCN07YA2DR6jbSGw2DTXDuKhCKpCMd4HmepwR7ZJMIi aqOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qAMMJwvm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kf17si2911441ejc.308.2021.02.24.23.19.56; Wed, 24 Feb 2021 23:20:19 -0800 (PST) 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=pass header.i=@samsung.com header.s=mail20170921 header.b=qAMMJwvm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232161AbhBYHS1 (ORCPT + 99 others); Thu, 25 Feb 2021 02:18:27 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:48031 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbhBYHSY (ORCPT ); Thu, 25 Feb 2021 02:18:24 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210225071739epoutp035fc140f81c116baf31e2a8af956c31b1~m7GrGmjOo2532125321epoutp03a for ; Thu, 25 Feb 2021 07:17:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210225071739epoutp035fc140f81c116baf31e2a8af956c31b1~m7GrGmjOo2532125321epoutp03a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1614237459; bh=fJg0zRzkXEQMUG5OalYDqSfSccHgkY0ApL62phtZOXw=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=qAMMJwvm0KbFxsoSRUjKv51r7gqhHDHF1URnD8Gwr20pmYXpVdEuBN4ETrhs5Y64K VoMZ93N6mmIr/SCkCt6g0ffy32EtIhk+2bJbGBQExGwEeLMwelzBkBjmTCnb1Pcn0i SMjMziRH2PhpQCj8ZpimWlQf5XWcLrzaILMRjK/M= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20210225071739epcas1p397c5d19066a6b70c60d586e40d7b9b4a~m7GqeigaH2786727867epcas1p3N; Thu, 25 Feb 2021 07:17:39 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.162]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4DmPJ20l6qz4x9Q9; Thu, 25 Feb 2021 07:17:38 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 89.C6.09577.11F47306; Thu, 25 Feb 2021 16:17:38 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20210225071737epcas1p3c94d78490b86a86a21840a3105316ed7~m7Gox3XGo2981929819epcas1p3R; Thu, 25 Feb 2021 07:17:37 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210225071737epsmtrp2a9d45efbd7c991a5cb92eb4f5041a648~m7GoxAmTI1199311993epsmtrp2N; Thu, 25 Feb 2021 07:17:37 +0000 (GMT) X-AuditID: b6c32a39-bfdff70000002569-e8-60374f11ba76 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 83.7A.08745.11F47306; Thu, 25 Feb 2021 16:17:37 +0900 (KST) Received: from sh043lee03 (unknown [10.253.101.72]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210225071737epsmtip283c5fbfe7937581864204a1a036a9f96~m7Gof6s5Q2589525895epsmtip2b; Thu, 25 Feb 2021 07:17:36 +0000 (GMT) From: =?utf-8?B?7J207Iq57Z2s?= To: , , , , , Cc: , , , , , , , In-Reply-To: <20210222083156.19158-1-sh043.lee@samsung.com> Subject: RE: [PATCH] mmc: core: set read only with permanent write protect Date: Thu, 25 Feb 2021 16:17:36 +0900 Message-ID: <000001d70b46$4b55a800$e200f800$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQLkAIFN/NEy3Z1t/BSdwJSVZvCFVQKLtnjLqDolyjA= Content-Language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIJsWRmVeSWpSXmKPExsWy7bCmvq6Qv3mCwbxDjBYzTrWxWuy7dpLd 4tff9ewWe2bfZbbo2DqZyWLH8zPsFrv+NjNZXN41h83iyP9+RosFe06zWVw7c4LVYvXrfewW x9eGW2y+9I3Fgc/j8dyN7B6bVnWyedy5tofNo2/LKkaPz5vkPLauWcwcwBaVY5ORmpiSWqSQ mpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6DrlpkDdK2SQlliTilQKCCxuFhJ 386mKL+0JFUhI7+4xFYptSAlp8DQoECvODG3uDQvXS85P9fK0MDAyBSoMiEnY3HDXaaCl4IV r6d+ZG5gPMzXxcjBISFgIvHlP38XIxeHkMAORom/u26zQjifGCXu3boI5XxmlLj/qI+9i5ET rOPx3wtMEIldjBI7LsxkBkkICbxglGi9rg0ylk3ATOL5nSCQGhGB+YwSb+ffYQdxmAVuMUps ar8HNolTwFqi79pZJhBbWMBLYsG0LhYQm0VAVWLqyrdgNbwClh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5G DiBbWOLw4WKIkmeMEtueMIKE2QTMJJ7fCQIJiwgsZZTo2hraxcjFwSzwiFHi96IZLCCOkEAP o8T8T3sZQao4Bawl+q6dBdslLOAlsWBaFwuIzSKgKjF15VuwvbwClhIfp71lg7AFJU7OfAJW wyygLfH05lMoW15i+9s5zBB3Kkj8fLqMFeIKK4lP9w8xQdSISMzubGOewCg8C8moWUhGzUIy ahaSlgWMLKsYJVMLinPTc4sNC4zyUsv1ihNzi0vz0vWS83M3MYIjU0trB+OeVR/0DjEycTAe YpTgYFYS4d38zzRBiDclsbIqtSg/vqg0J7X4EKM0B4uSOO+FrpPxQgLpiSWp2ampBalFMFkm Dk6pBqbYedmOKm8/L5X12n7spcGrBXOWfFyav7BGLDV5OePLnFml+/cGGuvlTZwmf0nxVeXe r3o35jxcuefT5NnrPzOwH7QM2m7Q4yVzYIvj011cQldLRNyVpldWy4lNnL69MiZl0seNh60X CYSwf3J/cmjVttMha0TtGzfvrOd/d/LE4yM7K//eWb999779T2bElX2dvN0jLXnaH+b36utu xpk9qJMyf3R+xqt/nTomPx8XBwaFPU96MbFI+fzcFXcOHpvNp3zmQ3yOhaPUNeXD39Wscgsr lz7X1WF87hX5KaYmPbeNRVd218uel9dVd+7kZvq3eulvpQvRQrwFLjxPxbo+Xel7YH4lIOj9 CXG5nAbXOUosxRmJhlrMRcWJAC0DaGw7AwAA X-CMS-MailID: 20210225071737epcas1p3c94d78490b86a86a21840a3105316ed7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210222081517epcas1p37fef998684dc9eae0bcd2764a3f82fb1 References: <20210222083156.19158-1-sh043.lee@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Maintainer & commiters, Please review the patch for updating. I'm not sure if it's reviewed or not. As you know, there are lots of defect SD cards in the market. It's one of solution that reduces the system load. The CSD register shows that it's permanent write protected due to lifespan or internal problem. Once host sets read only field, the upper layer doesn't issue unnecessary write operation in it. Thanks and regards, Seunghui Lee. > -----Original Message----- > From: Seunghui Lee > Sent: Monday, February 22, 2021 5:32 PM > To: ulf.hansson@linaro.org; pali@kernel.org; huyue2@yulong.com; > tiantao6@hisilicon.com; linux-mmc@vger.kernel.org; linux- > kernel@vger.kernel.org > Cc: grant.jung@samsung.com; jt77.jang@samsung.com; > dh0421.hwang@samsung.com; junwoo80.lee@samsung.com; jangsub.yi@samsung.com; > cw9316.lee@samsung.com; sh8267.baek@samsung.com; wkon.kim@samsung.com; > Seunghui Lee > Subject: [PATCH] mmc: core: set read only with permanent write protect > > 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 > --- > 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