Skip to contentSkip to conversation

mmc: core: fix wrong bit operation for SD card's au_size

PATCH In review Jaehoon Chung 3 participants 3 messages Feb 21, 2012 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: core: fix wrong bit operation for SD card's au_size

In SD spec, AU_SIZE and the value can be selected from 16KB. But this code should be selected from 32KB.
I think right that shift (au + 3) instead of (au + 4).

---
 drivers/mmc/core/sd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/core/sd.c +1 -1
index 5017f93..85c7b39 100644
@@ -245,7 +245,7 @@ static int mmc_read_ssr(struct mmc_card *card)
 	 */
 	au = UNSTUFF_BITS(ssr, 428 - 384, 4);
 	if (au > 0 || au <= 9) {
-		card->ssr.au = 1 << (au + 4);
+		card->ssr.au = 1 << (au + 3);
 		es = UNSTUFF_BITS(ssr, 408 - 384, 16);
 		et = UNSTUFF_BITS(ssr, 402 - 384, 6);
 		eo = UNSTUFF_BITS(ssr, 400 - 384, 2);
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 26 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Jaehoon Chung
Sent: Tuesday, February 21, 2012 10:02 AM
To: linux-mmc
Cc: Chris Ball; Kyungmin Park; [email protected]
Subject: [PATCH] mmc: core: fix wrong bit operation for SD card's au_size

In SD spec, AU_SIZE and the value can be selected from 16KB. But this code should be selected from 32KB.
I think right that shift (au + 3) instead of (au + 4).

---
 drivers/mmc/core/sd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/core/sd.c index renamed from drivers/mmc/core/sd.c +0 -0

5017f93..85c7b39 100644

drivers/mmc/core/sd.c static int mmc_read_ssr(struct mmc_card *card) · line 248

Quoted 5 lines
drivers/mmc/core/sd.c +1 -1
@@ -245,7 +245,7 @@ static int mmc_read_ssr(struct mmc_card *card)
 	 */
 	au = UNSTUFF_BITS(ssr, 428 - 384, 4);
 	if (au > 0 || au <= 9) {
-		card->ssr.au = 1 << (au + 4);
+		card->ssr.au = 1 << (au + 3);

(au+4) is correct only. Look at the definition of "card->ssr.au" ("include/linux/mmc/card.h"), au is in terms of sectors.

		struct sd_ssr {
		        unsigned int            au;                     /*

In sectors */

Now let's take the example of "AU_SIZE" = 1 then (1 << (au+4)) would be 32. Now as "card->sss.au" is in term of sectors, 32 sectors means 16KB (assuming 512 byte sector size).

Regards,
Subhash

Quoted 7 lines
drivers/mmc/core/sd.c +0 -1
 		es = UNSTUFF_BITS(ssr, 408 - 384, 16);
 		et = UNSTUFF_BITS(ssr, 402 - 384, 6);
 		eo = UNSTUFF_BITS(ssr, 400 - 384, 2);
--

1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in

the

Quoted 2 lines

body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Subhash.

Right..sorry..my misunderstanding.
Thank you for your explanation.

Best Regards,
Jaehoon Chung

2012/2/21 Subhash Jadavani <[email protected]>:

Quoted 60 lines
Quoted 26 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Jaehoon Chung
Sent: Tuesday, February 21, 2012 10:02 AM
To: linux-mmc
Cc: Chris Ball; Kyungmin Park; [email protected]
Subject: [PATCH] mmc: core: fix wrong bit operation for SD card's au_size

In SD spec, AU_SIZE and the value can be selected from 16KB. But this code should be selected from 32KB.
I think right that shift (au + 3) instead of (au + 4).

---
 drivers/mmc/core/sd.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/core/sd.c index renamed from drivers/mmc/core/sd.c +0 -0

5017f93..85c7b39 100644

drivers/mmc/core/sd.c static int mmc_read_ssr(struct mmc_card *card) · line 248

Quoted 5 lines
drivers/mmc/core/sd.c +1 -1
@@ -245,7 +245,7 @@ static int mmc_read_ssr(struct mmc_card *card)
        */
       au = UNSTUFF_BITS(ssr, 428 - 384, 4);
       if (au > 0 || au <= 9) {
-             card->ssr.au = 1 << (au + 4);
+             card->ssr.au = 1 << (au + 3);

(au+4) is correct only. Look at the definition of "card->ssr.au" ("include/linux/mmc/card.h"), au is in terms of sectors. struct sd_ssr {
                       unsigned int            au;                     /* In sectors */

Now let's take the example of "AU_SIZE" = 1 then (1 << (au+4)) would be 32. Now as "card->sss.au" is in term of sectors, 32 sectors means 16KB (assuming 512 byte sector size).

Regards,
Subhash

Quoted 7 lines
drivers/mmc/core/sd.c +0 -1
               es = UNSTUFF_BITS(ssr, 408 - 384, 16);
               et = UNSTUFF_BITS(ssr, 402 - 384, 6);
               eo = UNSTUFF_BITS(ssr, 400 - 384, 2);
--

1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in

the

Quoted 2 lines

body of a message to [email protected] 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html