diff mbox

[v3] mmc: card: Skip secure option for MoviNAND.

Message ID 5029F8F6.1080207@samsung.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

IAN CHEN Aug. 14, 2012, 7:06 a.m. UTC
For several MoviNAND, there are some known issue with secure option.
For these specific MoviNAND device, we skip secure option.

You could refer this discussion in XDA developers.
http://forum.xda-developers.com/showthread.php?t=1644364
https://plus.google.com/111398485184813224730/posts/21pTYfTsCkB#111398485184813224730/posts/21pTYfTsCkB

Signed-off-by: Ian Chen <ian.cy.chen@samsung.com>
---
 drivers/mmc/card/block.c |   24 +++++++++++++++++++++++-
 include/linux/mmc/card.h |    1 +
 2 files changed, 24 insertions(+), 1 deletions(-)

 						/* byte mode */
 	unsigned int    poweroff_notify_state;	/* eMMC4.5 notify feature */
 #define MMC_NO_POWER_NOTIFICATION	0

Comments

Namjae Jeon Aug. 14, 2012, 7:23 a.m. UTC | #1
2012/8/14, IAN CHEN <ian.cy.chen@samsung.com>:
> For several MoviNAND, there are some known issue with secure option.
> For these specific MoviNAND device, we skip secure option.
>
> You could refer this discussion in XDA developers.
> http://forum.xda-developers.com/showthread.php?t=1644364
> https://plus.google.com/111398485184813224730/posts/21pTYfTsCkB#111398485184813224730/posts/21pTYfTsCkB
>
> Signed-off-by: Ian Chen <ian.cy.chen@samsung.com>
> ---
Looks good.
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Aug. 14, 2012, 8:06 a.m. UTC | #2
On Tue, Aug 14, 2012 at 9:06 AM, IAN CHEN <ian.cy.chen@samsung.com> wrote:

> +#define MMC_QUIRK_SECURE_MODE_BROKEN (1<<10)   /* Skip secure for
> erase/trim */

OK this will work and sorry for being picky, but we are working with RPMB
support and that's some other "secure mode" so to avoid any
misuderstandings it's better to name the flag like I proposed,
MMC_QUIRK_SEC_ERASE_TRIM_BROKEN

I won't die if this goes in though :-)

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jaehoon Chung Aug. 14, 2012, 7:07 p.m. UTC | #3
Looks good to me
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

2012/8/14 IAN CHEN <ian.cy.chen@samsung.com>:
> For several MoviNAND, there are some known issue with secure option.
> For these specific MoviNAND device, we skip secure option.
>
> You could refer this discussion in XDA developers.
> http://forum.xda-developers.com/showthread.php?t=1644364
> https://plus.google.com/111398485184813224730/posts/21pTYfTsCkB#111398485184813224730/posts/21pTYfTsCkB
>
> Signed-off-by: Ian Chen <ian.cy.chen@samsung.com>
> ---
>  drivers/mmc/card/block.c |   24 +++++++++++++++++++++++-
>  include/linux/mmc/card.h |    1 +
>  2 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index f1c84de..8d2de7e 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1411,7 +1411,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq,
> struct request *req)
>                 /* complete ongoing async transfer before issuing discard */
>                 if (card->host->areq)
>                         mmc_blk_issue_rw_rq(mq, NULL);
> -               if (req->cmd_flags & REQ_SECURE)
> +               if (req->cmd_flags & REQ_SECURE &&
> +                       !(card->quirks & MMC_QUIRK_SECURE_MODE_BROKEN))
>                         ret = mmc_blk_issue_secdiscard_rq(mq, req);
>                 else
>                         ret = mmc_blk_issue_discard_rq(mq, req);
> @@ -1716,6 +1717,7 @@ force_ro_fail:
>  #define CID_MANFID_SANDISK     0x2
>  #define CID_MANFID_TOSHIBA     0x11
>  #define CID_MANFID_MICRON      0x13
> +#define CID_MANFID_SAMSUNG     0x15
>
>  static const struct mmc_fixup blk_fixups[] =
>  {
> @@ -1752,6 +1754,26 @@ static const struct mmc_fixup blk_fixups[] =
>         MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
>                   MMC_QUIRK_LONG_READ_TIME),
>
> +       /*
> +        * Some issue about secure erase/secure trim for Samsung MoviNAND
> +        */
> +       MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +       MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
> +                 MMC_QUIRK_SECURE_MODE_BROKEN),
> +
>         END_FIXUP
>  };
>
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index 111aca5..e7ec522 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -239,6 +239,7 @@ struct mmc_card {
>  #define MMC_QUIRK_BLK_NO_CMD23 (1<<7)          /* Avoid CMD23 for regular
> multiblock */
>  #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8)  /* Avoid sending 512
> bytes in */
>  #define MMC_QUIRK_LONG_READ_TIME (1<<9)                /* Data read time > CSD says */
> +#define MMC_QUIRK_SECURE_MODE_BROKEN (1<<10)   /* Skip secure for
> erase/trim */
>                                                 /* byte mode */
>         unsigned int    poweroff_notify_state;  /* eMMC4.5 notify feature */
>  #define MMC_NO_POWER_NOTIFICATION      0
> --
> 1.7.0.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
IAN CHEN Aug. 16, 2012, 4:09 a.m. UTC | #4
MMC_QUIRK_SEC_ERASE_TRIM_BROKEN seems quite clear but I might not use "SEC"
due to it could be Samsung Electronics Corporation.
So, how about MMC_QUIRK_SECDISCARD_BROKEN which was used in
mmc_blk_issue_secdiscard_rq() naming, the function we skip.
Or, MMC_QUIRK_SECERASE_SECTRIM_BROKEN?

Regards,
Ian
-----Original Message-----
From: Linus Walleij [mailto:linus.walleij@linaro.org] 
Sent: Tuesday, August 14, 2012 5:07 PM
To: IAN CHEN
Cc: cjb@laptop.org; linkinjeon@gmail.com; adrian.hunter@intel.com;
subhashj@codeaurora.org; linux-mmc@vger.kernel.org;
linux-kernel@vger.kernel.org; d.j.shin@samsung.com;
jongtae22.kim@samsung.com; kyungmin.park@samsung.com; jh80.chung@samsung.com
Subject: Re: [PATCH v3] mmc: card: Skip secure option for MoviNAND.

On Tue, Aug 14, 2012 at 9:06 AM, IAN CHEN <ian.cy.chen@samsung.com> wrote:

> +#define MMC_QUIRK_SECURE_MODE_BROKEN (1<<10)   /* Skip secure for
> erase/trim */

OK this will work and sorry for being picky, but we are working with RPMB
support and that's some other "secure mode" so to avoid any
misuderstandings it's better to name the flag like I proposed,
MMC_QUIRK_SEC_ERASE_TRIM_BROKEN

I won't die if this goes in though :-)

Yours,
Linus Walleij

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jaehoon Chung Aug. 16, 2012, 4:14 a.m. UTC | #5
On 08/16/2012 01:09 PM, IAN CHEN wrote:
> MMC_QUIRK_SEC_ERASE_TRIM_BROKEN seems quite clear but I might not use "SEC"
> due to it could be Samsung Electronics Corporation.
I didn't think so.
MMC developers didn't think that SEC means Samsung Electronics Corporation.
Already we used the flags with "_SEC_"
It's no problem.

Best Regards,
Jaehoon Chung
> So, how about MMC_QUIRK_SECDISCARD_BROKEN which was used in
> mmc_blk_issue_secdiscard_rq() naming, the function we skip.
> Or, MMC_QUIRK_SECERASE_SECTRIM_BROKEN?
> 
> Regards,
> Ian
> -----Original Message-----
> From: Linus Walleij [mailto:linus.walleij@linaro.org] 
> Sent: Tuesday, August 14, 2012 5:07 PM
> To: IAN CHEN
> Cc: cjb@laptop.org; linkinjeon@gmail.com; adrian.hunter@intel.com;
> subhashj@codeaurora.org; linux-mmc@vger.kernel.org;
> linux-kernel@vger.kernel.org; d.j.shin@samsung.com;
> jongtae22.kim@samsung.com; kyungmin.park@samsung.com; jh80.chung@samsung.com
> Subject: Re: [PATCH v3] mmc: card: Skip secure option for MoviNAND.
> 
> On Tue, Aug 14, 2012 at 9:06 AM, IAN CHEN <ian.cy.chen@samsung.com> wrote:
> 
>> +#define MMC_QUIRK_SECURE_MODE_BROKEN (1<<10)   /* Skip secure for
>> erase/trim */
> 
> OK this will work and sorry for being picky, but we are working with RPMB
> support and that's some other "secure mode" so to avoid any
> misuderstandings it's better to name the flag like I proposed,
> MMC_QUIRK_SEC_ERASE_TRIM_BROKEN
> 
> I won't die if this goes in though :-)
> 
> Yours,
> Linus Walleij
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index f1c84de..8d2de7e 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1411,7 +1411,8 @@  static int mmc_blk_issue_rq(struct mmc_queue *mq,
struct request *req)
 		/* complete ongoing async transfer before issuing discard */
 		if (card->host->areq)
 			mmc_blk_issue_rw_rq(mq, NULL);
-		if (req->cmd_flags & REQ_SECURE)
+		if (req->cmd_flags & REQ_SECURE &&
+			!(card->quirks & MMC_QUIRK_SECURE_MODE_BROKEN))
 			ret = mmc_blk_issue_secdiscard_rq(mq, req);
 		else
 			ret = mmc_blk_issue_discard_rq(mq, req);
@@ -1716,6 +1717,7 @@  force_ro_fail:
 #define CID_MANFID_SANDISK	0x2
 #define CID_MANFID_TOSHIBA	0x11
 #define CID_MANFID_MICRON	0x13
+#define CID_MANFID_SAMSUNG	0x15

 static const struct mmc_fixup blk_fixups[] =
 {
@@ -1752,6 +1754,26 @@  static const struct mmc_fixup blk_fixups[] =
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
 		  MMC_QUIRK_LONG_READ_TIME),

+	/*
+	 * Some issue about secure erase/secure trim for Samsung MoviNAND
+	 */
+	MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+	MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SECURE_MODE_BROKEN),
+
 	END_FIXUP
 };

diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 111aca5..e7ec522 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -239,6 +239,7 @@  struct mmc_card {
 #define MMC_QUIRK_BLK_NO_CMD23	(1<<7)		/* Avoid CMD23 for regular
multiblock */
 #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8)	/* Avoid sending 512
bytes in */
 #define MMC_QUIRK_LONG_READ_TIME (1<<9)		/* Data read time > CSD says */
+#define MMC_QUIRK_SECURE_MODE_BROKEN (1<<10)	/* Skip secure for
erase/trim */