]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
hsmmc: Add MMC3 support
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 27 Jan 2009 09:53:42 +0000 (11:53 +0200)
committerTony Lindgren <tony@atomide.com>
Fri, 20 Feb 2009 20:15:28 +0000 (12:15 -0800)
Device connected to MMC3 is assumed to be self-powered, so
set_power() function is empty. It can't be omited because
host driver requires it. Array size for hsmmc[] is specified
because hsmmc[2].name is needed for MMC3 name.

Also fix a leak which happens if invalid controller id
is passed.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-omap3pandora.c
arch/arm/mach-omap2/mmc-twl4030.c

index b8a78c0c59618fdd7b5ed7144a26d46bdd8b5630..c67f62ff8850976a9da45820f6ed19493323b0ae 100644 (file)
@@ -158,6 +158,12 @@ static struct twl4030_hsmmc_info omap3pandora_mmc[] = {
                .ext_clock      = 1,
                .transceiver    = true,
        },
+       {
+               .mmc            = 3,
+               .wires          = 4,
+               .gpio_cd        = -EINVAL,
+               .gpio_wp        = -EINVAL,
+       },
        {}      /* Terminator */
 };
 
index 182c7a3332dc4f967362015f2592d7f210ed00ca..38a7c5ef10118c01f3f83132f8222e498dd438f2 100644 (file)
@@ -62,7 +62,7 @@ static struct twl_mmc_controller {
        u8              twl_vmmc_dev_grp;
        u8              twl_mmc_dedicated;
        char            name[HSMMC_NAME_LEN];
-} hsmmc[] = {
+} hsmmc[OMAP34XX_NR_MMC] = {
        {
                .twl_vmmc_dev_grp               = VMMC1_DEV_GRP,
                .twl_mmc_dedicated              = VMMC1_DEDICATED,
@@ -347,6 +347,15 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vd
        return ret;
 }
 
+static int twl_mmc3_set_power(struct device *dev, int slot, int power_on, int vdd)
+{
+       /*
+        * Assume MMC3 has self-powered device connected, for example on-board
+        * chip with external power source.
+        */
+       return 0;
+}
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
@@ -414,7 +423,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
                /* NOTE:  we assume OMAP's MMC1 and MMC2 use
                 * the TWL4030's VMMC1 and VMMC2, respectively;
-                * and that OMAP's MMC3 isn't used.
+                * and that MMC3 device has it's own power source.
                 */
 
                switch (c->mmc) {
@@ -429,8 +438,13 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
                        else
                                mmc->slots[0].ocr_mask = MMC_VDD_165_195;
                        break;
+               case 3:
+                       mmc->slots[0].set_power = twl_mmc3_set_power;
+                       mmc->slots[0].ocr_mask = MMC_VDD_165_195;
+                       break;
                default:
                        pr_err("MMC%d configuration not supported!\n", c->mmc);
+                       kfree(mmc);
                        continue;
                }
                hsmmc_data[c->mmc - 1] = mmc;