From 8256c05ae660ffad5e19b7994147a0ac861c6a89 Mon Sep 17 00:00:00 2001 From: Jerry Huang Date: Tue, 14 Feb 2012 14:05:37 +0800 Subject: [PATCH] --- yaml --- r: 297325 b: refs/heads/master c: f060bc9c12d28c9a561fdd8cf1d60bdefd92db2d h: refs/heads/master i: 297323: 35fd46d3d9c625fe8d8d6be70195349ea053bea5 v: v3 --- [refs] | 2 +- trunk/drivers/mmc/host/sdhci-of-esdhc.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index a43b7e605718..61d483d9a32f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7b2fd4f23f72c13a78c0892d330dde305ef2fb80 +refs/heads/master: f060bc9c12d28c9a561fdd8cf1d60bdefd92db2d diff --git a/trunk/drivers/mmc/host/sdhci-of-esdhc.c b/trunk/drivers/mmc/host/sdhci-of-esdhc.c index 2ef52f47def8..f8eb1fb0c921 100644 --- a/trunk/drivers/mmc/host/sdhci-of-esdhc.c +++ b/trunk/drivers/mmc/host/sdhci-of-esdhc.c @@ -1,7 +1,7 @@ /* * Freescale eSDHC controller driver. * - * Copyright (c) 2007, 2010 Freescale Semiconductor, Inc. + * Copyright (c) 2007, 2010, 2012 Freescale Semiconductor, Inc. * Copyright (c) 2009 MontaVista Software, Inc. * * Authors: Xiaobo Xie @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -114,6 +115,20 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) return pltfm_host->clock / 256 / 16; } +static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) +{ + /* Workaround to reduce the clock frequency for p1010 esdhc */ + if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) { + if (clock > 20000000) + clock -= 5000000; + if (clock > 40000000) + clock -= 5000000; + } + + /* Set the clock */ + esdhc_set_clock(host, clock); +} + #ifdef CONFIG_PM static u32 esdhc_proctl; static void esdhc_of_suspend(struct sdhci_host *host) @@ -135,7 +150,7 @@ static struct sdhci_ops sdhci_esdhc_ops = { .write_l = sdhci_be32bs_writel, .write_w = esdhc_writew, .write_b = esdhc_writeb, - .set_clock = esdhc_set_clock, + .set_clock = esdhc_of_set_clock, .enable_dma = esdhc_of_enable_dma, .get_max_clock = esdhc_of_get_max_clock, .get_min_clock = esdhc_of_get_min_clock,