Skip to contentSkip to conversation

mmc: fix ERASE_GRP_DEF handling

PATCH New Hannes Petermaier 3 participants 4 messages Aug 8, 2014 – Oct 2, 2014 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: fix ERASE_GRP_DEF handling

if we set manually this bit on the eMMC card using mmc_switch(...), we also have to set it within our (before read) internal structure 'ext_csd'.

Otherwise following checks on this will fail.

---
 drivers/mmc/mmc.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/mmc.c +2 -0
index a26f3ce..52a8e36 100644
@@ -1010,6 +1010,8 @@ static int mmc_startup(struct mmc *mmc)
 
 			if (err)
 				return err;
+			else
+				ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;
 
 			/* Read out group size from ext_csd */
 			mmc->erase_grp_size =
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 mmc: fix ERASE_GRP_DEF handling

Hi, Hannes.

Quoted 16 lines · Hannes Petermaier

if we set manually this bit on the eMMC card using mmc_switch(...), we also have to set it within our (before read) internal structure 'ext_csd'.

Otherwise following checks on this will fail.

---
 drivers/mmc/mmc.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/mmc.c +0 -0
index a26f3ce..52a8e36 100644

drivers/mmc/mmc.c static int mmc_startup(struct mmc *mmc) · line 1014

Quoted 5 lines
drivers/mmc/mmc.c +2 -0
@@ -1010,6 +1010,8 @@ static int mmc_startup(struct mmc *mmc)
 
 			if (err)
 				return err;
+			else
+				ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;

When is this value read?
If i'm right, you means that it has to set before comparing with test_csd, right? It's reasonable, but i'm not sure that hard-coding is right.

Best Regards,
Jaehoon Chung

Quoted 4 lines
drivers/mmc/mmc.c +0 -0
 			/* Read out group size from ext_csd */
 			mmc->erase_grp_size =
 
#2 lore raw

PATCH 1/1 mmc: fix ERASE_GRP_DEF handling

Quoted 1 line

Hi, Hannes.

Hi Jaehoon,

Quoted 11 lines

drivers/mmc/mmc.c static int mmc_startup(struct mmc *mmc) · line 1014

Quoted 10 lines
drivers/mmc/mmc.c +2 -0
index a26f3ce..52a8e36 100644
@@ -1010,6 +1010,8 @@ static int mmc_startup(struct mmc *mmc)
 
          if (err)
             return err;
+         else
+            ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;

When is this value read?

a few lines above, have a look at line 967:
/* check ext_csd version and capacity */
err = mmc_send_ext_csd(mmc, ext_csd);

Quoted 1 line

If i'm right, you means that it has to set before comparing with

test_csd, right?
yes, exactly thats what i mean.

Quoted 1 line

It's reasonable, but i'm not sure that hard-coding is right.

why not ? we set the bit using mmc_switch, and only after success we alter our internal structure.

Quoted 3 lines

Best Regards,
Jaehoon Chung

best regards,
Hannes

#3 lore raw

PATCH 1/1 mmc: fix ERASE_GRP_DEF handling

Hi Hannes,

Quoted 19 lines · Hannes Petermaier
Quoted 1 line

Hi, Hannes.

Hi Jaehoon,

Quoted 11 lines

drivers/mmc/mmc.c static int mmc_startup(struct mmc *mmc) · line 1014

Quoted 10 lines
drivers/mmc/mmc.c +2 -0
index a26f3ce..52a8e36 100644
@@ -1010,6 +1010,8 @@ static int mmc_startup(struct mmc *mmc)
 
         if (err)
            return err;
+         else
+            ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1;

When is this value read?

a few lines above, have a look at line 967:
/* check ext_csd version and capacity */
err = mmc_send_ext_csd(mmc, ext_csd);

Quoted 8 lines
Quoted 1 line

If i'm right, you means that it has to set before comparing with

test_csd, right?
yes, exactly thats what i mean.

Quoted 1 line

It's reasonable, but i'm not sure that hard-coding is right.

why not ? we set the bit using mmc_switch, and only after success we alter our internal structure.

It is reasonable in this context, but I?m wary of cases where a read would be required in case the write didn?t ?take?.

I?ll apply this for now.

Quoted 9 lines
Quoted 3 lines

Best Regards,
Jaehoon Chung

best regards,
Hannes

Regards

? Pantelis