Skip to contentSkip to conversation

fsl_esdhc: Only modify the field we are changing in WML

PATCH Superseded Kumar Gala 2 participants 3 messages Mar 19, 2010 – Mar 21, 2010 MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 3/3 fsl_esdhc: Only modify the field we are changing in WML

From: Roy Zang <[email protected]>

When we set the read or write watermark in WML we should maintain the rest of the register as is, rather than using some hard coded value.

---
* This patch supercededs (fsl_esdhc: Only modify WML[WR] field)

 drivers/mmc/fsl_esdhc.c |    8 +++-----
 include/fsl_esdhc.h     |    2 ++
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/mmc/fsl_esdhc.c +3 -5
index 999b581..c7b7e84 100644
@@ -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;
-
+		esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value);
 		esdhc_write32(&regs->dsaddr, (u32)data->dest);
 	} else {
 		if (wml_value > 0x80)
@@ -120,12 +119,11 @@ 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);
 	}
 
-	esdhc_write32(&regs->wml, wml_value);
-
 	esdhc_write32(&regs->blkattr, data->blocks << 16 | data->blocksize);
 
 	/* Calculate the timeout period for data transactions */
include/fsl_esdhc.h +2 -0
index 5f02018..f9ae15a 100644
@@ -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)
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 3/3 fsl_esdhc: Only modify the field we are changing in WML

Quoted 9 lines · Kumar Gala

From: Roy Zang <[email protected]>

When we set the read or write watermark in WML we should maintain the rest of the register as is, rather than using some hard coded value.

---
* This patch supercededs (fsl_esdhc: Only modify WML[WR] field)

Hi,

drivers/mmc/fsl_esdhc.c static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data) · line 123

Quoted 1 line
drivers/mmc/fsl_esdhc.c +1 -0
+		esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK, wml_value << 16);

Line too long.

Tested successfully on mx51evk.

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
author
#2 lore raw

PATCH 3/3 fsl_esdhc: Only modify the field we are changing in WML

Quoted 17 lines · Stefano Babic
Quoted 9 lines · Kumar Gala

From: Roy Zang <[email protected]>

When we set the read or write watermark in WML we should maintain the rest of the register as is, rather than using some hard coded value.

---
* This patch supercededs (fsl_esdhc: Only modify WML[WR] field)

Hi,

drivers/mmc/fsl_esdhc.c static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data) · line 123

Quoted 1 line
drivers/mmc/fsl_esdhc.c +1 -0
+		esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK, wml_value << 16);

Line too long.

Quoted 6 lines

Tested successfully on mx51evk.

Regards,
Stefano

Thanks, will fix the line length in my git tree commit.

- k