]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/mmc/host/tmio_mmc.c
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[mv-sheeva.git] / drivers / mmc / host / tmio_mmc.c
index b576640704856b4ae3e33c2450112284d685432d..91991b460c4547c7a90a583ca987f087c6babd53 100644 (file)
@@ -10,7 +10,7 @@
  *
  * Driver for the MMC / SD / SDIO cell found in:
  *
- * TC6393XB TC6391XB TC6387XB T7L66XB
+ * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
  *
  * This driver draws mainly on scattered spec sheets, Reverse engineering
  * of the toshiba e800  SD driver and some parts of the 2.4 ASIC3 driver (4 bit
 
 static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
 {
-       u32 clk = 0, clock, f_min = host->mmc->f_min;
+       u32 clk = 0, clock;
 
        if (new_clock) {
-               for (clock = f_min, clk = 0x100; new_clock >= (clock<<1); ) {
+               for (clock = host->mmc->f_min, clk = 0x80000080;
+                       new_clock >= (clock<<1); clk >>= 1)
                        clock <<= 1;
-                       clk >>= 1;
-               }
-               if (clk & 0x1)
-                       clk = 0x20000;
-
-               clk >>= 2;
-               sd_config_write8(host, CNF_SD_CLK_MODE, (clk & 0x8000) ? 0 : 1);
                clk |= 0x100;
        }
 
-       sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk);
+       sd_config_write8(host, CNF_SD_CLK_MODE, clk >> 22);
+       sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff);
 }
 
 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
@@ -493,11 +488,6 @@ static int tmio_mmc_resume(struct platform_device *dev)
        struct tmio_mmc_host *host = mmc_priv(mmc);
        int ret = 0;
 
-       /* Enable the MMC/SD Control registers */
-       sd_config_write16(host, CNF_CMD, SDCREN);
-       sd_config_write32(host, CNF_CTL_BASE,
-               (dev->resource[0].start >> host->bus_shift) & 0xfffe);
-
        /* Tell the MFD core we are ready to be enabled */
        if (cell->enable) {
                ret = cell->enable(dev);
@@ -505,6 +495,11 @@ static int tmio_mmc_resume(struct platform_device *dev)
                        goto out;
        }
 
+       /* Enable the MMC/SD Control registers */
+       sd_config_write16(host, CNF_CMD, SDCREN);
+       sd_config_write32(host, CNF_CTL_BASE,
+               (dev->resource[0].start >> host->bus_shift) & 0xfffe);
+
        mmc_resume_host(mmc);
 
 out:
@@ -563,11 +558,6 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
        mmc->f_min = mmc->f_max / 512;
        mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
 
-       /* Enable the MMC/SD Control registers */
-       sd_config_write16(host, CNF_CMD, SDCREN);
-       sd_config_write32(host, CNF_CTL_BASE,
-               (dev->resource[0].start >> host->bus_shift) & 0xfffe);
-
        /* Tell the MFD core we are ready to be enabled */
        if (cell->enable) {
                ret = cell->enable(dev);
@@ -575,6 +565,11 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
                        goto unmap_cnf;
        }
 
+       /* Enable the MMC/SD Control registers */
+       sd_config_write16(host, CNF_CMD, SDCREN);
+       sd_config_write32(host, CNF_CTL_BASE,
+               (dev->resource[0].start >> host->bus_shift) & 0xfffe);
+
        /* Disable SD power during suspend */
        sd_config_write8(host, CNF_PWR_CTL_3, 0x01);