From patchwork Tue Mar 10 21:11:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 10979 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2ALBp67025043 for ; Tue, 10 Mar 2009 21:11:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755316AbZCJVLX (ORCPT ); Tue, 10 Mar 2009 17:11:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755697AbZCJVLX (ORCPT ); Tue, 10 Mar 2009 17:11:23 -0400 Received: from mho-01-bos.mailhop.org ([63.208.196.178]:57200 "EHLO mho-01-bos.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755008AbZCJVLW (ORCPT ); Tue, 10 Mar 2009 17:11:22 -0400 Received: from c-69-181-40-92.hsd1.ca.comcast.net ([69.181.40.92] helo=[127.0.0.1]) by mho-01-bos.mailhop.org with esmtpa (Exim 4.68) (envelope-from ) id 1Lh9EL-000AfL-JX; Tue, 10 Mar 2009 21:11:17 +0000 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 69.181.40.92 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18iU/eN1tYi3khEFP1PhdPw Subject: [PATCH 08/12] ARM: OMAP3: mmc-twl4030 fix for vmmc = 0 To: linux-arm-kernel@lists.arm.linux.org.uk From: Tony Lindgren Cc: David Brownell , linux-omap@vger.kernel.org Date: Tue, 10 Mar 2009 14:11:17 -0700 Message-ID: <20090310211117.16425.39829.stgit@localhost> In-Reply-To: <20090310205824.16425.97745.stgit@localhost> References: <20090310205824.16425.97745.stgit@localhost> User-Agent: StGit/0.14.3.343.g0584 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: David Brownell 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 Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/mmc-twl4030.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c index 042035c..2becaf3 100644 --- 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 *dev, int slot) 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 twl_mmc_controller *c, int vdd) /* 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 twl_mmc_controller *c, int vdd) 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,