From patchwork Mon Feb 23 18:14:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brownell X-Patchwork-Id: 8443 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 n1NIGA7l025226 for ; Mon, 23 Feb 2009 18:16:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbZBWSQJ (ORCPT ); Mon, 23 Feb 2009 13:16:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752298AbZBWSQJ (ORCPT ); Mon, 23 Feb 2009 13:16:09 -0500 Received: from n8b.bullet.sp1.yahoo.com ([69.147.64.169]:28437 "HELO n8b.bullet.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751629AbZBWSQH (ORCPT ); Mon, 23 Feb 2009 13:16:07 -0500 Received: from [216.252.122.216] by n8.bullet.sp1.yahoo.com with NNFMP; 23 Feb 2009 18:16:06 -0000 Received: from [68.142.206.146] by t1.bullet.sp1.yahoo.com with NNFMP; 23 Feb 2009 18:16:05 -0000 X-yahoo-newman-spamcop: yes Received: from [68.142.194.243] by n19.bullet.mail.mud.yahoo.com with NNFMP; 23 Feb 2009 18:14:31 -0000 Received: from [68.142.201.240] by t1.bullet.mud.yahoo.com with NNFMP; 23 Feb 2009 18:14:31 -0000 Received: from [127.0.0.1] by omp401.mail.mud.yahoo.com with NNFMP; 23 Feb 2009 18:14:31 -0000 X-Yahoo-Newman-Id: 606748.39336.bm@omp401.mail.mud.yahoo.com Received: (qmail 34885 invoked from network); 23 Feb 2009 18:14:31 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id; b=WauGmC67X1hdR7SCOYHiM3/H705Ad3/ec27OsJkdNHUT+2bZKNFjgYCOIaNYoN9S5v3VAc7ijfd/KEMsEukioisyCtt7w2jJbeFA/UQB92xl1BiV5eWhxWtkek/fGT2+rz5akFsMdJzi3PYFqCJ6Yw97R4/09Zrwlr46PQlf3dE= ; Received: from unknown (HELO pogo) (david-b@69.226.224.20 with plain) by smtp101.sbc.mail.sp1.yahoo.com with SMTP; 23 Feb 2009 18:14:30 -0000 X-YMail-OSG: BXMThvQVM1lWDcL4FpB4a6rJ5AbkUkCfw8kAm_rpXfE3T2AEjT4oWA8ky2hvHBScdORFhJG1wyXGtqUljfLBdSuYwK6jHGi.AJoLD9oTBBm_4T0PsOq1XBSU2YPD2JCGHA9pxPQxMbYoDTEm6WpfeB94xB5t.LeHEUpPsFLF4hlm63aj1WoD_TmSNBoxFnZuoQgIGq2ZfIvedLe2BJfycm2R7wE2ChZ5DDuZzg-- X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: "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 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200902231014.26352.david-b@pacbell.net> 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 --- NOTE: won't apply to current mainline GIT. arch/arm/mach-omap2/mmc-twl4030.c | 18 ++++++++++-------- 1 file 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 --- 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,