[U-Boot] [PATCH] sdhc: use reset value instead of a hardcoded value to set wml

From: Roy Zang tie-fei.zang@freescale.com
Use reset value instead of a hardcoded value to set wml.
Signed-off-by: Roy Zang tie-fei.zang@freescale.com --- drivers/mmc/fsl_esdhc.c | 8 +++++--- include/fsl_esdhc.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 34a2585..dc37bf8 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -1,5 +1,5 @@ /* - * Copyright 2007, Freescale Semiconductor, Inc + * Copyright 2007, 2010 Freescale Semiconductor, Inc * Andy Fleming * * Based vaguely on the pxa mmc code: @@ -110,7 +110,8 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data) if (wml_value > 0x10) wml_value = 0x10;
- wml_value = 0x100000 | wml_value; + wml_value = in_be32(®s->wml) & (~WML_RD_WML_MASK) | + wml_value;
out_be32(®s->dsaddr, (u32)data->dest); } else { @@ -120,7 +121,8 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data) printf("\nThe SD card is locked. Can not write to a locked card.\n\n"); return TIMEOUT; } - wml_value = wml_value << 16 | 0x10; + wml_value = in_be32(®s->wml) & (~WML_WR_WML_MASK) | + (wml_value << 16); out_be32(®s->dsaddr, (u32)data->src); }
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h index adb43d7..3b5665d 100644 --- a/include/fsl_esdhc.h +++ b/include/fsl_esdhc.h @@ -2,7 +2,7 @@ * FSL SD/MMC Defines *------------------------------------------------------------------- * - * Copyright 2007-2008, Freescale Semiconductor, Inc + * Copyright 2007-2008, 2010 Freescale Semiconductor, Inc * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -130,6 +130,8 @@
#define WML 0x2e044 #define WML_WRITE 0x00010000 +#define WML_RD_WML_MASK 0xff +#define WML_WR_WML_MASK 0xff0000
#define BLKATTR 0x2e004 #define BLKATTR_CNT(x) ((x & 0xffff) << 16)
participants (1)
-
Roy Zang