[U-Boot] [PATCH 3/3] fsl_esdhc: Only modify WML[WR] field

Kumar Gala galak at kernel.crashing.org
Fri Mar 19 16:38:15 CET 2010


From: Roy Zang <tie-fei.zang at freescale.com>

Maintain the value of the reset of wml register rather than hard coding it

Signed-off-by: Roy Zang <tie-fei.zang at freescale.com>
---
 drivers/mmc/fsl_esdhc.c |    7 ++++---
 include/fsl_esdhc.h     |    2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 999b581..b3d99dc 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -110,8 +110,7 @@ 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(&regs->wml) & ~WML_RD_WML_MASK;
 		esdhc_write32(&regs->dsaddr, (u32)data->dest);
 	} else {
 		if (wml_value > 0x80)
@@ -120,7 +119,9 @@ 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;
+
+		esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK, wml_value << 16);
+
 		esdhc_write32(&regs->dsaddr, (u32)data->src);
 	}
 
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
index 5f02018..f9ae15a 100644
--- a/include/fsl_esdhc.h
+++ b/include/fsl_esdhc.h
@@ -133,6 +133,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)
-- 
1.6.0.6



More information about the U-Boot mailing list