Hi, On Sun, Feb 12 2012, Chris Ball wrote: > Hi, > > On Sun, Feb 12 2012, Huang Changming-R66093 wrote: >> You are right. >> I want to use the below code in header file "drivers/mmc/host/sdhci-esdhc.h": >> if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) >> then I can avoid the twice test of the clock. >> do you think if it is reasonable? > > Yes, I think that's okay; let's try it. Thanks, Actually, I think I'm still missing something. Why doesn't this work? +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); +} - Chris. -- Chris Ball <cjb@xxxxxxxxxx> <http://printf.net/> One Laptop Per Child -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html