All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] fsl_esdhc: Only modify WML[WR] field
Date: Fri, 19 Mar 2010 10:38:15 -0500	[thread overview]
Message-ID: <1269013095-6725-3-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1269013095-6725-2-git-send-email-galak@kernel.crashing.org>

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

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

Signed-off-by: Roy Zang <tie-fei.zang@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

  reply	other threads:[~2010-03-19 15:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 15:38 [U-Boot] [PATCH 1/3] fsl_esdhc: Always stop clock before changing frequency Kumar Gala
2010-03-19 15:38 ` [U-Boot] [PATCH 2/3] fsl_esdhc: Add function to reset the eSDHC controller Kumar Gala
2010-03-19 15:38   ` Kumar Gala [this message]
2010-03-19 18:07     ` [U-Boot] [PATCH 3/3] fsl_esdhc: Only modify WML[WR] field Kumar Gala
2010-03-20 17:56   ` [U-Boot] [PATCH 2/3] fsl_esdhc: Add function to reset the eSDHC controller Stefano Babic
2010-03-21 18:10     ` Kumar Gala
2010-03-20 17:54 ` [U-Boot] [PATCH 1/3] fsl_esdhc: Always stop clock before changing frequency Stefano Babic
2010-03-21 18:10   ` Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1269013095-6725-3-git-send-email-galak@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.