]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Updates to the mmc-twl4030 code
authorDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 20 Mar 2009 22:33:24 +0000 (22:33 +0000)
committerTony Lindgren <tony@atomide.com>
Mon, 23 Mar 2009 19:27:23 +0000 (12:27 -0700)
Updates to the mmc-twl4030 code:

 - Partial workaround for the bug fixed more comprehensively
   by f4223ec219313d631c3f620220ed23670c158a34 ... workaround
   applies only to MMC devs using this code.

 - Fix a cut'n'paste bug as noted by Adrian Hunter:  the intent
   was to "disable" not (re)"enable".

The reason to want this workaround is lack of faith that any
sane fix for that regulator framework bug will ever merge,
while still wanting to see things work in mainline.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/mmc-twl4030.c

index 77a12e5b4460e13ccf975d5ac137a623d8d851ad..2ff50f05f4917bb61d7c80d0ea6494a8e60eaf5a 100644 (file)
@@ -128,6 +128,27 @@ static int twl_mmc_late_init(struct device *dev)
                        reg = regulator_get(dev, "vmmc_aux");
                        hsmmc[i].vcc_aux = IS_ERR(reg) ? NULL : reg;
 
+                       /* UGLY HACK:  workaround regulator framework bugs.
+                        * When the bootloader leaves a supply active, it's
+                        * initialized with zero usecount ... and we can't
+                        * disable it without first disabling it.  Until the
+                        * framework is fixed, we need a workaround like this
+                        * (which is safe for MMC, but not in general).
+                        */
+                       if (regulator_is_enabled(hsmmc[i].vcc) > 0) {
+                               dev_warn(dev, "APPLY REGULATOR HACK for vmmc\n");
+                               regulator_enable(hsmmc[i].vcc);
+                               regulator_disable(hsmmc[i].vcc);
+                       }
+                       if (hsmmc[i].vcc_aux) {
+                               if (regulator_is_enabled(reg) > 0) {
+                                       dev_warn(dev, "APPLY REGULATOR HACK "
+                                               "for vmmc_aux\n");
+                                       regulator_enable(reg);
+                                       regulator_disable(reg);
+                               }
+                       }
+
                        break;
                }
        }
@@ -285,7 +306,7 @@ static int twl_mmc23_set_power(struct device *dev, int slot, int power_on, int v
                }
        } else {
                if (c->vcc_aux)
-                       ret = regulator_enable(c->vcc_aux);
+                       ret = regulator_disable(c->vcc_aux);
                if (ret == 0)
                        ret = mmc_regulator_set_ocr(c->vcc, 0);
        }