]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mmc: Fix version check for clock API in sdhci driver
authorJoe Hershberger <joe.hershberger@ni.com>
Fri, 17 Aug 2012 10:18:54 +0000 (10:18 +0000)
committerAndy Fleming <afleming@freescale.com>
Wed, 5 Sep 2012 22:33:25 +0000 (17:33 -0500)
When setting up the clocks in the sdhci driver, the "spec version"
must be masked off.  Otherwise any time the vendor version is not 0,
the check will allways assume the interface is version 3.  This breaks
when the interface is actually version 1 or 2.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
drivers/mmc/sdhci.c

index 1709643da83b66585b0e9d5c7ae1851da2defaa1..b07dc0064e709bc463b5b4553cf95da769b7bb5c 100644 (file)
@@ -260,7 +260,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
        if (clock == 0)
                return 0;
 
-       if (host->version >= SDHCI_SPEC_300) {
+       if ((host->version & SDHCI_SPEC_VER_MASK) >= SDHCI_SPEC_300) {
                /* Version 3.00 divisors must be a multiple of 2. */
                if (mmc->f_max <= clock)
                        div = 1;
@@ -347,10 +347,10 @@ void sdhci_set_ios(struct mmc *mmc)
        ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
        if (mmc->bus_width == 8) {
                ctrl &= ~SDHCI_CTRL_4BITBUS;
-               if (host->version >= SDHCI_SPEC_300)
+               if ((host->version & SDHCI_SPEC_VER_MASK) >= SDHCI_SPEC_300)
                        ctrl |= SDHCI_CTRL_8BITBUS;
        } else {
-               if (host->version >= SDHCI_SPEC_300)
+               if ((host->version & SDHCI_SPEC_VER_MASK) >= SDHCI_SPEC_300)
                        ctrl &= ~SDHCI_CTRL_8BITBUS;
                if (mmc->bus_width == 4)
                        ctrl |= SDHCI_CTRL_4BITBUS;
@@ -421,7 +421,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
        if (max_clk)
                mmc->f_max = max_clk;
        else {
-               if (host->version >= SDHCI_SPEC_300)
+               if ((host->version & SDHCI_SPEC_VER_MASK) >= SDHCI_SPEC_300)
                        mmc->f_max = (caps & SDHCI_CLOCK_V3_BASE_MASK)
                                >> SDHCI_CLOCK_BASE_SHIFT;
                else
@@ -436,7 +436,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
        if (min_clk)
                mmc->f_min = min_clk;
        else {
-               if (host->version >= SDHCI_SPEC_300)
+               if ((host->version & SDHCI_SPEC_VER_MASK) >= SDHCI_SPEC_300)
                        mmc->f_min = mmc->f_max / SDHCI_MAX_DIV_SPEC_300;
                else
                        mmc->f_min = mmc->f_max / SDHCI_MAX_DIV_SPEC_200;