All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: Fix mmc bus width
@ 2014-09-30 15:04 Mario Schuknecht
  2014-10-02 11:20 ` Pantelis Antoniou
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Schuknecht @ 2014-09-30 15:04 UTC (permalink / raw)
  To: u-boot

After setting the bus width, the extended CSD register is read. Some selected
fields are compared with previously read extended CSD register fields. In this
comparison the EXT_CSD_ERASE_GROUP_DEF field is compared. But this field is
previously written under certain circumstances. And then the comparison fails.

Only compare read-only fields. Therefore compare field EXT_CSD_HC_WP_GRP_SIZE
instead of field EXT_CSD_ERASE_GROUP_DEF.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
---
 drivers/mmc/mmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index a26f3ce..d1faa9f 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1127,10 +1127,11 @@ static int mmc_startup(struct mmc *mmc)
 			mmc_set_bus_width(mmc, widths[idx]);
 
 			err = mmc_send_ext_csd(mmc, test_csd);
+			/* Only compare read only fields */
 			if (!err && ext_csd[EXT_CSD_PARTITIONING_SUPPORT] \
 				    == test_csd[EXT_CSD_PARTITIONING_SUPPORT]
-				 && ext_csd[EXT_CSD_ERASE_GROUP_DEF] \
-				    == test_csd[EXT_CSD_ERASE_GROUP_DEF] \
+				 && ext_csd[EXT_CSD_HC_WP_GRP_SIZE] \
+				    == test_csd[EXT_CSD_HC_WP_GRP_SIZE] \
 				 && ext_csd[EXT_CSD_REV] \
 				    == test_csd[EXT_CSD_REV]
 				 && ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] \
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] mmc: Fix mmc bus width
  2014-09-30 15:04 [U-Boot] [PATCH] mmc: Fix mmc bus width Mario Schuknecht
@ 2014-10-02 11:20 ` Pantelis Antoniou
  0 siblings, 0 replies; 2+ messages in thread
From: Pantelis Antoniou @ 2014-10-02 11:20 UTC (permalink / raw)
  To: u-boot

Hi Mario,

On Sep 30, 2014, at 6:04 PM, Mario Schuknecht <mario.schuknecht@dresearch-fe.de> wrote:

> After setting the bus width, the extended CSD register is read. Some selected
> fields are compared with previously read extended CSD register fields. In this
> comparison the EXT_CSD_ERASE_GROUP_DEF field is compared. But this field is
> previously written under certain circumstances. And then the comparison fails.
> 
> Only compare read-only fields. Therefore compare field EXT_CSD_HC_WP_GRP_SIZE
> instead of field EXT_CSD_ERASE_GROUP_DEF.
> 
> Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
> ---
> drivers/mmc/mmc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index a26f3ce..d1faa9f 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1127,10 +1127,11 @@ static int mmc_startup(struct mmc *mmc)
> 			mmc_set_bus_width(mmc, widths[idx]);
> 
> 			err = mmc_send_ext_csd(mmc, test_csd);
> +			/* Only compare read only fields */
> 			if (!err && ext_csd[EXT_CSD_PARTITIONING_SUPPORT] \
> 				    == test_csd[EXT_CSD_PARTITIONING_SUPPORT]
> -				 && ext_csd[EXT_CSD_ERASE_GROUP_DEF] \
> -				    == test_csd[EXT_CSD_ERASE_GROUP_DEF] \
> +				 && ext_csd[EXT_CSD_HC_WP_GRP_SIZE] \
> +				    == test_csd[EXT_CSD_HC_WP_GRP_SIZE] \
> 				 && ext_csd[EXT_CSD_REV] \
> 				    == test_csd[EXT_CSD_REV]
> 				 && ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] \
> -- 
> 1.8.4.5
> 

Applied, thanks.

Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-02 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30 15:04 [U-Boot] [PATCH] mmc: Fix mmc bus width Mario Schuknecht
2014-10-02 11:20 ` Pantelis Antoniou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.