* + mmc-recognize-csd-structure.patch added to -mm tree
@ 2010-06-04 22:36 akpm
2010-06-04 23:12 ` Chris Ball
2010-06-07 7:27 ` Adrian Hunter
0 siblings, 2 replies; 4+ messages in thread
From: akpm @ 2010-06-04 22:36 UTC (permalink / raw)
To: mm-commits; +Cc: kmpark, adrian.hunter, kyungmin.park, linux-mmc
The patch titled
mmc: recognize CSD structure
has been added to the -mm tree. Its filename is
mmc-recognize-csd-structure.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: mmc: recognize CSD structure
From: Kyungmin Park <kmpark@infradead.org>
The eMMC spec 4.4 and 4.3 + additional feature chips has CSD structure
version 3 and version 3 have to check the CSD_STRUCTURE byte in the
EXT_CSD register.
Also fix EXT_CSD revision message.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/mmc/core/mmc.c | 26 +++++++++++++++++++-------
include/linux/mmc/card.h | 1 +
include/linux/mmc/mmc.h | 1 +
3 files changed, 21 insertions(+), 7 deletions(-)
diff -puN drivers/mmc/core/mmc.c~mmc-recognize-csd-structure drivers/mmc/core/mmc.c
--- a/drivers/mmc/core/mmc.c~mmc-recognize-csd-structure
+++ a/drivers/mmc/core/mmc.c
@@ -114,17 +114,18 @@ static int mmc_decode_cid(struct mmc_car
static int mmc_decode_csd(struct mmc_card *card)
{
struct mmc_csd *csd = &card->csd;
- unsigned int e, m, csd_struct;
+ unsigned int e, m;
u32 *resp = card->raw_csd;
/*
* We only understand CSD structure v1.1 and v1.2.
* v1.2 has extra information in bits 15, 11 and 10.
+ * also support the for eMMC v4.4 & v4.41.
*/
- csd_struct = UNSTUFF_BITS(resp, 126, 2);
- if (csd_struct != 1 && csd_struct != 2) {
+ csd->structure = UNSTUFF_BITS(resp, 126, 2);
+ if (csd->structure == 0) {
printk(KERN_ERR "%s: unrecognised CSD structure version %d\n",
- mmc_hostname(card->host), csd_struct);
+ mmc_hostname(card->host), csd->structure);
return -EINVAL;
}
@@ -207,11 +208,22 @@ static int mmc_read_ext_csd(struct mmc_c
goto out;
}
+ /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
+ if (card->csd.structure == 3) {
+ int ext_csd_struct = ext_csd[EXT_CSD_STRUCTURE];
+ if (ext_csd_struct > 2) {
+ printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
+ "version %d\n", mmc_hostname(card->host),
+ ext_csd_struct);
+ err = -EINVAL;
+ goto out;
+ }
+ }
+
card->ext_csd.rev = ext_csd[EXT_CSD_REV];
if (card->ext_csd.rev > 5) {
- printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
- "version %d\n", mmc_hostname(card->host),
- card->ext_csd.rev);
+ printk(KERN_ERR "%s: unrecognised EXT_CSD revision %d\n",
+ mmc_hostname(card->host), card->ext_csd.rev);
err = -EINVAL;
goto out;
}
diff -puN include/linux/mmc/card.h~mmc-recognize-csd-structure include/linux/mmc/card.h
--- a/include/linux/mmc/card.h~mmc-recognize-csd-structure
+++ a/include/linux/mmc/card.h
@@ -24,6 +24,7 @@ struct mmc_cid {
};
struct mmc_csd {
+ unsigned char structure;
unsigned char mmca_vsn;
unsigned short cmdclass;
unsigned short tacc_clks;
diff -puN include/linux/mmc/mmc.h~mmc-recognize-csd-structure include/linux/mmc/mmc.h
--- a/include/linux/mmc/mmc.h~mmc-recognize-csd-structure
+++ a/include/linux/mmc/mmc.h
@@ -254,6 +254,7 @@ struct _mmc_csd {
#define EXT_CSD_BUS_WIDTH 183 /* R/W */
#define EXT_CSD_HS_TIMING 185 /* R/W */
#define EXT_CSD_CARD_TYPE 196 /* RO */
+#define EXT_CSD_STRUCTURE 194 /* RO */
#define EXT_CSD_REV 192 /* RO */
#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
#define EXT_CSD_S_A_TIMEOUT 217
_
Patches currently in -mm which might be from kmpark@infradead.org are
mmc-recognize-csd-structure.patch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + mmc-recognize-csd-structure.patch added to -mm tree
2010-06-04 22:36 + mmc-recognize-csd-structure.patch added to -mm tree akpm
@ 2010-06-04 23:12 ` Chris Ball
2010-06-07 7:27 ` Adrian Hunter
1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2010-06-04 23:12 UTC (permalink / raw)
To: akpm, kmpark, kyungmin.park, linux-mmc
Hi,
On Fri, Jun 04, 2010 at 03:36:21PM -0700, akpm@linux-foundation.org wrote:
> diff -puN drivers/mmc/core/mmc.c~mmc-recognize-csd-structure drivers/mmc/core/mmc.c
> --- a/drivers/mmc/core/mmc.c~mmc-recognize-csd-structure
> +++ a/drivers/mmc/core/mmc.c
> @@ -114,17 +114,18 @@ static int mmc_decode_cid(struct mmc_car
> static int mmc_decode_csd(struct mmc_card *card)
> {
> struct mmc_csd *csd = &card->csd;
> - unsigned int e, m, csd_struct;
> + unsigned int e, m;
> u32 *resp = card->raw_csd;
>
> /*
> * We only understand CSD structure v1.1 and v1.2.
> * v1.2 has extra information in bits 15, 11 and 10.
> + * also support the for eMMC v4.4 & v4.41.
> */
Minor typo here. I suggest "We also support eMMC v4.4 & v4.41."
--
Chris Ball <cjb@laptop.org>
One Laptop Per Child
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + mmc-recognize-csd-structure.patch added to -mm tree
2010-06-04 22:36 + mmc-recognize-csd-structure.patch added to -mm tree akpm
2010-06-04 23:12 ` Chris Ball
@ 2010-06-07 7:27 ` Adrian Hunter
2010-06-07 10:44 ` Kyungmin Park
1 sibling, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2010-06-07 7:27 UTC (permalink / raw)
To: akpm@linux-foundation.org
Cc: mm-commits@vger.kernel.org, kmpark@infradead.org,
kyungmin.park@samsung.com, linux-mmc@vger.kernel.org
ext akpm@linux-foundation.org wrote:
> The patch titled
> mmc: recognize CSD structure
> has been added to the -mm tree. Its filename is
> mmc-recognize-csd-structure.patch
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>
> See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
> out what to do about this
>
> The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
>
> ------------------------------------------------------
> Subject: mmc: recognize CSD structure
> From: Kyungmin Park <kmpark@infradead.org>
>
> The eMMC spec 4.4 and 4.3 + additional feature chips has CSD structure
> version 3 and version 3 have to check the CSD_STRUCTURE byte in the
> EXT_CSD register.
>From my understanding there is no CSD structure version 3, so the comment
is a bit misleading. The '3' value is used to mean something else i.e.
look for the actual version value in another register. The actual version
is still '2'. Also v4.3 and v4.4 eMMCs do not need to use the '3' value
and (apart from Samsung) probably won't because it is essentially
meaningless.
The comment doesn't matter but the unsupported 0 value needs to be
checked in EXT_CSD too - see below.
>
> Also fix EXT_CSD revision message.
>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Adrian Hunter <adrian.hunter@nokia.com>
> Cc: <linux-mmc@vger.kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> drivers/mmc/core/mmc.c | 26 +++++++++++++++++++-------
> include/linux/mmc/card.h | 1 +
> include/linux/mmc/mmc.h | 1 +
> 3 files changed, 21 insertions(+), 7 deletions(-)
>
> diff -puN drivers/mmc/core/mmc.c~mmc-recognize-csd-structure drivers/mmc/core/mmc.c
> --- a/drivers/mmc/core/mmc.c~mmc-recognize-csd-structure
> +++ a/drivers/mmc/core/mmc.c
> @@ -114,17 +114,18 @@ static int mmc_decode_cid(struct mmc_car
> static int mmc_decode_csd(struct mmc_card *card)
> {
> struct mmc_csd *csd = &card->csd;
> - unsigned int e, m, csd_struct;
> + unsigned int e, m;
> u32 *resp = card->raw_csd;
>
> /*
> * We only understand CSD structure v1.1 and v1.2.
> * v1.2 has extra information in bits 15, 11 and 10.
> + * also support the for eMMC v4.4 & v4.41.
> */
> - csd_struct = UNSTUFF_BITS(resp, 126, 2);
> - if (csd_struct != 1 && csd_struct != 2) {
> + csd->structure = UNSTUFF_BITS(resp, 126, 2);
> + if (csd->structure == 0) {
> printk(KERN_ERR "%s: unrecognised CSD structure version %d\n",
> - mmc_hostname(card->host), csd_struct);
> + mmc_hostname(card->host), csd->structure);
> return -EINVAL;
> }
>
> @@ -207,11 +208,22 @@ static int mmc_read_ext_csd(struct mmc_c
> goto out;
> }
>
> + /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
> + if (card->csd.structure == 3) {
> + int ext_csd_struct = ext_csd[EXT_CSD_STRUCTURE];
> + if (ext_csd_struct > 2) {
0 still isn't supported i.e.
if (ext_csd_struct < 1 || ext_csd_struct > 2) {
> + printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
> + "version %d\n", mmc_hostname(card->host),
> + ext_csd_struct);
> + err = -EINVAL;
> + goto out;
> + }
> + }
> +
> card->ext_csd.rev = ext_csd[EXT_CSD_REV];
> if (card->ext_csd.rev > 5) {
> - printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
> - "version %d\n", mmc_hostname(card->host),
> - card->ext_csd.rev);
> + printk(KERN_ERR "%s: unrecognised EXT_CSD revision %d\n",
> + mmc_hostname(card->host), card->ext_csd.rev);
> err = -EINVAL;
> goto out;
> }
> diff -puN include/linux/mmc/card.h~mmc-recognize-csd-structure include/linux/mmc/card.h
> --- a/include/linux/mmc/card.h~mmc-recognize-csd-structure
> +++ a/include/linux/mmc/card.h
> @@ -24,6 +24,7 @@ struct mmc_cid {
> };
>
> struct mmc_csd {
> + unsigned char structure;
> unsigned char mmca_vsn;
> unsigned short cmdclass;
> unsigned short tacc_clks;
> diff -puN include/linux/mmc/mmc.h~mmc-recognize-csd-structure include/linux/mmc/mmc.h
> --- a/include/linux/mmc/mmc.h~mmc-recognize-csd-structure
> +++ a/include/linux/mmc/mmc.h
> @@ -254,6 +254,7 @@ struct _mmc_csd {
> #define EXT_CSD_BUS_WIDTH 183 /* R/W */
> #define EXT_CSD_HS_TIMING 185 /* R/W */
> #define EXT_CSD_CARD_TYPE 196 /* RO */
> +#define EXT_CSD_STRUCTURE 194 /* RO */
> #define EXT_CSD_REV 192 /* RO */
> #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
> #define EXT_CSD_S_A_TIMEOUT 217
> _
>
> Patches currently in -mm which might be from kmpark@infradead.org are
>
> mmc-recognize-csd-structure.patch
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + mmc-recognize-csd-structure.patch added to -mm tree
2010-06-07 7:27 ` Adrian Hunter
@ 2010-06-07 10:44 ` Kyungmin Park
0 siblings, 0 replies; 4+ messages in thread
From: Kyungmin Park @ 2010-06-07 10:44 UTC (permalink / raw)
To: Adrian Hunter
Cc: akpm@linux-foundation.org, mm-commits@vger.kernel.org,
linux-mmc@vger.kernel.org
On Mon, Jun 7, 2010 at 4:27 PM, Adrian Hunter <adrian.hunter@nokia.com> wrote:
> ext akpm@linux-foundation.org wrote:
>>
>> The patch titled
>> mmc: recognize CSD structure
>> has been added to the -mm tree. Its filename is
>> mmc-recognize-csd-structure.patch
>>
>> Before you just go and hit "reply", please:
>> a) Consider who else should be cc'ed
>> b) Prefer to cc a suitable mailing list as well
>> c) Ideally: find the original patch on the mailing list and do a
>> reply-to-all to that, adding suitable additional cc's
>>
>> *** Remember to use Documentation/SubmitChecklist when testing your code
>> ***
>>
>> See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
>> out what to do about this
>>
>> The current -mm tree may be found at
>> http://userweb.kernel.org/~akpm/mmotm/
>>
>> ------------------------------------------------------
>> Subject: mmc: recognize CSD structure
>> From: Kyungmin Park <kmpark@infradead.org>
>>
>> The eMMC spec 4.4 and 4.3 + additional feature chips has CSD structure
>> version 3 and version 3 have to check the CSD_STRUCTURE byte in the
>> EXT_CSD register.
>
> From my understanding there is no CSD structure version 3, so the comment
> is a bit misleading. The '3' value is used to mean something else i.e.
> look for the actual version value in another register. The actual version
> is still '2'.
Right, right version is '2'.
Also v4.3 and v4.4 eMMCs do not need to use the '3' value
> and (apart from Samsung) probably won't because it is essentially
> meaningless.
Umm I got iNAND also and it has '3' value instead of '2'.
>
> The comment doesn't matter but the unsupported 0 value needs to be
> checked in EXT_CSD too - see below.
No problem to add the version check.
Thank you,
Kyungmin Park
>
>>
>> Also fix EXT_CSD revision message.
>>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Cc: Adrian Hunter <adrian.hunter@nokia.com>
>> Cc: <linux-mmc@vger.kernel.org>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>> ---
>>
>> drivers/mmc/core/mmc.c | 26 +++++++++++++++++++-------
>> include/linux/mmc/card.h | 1 +
>> include/linux/mmc/mmc.h | 1 +
>> 3 files changed, 21 insertions(+), 7 deletions(-)
>>
>> diff -puN drivers/mmc/core/mmc.c~mmc-recognize-csd-structure
>> drivers/mmc/core/mmc.c
>> --- a/drivers/mmc/core/mmc.c~mmc-recognize-csd-structure
>> +++ a/drivers/mmc/core/mmc.c
>> @@ -114,17 +114,18 @@ static int mmc_decode_cid(struct mmc_car
>> static int mmc_decode_csd(struct mmc_card *card)
>> {
>> struct mmc_csd *csd = &card->csd;
>> - unsigned int e, m, csd_struct;
>> + unsigned int e, m;
>> u32 *resp = card->raw_csd;
>> /*
>> * We only understand CSD structure v1.1 and v1.2.
>> * v1.2 has extra information in bits 15, 11 and 10.
>> + * also support the for eMMC v4.4 & v4.41.
>> */
>> - csd_struct = UNSTUFF_BITS(resp, 126, 2);
>> - if (csd_struct != 1 && csd_struct != 2) {
>> + csd->structure = UNSTUFF_BITS(resp, 126, 2);
>> + if (csd->structure == 0) {
>> printk(KERN_ERR "%s: unrecognised CSD structure version
>> %d\n",
>> - mmc_hostname(card->host), csd_struct);
>> + mmc_hostname(card->host), csd->structure);
>> return -EINVAL;
>> }
>> @@ -207,11 +208,22 @@ static int mmc_read_ext_csd(struct mmc_c
>> goto out;
>> }
>> + /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD
>> register */
>> + if (card->csd.structure == 3) {
>> + int ext_csd_struct = ext_csd[EXT_CSD_STRUCTURE];
>> + if (ext_csd_struct > 2) {
>
> 0 still isn't supported i.e.
>
> if (ext_csd_struct < 1 || ext_csd_struct > 2) {
>
>
>> + printk(KERN_ERR "%s: unrecognised EXT_CSD
>> structure "
>> + "version %d\n", mmc_hostname(card->host),
>> + ext_csd_struct);
>> + err = -EINVAL;
>> + goto out;
>> + }
>> + }
>> +
>> card->ext_csd.rev = ext_csd[EXT_CSD_REV];
>> if (card->ext_csd.rev > 5) {
>> - printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
>> - "version %d\n", mmc_hostname(card->host),
>> - card->ext_csd.rev);
>> + printk(KERN_ERR "%s: unrecognised EXT_CSD revision %d\n",
>> + mmc_hostname(card->host), card->ext_csd.rev);
>> err = -EINVAL;
>> goto out;
>> }
>> diff -puN include/linux/mmc/card.h~mmc-recognize-csd-structure
>> include/linux/mmc/card.h
>> --- a/include/linux/mmc/card.h~mmc-recognize-csd-structure
>> +++ a/include/linux/mmc/card.h
>> @@ -24,6 +24,7 @@ struct mmc_cid {
>> };
>> struct mmc_csd {
>> + unsigned char structure;
>> unsigned char mmca_vsn;
>> unsigned short cmdclass;
>> unsigned short tacc_clks;
>> diff -puN include/linux/mmc/mmc.h~mmc-recognize-csd-structure
>> include/linux/mmc/mmc.h
>> --- a/include/linux/mmc/mmc.h~mmc-recognize-csd-structure
>> +++ a/include/linux/mmc/mmc.h
>> @@ -254,6 +254,7 @@ struct _mmc_csd {
>> #define EXT_CSD_BUS_WIDTH 183 /* R/W */
>> #define EXT_CSD_HS_TIMING 185 /* R/W */
>> #define EXT_CSD_CARD_TYPE 196 /* RO */
>> +#define EXT_CSD_STRUCTURE 194 /* RO */
>> #define EXT_CSD_REV 192 /* RO */
>> #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
>> #define EXT_CSD_S_A_TIMEOUT 217
>> _
>>
>> Patches currently in -mm which might be from kmpark@infradead.org are
>>
>> mmc-recognize-csd-structure.patch
>>
>>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-07 10:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-04 22:36 + mmc-recognize-csd-structure.patch added to -mm tree akpm
2010-06-04 23:12 ` Chris Ball
2010-06-07 7:27 ` Adrian Hunter
2010-06-07 10:44 ` Kyungmin Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox