[PATCH 1/2] MMC/pxamci: workaround regulator framework bugs

From: Daniel Ribeiro
Date: Fri Jun 26 2009 - 19:08:28 EST


The voltage regulator framework can't sanely deal with voltage
regulators which are left enabled by the bootloader. We workaround this
by forcing an enable()/disable() pair so it has a sane use_count.

Signed-off-by: Daniel Ribeiro <drwyrm@xxxxxxxxx>

---
drivers/mmc/host/pxamci.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index d7d7109..20fb3da 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -80,6 +80,18 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
if (IS_ERR(host->vcc))
host->vcc = NULL;
else {
+ /*
+ * When the bootloader leaves a supply active, it's
+ * initialized with zero usecount ... and we can't
+ * disable it without first enabling 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(host->vcc) > 0) {
+ regulator_enable(host->vcc);
+ regulator_disable(host->vcc);
+ }
+
host->mmc->ocr_avail = mmc_regulator_get_ocrmask(host->vcc);
if (host->pdata && host->pdata->ocr_mask)
dev_warn(mmc_dev(host->mmc),
--
tg: (87da0bf..) mmc/workaround-regulator-bugs (depends on: mmc/pxamci-regulator-support)

--
Daniel Ribeiro

Attachment: signature.asc
Description: Esta =?ISO-8859-1?Q?=E9?= uma parte de mensagemassinada digitalmente