aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJerry Huang <Chang-Ming.Huang@freescale.com>2012-02-14 01:05:37 -0500
committerChris Ball <cjb@laptop.org>2012-03-25 19:33:45 -0400
commitf060bc9c12d28c9a561fdd8cf1d60bdefd92db2d (patch)
treee809149b9f1ca68f16eedd65124c952cb9144262 /drivers
parent7b2fd4f23f72c13a78c0892d330dde305ef2fb80 (diff)
mmc: esdhc: Workaround for data crc error on p1010rdb
SD card read was failing (data crc error) on some cards at maximum possible frequency on P1010 (CCB frequency set to 400MHz). Some clock deviations are also observed at this frequency. Hence reduced the mmc clock freq. Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com> Singed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/sdhci-of-esdhc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 2ef52f47def8..f8eb1fb0c921 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Freescale eSDHC controller driver. 2 * Freescale eSDHC controller driver.
3 * 3 *
4 * Copyright (c) 2007, 2010 Freescale Semiconductor, Inc. 4 * Copyright (c) 2007, 2010, 2012 Freescale Semiconductor, Inc.
5 * Copyright (c) 2009 MontaVista Software, Inc. 5 * Copyright (c) 2009 MontaVista Software, Inc.
6 * 6 *
7 * Authors: Xiaobo Xie <X.Xie@freescale.com> 7 * Authors: Xiaobo Xie <X.Xie@freescale.com>
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/module.h> 19#include <linux/module.h>
19#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
@@ -114,6 +115,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
114 return pltfm_host->clock / 256 / 16; 115 return pltfm_host->clock / 256 / 16;
115} 116}
116 117
118static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
119{
120 /* Workaround to reduce the clock frequency for p1010 esdhc */
121 if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
122 if (clock > 20000000)
123 clock -= 5000000;
124 if (clock > 40000000)
125 clock -= 5000000;
126 }
127
128 /* Set the clock */
129 esdhc_set_clock(host, clock);
130}
131
117#ifdef CONFIG_PM 132#ifdef CONFIG_PM
118static u32 esdhc_proctl; 133static u32 esdhc_proctl;
119static void esdhc_of_suspend(struct sdhci_host *host) 134static void esdhc_of_suspend(struct sdhci_host *host)
@@ -135,7 +150,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
135 .write_l = sdhci_be32bs_writel, 150 .write_l = sdhci_be32bs_writel,
136 .write_w = esdhc_writew, 151 .write_w = esdhc_writew,
137 .write_b = esdhc_writeb, 152 .write_b = esdhc_writeb,
138 .set_clock = esdhc_set_clock, 153 .set_clock = esdhc_of_set_clock,
139 .enable_dma = esdhc_of_enable_dma, 154 .enable_dma = esdhc_of_enable_dma,
140 .get_max_clock = esdhc_of_get_max_clock, 155 .get_max_clock = esdhc_of_get_max_clock,
141 .get_min_clock = esdhc_of_get_min_clock, 156 .get_min_clock = esdhc_of_get_min_clock,