]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/mmc-twl4030.c
Remove extra code in arch/arm/*omap* to move it into omap-pool branch
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / mmc-twl4030.c
index 33e5b9b7da4c814379be6d29bcf10a3ff558c694..dc40b3e72206080164b1c1f5b17def1f4d211688 100644 (file)
@@ -61,7 +61,7 @@ static struct twl_mmc_controller {
        struct omap_mmc_platform_data   *mmc;
        u8              twl_vmmc_dev_grp;
        u8              twl_mmc_dedicated;
-       char            name[HSMMC_NAME_LEN];
+       char            name[HSMMC_NAME_LEN + 1];
 } hsmmc[OMAP34XX_NR_MMC] = {
        {
                .twl_vmmc_dev_grp               = VMMC1_DEV_GRP,
@@ -100,6 +100,14 @@ static int twl_mmc_get_ro(struct device *dev, int slot)
        return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
 }
 
+static int twl_mmc_get_cover_state(struct device *dev, int slot)
+{
+       struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+       /* NOTE: assumes card detect signal is active-low */
+       return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+}
+
 /*
  * MMC Slot Initialization.
  */
@@ -349,7 +357,8 @@ 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)
+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
@@ -393,7 +402,11 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
                        return;
                }
 
-               sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+               if (c->name)
+                       strncpy(twl->name, c->name, HSMMC_NAME_LEN);
+               else
+                       snprintf(twl->name, ARRAY_SIZE(twl->name),
+                               "mmc%islot%i", c->mmc, 1);
                mmc->slots[0].name = twl->name;
                mmc->nr_slots = 1;
                mmc->slots[0].wires = c->wires;
@@ -409,7 +422,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
                        mmc->slots[0].switch_pin = c->gpio_cd;
                        mmc->slots[0].card_detect_irq = gpio_to_irq(c->gpio_cd);
-                       mmc->slots[0].card_detect = twl_mmc_card_detect;
+                       if (c->cover_only)
+                               mmc->slots[0].get_cover_state = twl_mmc_get_cover_state;
+                       else
+                               mmc->slots[0].card_detect = twl_mmc_card_detect;
                } else
                        mmc->slots[0].switch_pin = -EINVAL;