public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: [patch 2.6.29-rc5-omap-git] mach-omap2/mmc-twl4030: fix for vmmc = 0
Date: Mon, 23 Feb 2009 10:14:26 -0800	[thread overview]
Message-ID: <200902231014.26352.david-b@pacbell.net> (raw)

From: David Brownell <dbrownell@users.sourceforge.net>

Resolve longstanding issue noted by Adrian Hunter:  confusion
between settting VSEL=0 (which is 1.8V on MMC1) and poweroff.

Also, leave VSEL alone if we're just powering the regulator off.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
NOTE: won't apply to current mainline GIT.

 arch/arm/mach-omap2/mmc-twl4030.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -178,7 +178,10 @@ static int twl_mmc_resume(struct device 
 static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
 {
 	int ret;
-	u8 vmmc, dev_grp_val;
+	u8 vmmc = 0, dev_grp_val;
+
+	if (!vdd)
+		goto doit;
 
 	if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP) {
 		/* VMMC1:  max 220 mA.  And for 8-bit mode,
@@ -203,8 +206,7 @@ static int twl_mmc_set_voltage(struct tw
 			/* error if VSIM needed */
 			break;
 		default:
-			vmmc = 0;
-			break;
+			return -EINVAL;
 		}
 	} else if (c->twl_vmmc_dev_grp == VMMC2_DEV_GRP) {
 		/* VMMC2:  max 100 mA */
@@ -230,21 +232,21 @@ static int twl_mmc_set_voltage(struct tw
 			vmmc = VMMC2_315V;
 			break;
 		default:
-			vmmc = 0;
-			break;
+			return -EINVAL;
 		}
 	} else {
-		return 0;
+		return -EINVAL;
 	}
 
-	if (vmmc)
+doit:
+	if (vdd)
 		dev_grp_val = VMMC_DEV_GRP_P1;	/* Power up */
 	else
 		dev_grp_val = LDO_CLR;		/* Power down */
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
 					dev_grp_val, c->twl_vmmc_dev_grp);
-	if (ret)
+	if (ret || !vdd)
 		return ret;
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,


             reply	other threads:[~2009-02-23 18:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23 18:14 David Brownell [this message]
2009-02-24 11:48 ` [patch 2.6.29-rc5-omap-git] mach-omap2/mmc-twl4030: fix for vmmc = 0 Adrian Hunter
2009-02-24 20:13   ` David Brownell
2009-02-25  9:45     ` Adrian Hunter
2009-02-25 10:04       ` David Brownell
2009-02-27 21:52 ` [APPLIED] " Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200902231014.26352.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox