Fix common misspellings
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / mmc / host / tmio_mmc_pio.c
index 28e14c7a254087acfb8229850467b34ad25d00e8..62d37de6de76d7551d575f22df39909479030aec 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/irq.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
+#include <linux/mmc/tmio.h>
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/platform_device.h>
 
 #include "tmio_mmc.h"
 
-#define CTL_SD_CMD 0x00
-#define CTL_ARG_REG 0x04
-#define CTL_STOP_INTERNAL_ACTION 0x08
-#define CTL_XFER_BLK_COUNT 0xa
-#define CTL_RESPONSE 0x0c
-#define CTL_STATUS 0x1c
-#define CTL_IRQ_MASK 0x20
-#define CTL_SD_CARD_CLK_CTL 0x24
-#define CTL_SD_XFER_LEN 0x26
-#define CTL_SD_MEM_CARD_OPT 0x28
-#define CTL_SD_ERROR_DETAIL_STATUS 0x2c
-#define CTL_SD_DATA_PORT 0x30
-#define CTL_TRANSACTION_CTL 0x34
-#define CTL_SDIO_STATUS 0x36
-#define CTL_SDIO_IRQ_MASK 0x38
-#define CTL_RESET_SD 0xe0
-#define CTL_SDIO_REGS 0x100
-#define CTL_CLK_AND_WAIT_CTL 0x138
-#define CTL_RESET_SDIO 0x1e0
-
 static u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 {
        return readw(host->ctl + (addr << host->bus_shift));
@@ -208,26 +189,14 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)
 
 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 {
-       struct tmio_mmc_data *pdata = host->pdata;
        struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
 
-       /*
-        * Testing on sh-mobile showed that SDIO IRQs are unmasked when
-        * CTL_CLK_AND_WAIT_CTL gets written, so we have to disable the
-        * device IRQ here and restore the SDIO IRQ mask before
-        * re-enabling the device IRQ.
-        */
-       if (pdata->flags & TMIO_MMC_SDIO_IRQ)
-               disable_irq(host->irq);
        /* implicit BUG_ON(!res) */
        if (resource_size(res) > 0x100) {
                sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);
                msleep(10);
        }
-       if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
-               tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled);
-               enable_irq(host->irq);
-       }
+
        sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &
                sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
        msleep(10);
@@ -235,24 +204,17 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 
 static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
 {
-       struct tmio_mmc_data *pdata = host->pdata;
        struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
 
        sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |
                sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
        msleep(10);
-       /* see comment in tmio_mmc_clk_stop above */
-       if (pdata->flags & TMIO_MMC_SDIO_IRQ)
-               disable_irq(host->irq);
+
        /* implicit BUG_ON(!res) */
        if (resource_size(res) > 0x100) {
                sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
                msleep(10);
        }
-       if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
-               tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled);
-               enable_irq(host->irq);
-       }
 }
 
 static void tmio_mmc_reset(struct tmio_mmc_host *host)
@@ -393,7 +355,7 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
 /*
  * This chip always returns (at least?) as much data as you ask for.
  * I'm unsure what happens if you ask for less than a block. This should be
- * looked into to ensure that a funny length read doesnt hose the controller.
+ * looked into to ensure that a funny length read doesn't hose the controller.
  */
 static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
 {
@@ -765,20 +727,19 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        if (ios->clock)
                tmio_mmc_set_clock(host, ios->clock);
 
-       /* Power sequence - OFF -> ON -> UP */
-       switch (ios->power_mode) {
-       case MMC_POWER_OFF: /* power down SD bus */
-               if (host->set_pwr)
+       /* Power sequence - OFF -> UP -> ON */
+       if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {
+               /* power down SD bus */
+               if (ios->power_mode == MMC_POWER_OFF && host->set_pwr)
                        host->set_pwr(host->pdev, 0);
                tmio_mmc_clk_stop(host);
-               break;
-       case MMC_POWER_ON: /* power up SD bus */
+       } else if (ios->power_mode == MMC_POWER_UP) {
+               /* power up SD bus */
                if (host->set_pwr)
                        host->set_pwr(host->pdev, 1);
-               break;
-       case MMC_POWER_UP: /* start bus clock */
+       } else {
+               /* start bus clock */
                tmio_mmc_clk_start(host);
-               break;
        }
 
        switch (ios->bus_width) {