diff mbox

[2/6] OMAP: mmc-twl4030 support VSIM is VMMC2_IO

Message ID 20090310093309.16889.79381.sendpatchset@ahunter-laptop (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Adrian Hunter March 10, 2009, 9:33 a.m. UTC
From 2f6a22e9091a09fb3cbb720356116035611636b2 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <adrian.hunter@nokia.com>
Date: Fri, 23 Jan 2009 11:45:49 +0200
Subject: [PATCH] OMAP: mmc-twl4030 support VSIM is VMMC2_IO

eMMC has two voltage lines, one for I/O and one for the
NAND core.  This patch allows VSIM and VMMC2 respectively,
to be used for those two.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
 arch/arm/mach-omap2/mmc-twl4030.c |   25 ++++++++++++++++++++++++-
 arch/arm/mach-omap2/mmc-twl4030.h |    1 +
 2 files changed, 25 insertions(+), 1 deletions(-)

Comments

David Brownell March 10, 2009, 5:46 p.m. UTC | #1
On Tuesday 10 March 2009, Adrian Hunter wrote:
> @@ -61,6 +65,7 @@ static struct twl_mmc_controller {
>         struct omap_mmc_platform_data   *mmc;
>         u8              twl_vmmc_dev_grp;
>         u8              twl_mmc_dedicated;
> +       bool            vsim_18v;
>         char            name[HSMMC_NAME_LEN + 1];
>  } hsmmc[OMAP34XX_NR_MMC] = {
>         {

I have an alternate approach to your patches #2, and #6 ...
basically, as part of switching the mmc-twl4030 glue over to
the regulator framework, each MMC device can have two named
supplies.  (And the glue should work with PMICs other than
just the twl4030 family chips.)

So an eMMC chip with both power rails switchable would set up
one for Vcc, and a second for VccQ ... which need not be VSIM,
and need not even use a twl4030.  MMC2 and MMC3 would be able
to switch VccQ on after Vcc, for eMMC ... or similarly for an
SDIO chip with a switchable regulator.

So your #2 patch won't be needed, since the second supply would
be handled in a more general way; ditto #6.  Some of the other
patches will also be affected.

I'll send patches implementing this as soon as I get them
working on one more board.

- Dave

--
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 mbox

Patch

diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index aeaab5a..736b039 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -52,6 +52,10 @@ 
 
 #define VMMC_DEV_GRP_P1		0x20
 
+#define VSIM_DEV_GRP		0x37
+#define VSIM_18V		0x03
+#define VSIM_DEDICATED		0x3A
+
 static u16 control_pbias_offset;
 static u16 control_devconf1_offset;
 
@@ -61,6 +65,7 @@  static struct twl_mmc_controller {
 	struct omap_mmc_platform_data	*mmc;
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
+	bool		vsim_18v;
 	char		name[HSMMC_NAME_LEN + 1];
 } hsmmc[OMAP34XX_NR_MMC] = {
 	{
@@ -251,6 +256,19 @@  doit:
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
 					vmmc, c->twl_mmc_dedicated);
+	if (ret)
+		return ret;
+
+	if (c->vsim_18v) {
+		u8 vsim = vmmc ? VSIM_18V : 0;
+
+		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+					   dev_grp_val, VSIM_DEV_GRP);
+		if (ret)
+			return ret;
+		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+					   vsim, VSIM_DEDICATED);
+	}
 
 	return ret;
 }
@@ -437,7 +455,12 @@  void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			mmc->slots[0].set_power = twl_mmc2_set_power;
 			if (c->transceiver)
 				mmc->slots[0].ocr_mask = MMC2_OCR;
-			else
+			else if (c->vsim_18v) {
+				mmc->slots[0].ocr_mask = MMC_VDD_27_28 |
+					MMC_VDD_28_29 | MMC_VDD_29_30 |
+					MMC_VDD_30_31 | MMC_VDD_31_32;
+				twl->vsim_18v = true;
+			} else
 				mmc->slots[0].ocr_mask = MMC_VDD_165_195;
 			break;
 		case 3:
diff --git a/arch/arm/mach-omap2/mmc-twl4030.h b/arch/arm/mach-omap2/mmc-twl4030.h
index 21d3572..087a969 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.h
+++ b/arch/arm/mach-omap2/mmc-twl4030.h
@@ -11,6 +11,7 @@  struct twl4030_hsmmc_info {
 	u8	wires;		/* 1/4/8 wires */
 	bool	transceiver;	/* MMC-2 option */
 	bool	ext_clock;	/* use external pin for input clock */
+	bool	vsim_18v;	/* MMC-2 option */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
 	struct device *dev;	/* returned: pointer to mmc adapter */