]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: 7219/1: mmc: mmci: Change vdd_handler to a generic ios_handler
authorUlf Hansson <ulf.hansson@stericsson.com>
Tue, 13 Dec 2011 15:57:55 +0000 (16:57 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 20 Jan 2012 00:00:56 +0000 (00:00 +0000)
The purpose of the vdd_handler does not make sense. We remove it
and use a generic approach instead. A new ios_handler is added, the
purpose of which e.g. can be to control GPIO pins to a levelshifter.

Previously the vdd_handler was also used for making additional
changes to the power register bits. This option is superfluous and is
therefore removed.

Adaptaptions from the old vdd_handler to the new ios_handler is done for
mach-ux500 board, which was the only one using the vdd_handler.

This patch is based upon a patch from Sebastian Rasmussen.

Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-ux500/board-mop500-sdi.c
drivers/mmc/host/mmci.c
include/linux/amba/mmci.h

index 23be34b3bb6e8a9f2e41547c2d18b724c1a17609..4049bd7f061f2a423ca9c1e25daa997dc09c6535 100644 (file)
  * SDI 0 (MicroSD slot)
  */
 
-/* MMCIPOWER bits */
-#define MCI_DATA2DIREN         (1 << 2)
-#define MCI_CMDDIREN           (1 << 3)
-#define MCI_DATA0DIREN         (1 << 4)
-#define MCI_DATA31DIREN                (1 << 5)
-#define MCI_FBCLKEN            (1 << 7)
-
 /* GPIO pins used by the sdi0 level shifter */
 static int sdi0_en = -1;
 static int sdi0_vsel = -1;
 
-static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd,
-                                  unsigned char power_mode)
+static int mop500_sdi0_ios_handler(struct device *dev, struct mmc_ios *ios)
 {
-       switch (power_mode) {
+       switch (ios->power_mode) {
        case MMC_POWER_UP:
        case MMC_POWER_ON:
                /*
@@ -65,8 +57,7 @@ static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd,
                break;
        }
 
-       return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN |
-              MCI_DATA2DIREN | MCI_DATA31DIREN;
+       return 0;
 }
 
 #ifdef CONFIG_STE_DMA40
@@ -90,13 +81,17 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
 #endif
 
 static struct mmci_platform_data mop500_sdi0_data = {
-       .vdd_handler    = mop500_sdi0_vdd_handler,
+       .ios_handler    = mop500_sdi0_ios_handler,
        .ocr_mask       = MMC_VDD_29_30,
        .f_max          = 50000000,
        .capabilities   = MMC_CAP_4_BIT_DATA |
                                MMC_CAP_SD_HIGHSPEED |
                                MMC_CAP_MMC_HIGHSPEED,
        .gpio_wp        = -1,
+       .sigdir         = MCI_ST_FBCLKEN |
+                               MCI_ST_CMDDIREN |
+                               MCI_ST_DATA0DIREN |
+                               MCI_ST_DATA2DIREN,
 #ifdef CONFIG_STE_DMA40
        .dma_filter     = stedma40_filter,
        .dma_rx_param   = &mop500_sdi0_dma_cfg_rx,
index eb11ce61941ddcdedb796c26dc0894898e9fa2b5..0af1507d15c0ed5e1802afd7f10576775da989a9 100644 (file)
@@ -1026,6 +1026,10 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        unsigned long flags;
        int ret;
 
+       if (host->plat->ios_handler &&
+               host->plat->ios_handler(mmc_dev(mmc), ios))
+                       dev_err(mmc_dev(mmc), "platform ios_handler failed\n");
+
        switch (ios->power_mode) {
        case MMC_POWER_OFF:
                if (host->vcc)
@@ -1045,10 +1049,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                                return;
                        }
                }
-               if (host->plat->vdd_handler)
-                       pwr |= host->plat->vdd_handler(mmc_dev(mmc), ios->vdd,
-                                                      ios->power_mode);
-
                /*
                 * The ST Micro variant doesn't have the PL180s MCI_PWR_UP
                 * and instead uses MCI_PWR_ON so apply whatever value is
index b51bf5fa85f89a5b6889837d51292cf263b17abd..32a89cf5ec4589b51734f6e65b91a5e9dd6ac53f 100644 (file)
@@ -31,7 +31,8 @@ struct dma_chan;
  * @ocr_mask: available voltages on the 4 pins from the block, this
  * is ignored if a regulator is used, see the MMC_VDD_* masks in
  * mmc/host.h
- * @vdd_handler: a callback function to translate a MMC_VDD_*
+ * @ios_handler: a callback function to act on specfic ios changes,
+ * used for example to control a levelshifter
  * mask into a value to be binary (or set some other custom bits
  * in MMCIPWR) or:ed and written into the MMCIPWR register of the
  * block.  May also control external power based on the power_mode.
@@ -61,8 +62,7 @@ struct dma_chan;
 struct mmci_platform_data {
        unsigned int f_max;
        unsigned int ocr_mask;
-       u32 (*vdd_handler)(struct device *, unsigned int vdd,
-                          unsigned char power_mode);
+       int (*ios_handler)(struct device *, struct mmc_ios *);
        unsigned int (*status)(struct device *);
        int     gpio_wp;
        int     gpio_cd;