public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hsmmc: Add MMC3 support
@ 2009-01-27  9:53 Grazvydas Ignotas
  2009-02-08 19:41 ` David Brownell
  0 siblings, 1 reply; 3+ messages in thread
From: Grazvydas Ignotas @ 2009-01-27  9:53 UTC (permalink / raw)
  To: linux-omap; +Cc: Grazvydas Ignotas

Device connected to MMC3 is assumed to be self-powered, so
set_power() function is empty. It can't be omited because
host driver requires it. Array size for hsmmc[] is specified
because hsmmc[2].name is needed for MMC3 name.

Also fix a leak which happens if invalid controller id
is passed.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
This patch applies on top of David Brownel's recent 2 patches.

 arch/arm/mach-omap2/board-omap3pandora.c |    6 ++++++
 arch/arm/mach-omap2/mmc-twl4030.c        |   18 ++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 2637641..6c1e8fe 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -159,6 +159,12 @@ static struct twl4030_hsmmc_info omap3pandora_mmc[] = {
 		.ext_clock	= 1,
 		.transceiver	= true,
 	},
+	{
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+	},
 	{}	/* Terminator */
 };
 
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index b45135e..3b98948 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -61,7 +61,7 @@ static struct twl_mmc_controller {
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
 	char		name[HSMMC_NAME_LEN];
-} hsmmc[] = {
+} hsmmc[OMAP34XX_NR_MMC] = {
 	{
 		.twl_vmmc_dev_grp		= VMMC1_DEV_GRP,
 		.twl_mmc_dedicated		= VMMC1_DEDICATED,
@@ -346,6 +346,15 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vd
 	return ret;
 }
 
+static int twl_mmc3_set_power(struct device *dev, int slot, int power_on, int vdd)
+{
+	/*
+	 * Assume MMC3 has self-powered device connected, for example on-board
+	 * chip with external power source.
+	 */
+	return 0;
+}
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
@@ -413,7 +422,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
 		/* NOTE:  we assume OMAP's MMC1 and MMC2 use
 		 * the TWL4030's VMMC1 and VMMC2, respectively;
-		 * and that OMAP's MMC3 isn't used.
+		 * and that MMC3 device has it's own power source.
 		 */
 
 		switch (c->mmc) {
@@ -428,8 +437,13 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			else
 				mmc->slots[0].ocr_mask = MMC_VDD_165_195;
 			break;
+		case 3:
+			mmc->slots[0].set_power = twl_mmc3_set_power;
+			mmc->slots[0].ocr_mask = MMC_VDD_165_195;
+			break;
 		default:
 			pr_err("MMC%d configuration not supported!\n", c->mmc);
+			kfree(mmc);
 			continue;
 		}
 		hsmmc_data[c->mmc - 1] = mmc;
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hsmmc: Add MMC3 support
  2009-01-27  9:53 [PATCH] hsmmc: Add MMC3 support Grazvydas Ignotas
@ 2009-02-08 19:41 ` David Brownell
  2009-02-20 20:16   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: David Brownell @ 2009-02-08 19:41 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: linux-omap

On Tuesday 27 January 2009, Grazvydas Ignotas wrote:
> Device connected to MMC3 is assumed to be self-powered, so
> set_power() function is empty. It can't be omited because
> host driver requires it. Array size for hsmmc[] is specified
> because hsmmc[2].name is needed for MMC3 name.

Just for the record ... this should eventually be handled
using the regulator framework, which will also help with the
decoupling of hsmmc setup from twl4030 setup.

So for example if a given slot is hooked up to an SDIO
chip with a hard-wired 3v3 supply (Pandora MMC3, and
Overo MMC2) then it'd have a fixed voltage regulator;
and the HSMMC driver would just use that.  (It would
get a "can't do that" error on disable though.)

- Dave


> 
> Also fix a leak which happens if invalid controller id
> is passed.
> 
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
> This patch applies on top of David Brownell's recent 2 patches.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hsmmc: Add MMC3 support
  2009-02-08 19:41 ` David Brownell
@ 2009-02-20 20:16   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-02-20 20:16 UTC (permalink / raw)
  To: dbrownell; +Cc: Grazvydas Ignotas, linux-omap

* David Brownell <david-b@pacbell.net> [090208 11:42]:
> On Tuesday 27 January 2009, Grazvydas Ignotas wrote:
> > Device connected to MMC3 is assumed to be self-powered, so
> > set_power() function is empty. It can't be omited because
> > host driver requires it. Array size for hsmmc[] is specified
> > because hsmmc[2].name is needed for MMC3 name.
> 
> Just for the record ... this should eventually be handled
> using the regulator framework, which will also help with the
> decoupling of hsmmc setup from twl4030 setup.
> 
> So for example if a given slot is hooked up to an SDIO
> chip with a hard-wired 3v3 supply (Pandora MMC3, and
> Overo MMC2) then it'd have a fixed voltage regulator;
> and the HSMMC driver would just use that.  (It would
> get a "can't do that" error on disable though.)

Adding to omap3-upstream and pushing to linux-omap.

Tony

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-20 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-27  9:53 [PATCH] hsmmc: Add MMC3 support Grazvydas Ignotas
2009-02-08 19:41 ` David Brownell
2009-02-20 20:16   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox