fsl_esdhc: Deal with watermark level register related changes
authorPriyanka Jain <Priyanka.Jain@freescale.com>
Wed, 9 Feb 2011 03:54:10 +0000 (09:24 +0530)
committerKumar Gala <galak@kernel.crashing.org>
Sun, 10 Apr 2011 16:17:55 +0000 (11:17 -0500)
P1010 and P1014 has v2.3 version of FSL eSDHC controller in which watermark
level register description has been changed:

9-15 bits represent WR_WML[0:6], Max value = 128 represented by 0x00
25-31 bits represent RD_WML[0:6], Max value = 128 represented by 0x00

Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
Signed-off-by: Poonam Aggrwal <Poonam.Aggrwal@freescale.com>
Tested-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/include/asm/config_mpc85xx.h
drivers/mmc/fsl_esdhc.c
include/fsl_esdhc.h

index 59aeb31087ff5831c5f10f1c34830346c038b232..41fd86c4e222bf648a910b01a0dc93cdd1ffaea0 100644 (file)
@@ -88,6 +88,7 @@
 
 #elif defined(CONFIG_P1010)
 #define CONFIG_MAX_CPUS                        1
+#define CONFIG_FSL_SDHC_V2_3
 #define CONFIG_SYS_FSL_NUM_LAWS                12
 #define CONFIG_TSECV2
 #define CONFIG_SYS_FSL_SEC_COMPAT      4
 
 #elif defined(CONFIG_P1014)
 #define CONFIG_MAX_CPUS                        1
+#define CONFIG_FSL_SDHC_V2_3
 #define CONFIG_SYS_FSL_NUM_LAWS                12
 #define CONFIG_TSECV2
 #define CONFIG_SYS_FSL_SEC_COMPAT      4
index 0962ac4476aaef82b51616c08add152330fccb78..4f1b5150c942b7d64d435c677a58aed75cfef051 100644 (file)
@@ -178,14 +178,14 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
        wml_value = data->blocksize/4;
 
        if (data->flags & MMC_DATA_READ) {
-               if (wml_value > 0x10)
-                       wml_value = 0x10;
+               if (wml_value > WML_RD_WML_MAX)
+                       wml_value = WML_RD_WML_MAX_VAL;
 
                esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value);
                esdhc_write32(&regs->dsaddr, (u32)data->dest);
        } else {
-               if (wml_value > 0x80)
-                       wml_value = 0x80;
+               if (wml_value > WML_WR_WML_MAX)
+                       wml_value = WML_WR_WML_MAX_VAL;
                if ((esdhc_read32(&regs->prsstat) & PRSSTAT_WPSPL) == 0) {
                        printf("\nThe SD card is locked. Can not write to a locked card.\n\n");
                        return TIMEOUT;
index 477bbd792e81f4066c4f6d0b4239d798f82afc28..8418bf7f47aa177af9bcd029276646c5525e15b9 100644 (file)
@@ -2,7 +2,7 @@
  * FSL SD/MMC Defines
  *-------------------------------------------------------------------
  *
- * Copyright 2007-2008,2010 Freescale Semiconductor, Inc
+ * Copyright 2007-2008,2010-2011 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
 
 #define WML            0x2e044
 #define WML_WRITE      0x00010000
+#ifdef CONFIG_FSL_SDHC_V2_3
+#define WML_RD_WML_MAX         0x80
+#define WML_WR_WML_MAX         0x80
+#define WML_RD_WML_MAX_VAL     0x0
+#define WML_WR_WML_MAX_VAL     0x0
+#define WML_RD_WML_MASK                0x7f
+#define WML_WR_WML_MASK                0x7f0000
+#else
+#define WML_RD_WML_MAX         0x10
+#define WML_WR_WML_MAX         0x80
+#define WML_RD_WML_MAX_VAL     0x10
+#define WML_WR_WML_MAX_VAL     0x80
 #define WML_RD_WML_MASK        0xff
 #define WML_WR_WML_MASK        0xff0000
+#endif
 
 #define BLKATTR                0x2e004
 #define BLKATTR_CNT(x) ((x & 0xffff) << 16)