public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Init updates for hsmmc, also second controller
@ 2008-10-31  2:04 Tony Lindgren
  2008-10-31  2:04 ` [PATCH 1/4] HSMMC: Make hsmmc use omap_ctrl_read/write and existing defines Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31  2:04 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

Hi all,

I've been preparing the hsmmc code for mainline so we can mount root.
Here are the related changes for linux-omap for initializing the hsmmc.

This also makes the second controller work, at least on 3430sdp.

If anybody is interested in using the hsmmc with mainline, I've posted
my current patch series to:

http://www.muru.com/linux/omap/patches/hsmmc-2008-10-30.tar.gz

I'll be feeding these patches upstream, but that won't hit mainline
until next merge window.

Regards,

Tony

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

* [PATCH 1/4] HSMMC: Make hsmmc use omap_ctrl_read/write and existing defines
  2008-10-31  2:04 [PATCH 0/4] Init updates for hsmmc, also second controller Tony Lindgren
@ 2008-10-31  2:04 ` Tony Lindgren
  2008-10-31  2:04   ` [PATCH 2/4] HSMMC: Fix voltage defines, make card detect gpio controller specific Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31  2:04 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

Make hsmmc use omap_ctrl_read/write and existing defines

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/hsmmc.c               |  116 +++++++++++++++-------------
 arch/arm/plat-omap/include/mach/control.h |   17 ++++
 2 files changed, 79 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b1b18e3..b5ef975 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -19,6 +19,7 @@
 #include <linux/i2c/twl4030.h>
 
 #include <mach/hardware.h>
+#include <mach/control.h>
 #include <mach/mmc.h>
 #include <mach/board.h>
 
@@ -35,16 +36,22 @@
 #define VSEL_S2_CLR		0x40
 #define GPIO_0_BIT_POS		(1 << 0)
 
-#define OMAP2_CONTROL_DEVCONF0	0x48002274
-#define OMAP2_CONTROL_DEVCONF1	0x490022E8
-
-#define OMAP2_CONTROL_DEVCONF0_LBCLK	(1 << 24)
-#define OMAP2_CONTROL_DEVCONF1_ACTOV	(1 << 31)
-
-#define OMAP2_CONTROL_PBIAS_VMODE	(1 << 0)
-#define OMAP2_CONTROL_PBIAS_PWRDNZ	(1 << 1)
-#define OMAP2_CONTROL_PBIAS_SCTRL	(1 << 2)
+static u16 control_pbias_offset;
 
+static struct hsmmc_controller {
+	u16		control_devconf_offset;
+	u32		devconf_loopback_clock;
+	int		mmc1_cd_gpio;
+} hsmmc[] = {
+	{
+		.control_devconf_offset		= OMAP2_CONTROL_DEVCONF0,
+		.devconf_loopback_clock		= OMAP2_MMCSDIO1ADPCLKISEL,
+	},
+	{
+		/* control_devconf_offset set dynamically */
+		.devconf_loopback_clock		= OMAP2_MMCSDIO2ADPCLKISEL,
+	},
+};
 
 static const int mmc1_cd_gpio = OMAP_MAX_GPIO_LINES;		/* HACK!! */
 
@@ -140,53 +147,45 @@ static int hsmmc_resume(struct device *dev, int slot)
 
 #endif
 
-static int hsmmc_set_power(struct device *dev, int slot, int power_on,
+static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 				int vdd)
 {
-	u32 vdd_sel = 0, devconf = 0, reg = 0;
+	u32 reg;
 	int ret = 0;
-
-	/* REVISIT: Using address directly till the control.h defines
-	 * are settled.
-	 */
-#if defined(CONFIG_ARCH_OMAP2430)
-	#define OMAP2_CONTROL_PBIAS 0x490024A0
-#else
-	#define OMAP2_CONTROL_PBIAS 0x48002520
-#endif
+	u16 control_devconf_offset = hsmmc[0].control_devconf_offset;
 
 	if (power_on) {
-		if (cpu_is_omap24xx())
-			devconf = omap_readl(OMAP2_CONTROL_DEVCONF1);
-		else
-			devconf = omap_readl(OMAP2_CONTROL_DEVCONF0);
+		u32 vdd_sel = 0;
 
 		switch (1 << vdd) {
 		case MMC_VDD_33_34:
 		case MMC_VDD_32_33:
 			vdd_sel = VSEL_3V;
-			if (cpu_is_omap24xx())
-				devconf |= OMAP2_CONTROL_DEVCONF1_ACTOV;
 			break;
 		case MMC_VDD_165_195:
 			vdd_sel = VSEL_18V;
-			if (cpu_is_omap24xx())
-				devconf &= ~OMAP2_CONTROL_DEVCONF1_ACTOV;
 		}
 
-		if (cpu_is_omap24xx())
-			omap_writel(devconf, OMAP2_CONTROL_DEVCONF1);
-		else
-			omap_writel(devconf | OMAP2_CONTROL_DEVCONF0_LBCLK,
-				    OMAP2_CONTROL_DEVCONF0);
+		if (cpu_is_omap2430()) {
+			reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
+			if (vdd_sel == VSEL_3V)
+				reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
+			else
+				reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
+			omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
+		}
 
-		reg = omap_readl(OMAP2_CONTROL_PBIAS);
-		reg |= OMAP2_CONTROL_PBIAS_SCTRL;
-		omap_writel(reg, OMAP2_CONTROL_PBIAS);
+		/* REVISIT: Loop back clock not needed for 2430? */
+		if (!cpu_is_omap2430()) {
+			reg = omap_ctrl_readl(control_devconf_offset);
+			reg |= OMAP2_MMCSDIO1ADPCLKISEL;
+			omap_ctrl_writel(reg, control_devconf_offset);
+		}
 
-		reg = omap_readl(OMAP2_CONTROL_PBIAS);
-		reg &= ~OMAP2_CONTROL_PBIAS_PWRDNZ;
-		omap_writel(reg, OMAP2_CONTROL_PBIAS);
+		reg = omap_ctrl_readl(control_pbias_offset);
+		reg |= OMAP2_PBIASSPEEDCTRL0;
+		reg &= ~OMAP2_PBIASLITEPWRDNZ0;
+		omap_ctrl_writel(reg, control_pbias_offset);
 
 		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
 						P1_DEV_GRP, VMMC1_DEV_GRP);
@@ -198,15 +197,16 @@ static int hsmmc_set_power(struct device *dev, int slot, int power_on,
 		if (ret)
 			goto err;
 
+		/* 100ms delay required for PBIAS configuration */
 		msleep(100);
-		reg = omap_readl(OMAP2_CONTROL_PBIAS);
-		reg |= (OMAP2_CONTROL_PBIAS_SCTRL |
-			OMAP2_CONTROL_PBIAS_PWRDNZ);
+
+		reg = omap_ctrl_readl(control_pbias_offset);
+		reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
 		if (vdd_sel == VSEL_18V)
-			reg &= ~OMAP2_CONTROL_PBIAS_VMODE;
+			reg &= ~OMAP2_PBIASLITEVMODE0;
 		else
-			reg |= OMAP2_CONTROL_PBIAS_VMODE;
-		omap_writel(reg, OMAP2_CONTROL_PBIAS);
+			reg |= OMAP2_PBIASLITEVMODE0;
+		omap_ctrl_writel(reg, control_pbias_offset);
 
 		return ret;
 
@@ -214,9 +214,9 @@ static int hsmmc_set_power(struct device *dev, int slot, int power_on,
 		/* Power OFF */
 
 		/* For MMC1, Toggle PBIAS before every power up sequence */
-		reg = omap_readl(OMAP2_CONTROL_PBIAS);
-		reg &= ~OMAP2_CONTROL_PBIAS_PWRDNZ;
-		omap_writel(reg, OMAP2_CONTROL_PBIAS);
+		reg = omap_ctrl_readl(control_pbias_offset);
+		reg &= ~OMAP2_PBIASLITEPWRDNZ0;
+		omap_ctrl_writel(reg, control_pbias_offset);
 
 		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
 						LDO_CLR, VMMC1_DEV_GRP);
@@ -230,11 +230,11 @@ static int hsmmc_set_power(struct device *dev, int slot, int power_on,
 
 		/* 100ms delay required for PBIAS configuration */
 		msleep(100);
-		reg = omap_readl(OMAP2_CONTROL_PBIAS);
-		reg |= (OMAP2_CONTROL_PBIAS_VMODE |
-			OMAP2_CONTROL_PBIAS_PWRDNZ |
-			OMAP2_CONTROL_PBIAS_SCTRL);
-		omap_writel(reg, OMAP2_CONTROL_PBIAS);
+
+		reg = omap_ctrl_readl(control_pbias_offset);
+		reg |= (OMAP2_PBIASSPEEDCTRL0 | OMAP2_PBIASLITEPWRDNZ0 |
+			OMAP2_PBIASLITEVMODE0);
+		omap_ctrl_writel(reg, control_pbias_offset);
 	}
 
 	return 0;
@@ -254,7 +254,7 @@ static struct omap_mmc_platform_data mmc1_data = {
 	.dma_mask			= 0xffffffff,
 	.slots[0] = {
 		.wire4			= 1,
-		.set_power		= hsmmc_set_power,
+		.set_power		= hsmmc1_set_power,
 		.ocr_mask		= MMC_VDD_32_33 | MMC_VDD_33_34 |
 						MMC_VDD_165_195,
 		.name			= "first slot",
@@ -268,6 +268,14 @@ static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC];
 
 void __init hsmmc_init(void)
 {
+	if (cpu_is_omap2430()) {
+		control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
+		hsmmc[1].control_devconf_offset = OMAP243X_CONTROL_DEVCONF1;
+	} else {
+		control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
+		hsmmc[1].control_devconf_offset = OMAP343X_CONTROL_DEVCONF1;
+	}
+
 	hsmmc_data[0] = &mmc1_data;
 	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
 }
diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
index 9ca0e08..b950e1e 100644
--- a/arch/arm/plat-omap/include/mach/control.h
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -74,6 +74,7 @@
 #define OMAP243X_CONTROL_IVA2_BOOTADDR	(OMAP2_CONTROL_GENERAL + 0x0190)
 #define OMAP243X_CONTROL_IVA2_BOOTMOD	(OMAP2_CONTROL_GENERAL + 0x0194)
 #define OMAP243X_CONTROL_IVA2_GEMCFG	(OMAP2_CONTROL_GENERAL + 0x0198)
+#define OMAP243X_CONTROL_PBIAS_LITE	(OMAP2_CONTROL_GENERAL + 0x0230)
 
 /* 24xx-only CONTROL_GENERAL register offsets */
 #define OMAP24XX_CONTROL_DEBOBS		(OMAP2_CONTROL_GENERAL + 0x0000)
@@ -149,6 +150,7 @@
 #define OMAP343X_CONTROL_FUSE_SR	(OMAP2_CONTROL_GENERAL + 0x0130)
 #define OMAP343X_CONTROL_IVA2_BOOTADDR	(OMAP2_CONTROL_GENERAL + 0x0190)
 #define OMAP343X_CONTROL_IVA2_BOOTMOD	(OMAP2_CONTROL_GENERAL + 0x0194)
+#define OMAP343X_CONTROL_PBIAS_LITE	(OMAP2_CONTROL_GENERAL + 0x02b0)
 #define OMAP343X_CONTROL_TEMP_SENSOR	(OMAP2_CONTROL_GENERAL + 0x02b4)
 
 /*
@@ -163,11 +165,14 @@
  * and the security mode (secure, non-secure, don't care)
  */
 /* CONTROL_DEVCONF0 bits */
+#define OMAP2_MMCSDIO1ADPCLKISEL	(1 << 24) /* MMC1 loop back clock */
 #define OMAP24XX_USBSTANDBYCTRL		(1 << 15)
 #define OMAP2_MCBSP2_CLKS_MASK		(1 << 6)
 #define OMAP2_MCBSP1_CLKS_MASK		(1 << 2)
 
 /* CONTROL_DEVCONF1 bits */
+#define OMAP243X_MMC1_ACTIVE_OVERWRITE	(1 << 31)
+#define OMAP2_MMCSDIO2ADPCLKISEL	(1 << 6) /* MMC2 loop back clock */
 #define OMAP2_MCBSP5_CLKS_MASK		(1 << 4) /* > 242x */
 #define OMAP2_MCBSP4_CLKS_MASK		(1 << 2) /* > 242x */
 #define OMAP2_MCBSP3_CLKS_MASK		(1 << 0) /* > 242x */
@@ -191,6 +196,18 @@
 #define OMAP343X_SR1_SENPENABLE_MASK	(0x3 << 0)
 #define OMAP343X_SR1_SENPENABLE_SHIFT	0
 
+/* CONTROL_PBIAS_LITE bits */
+#define OMAP343X_PBIASLITESUPPLY_HIGH1	(1 << 15)
+#define OMAP343X_PBIASLITEVMODEERROR1	(1 << 11)
+#define OMAP343X_PBIASSPEEDCTRL1	(1 << 10)
+#define OMAP343X_PBIASLITEPWRDNZ1	(1 << 9)
+#define OMAP343X_PBIASLITEVMODE1	(1 << 8)
+#define OMAP343X_PBIASLITESUPPLY_HIGH0	(1 << 7)
+#define OMAP343X_PBIASLITEVMODEERROR0	(1 << 3)
+#define OMAP2_PBIASSPEEDCTRL0		(1 << 2)
+#define OMAP2_PBIASLITEPWRDNZ0		(1 << 1)
+#define OMAP2_PBIASLITEVMODE0		(1 << 0)
+
 #ifndef __ASSEMBLY__
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 extern void __iomem *omap_ctrl_base_get(void);
-- 
1.5.6.rc3.21.g8c6b5


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

* [PATCH 2/4] HSMMC: Fix voltage defines, make card detect gpio controller specific
  2008-10-31  2:04 ` [PATCH 1/4] HSMMC: Make hsmmc use omap_ctrl_read/write and existing defines Tony Lindgren
@ 2008-10-31  2:04   ` Tony Lindgren
  2008-10-31  2:04     ` [PATCH 3/4] HSMMC: Add support for the second controller Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31  2:04 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

Fix voltage defines, make card detect gpio controller specific

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/hsmmc.c |   60 ++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b5ef975..f711d7b 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -25,27 +25,32 @@
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-#define VMMC1_DEV_GRP		0x27
-#define P1_DEV_GRP		0x20
-#define VMMC1_DEDICATED		0x2A
-#define VSEL_3V			0x02
-#define VSEL_18V		0x00
 #define TWL_GPIO_IMR1A		0x1C
 #define TWL_GPIO_ISR1A		0x19
 #define LDO_CLR			0x00
 #define VSEL_S2_CLR		0x40
 #define GPIO_0_BIT_POS		(1 << 0)
 
+#define VMMC1_DEV_GRP		0x27
+#define VMMC1_DEV_GRP_P1	0x20
+#define VMMC1_DEDICATED		0x2A
+#define VMMC1_CLR		0x00
+#define VMMC1_315V		0x03
+#define VMMC1_300V		0x02
+#define VMMC1_285V		0x01
+#define VMMC1_185V		0x00
+
 static u16 control_pbias_offset;
 
 static struct hsmmc_controller {
 	u16		control_devconf_offset;
 	u32		devconf_loopback_clock;
-	int		mmc1_cd_gpio;
+	int		card_detect_gpio;
 } hsmmc[] = {
 	{
 		.control_devconf_offset		= OMAP2_CONTROL_DEVCONF0,
 		.devconf_loopback_clock		= OMAP2_MMCSDIO1ADPCLKISEL,
+		.card_detect_gpio		= OMAP_MAX_GPIO_LINES,
 	},
 	{
 		/* control_devconf_offset set dynamically */
@@ -53,24 +58,22 @@ static struct hsmmc_controller {
 	},
 };
 
-static const int mmc1_cd_gpio = OMAP_MAX_GPIO_LINES;		/* HACK!! */
-
-static int hsmmc_card_detect(int irq)
+static int hsmmc1_card_detect(int irq)
 {
-	return gpio_get_value_cansleep(mmc1_cd_gpio);
+	return gpio_get_value_cansleep(hsmmc[0].card_detect_gpio);
 }
 
 /*
  * MMC Slot Initialization.
  */
-static int hsmmc_late_init(struct device *dev)
+static int hsmmc1_late_init(struct device *dev)
 {
 	int ret = 0;
 
 	/*
 	 * Configure TWL4030 GPIO parameters for MMC hotplug irq
 	 */
-	ret = gpio_request(mmc1_cd_gpio, "mmc0_cd");
+	ret = gpio_request(hsmmc[0].card_detect_gpio, "mmc0_cd");
 	if (ret)
 		goto err;
 
@@ -85,9 +88,9 @@ err:
 	return ret;
 }
 
-static void hsmmc_cleanup(struct device *dev)
+static void hsmmc1_cleanup(struct device *dev)
 {
-	gpio_free(mmc1_cd_gpio);
+	gpio_free(hsmmc[0].card_detect_gpio);
 }
 
 #ifdef CONFIG_PM
@@ -125,7 +128,7 @@ err:
 	return ret;
 }
 
-static int hsmmc_suspend(struct device *dev, int slot)
+static int hsmmc1_suspend(struct device *dev, int slot)
 {
 	int ret = 0;
 
@@ -135,7 +138,7 @@ static int hsmmc_suspend(struct device *dev, int slot)
 	return ret;
 }
 
-static int hsmmc_resume(struct device *dev, int slot)
+static int hsmmc1_resume(struct device *dev, int slot)
 {
 	int ret = 0;
 
@@ -160,15 +163,20 @@ static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 		switch (1 << vdd) {
 		case MMC_VDD_33_34:
 		case MMC_VDD_32_33:
-			vdd_sel = VSEL_3V;
+		case MMC_VDD_31_32:
+		case MMC_VDD_30_31:
+			vdd_sel = VMMC1_315V;
+			break;
+		case MMC_VDD_29_30:
+			vdd_sel = VMMC1_300V;
 			break;
 		case MMC_VDD_165_195:
-			vdd_sel = VSEL_18V;
+			vdd_sel = VMMC1_185V;
 		}
 
 		if (cpu_is_omap2430()) {
 			reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
-			if (vdd_sel == VSEL_3V)
+			if (vdd_sel >= VMMC1_300V)
 				reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
 			else
 				reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
@@ -188,7 +196,7 @@ static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 		omap_ctrl_writel(reg, control_pbias_offset);
 
 		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-						P1_DEV_GRP, VMMC1_DEV_GRP);
+						VMMC1_DEV_GRP_P1, VMMC1_DEV_GRP);
 		if (ret)
 			goto err;
 
@@ -202,7 +210,7 @@ static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 
 		reg = omap_ctrl_readl(control_pbias_offset);
 		reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
-		if (vdd_sel == VSEL_18V)
+		if (vdd_sel == VMMC1_185V)
 			reg &= ~OMAP2_PBIASLITEVMODE0;
 		else
 			reg |= OMAP2_PBIASLITEVMODE0;
@@ -245,11 +253,11 @@ err:
 
 static struct omap_mmc_platform_data mmc1_data = {
 	.nr_slots			= 1,
-	.init				= hsmmc_late_init,
-	.cleanup			= hsmmc_cleanup,
+	.init				= hsmmc1_late_init,
+	.cleanup			= hsmmc1_cleanup,
 #ifdef CONFIG_PM
-	.suspend			= hsmmc_suspend,
-	.resume				= hsmmc_resume,
+	.suspend			= hsmmc1_suspend,
+	.resume				= hsmmc1_resume,
 #endif
 	.dma_mask			= 0xffffffff,
 	.slots[0] = {
@@ -260,7 +268,7 @@ static struct omap_mmc_platform_data mmc1_data = {
 		.name			= "first slot",
 
 		.card_detect_irq        = TWL4030_GPIO_IRQ_NO(0),
-		.card_detect            = hsmmc_card_detect,
+		.card_detect            = hsmmc1_card_detect,
 	},
 };
 
-- 
1.5.6.rc3.21.g8c6b5


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

* [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  2:04   ` [PATCH 2/4] HSMMC: Fix voltage defines, make card detect gpio controller specific Tony Lindgren
@ 2008-10-31  2:04     ` Tony Lindgren
  2008-10-31  2:04       ` [PATCH 4/4] HSMMC: Misc clean-up for hsmmc init Tony Lindgren
  2008-10-31  3:12       ` [PATCH 3/4] HSMMC: Add support for the second controller David Brownell
  0 siblings, 2 replies; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31  2:04 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

Add support for the second controller hopefully in a generic way.
Also put the twl4030 specific voltage configuration into a separate
function.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-2430sdp.c      |    4 +-
 arch/arm/mach-omap2/board-3430sdp.c      |    4 +-
 arch/arm/mach-omap2/board-ldp.c          |    4 +-
 arch/arm/mach-omap2/board-omap2evm.c     |    4 +-
 arch/arm/mach-omap2/board-omap3beagle.c  |    4 +-
 arch/arm/mach-omap2/board-omap3evm.c     |    4 +-
 arch/arm/mach-omap2/board-omap3pandora.c |    4 +-
 arch/arm/mach-omap2/board-overo.c        |    4 +-
 arch/arm/mach-omap2/hsmmc.c              |  192 +++++++++++++++++++++---------
 arch/arm/plat-omap/include/mach/hsmmc.h  |   35 ------
 arch/arm/plat-omap/include/mach/mmc.h    |    9 ++-
 11 files changed, 160 insertions(+), 108 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/mach/hsmmc.h

diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index cea2540..8532ef3 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -36,7 +36,7 @@
 #include <mach/mux.h>
 #include <mach/board.h>
 #include <mach/usb-musb.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/common.h>
 #include <mach/keypad.h>
 #include <mach/gpmc.h>
@@ -404,7 +404,7 @@ static void __init omap_2430sdp_init(void)
 	spi_register_board_info(sdp2430_spi_board_info,
 				ARRAY_SIZE(sdp2430_spi_board_info));
 	ads7846_dev_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 
 	/* turn off secondary LCD backlight */
 	omap_set_gpio_direction(SECONDARY_LCD_GPIO, 0);
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 8773698..0221b66 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -35,7 +35,7 @@
 #include <mach/board.h>
 #include <mach/usb-musb.h>
 #include <mach/usb-ehci.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/common.h>
 #include <mach/keypad.h>
 #include <mach/dma.h>
@@ -465,7 +465,7 @@ static void __init omap_3430sdp_init(void)
 	omap_serial_init();
 	usb_musb_init();
 	usb_ehci_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1 | HSMMC2);
 }
 
 static void __init omap_3430sdp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d4d4e90..387bd41 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -34,7 +34,7 @@
 #include <mach/board.h>
 #include <mach/common.h>
 #include <mach/gpmc.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/usb-musb.h>
 
 #include <asm/io.h>
@@ -341,7 +341,7 @@ static void __init omap_ldp_init(void)
 	ads7846_dev_init();
 	omap_serial_init();
 	usb_musb_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 }
 
 static void __init omap_ldp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-omap2evm.c b/arch/arm/mach-omap2/board-omap2evm.c
index d284551..68aebe7 100644
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -34,7 +34,7 @@
 #include <mach/gpio.h>
 #include <mach/board.h>
 #include <mach/common.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/keypad.h>
 #include <mach/gpmc.h>
 #include <mach/nand.h>
@@ -347,7 +347,7 @@ static void __init omap2_evm_init(void)
 	spi_register_board_info(omap2evm_spi_board_info,
 				ARRAY_SIZE(omap2evm_spi_board_info));
 	omap_serial_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 	omap2evm_flash_init();
 	ads7846_dev_init();
 }
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index ce6c7b4..062a28b 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -37,7 +37,7 @@
 #include <mach/board.h>
 #include <mach/usb-musb.h>
 #include <mach/usb-ehci.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/common.h>
 #include <mach/gpmc.h>
 #include <mach/nand.h>
@@ -309,7 +309,7 @@ static void __init omap3_beagle_init(void)
 	omap_cfg_reg(AH8_34XX_GPIO29);
 	gpio_request(29, "mmc0_wp");
 	gpio_direction_input(29);
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 
 	omap_cfg_reg(J25_34XX_GPIO170);
 	gpio_request(170, "DVI_nPD");
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index a72772f..614fa02 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -32,7 +32,7 @@
 #include <mach/gpio.h>
 #include <mach/keypad.h>
 #include <mach/board.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/usb-musb.h>
 #include <mach/usb-ehci.h>
 #include <mach/common.h>
@@ -245,7 +245,7 @@ static void __init omap3_evm_init(void)
 				ARRAY_SIZE(omap3evm_spi_board_info));
 
 	omap_serial_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 	usb_musb_init();
 	usb_ehci_init();
 	omap3evm_flash_init();
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index f4180a0..ee001bb 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -41,7 +41,7 @@
 #include <mach/gpio.h>
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/nand.h>
 #include <mach/usb-ehci.h>
 #include <mach/usb-musb.h>
@@ -208,7 +208,7 @@ static void __init omap3pandora_init(void)
 	omap_board_config = omap3pandora_config;
 	omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
 	omap_serial_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 	usb_musb_init();
 	usb_ehci_init();
 	omap3pandora_flash_init();
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index b0e5cec..a4bd804 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -42,7 +42,7 @@
 #include <mach/gpio.h>
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
-#include <mach/hsmmc.h>
+#include <mach/mmc.h>
 #include <mach/nand.h>
 #include <mach/usb-ehci.h>
 #include <mach/usb-musb.h>
@@ -212,7 +212,7 @@ static void __init overo_init(void)
 	omap_board_config = overo_config;
 	omap_board_config_size = ARRAY_SIZE(overo_config);
 	omap_serial_init();
-	hsmmc_init();
+	hsmmc_init(HSMMC1);
 	usb_musb_init();
 	usb_ehci_init();
 	overo_flash_init();
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index f711d7b..23cbdf6 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -32,13 +32,23 @@
 #define GPIO_0_BIT_POS		(1 << 0)
 
 #define VMMC1_DEV_GRP		0x27
-#define VMMC1_DEV_GRP_P1	0x20
-#define VMMC1_DEDICATED		0x2A
 #define VMMC1_CLR		0x00
 #define VMMC1_315V		0x03
 #define VMMC1_300V		0x02
 #define VMMC1_285V		0x01
 #define VMMC1_185V		0x00
+#define VMMC1_DEDICATED		0x2A
+
+#define VMMC2_DEV_GRP		0x2B
+#define VMMC2_CLR		0x40
+#define VMMC2_315V		0x0c
+#define VMMC2_300V		0x0b
+#define VMMC2_285V		0x0a
+#define VMMC2_260V		0x08
+#define VMMC2_185V		0x06
+#define VMMC2_DEDICATED		0x2E
+
+#define VMMC_DEV_GRP_P1		0x20
 
 static u16 control_pbias_offset;
 
@@ -46,17 +56,23 @@ static struct hsmmc_controller {
 	u16		control_devconf_offset;
 	u32		devconf_loopback_clock;
 	int		card_detect_gpio;
+	u8		twl_vmmc_dev_grp;
+	u8		twl_mmc_dedicated;
 } hsmmc[] = {
 	{
 		.control_devconf_offset		= OMAP2_CONTROL_DEVCONF0,
 		.devconf_loopback_clock		= OMAP2_MMCSDIO1ADPCLKISEL,
 		.card_detect_gpio		= OMAP_MAX_GPIO_LINES,
+		.twl_vmmc_dev_grp		= VMMC1_DEV_GRP,
+		.twl_mmc_dedicated		= VMMC1_DEDICATED,
 	},
 	{
 		/* control_devconf_offset set dynamically */
 		.devconf_loopback_clock		= OMAP2_MMCSDIO2ADPCLKISEL,
+		.twl_vmmc_dev_grp		= VMMC2_DEV_GRP,
+		.twl_mmc_dedicated		= VMMC2_DEDICATED,
 	},
-};
+ };
 
 static int hsmmc1_card_detect(int irq)
 {
@@ -96,7 +112,7 @@ static void hsmmc1_cleanup(struct device *dev)
 #ifdef CONFIG_PM
 
 /*
- * To mask and unmask MMC Card Detect Interrupt
+ * Mask and unmask MMC Card Detect Interrupt
  * mask : 1
  * unmask : 0
  */
@@ -150,33 +166,88 @@ static int hsmmc1_resume(struct device *dev, int slot)
 
 #endif
 
+/*
+ * Sets the MMC voltage in twl4030
+ */
+static int hsmmc_twl_set_voltage(struct hsmmc_controller *c, int vdd)
+{
+	int ret;
+	u8 vmmc, dev_grp_val;
+
+	switch (1 << vdd) {
+	case MMC_VDD_35_36:
+	case MMC_VDD_34_35:
+	case MMC_VDD_33_34:
+	case MMC_VDD_32_33:
+	case MMC_VDD_31_32:
+	case MMC_VDD_30_31:
+		if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
+			vmmc = VMMC1_315V;
+		else
+			vmmc = VMMC2_315V;
+		break;
+	case MMC_VDD_29_30:
+		if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
+			vmmc = VMMC1_315V;
+		else
+			vmmc = VMMC2_300V;
+		break;
+	case MMC_VDD_27_28:
+	case MMC_VDD_26_27:
+		if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
+			vmmc = VMMC1_285V;
+		else
+			vmmc = VMMC2_285V;
+		break;
+	case MMC_VDD_25_26:
+	case MMC_VDD_24_25:
+	case MMC_VDD_23_24:
+	case MMC_VDD_22_23:
+	case MMC_VDD_21_22:
+	case MMC_VDD_20_21:
+		if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
+			vmmc = VMMC1_285V;
+		else
+			vmmc = VMMC2_260V;
+		break;
+	case MMC_VDD_165_195:
+		if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP)
+			vmmc = VMMC1_185V;
+		else
+			vmmc = VMMC2_185V;
+		break;
+	default:
+		vmmc = 0;
+		break;
+	}
+
+	if (vmmc)
+		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)
+		return ret;
+
+	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+						vmmc, c->twl_mmc_dedicated);
+
+	return ret;
+}
+
 static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 				int vdd)
 {
 	u32 reg;
 	int ret = 0;
-	u16 control_devconf_offset = hsmmc[0].control_devconf_offset;
+	struct hsmmc_controller *c = &hsmmc[0];
 
 	if (power_on) {
-		u32 vdd_sel = 0;
-
-		switch (1 << vdd) {
-		case MMC_VDD_33_34:
-		case MMC_VDD_32_33:
-		case MMC_VDD_31_32:
-		case MMC_VDD_30_31:
-			vdd_sel = VMMC1_315V;
-			break;
-		case MMC_VDD_29_30:
-			vdd_sel = VMMC1_300V;
-			break;
-		case MMC_VDD_165_195:
-			vdd_sel = VMMC1_185V;
-		}
-
 		if (cpu_is_omap2430()) {
 			reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
-			if (vdd_sel >= VMMC1_300V)
+			if ((1 << vdd) >= MMC_VDD_30_31)
 				reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
 			else
 				reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
@@ -185,9 +256,9 @@ static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 
 		/* REVISIT: Loop back clock not needed for 2430? */
 		if (!cpu_is_omap2430()) {
-			reg = omap_ctrl_readl(control_devconf_offset);
+			reg = omap_ctrl_readl(c->control_devconf_offset);
 			reg |= OMAP2_MMCSDIO1ADPCLKISEL;
-			omap_ctrl_writel(reg, control_devconf_offset);
+			omap_ctrl_writel(reg, c->control_devconf_offset);
 		}
 
 		reg = omap_ctrl_readl(control_pbias_offset);
@@ -195,60 +266,53 @@ static int hsmmc1_set_power(struct device *dev, int slot, int power_on,
 		reg &= ~OMAP2_PBIASLITEPWRDNZ0;
 		omap_ctrl_writel(reg, control_pbias_offset);
 
-		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-						VMMC1_DEV_GRP_P1, VMMC1_DEV_GRP);
-		if (ret)
-			goto err;
-
-		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-						vdd_sel, VMMC1_DEDICATED);
-		if (ret)
-			goto err;
+		ret = hsmmc_twl_set_voltage(c, vdd);
 
 		/* 100ms delay required for PBIAS configuration */
 		msleep(100);
-
 		reg = omap_ctrl_readl(control_pbias_offset);
 		reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
-		if (vdd_sel == VMMC1_185V)
+		if ((1 << vdd) <= MMC_VDD_165_195)
 			reg &= ~OMAP2_PBIASLITEVMODE0;
 		else
 			reg |= OMAP2_PBIASLITEVMODE0;
 		omap_ctrl_writel(reg, control_pbias_offset);
-
-		return ret;
-
 	} else {
-		/* Power OFF */
-
-		/* For MMC1, Toggle PBIAS before every power up sequence */
 		reg = omap_ctrl_readl(control_pbias_offset);
 		reg &= ~OMAP2_PBIASLITEPWRDNZ0;
 		omap_ctrl_writel(reg, control_pbias_offset);
 
-		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-						LDO_CLR, VMMC1_DEV_GRP);
-		if (ret)
-			goto err;
-
-		ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-						VSEL_S2_CLR, VMMC1_DEDICATED);
-		if (ret)
-			goto err;
+		ret = hsmmc_twl_set_voltage(c, 0);
 
 		/* 100ms delay required for PBIAS configuration */
 		msleep(100);
-
 		reg = omap_ctrl_readl(control_pbias_offset);
 		reg |= (OMAP2_PBIASSPEEDCTRL0 | OMAP2_PBIASLITEPWRDNZ0 |
 			OMAP2_PBIASLITEVMODE0);
 		omap_ctrl_writel(reg, control_pbias_offset);
 	}
 
-	return 0;
+	return ret;
+}
 
-err:
-	return 1;
+static int hsmmc2_set_power(struct device *dev, int slot, int power_on, int vdd)
+{
+	int ret;
+
+	struct hsmmc_controller *c = &hsmmc[1];
+
+	if (power_on) {
+		u32 reg;
+
+		reg = omap_ctrl_readl(c->control_devconf_offset);
+		reg |= OMAP2_MMCSDIO2ADPCLKISEL;
+		omap_ctrl_writel(reg, c->control_devconf_offset);
+		ret = hsmmc_twl_set_voltage(c, vdd);
+	} else {
+		ret = hsmmc_twl_set_voltage(c, 0);
+	}
+
+	return ret;
 }
 
 static struct omap_mmc_platform_data mmc1_data = {
@@ -272,9 +336,20 @@ static struct omap_mmc_platform_data mmc1_data = {
 	},
 };
 
+static struct omap_mmc_platform_data mmc2_data = {
+	.nr_slots			= 1,
+	.slots[0] = {
+		.set_power		= hsmmc2_set_power,
+		.ocr_mask		= MMC_VDD_27_28 | MMC_VDD_28_29 |
+					  MMC_VDD_29_30 | MMC_VDD_30_31 |
+					  MMC_VDD_31_32 | MMC_VDD_32_33,
+		.name			= "second slot",
+	},
+};
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC];
 
-void __init hsmmc_init(void)
+void __init hsmmc_init(int controller_mask)
 {
 	if (cpu_is_omap2430()) {
 		control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
@@ -284,7 +359,12 @@ void __init hsmmc_init(void)
 		hsmmc[1].control_devconf_offset = OMAP343X_CONTROL_DEVCONF1;
 	}
 
-	hsmmc_data[0] = &mmc1_data;
+	if (controller_mask & HSMMC1)
+		hsmmc_data[0] = &mmc1_data;
+	if (controller_mask & HSMMC2)
+		hsmmc_data[1] = &mmc2_data;
+	if (controller_mask & HSMMC3)
+		pr_err("HSMMC: Unknown configuration for controller 3\n");
 	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
 }
 
diff --git a/arch/arm/plat-omap/include/mach/hsmmc.h b/arch/arm/plat-omap/include/mach/hsmmc.h
deleted file mode 100644
index 587e8ab..0000000
--- a/arch/arm/plat-omap/include/mach/hsmmc.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * include/asm-arm/arch-omap/hsmmc.h
- *
- * Hardware definitions for SD/MMC Controller on OMAP243x and OMAP34xx
- *
- * Initial creation by Felipe Balbi.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __ASM_ARCH_OMAP_HSMMC_H
-#define __ASM_ARCH_OMAP_HSMMC_H
-
-extern void hsmmc_init(void);
-
-#endif /* __ASM_ARCH_OMAP_HSMMC_H */
-
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
index 2f20789..5e8ac72 100644
--- a/arch/arm/plat-omap/include/mach/mmc.h
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -30,6 +30,9 @@
 #define OMAP2_MMC1_BASE		0x4809c000
 #define OMAP2_MMC2_BASE		0x480b4000
 #define OMAP3_MMC3_BASE		0x480ad000
+#define HSMMC3			(1 << 2)
+#define HSMMC2			(1 << 1)
+#define HSMMC1			(1 << 0)
 
 #define OMAP_MMC_MAX_SLOTS	2
 
@@ -127,7 +130,11 @@ static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
 #endif
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
-void __init hsmmc_init(void);
+void __init hsmmc_init(int controller_mask);
+#else
+static inline void hsmmc_init(void)
+{
+}
 #endif
 
 #endif
-- 
1.5.6.rc3.21.g8c6b5


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

* [PATCH 4/4] HSMMC: Misc clean-up for hsmmc init
  2008-10-31  2:04     ` [PATCH 3/4] HSMMC: Add support for the second controller Tony Lindgren
@ 2008-10-31  2:04       ` Tony Lindgren
  2008-10-31  3:12       ` [PATCH 3/4] HSMMC: Add support for the second controller David Brownell
  1 sibling, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31  2:04 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

Misc clean-up for hsmmc init

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/devices.c         |    2 +-
 arch/arm/mach-omap2/board-overo.c     |    2 ++
 arch/arm/mach-omap2/devices.c         |    2 +-
 arch/arm/mach-omap2/hsmmc.c           |   16 +++++-----------
 arch/arm/plat-omap/devices.c          |    2 +-
 arch/arm/plat-omap/include/mach/mmc.h |   12 ++++--------
 6 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 375a874..024dab1 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -102,7 +102,7 @@ static inline void omap_init_mbox(void) { }
 
 /*-------------------------------------------------------------------------*/
 
-#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			int controller_nr)
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index a4bd804..4f0b5d4 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -26,6 +26,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/i2c/twl4030.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -144,6 +145,7 @@ static void __init overo_flash_init(void)
 static struct omap_uart_config overo_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
 };
+
 static struct twl4030_gpio_platform_data overo_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 32550a5..0dd8b96 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -358,7 +358,7 @@ static inline void omap_init_sha1_md5(void) { }
 
 /*-------------------------------------------------------------------------*/
 
-#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
 	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
 static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 23cbdf6..f1d050a 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap2/board-sdp-hsmmc.c
+ * linux/arch/arm/mach-omap2/hsmmc.c
  *
  * Copyright (C) 2007-2008 Texas Instruments
  * Copyright (C) 2008 Nokia Corporation
@@ -101,6 +101,7 @@ static int hsmmc1_late_init(struct device *dev)
 
 err:
 	dev_err(dev, "Failed to configure TWL4030 GPIO IRQ\n");
+
 	return ret;
 }
 
@@ -232,7 +233,7 @@ static int hsmmc_twl_set_voltage(struct hsmmc_controller *c, int vdd)
 		return ret;
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-						vmmc, c->twl_mmc_dedicated);
+					vmmc, c->twl_mmc_dedicated);
 
 	return ret;
 }
@@ -331,8 +332,8 @@ static struct omap_mmc_platform_data mmc1_data = {
 						MMC_VDD_165_195,
 		.name			= "first slot",
 
-		.card_detect_irq        = TWL4030_GPIO_IRQ_NO(0),
-		.card_detect            = hsmmc1_card_detect,
+		.card_detect_irq	= TWL4030_GPIO_IRQ_NO(0),
+		.card_detect		= hsmmc1_card_detect,
 	},
 };
 
@@ -368,11 +369,4 @@ void __init hsmmc_init(int controller_mask)
 	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
 }
 
-#else
-
-void __init hsmmc_init(void)
-{
-
-}
-
 #endif
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index c22bd5f..25c6d10 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -191,7 +191,7 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
 
 /*-------------------------------------------------------------------------*/
 
-#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
+#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
 	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
 #define OMAP_MMC_NR_RES		2
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
index 5e8ac72..0c2ef3b 100644
--- a/arch/arm/plat-omap/include/mach/mmc.h
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -111,6 +111,7 @@ void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
 				int nr_controllers);
 void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
 				int nr_controllers);
+void hsmmc_init(int controller_mask);
 int omap_mmc_add(int id, unsigned long base, unsigned long size,
 			unsigned int irq, struct omap_mmc_platform_data *data);
 #else
@@ -122,19 +123,14 @@ static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
 				int nr_controllers)
 {
 }
+static inline void hsmmc_init(int controller_mask)
+{
+}
 static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
 		unsigned int irq, struct omap_mmc_platform_data *data)
 {
 	return 0;
 }
-#endif
 
-#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
-void __init hsmmc_init(int controller_mask);
-#else
-static inline void hsmmc_init(void)
-{
-}
 #endif
-
 #endif
-- 
1.5.6.rc3.21.g8c6b5


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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  2:04     ` [PATCH 3/4] HSMMC: Add support for the second controller Tony Lindgren
  2008-10-31  2:04       ` [PATCH 4/4] HSMMC: Misc clean-up for hsmmc init Tony Lindgren
@ 2008-10-31  3:12       ` David Brownell
  2008-10-31  3:39         ` Tony Lindgren
  2008-10-31  4:05         ` Steve Sakoman
  1 sibling, 2 replies; 30+ messages in thread
From: David Brownell @ 2008-10-31  3:12 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap

On Thursday 30 October 2008, Tony Lindgren wrote:
> @@ -212,7 +212,7 @@ static void __init overo_init(void)
>         omap_board_config = overo_config;
>         omap_board_config_size = ARRAY_SIZE(overo_config);
>         omap_serial_init();
> -       hsmmc_init();
> +       hsmmc_init(HSMMC1);

Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
as I understand things ... or maybe it's the third one.  :)

Related:  shouldn't hsmmc_init() accept a set of params, maybe even a struct,
describing how each controller is wired?

	- which controller (1, 2, 3)
	- how many data wires are used (1, 4, 8)
	- supported voltages (mask)
	- card detect gpio (or negative) ... assume gpio_to_irq(gpio) works
	- write protect gpio (or negative)
	- callback for updating the voltages

That would support more complete functionality ... and get away from
the current hard-wiring of most of those parameters.

- 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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  3:12       ` [PATCH 3/4] HSMMC: Add support for the second controller David Brownell
@ 2008-10-31  3:39         ` Tony Lindgren
  2008-10-31  6:41           ` David Brownell
  2008-10-31  4:05         ` Steve Sakoman
  1 sibling, 1 reply; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31  3:39 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap

* David Brownell <david-b@pacbell.net> [081030 20:12]:
> On Thursday 30 October 2008, Tony Lindgren wrote:
> > @@ -212,7 +212,7 @@ static void __init overo_init(void)
> >         omap_board_config = overo_config;
> >         omap_board_config_size = ARRAY_SIZE(overo_config);
> >         omap_serial_init();
> > -       hsmmc_init();
> > +       hsmmc_init(HSMMC1);
> 
> Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
> as I understand things ... or maybe it's the third one.  :)

OK

> Related:  shouldn't hsmmc_init() accept a set of params, maybe even a struct,
> describing how each controller is wired?
> 
> 	- which controller (1, 2, 3)
> 	- how many data wires are used (1, 4, 8)
> 	- supported voltages (mask)
> 	- card detect gpio (or negative) ... assume gpio_to_irq(gpio) works
> 	- write protect gpio (or negative)
> 	- callback for updating the voltages
> 
> That would support more complete functionality ... and get away from
> the current hard-wiring of most of those parameters.

Yeah I don't know what the right solution is.. I was thinking about
passing the struct omap_mmc_platform_data to hsmmc_init, but then
again hsmmc.c does not know anything about the custom configurations
and the power functions. So right now hsmmc.c would only call
omap2_init_mmc() with the custom struct omap_mmc_platform_data.

Maybe we should just let the boards with non-standarad wiring additionally
initialize the other mmc controllers from board-*.c by calling
omap2_init_mmc()?

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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  3:12       ` [PATCH 3/4] HSMMC: Add support for the second controller David Brownell
  2008-10-31  3:39         ` Tony Lindgren
@ 2008-10-31  4:05         ` Steve Sakoman
  2008-10-31 10:00           ` David Brownell
  1 sibling, 1 reply; 30+ messages in thread
From: Steve Sakoman @ 2008-10-31  4:05 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

On Thu, Oct 30, 2008 at 8:12 PM, David Brownell <david-b@pacbell.net> wrote:
> On Thursday 30 October 2008, Tony Lindgren wrote:
>> @@ -212,7 +212,7 @@ static void __init overo_init(void)
>>         omap_board_config = overo_config;
>>         omap_board_config_size = ARRAY_SIZE(overo_config);
>>         omap_serial_init();
>> -       hsmmc_init();
>> +       hsmmc_init(HSMMC1);
>
> Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
> as I understand things ... or maybe it's the third one.  :)

Correct!  The wi2wi chip is connected to mmc2 with a 4 bit data path.

Steve

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  3:39         ` Tony Lindgren
@ 2008-10-31  6:41           ` David Brownell
  2008-10-31 16:35             ` Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: David Brownell @ 2008-10-31  6:41 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap

On Thursday 30 October 2008, Tony Lindgren wrote:
> * David Brownell <david-b@pacbell.net> [081030 20:12]:
> >
> > Related:  shouldn't hsmmc_init() accept a set of params, maybe even a struct,
> > describing how each controller is wired?
> > 
> > 	- which controller (1, 2, 3)
> > 	- how many data wires are used (1, 4, 8)
> > 	- supported voltages (mask)
> > 	- card detect gpio (or negative) ... assume gpio_to_irq(gpio) works
> > 	- write protect gpio (or negative)
> > 	- callback for updating the voltages
> > 
> > That would support more complete functionality ... and get away from
> > the current hard-wiring of most of those parameters.
> 
> Yeah I don't know what the right solution is.. I was thinking about
> passing the struct omap_mmc_platform_data to hsmmc_init, but then
> again hsmmc.c does not know anything about the custom configurations
> and the power functions. So right now hsmmc.c would only call
> omap2_init_mmc() with the custom struct omap_mmc_platform_data.

Part of it is that "hsmmc.c" is really twl4030-specific glue,
but it's misnamed as being more generic.

Glue to other kinds of interface should call omap2_init_mmc()
directly ... the issue here is that the twl-specific stuff isn't
quite generic enough yet.


> Maybe we should just let the boards with non-standarad wiring additionally
> initialize the other mmc controllers from board-*.c by calling
> omap2_init_mmc()?

How about this instead:  boards pass an __initdata struct in, not a
mask, and it's used to set up the current omap_mmc_platform_data.
Struct should handle common TWL wiring options; maybe:

	struct twl4030_hsmmc_info {
		u8	mmc;		/* controller 1/2/3 */
		u8	wires;		/* 1/4/8 wires */
		u8	twl_reg;	/* vmmc1/vmmc2 */
		bool	cd_debounce;	/* in case cd isn't on twl4030 */
		int	gpio_cd;	/* or -EINVAL */
		int	gpio_wp;	/* or -EINVAL */
	};

So for example Beagle would only set up MMC-1, 8-wires, VMMC1,
debounced TWL GPIO-0 for CD, and some OMAP GPIO for WP ... while
Overo would do the same with 4-wires and a different GPIO, then
call hsmmc_init() again with a second struct for MMC-2, 4-wires,
VMMC2, no CD, no WP.

That should be a simple tweak on top of what you've just sent,

- Dave

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  4:05         ` Steve Sakoman
@ 2008-10-31 10:00           ` David Brownell
  2008-10-31 23:35             ` Steve Sakoman
  2008-11-03 22:54             ` Steve Sakoman
  0 siblings, 2 replies; 30+ messages in thread
From: David Brownell @ 2008-10-31 10:00 UTC (permalink / raw)
  To: Steve Sakoman; +Cc: linux-omap, Tony Lindgren

On Thursday 30 October 2008, Steve Sakoman wrote:
> > Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
> > as I understand things ... or maybe it's the third one.  :)
> 
> Correct!  The wi2wi chip is connected to mmc2 with a 4 bit data path.

With the appended patch on top of Tony's four, I get:

 mmc1: new SDIO card at address 0001
 firmware: requesting sd8686_helper.bin
 ...
 libertas: can't load helper firmware
 libertas: failed to load helper firmware
 libertas_sdio: probe of mmc1:0001:1 failed with error -2

So, progress.  What's the best place to get that stuff?
Do we know that this driver behaves with SDIO yet?

- dave


---
 arch/arm/mach-omap2/board-overo.c |    2 +-
 arch/arm/mach-omap2/hsmmc.c       |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -214,7 +214,7 @@ static void __init overo_init(void)
 	omap_board_config = overo_config;
 	omap_board_config_size = ARRAY_SIZE(overo_config);
 	omap_serial_init();
-	hsmmc_init(HSMMC1);
+	hsmmc_init(HSMMC1 | HSMMC2);
 	usb_musb_init();
 	usb_ehci_init();
 	overo_flash_init();
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -340,6 +340,7 @@ static struct omap_mmc_platform_data mmc
 static struct omap_mmc_platform_data mmc2_data = {
 	.nr_slots			= 1,
 	.slots[0] = {
+		.wire4			= 1,
 		.set_power		= hsmmc2_set_power,
 		.ocr_mask		= MMC_VDD_27_28 | MMC_VDD_28_29 |
 					  MMC_VDD_29_30 | MMC_VDD_30_31 |
--
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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31  6:41           ` David Brownell
@ 2008-10-31 16:35             ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2008-10-31 16:35 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap

* David Brownell <david-b@pacbell.net> [081030 23:41]:
> On Thursday 30 October 2008, Tony Lindgren wrote:
> > * David Brownell <david-b@pacbell.net> [081030 20:12]:
> > >
> > > Related:  shouldn't hsmmc_init() accept a set of params, maybe even a struct,
> > > describing how each controller is wired?
> > > 
> > > 	- which controller (1, 2, 3)
> > > 	- how many data wires are used (1, 4, 8)
> > > 	- supported voltages (mask)
> > > 	- card detect gpio (or negative) ... assume gpio_to_irq(gpio) works
> > > 	- write protect gpio (or negative)
> > > 	- callback for updating the voltages
> > > 
> > > That would support more complete functionality ... and get away from
> > > the current hard-wiring of most of those parameters.
> > 
> > Yeah I don't know what the right solution is.. I was thinking about
> > passing the struct omap_mmc_platform_data to hsmmc_init, but then
> > again hsmmc.c does not know anything about the custom configurations
> > and the power functions. So right now hsmmc.c would only call
> > omap2_init_mmc() with the custom struct omap_mmc_platform_data.
> 
> Part of it is that "hsmmc.c" is really twl4030-specific glue,
> but it's misnamed as being more generic.
> 
> Glue to other kinds of interface should call omap2_init_mmc()
> directly ... the issue here is that the twl-specific stuff isn't
> quite generic enough yet.

OK, good point. Let's rename it to twl4030-hsmmc.c or something like
that.

> > Maybe we should just let the boards with non-standarad wiring additionally
> > initialize the other mmc controllers from board-*.c by calling
> > omap2_init_mmc()?
> 
> How about this instead:  boards pass an __initdata struct in, not a
> mask, and it's used to set up the current omap_mmc_platform_data.
> Struct should handle common TWL wiring options; maybe:
> 
> 	struct twl4030_hsmmc_info {
> 		u8	mmc;		/* controller 1/2/3 */
> 		u8	wires;		/* 1/4/8 wires */
> 		u8	twl_reg;	/* vmmc1/vmmc2 */
> 		bool	cd_debounce;	/* in case cd isn't on twl4030 */
> 		int	gpio_cd;	/* or -EINVAL */
> 		int	gpio_wp;	/* or -EINVAL */
> 	};
> 
> So for example Beagle would only set up MMC-1, 8-wires, VMMC1,
> debounced TWL GPIO-0 for CD, and some OMAP GPIO for WP ... while
> Overo would do the same with 4-wires and a different GPIO, then
> call hsmmc_init() again with a second struct for MMC-2, 4-wires,
> VMMC2, no CD, no WP.
> 
> That should be a simple tweak on top of what you've just sent,

Sounds good to me. The twl4030 voltages may require further
options, but that can be added later.

Tony

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31 10:00           ` David Brownell
@ 2008-10-31 23:35             ` Steve Sakoman
  2008-11-01  0:36               ` David Brownell
  2008-11-03 22:54             ` Steve Sakoman
  1 sibling, 1 reply; 30+ messages in thread
From: Steve Sakoman @ 2008-10-31 23:35 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap, Tony Lindgren

On Fri, Oct 31, 2008 at 3:00 AM, David Brownell <david-b@pacbell.net> wrote:
> On Thursday 30 October 2008, Steve Sakoman wrote:
>> > Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
>> > as I understand things ... or maybe it's the third one.  :)
>>
>> Correct!  The wi2wi chip is connected to mmc2 with a 4 bit data path.
>
> With the appended patch on top of Tony's four, I get:
>
>  mmc1: new SDIO card at address 0001
>  firmware: requesting sd8686_helper.bin
>  ...
>  libertas: can't load helper firmware
>  libertas: failed to load helper firmware
>  libertas_sdio: probe of mmc1:0001:1 failed with error -2
>
> So, progress.  What's the best place to get that stuff?

I picked up a copy of the sd8686 helper and firmware from the Marvell
site (http://www.marvell.com/drivers/search.do)

I specified Linux 2.6 Fedora as the OS and used
SD-8686-LINUX26-SYSKT-9.70.3.p24-26409.P45-GPL

I copied the helper and sd8686.bin to /lib/firmware (and renamed the
helper to sd8686_helper.bin in the process)

Didn't have much more success though :-(

The error is slightly different now:

mmc1: new SDIO card at address 0001
firmware: requesting sd8686_helper.bin
libertas: failed to load helper firmware
libertas_sdio: probe of mmc1:0001:1 failed with error -84

Before beating my head against the wall too much on this, I've
requested a copy of the proper helper and firmware from wi2wi, since
it is not at all clear to me that the ones from the Marvell site are
the correct ones.

> Do we know that this driver behaves with SDIO yet?

I'm not aware of anyone else who has used the hsmmc driver with SDIO,
so I think we are pioneering.  Certainly the libertas_sdio driver
itself has been proven on other hw.

TI claims that the 1.0.2 release of the 35XX EVM software will support
the libertas_sdio driver via the EVM's mmc slot.  However, I don't see
that version of the software yet on the TI site, and my guess is that
it will be using the internal TI kernel and not linux-omap.

Steve

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31 23:35             ` Steve Sakoman
@ 2008-11-01  0:36               ` David Brownell
  2008-11-01  2:31                 ` Felipe Balbi
  2008-11-01  2:50                 ` Steve Sakoman
  0 siblings, 2 replies; 30+ messages in thread
From: David Brownell @ 2008-11-01  0:36 UTC (permalink / raw)
  To: Steve Sakoman; +Cc: linux-omap, Tony Lindgren

On Friday 31 October 2008, Steve Sakoman wrote:
> TI claims that the 1.0.2 release of the 35XX EVM software will support
> the libertas_sdio driver via the EVM's mmc slot.  However, I don't see
> that version of the software yet on the TI site, and my guess is that
> it will be using the internal TI kernel and not linux-omap.

Darn...

So while Tony's updates will enable root-on-MMC (vs just ramfs)
Overo won't yet have network links except over bluetooth.

Until the twl4030 USB transceiver driver goes to mainline,
at which point usb network links will work.  :)

- 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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-01  0:36               ` David Brownell
@ 2008-11-01  2:31                 ` Felipe Balbi
  2008-11-01  2:50                 ` Steve Sakoman
  1 sibling, 0 replies; 30+ messages in thread
From: Felipe Balbi @ 2008-11-01  2:31 UTC (permalink / raw)
  To: David Brownell; +Cc: Steve Sakoman, linux-omap, Tony Lindgren

On Fri, Oct 31, 2008 at 05:36:44PM -0700, David Brownell wrote:
> On Friday 31 October 2008, Steve Sakoman wrote:
> > TI claims that the 1.0.2 release of the 35XX EVM software will support
> > the libertas_sdio driver via the EVM's mmc slot.  However, I don't see
> > that version of the software yet on the TI site, and my guess is that
> > it will be using the internal TI kernel and not linux-omap.
> 
> Darn...
> 
> So while Tony's updates will enable root-on-MMC (vs just ramfs)
> Overo won't yet have network links except over bluetooth.
> 
> Until the twl4030 USB transceiver driver goes to mainline,
> at which point usb network links will work.  :)

about that, I'm hacking on it starting next week. Finaly sorted out a
few other stuff I had to do internally and now i'll try to add proper id
pin handling and finish that patch of yours ruling out the
otg_transceiver from struct musb (using only a pointer).

That will take a while since I'll have to make
otg_{set,get}_transceiver() generic (again), clean musb driver
(otg_transceiver crap) and then fix twl4030-usb. Hopefully i'll get it
done by 2.6.29 merge window, not sure though.

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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-01  0:36               ` David Brownell
  2008-11-01  2:31                 ` Felipe Balbi
@ 2008-11-01  2:50                 ` Steve Sakoman
  2008-11-01  3:02                   ` David Brownell
  1 sibling, 1 reply; 30+ messages in thread
From: Steve Sakoman @ 2008-11-01  2:50 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap, Tony Lindgren

On Fri, Oct 31, 2008 at 5:36 PM, David Brownell <david-b@pacbell.net> wrote:
> On Friday 31 October 2008, Steve Sakoman wrote:
>> TI claims that the 1.0.2 release of the 35XX EVM software will support
>> the libertas_sdio driver via the EVM's mmc slot.  However, I don't see
>> that version of the software yet on the TI site, and my guess is that
>> it will be using the internal TI kernel and not linux-omap.
>
> Darn...
>
> So while Tony's updates will enable root-on-MMC (vs just ramfs)
> Overo won't yet have network links except over bluetooth.
>
> Until the twl4030 USB transceiver driver goes to mainline,
> at which point usb network links will work.  :)

Hmm . . . my network dongles (both ethernet and wifi) work just fine
on musb now (using 2.6.27-omap1)

Steve

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-01  2:50                 ` Steve Sakoman
@ 2008-11-01  3:02                   ` David Brownell
  2008-11-01  3:11                     ` Steve Sakoman
  0 siblings, 1 reply; 30+ messages in thread
From: David Brownell @ 2008-11-01  3:02 UTC (permalink / raw)
  To: Steve Sakoman; +Cc: linux-omap, Tony Lindgren

On Friday 31 October 2008, Steve Sakoman wrote:
> > Until the twl4030 USB transceiver driver goes to mainline,
> > at which point usb network links will work.  :)
> 
> Hmm . . . my network dongles (both ethernet and wifi) work just fine
> on musb now (using 2.6.27-omap1)

On mainline??

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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-01  3:02                   ` David Brownell
@ 2008-11-01  3:11                     ` Steve Sakoman
  0 siblings, 0 replies; 30+ messages in thread
From: Steve Sakoman @ 2008-11-01  3:11 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren

On Fri, Oct 31, 2008 at 8:02 PM, David Brownell <david-b@pacbell.net> wrote:
> On Friday 31 October 2008, Steve Sakoman wrote:
>> > Until the twl4030 USB transceiver driver goes to mainline,
>> > at which point usb network links will work.  :)
>>
>> Hmm . . . my network dongles (both ethernet and wifi) work just fine
>> on musb now (using 2.6.27-omap1)
>
> On mainline??

Ah, no.  On linux-omap tag v2.6.27-omap1

Steve

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-10-31 10:00           ` David Brownell
  2008-10-31 23:35             ` Steve Sakoman
@ 2008-11-03 22:54             ` Steve Sakoman
  2008-11-03 23:22               ` Tony Lindgren
  2008-11-03 23:36               ` Steve Sakoman
  1 sibling, 2 replies; 30+ messages in thread
From: Steve Sakoman @ 2008-11-03 22:54 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap, Tony Lindgren

On Fri, Oct 31, 2008 at 2:00 AM, David Brownell <david-b@pacbell.net> wrote:
> On Thursday 30 October 2008, Steve Sakoman wrote:
>> > Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
>> > as I understand things ... or maybe it's the third one.  :)
>>
>> Correct!  The wi2wi chip is connected to mmc2 with a 4 bit data path.
>
> With the appended patch on top of Tony's four, I get:
>
>  mmc1: new SDIO card at address 0001
>  firmware: requesting sd8686_helper.bin
>  ...
>  libertas: can't load helper firmware
>  libertas: failed to load helper firmware
>  libertas_sdio: probe of mmc1:0001:1 failed with error -2
>
> So, progress.  What's the best place to get that stuff?
> Do we know that this driver behaves with SDIO yet?

After a bit more work I now have a wireless connection!

So I guess we now have confirmation that the driver supports the
second mmc slot even for SDIO!

I used David's appended patch plus Tony's 4 HSMMC patches.

I used version 8.73.7p3 of the Marvell SD8686 firmware and helper
binaries and placed them in /lib/firmware.

The log:

mmc1: new SDIO card at address 0001
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
firmware: requesting sd8686_helper.bin
firmware: requesting sd8686.bin
libertas: 00:19:88:05:96:ce, fw 8.73.7p3, cap 0x00000393
libertas: PREP_CMD: command 0x00a3 failed: 2
libertas: PREP_CMD: command 0x00a3 failed: 2
libertas: eth0: Marvell WLAN 802.11 adap
<snip>
root@overo:~# iwconfig eth0 essid any
root@overo:~# ifconfig eth0 up
root@overo:~# iwlist eth0 scan
eth0      Scan completed :
          Cell 01 - Address: 00:19:5B:48:16:C3
                    ESSID:"dlink"
                    Mode:Managed
                    Frequency:2.437 GHz (Channel 6)
                    Quality=85/100  Signal level=-65 dBm  Noise level=-88 dBm
                    Encryption key:off
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
                              48 Mb/s; 54 Mb/s
          Cell 02 - Address: 00:03:93:EA:69:AD
                    ESSID:"Millville"
                    Mode:Managed
                    Frequency:2.457 GHz (Channel 10)
                    Quality=98/100  Signal level=-30 dBm  Noise level=-88 dBm
                    Encryption key:off
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s

root@overo:~# udhcpc eth0
udhcpc (v1.11.3) started
run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
Sending discover...
Sending select for 192.168.0.22...
Lease of 192.168.0.22 obtained, lease time 86400
run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
adding dns 66.133.189.215
adding dns 216.67.192.3
root@overo:~# ping gumstix.com
PING gumstix.com (216.139.227.50): 56 data bytes
64 bytes from 216.139.227.50: seq=0 ttl=50 time=132.721 ms
64 bytes from 216.139.227.50: seq=1 ttl=50 time=132.233 ms
64 bytes from 216.139.227.50: seq=2 ttl=50 time=147.369 ms
\x03
--- gumstix.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 132.233/137.441/147.369 ms
root@overo:~#

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-03 22:54             ` Steve Sakoman
@ 2008-11-03 23:22               ` Tony Lindgren
  2008-11-03 23:36               ` Steve Sakoman
  1 sibling, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2008-11-03 23:22 UTC (permalink / raw)
  To: Steve Sakoman; +Cc: David Brownell, linux-omap

* Steve Sakoman <sakoman@gmail.com> [081103 14:54]:
> On Fri, Oct 31, 2008 at 2:00 AM, David Brownell <david-b@pacbell.net> wrote:
> > On Thursday 30 October 2008, Steve Sakoman wrote:
> >> > Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
> >> > as I understand things ... or maybe it's the third one.  :)
> >>
> >> Correct!  The wi2wi chip is connected to mmc2 with a 4 bit data path.
> >
> > With the appended patch on top of Tony's four, I get:
> >
> >  mmc1: new SDIO card at address 0001
> >  firmware: requesting sd8686_helper.bin
> >  ...
> >  libertas: can't load helper firmware
> >  libertas: failed to load helper firmware
> >  libertas_sdio: probe of mmc1:0001:1 failed with error -2
> >
> > So, progress.  What's the best place to get that stuff?
> > Do we know that this driver behaves with SDIO yet?
> 
> After a bit more work I now have a wireless connection!
> 
> So I guess we now have confirmation that the driver supports the
> second mmc slot even for SDIO!
> 
> I used David's appended patch plus Tony's 4 HSMMC patches.
> 
> I used version 8.73.7p3 of the Marvell SD8686 firmware and helper
> binaries and placed them in /lib/firmware.

Good to hear! I'll update the patches to change the hsmmc_init()
interface like Dave suggested.

Tony



> 
> The log:
> 
> mmc1: new SDIO card at address 0001
> libertas_sdio: Libertas SDIO driver
> libertas_sdio: Copyright Pierre Ossman
> firmware: requesting sd8686_helper.bin
> firmware: requesting sd8686.bin
> libertas: 00:19:88:05:96:ce, fw 8.73.7p3, cap 0x00000393
> libertas: PREP_CMD: command 0x00a3 failed: 2
> libertas: PREP_CMD: command 0x00a3 failed: 2
> libertas: eth0: Marvell WLAN 802.11 adap
> <snip>
> root@overo:~# iwconfig eth0 essid any
> root@overo:~# ifconfig eth0 up
> root@overo:~# iwlist eth0 scan
> eth0      Scan completed :
>           Cell 01 - Address: 00:19:5B:48:16:C3
>                     ESSID:"dlink"
>                     Mode:Managed
>                     Frequency:2.437 GHz (Channel 6)
>                     Quality=85/100  Signal level=-65 dBm  Noise level=-88 dBm
>                     Encryption key:off
>                     Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
>                               12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
>                               48 Mb/s; 54 Mb/s
>           Cell 02 - Address: 00:03:93:EA:69:AD
>                     ESSID:"Millville"
>                     Mode:Managed
>                     Frequency:2.457 GHz (Channel 10)
>                     Quality=98/100  Signal level=-30 dBm  Noise level=-88 dBm
>                     Encryption key:off
>                     Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
>                               9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
>                               48 Mb/s; 54 Mb/s
> 
> root@overo:~# udhcpc eth0
> udhcpc (v1.11.3) started
> run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
> Sending discover...
> Sending select for 192.168.0.22...
> Lease of 192.168.0.22 obtained, lease time 86400
> run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
> adding dns 66.133.189.215
> adding dns 216.67.192.3
> root@overo:~# ping gumstix.com
> PING gumstix.com (216.139.227.50): 56 data bytes
> 64 bytes from 216.139.227.50: seq=0 ttl=50 time=132.721 ms
> 64 bytes from 216.139.227.50: seq=1 ttl=50 time=132.233 ms
> 64 bytes from 216.139.227.50: seq=2 ttl=50 time=147.369 ms
> \x03
> --- gumstix.com ping statistics ---
> 3 packets transmitted, 3 packets received, 0% packet loss
> round-trip min/avg/max = 132.233/137.441/147.369 ms
> root@overo:~#

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-03 22:54             ` Steve Sakoman
  2008-11-03 23:22               ` Tony Lindgren
@ 2008-11-03 23:36               ` Steve Sakoman
  2008-11-05 23:54                 ` David Brownell
  1 sibling, 1 reply; 30+ messages in thread
From: Steve Sakoman @ 2008-11-03 23:36 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap, Tony Lindgren

On Mon, Nov 3, 2008 at 2:54 PM, Steve Sakoman <sakoman@gmail.com> wrote:
> On Fri, Oct 31, 2008 at 2:00 AM, David Brownell <david-b@pacbell.net> wrote:
>> On Thursday 30 October 2008, Steve Sakoman wrote:
>>> > Overo has its SDIO WLAN chip (libertas) hard wired to the second controller,
>>> > as I understand things ... or maybe it's the third one.  :)
>>>
>>> Correct!  The wi2wi chip is connected to mmc2 with a 4 bit data path.
>>
>> With the appended patch on top of Tony's four, I get:
>>
>>  mmc1: new SDIO card at address 0001
>>  firmware: requesting sd8686_helper.bin
>>  ...
>>  libertas: can't load helper firmware
>>  libertas: failed to load helper firmware
>>  libertas_sdio: probe of mmc1:0001:1 failed with error -2
>>
>> So, progress.  What's the best place to get that stuff?
>> Do we know that this driver behaves with SDIO yet?
>
> After a bit more work I now have a wireless connection!
>
> So I guess we now have confirmation that the driver supports the
> second mmc slot even for SDIO!
>
> I used David's appended patch plus Tony's 4 HSMMC patches.
>
> I used version 8.73.7p3 of the Marvell SD8686 firmware and helper
> binaries and placed them in /lib/firmware.

I just tried version 9.70.3p24 of the firmware & helper and have
confirmed that it also works.

This version is much more easily available from the Marvell site.  Go to:

http://www.marvell.com/drivers/search.do

Select "Network Controller" for device type (it's the only choice),
and "Linux 2.6 - Fedora" for the OS.

You will then be offered two choices, pick
SD-8686-LINUX26-SYSKT-9.70.3.p24-26409.P45-GPL.  Extract (and then
extract the tar image contained within) and look in the FWImage
directory.  Copy both .bin files to your omap system's /lib/firmware
directory and rename helper_sd.bin to sd8686.bin.

Steve

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-03 23:36               ` Steve Sakoman
@ 2008-11-05 23:54                 ` David Brownell
  2008-11-06  3:32                   ` Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: David Brownell @ 2008-11-05 23:54 UTC (permalink / raw)
  To: Steve Sakoman; +Cc: linux-omap, Tony Lindgren

On Monday 03 November 2008, Steve Sakoman wrote:
> >
> > I used David's appended patch plus Tony's 4 HSMMC patches.
> >
> > I used version 8.73.7p3 of the Marvell SD8686 firmware and helper
> > binaries and placed them in /lib/firmware.
> 
> I just tried version 9.70.3p24 of the firmware & helper and have
> confirmed that it also works.

Ditto ... at least in terms of "iwlist scan" finding a decent set
of networks.  I think something probably should be done to keep
that chip powered down when it's not in use; it's quite toasty.
I'm not sure whether that issue comes from the libertas driver,
the SDIO stack, or somewhere else (hsmmc glue).


> This version is much more easily available from the Marvell site.  Go to:
> 
> http://www.marvell.com/drivers/search.do
> 
> Select "Network Controller" for device type (it's the only choice),
> and "Linux 2.6 - Fedora" for the OS.
> 
> You will then be offered two choices, pick
> SD-8686-LINUX26-SYSKT-9.70.3.p24-26409.P45-GPL.  Extract (and then
> extract the tar image contained within) and look in the FWImage
> directory.  Copy both .bin files to your omap system's /lib/firmware
> directory and rename helper_sd.bin to sd8686.bin.

Or, for the record, add them to your kernel "firmware" directory
and using Kconfig set

CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE="sd8686_helper.bin sd8686.bin"
CONFIG_EXTRA_FIRMWARE_DIR="firmware"

It adds some bloat to the kernel (128+ KBytes) but is painless
in terms of rootfs configuration.

- 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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-05 23:54                 ` David Brownell
@ 2008-11-06  3:32                   ` Tony Lindgren
  2008-11-06  7:09                     ` David Brownell
  0 siblings, 1 reply; 30+ messages in thread
From: Tony Lindgren @ 2008-11-06  3:32 UTC (permalink / raw)
  To: David Brownell; +Cc: Steve Sakoman, linux-omap

* David Brownell <david-b@pacbell.net> [081105 15:54]:
> On Monday 03 November 2008, Steve Sakoman wrote:
> > >
> > > I used David's appended patch plus Tony's 4 HSMMC patches.
> > >
> > > I used version 8.73.7p3 of the Marvell SD8686 firmware and helper
> > > binaries and placed them in /lib/firmware.
> > 
> > I just tried version 9.70.3p24 of the firmware & helper and have
> > confirmed that it also works.
> 
> Ditto ... at least in terms of "iwlist scan" finding a decent set
> of networks.  I think something probably should be done to keep
> that chip powered down when it's not in use; it's quite toasty.
> I'm not sure whether that issue comes from the libertas driver,
> the SDIO stack, or somewhere else (hsmmc glue).
> 
> 
> > This version is much more easily available from the Marvell site.  Go to:
> > 
> > http://www.marvell.com/drivers/search.do
> > 
> > Select "Network Controller" for device type (it's the only choice),
> > and "Linux 2.6 - Fedora" for the OS.
> > 
> > You will then be offered two choices, pick
> > SD-8686-LINUX26-SYSKT-9.70.3.p24-26409.P45-GPL.  Extract (and then
> > extract the tar image contained within) and look in the FWImage
> > directory.  Copy both .bin files to your omap system's /lib/firmware
> > directory and rename helper_sd.bin to sd8686.bin.
> 
> Or, for the record, add them to your kernel "firmware" directory
> and using Kconfig set
> 
> CONFIG_FIRMWARE_IN_KERNEL=y
> CONFIG_EXTRA_FIRMWARE="sd8686_helper.bin sd8686.bin"
> CONFIG_EXTRA_FIRMWARE_DIR="firmware"
> 
> It adds some bloat to the kernel (128+ KBytes) but is painless
> in terms of rootfs configuration.

OK, I've pushed the hsmmc init patches. They still need work though.

Please everybody check your board MMC configuration and send patches
as needed.

Also the write protect interrupts are not handled, and gpio handling
is twl specific. Hopefully a better base for the code anyways.

Regards,

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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-06  3:32                   ` Tony Lindgren
@ 2008-11-06  7:09                     ` David Brownell
  2008-11-06 17:04                       ` Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: David Brownell @ 2008-11-06  7:09 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Steve Sakoman, linux-omap

On Wednesday 05 November 2008, Tony Lindgren wrote:
> OK, I've pushed the hsmmc init patches. They still need work though.
> 
> Please everybody check your board MMC configuration and send patches
> as needed.

See the appended build fixes ... :)

Also, I suspect there needs to be an MMC_CAP_8_BIT_DATA at
some point, with hsmmc driver support.


> Also the write protect interrupts are not handled, and gpio handling
> is twl specific. Hopefully a better base for the code anyways.

I'll have a look at write protect ... it wouldn't normally
be an IRQ, just an input GPIO.  Unlike the CD, which gets
used for both purposes; that code looks iffy too.

Yes, a better base.

- Dave
 

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

Build fixes for "HSMMC: Improve the interface for hsmmc_init()".
The header file needs to work without MMC support enabled, and
some board files needed to include it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 arch/arm/mach-omap2/board-2430sdp.c      |    3 +++
 arch/arm/mach-omap2/board-ldp.c          |    3 +++
 arch/arm/mach-omap2/board-omap2evm.c     |    3 +++
 arch/arm/mach-omap2/board-omap3beagle.c  |    2 ++
 arch/arm/mach-omap2/board-omap3evm.c     |    2 ++
 arch/arm/mach-omap2/board-omap3pandora.c |    2 ++
 arch/arm/mach-omap2/mmc-twl4030.h        |    8 ++++----
 7 files changed, 19 insertions(+), 4 deletions(-)

--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -44,6 +44,9 @@
 
 #include <asm/io.h>
 
+#include "mmc-twl4030.h"
+
+
 #define	SDP2430_FLASH_CS	0
 #define	SDP2430_SMC91X_CS	5
 
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -41,6 +41,9 @@
 #include <asm/delay.h>
 #include <mach/control.h>
 
+#include "mmc-twl4030.h"
+
+
 #define CONFIG_DISABLE_HFCLK 1
 
 #define ENABLE_VAUX1_DEDICATED	0x03
--- a/arch/arm/mach-omap2/board-omap2evm.c
+++ b/arch/arm/mach-omap2/board-omap2evm.c
@@ -41,6 +41,9 @@
 #include <mach/mcspi.h>
 #include <mach/mux.h>
 
+#include "mmc-twl4030.h"
+
+
 #define GPMC_OFF_CONFIG1_0 0x60
 
 static struct mtd_partition omap2evm_nand_partitions[] = {
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -44,6 +44,8 @@
 #include <mach/mux.h>
 
 #include "twl4030-generic-scripts.h"
+#include "mmc-twl4030.h"
+
 
 #define GPMC_CS0_BASE  0x60
 #define GPMC_CS_SIZE   0x30
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -40,6 +40,8 @@
 
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "twl4030-generic-scripts.h"
+#include "mmc-twl4030.h"
+
 
 static struct resource omap3evm_smc911x_resources[] = {
 	[0] =	{
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -47,6 +47,8 @@
 #include <mach/usb-musb.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
+#include "mmc-twl4030.h"
+
 
 #define NAND_BLOCK_SIZE SZ_128K
 #define GPMC_CS0_BASE  0x60
--- a/arch/arm/mach-omap2/mmc-twl4030.h
+++ b/arch/arm/mach-omap2/mmc-twl4030.h
@@ -6,20 +6,20 @@
  * published by the Free Software Foundation.
  */
 
-#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
-	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
-
 struct twl4030_hsmmc_info {
 	u8	mmc;		/* controller 1/2/3 */
 	u8	wires;		/* 1/4/8 wires */
 	int	gpio_cd;	/* or -EINVAL */
 };
 
+#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
+	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
+
 void hsmmc_init(struct twl4030_hsmmc_info *);
 
 #else
 
-static inline void hsmmc_init(struct twl4030_hsmmc_info *)
+static inline void hsmmc_init(struct twl4030_hsmmc_info *info)
 {
 }
 


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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-06  7:09                     ` David Brownell
@ 2008-11-06 17:04                       ` Tony Lindgren
  2008-11-06 20:19                         ` Grazvydas Ignotas
  2008-11-06 20:52                         ` David Brownell
  0 siblings, 2 replies; 30+ messages in thread
From: Tony Lindgren @ 2008-11-06 17:04 UTC (permalink / raw)
  To: David Brownell; +Cc: Steve Sakoman, linux-omap

* David Brownell <david-b@pacbell.net> [081105 23:10]:
> On Wednesday 05 November 2008, Tony Lindgren wrote:
> > OK, I've pushed the hsmmc init patches. They still need work though.
> > 
> > Please everybody check your board MMC configuration and send patches
> > as needed.
> 
> See the appended build fixes ... :)

Oops, sorry I did not expect that kind of fixes!

> Also, I suspect there needs to be an MMC_CAP_8_BIT_DATA at
> some point, with hsmmc driver support.
> 
> 
> > Also the write protect interrupts are not handled, and gpio handling
> > is twl specific. Hopefully a better base for the code anyways.
> 
> I'll have a look at write protect ... it wouldn't normally
> be an IRQ, just an input GPIO.  Unlike the CD, which gets
> used for both purposes; that code looks iffy too.

OK. We also need to figure out what to do if we need to support other
gpios than twl gpios.

> Yes, a better base.

Thanks, pushing.

Tony

> 
> - Dave
>  
> 
> ========= CUT HERE
> From: David Brownell <dbrownell@users.sourceforge.net>
> 
> Build fixes for "HSMMC: Improve the interface for hsmmc_init()".
> The header file needs to work without MMC support enabled, and
> some board files needed to include it.
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
>  arch/arm/mach-omap2/board-2430sdp.c      |    3 +++
>  arch/arm/mach-omap2/board-ldp.c          |    3 +++
>  arch/arm/mach-omap2/board-omap2evm.c     |    3 +++
>  arch/arm/mach-omap2/board-omap3beagle.c  |    2 ++
>  arch/arm/mach-omap2/board-omap3evm.c     |    2 ++
>  arch/arm/mach-omap2/board-omap3pandora.c |    2 ++
>  arch/arm/mach-omap2/mmc-twl4030.h        |    8 ++++----
>  7 files changed, 19 insertions(+), 4 deletions(-)
> 
> --- a/arch/arm/mach-omap2/board-2430sdp.c
> +++ b/arch/arm/mach-omap2/board-2430sdp.c
> @@ -44,6 +44,9 @@
>  
>  #include <asm/io.h>
>  
> +#include "mmc-twl4030.h"
> +
> +
>  #define	SDP2430_FLASH_CS	0
>  #define	SDP2430_SMC91X_CS	5
>  
> --- a/arch/arm/mach-omap2/board-ldp.c
> +++ b/arch/arm/mach-omap2/board-ldp.c
> @@ -41,6 +41,9 @@
>  #include <asm/delay.h>
>  #include <mach/control.h>
>  
> +#include "mmc-twl4030.h"
> +
> +
>  #define CONFIG_DISABLE_HFCLK 1
>  
>  #define ENABLE_VAUX1_DEDICATED	0x03
> --- a/arch/arm/mach-omap2/board-omap2evm.c
> +++ b/arch/arm/mach-omap2/board-omap2evm.c
> @@ -41,6 +41,9 @@
>  #include <mach/mcspi.h>
>  #include <mach/mux.h>
>  
> +#include "mmc-twl4030.h"
> +
> +
>  #define GPMC_OFF_CONFIG1_0 0x60
>  
>  static struct mtd_partition omap2evm_nand_partitions[] = {
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -44,6 +44,8 @@
>  #include <mach/mux.h>
>  
>  #include "twl4030-generic-scripts.h"
> +#include "mmc-twl4030.h"
> +
>  
>  #define GPMC_CS0_BASE  0x60
>  #define GPMC_CS_SIZE   0x30
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -40,6 +40,8 @@
>  
>  #include "sdram-micron-mt46h32m32lf-6.h"
>  #include "twl4030-generic-scripts.h"
> +#include "mmc-twl4030.h"
> +
>  
>  static struct resource omap3evm_smc911x_resources[] = {
>  	[0] =	{
> --- a/arch/arm/mach-omap2/board-omap3pandora.c
> +++ b/arch/arm/mach-omap2/board-omap3pandora.c
> @@ -47,6 +47,8 @@
>  #include <mach/usb-musb.h>
>  
>  #include "sdram-micron-mt46h32m32lf-6.h"
> +#include "mmc-twl4030.h"
> +
>  
>  #define NAND_BLOCK_SIZE SZ_128K
>  #define GPMC_CS0_BASE  0x60
> --- a/arch/arm/mach-omap2/mmc-twl4030.h
> +++ b/arch/arm/mach-omap2/mmc-twl4030.h
> @@ -6,20 +6,20 @@
>   * published by the Free Software Foundation.
>   */
>  
> -#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
> -	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
> -
>  struct twl4030_hsmmc_info {
>  	u8	mmc;		/* controller 1/2/3 */
>  	u8	wires;		/* 1/4/8 wires */
>  	int	gpio_cd;	/* or -EINVAL */
>  };
>  
> +#if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
> +	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
> +
>  void hsmmc_init(struct twl4030_hsmmc_info *);
>  
>  #else
>  
> -static inline void hsmmc_init(struct twl4030_hsmmc_info *)
> +static inline void hsmmc_init(struct twl4030_hsmmc_info *info)
>  {
>  }
>  
> 

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-06 17:04                       ` Tony Lindgren
@ 2008-11-06 20:19                         ` Grazvydas Ignotas
  2008-11-07  5:54                           ` David Brownell
  2008-11-06 20:52                         ` David Brownell
  1 sibling, 1 reply; 30+ messages in thread
From: Grazvydas Ignotas @ 2008-11-06 20:19 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap

I have another SD slot connected to MMC2 via transceiver (in addition
to usual MMC1). I wonder how can I add support for that? The easiest
way is to add remaining twl_mmc2_* functions mmc-twl4030.c, and it
works, but this stuff would be useless for all other boards, and I
know you hate #ifdefs here. Another way is to just copy mmc-twl4030.c
and add stuff there, but that would result in lots of code
duplication. BTW, we also have wifi chip on MMC3.
Any ideas?

Gražvydas
--
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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-06 17:04                       ` Tony Lindgren
  2008-11-06 20:19                         ` Grazvydas Ignotas
@ 2008-11-06 20:52                         ` David Brownell
  1 sibling, 0 replies; 30+ messages in thread
From: David Brownell @ 2008-11-06 20:52 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Steve Sakoman, linux-omap

On Thursday 06 November 2008, Tony Lindgren wrote:
> 
> > I'll have a look at write protect ... it wouldn't normally
> > be an IRQ, just an input GPIO.  Unlike the CD, which gets
> > used for both purposes; that code looks iffy too.
> 
> OK. We also need to figure out what to do if we need to support other
> gpios than twl gpios.

Mostly addressed in the patch you'll see.
The remaining bit is better handling of
debouncing.

- 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

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-06 20:19                         ` Grazvydas Ignotas
@ 2008-11-07  5:54                           ` David Brownell
  2008-11-07  9:36                             ` Grazvydas Ignotas
  0 siblings, 1 reply; 30+ messages in thread
From: David Brownell @ 2008-11-07  5:54 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: Tony Lindgren, linux-omap

On Thursday 06 November 2008, Grazvydas Ignotas wrote:
> I have another SD slot connected to MMC2 via transceiver (in addition
> to usual MMC1). I wonder how can I add support for that? The easiest
> way is to add remaining twl_mmc2_* functions mmc-twl4030.c,

I plan a followon to the patch I just sent, which will let the GPIOs
hook up more generically and remove the need for most such non-generic
functions.


> and it 
> works, but this stuff would be useless for all other boards, and I
> know you hate #ifdefs here.

It would help if you explained what needed #ifdeffing, so we
don't need to guess.  I didn't see schematics in any easily
found location on openpandora.org (that's your board?).

Do VMMC1 and GPIO-0/CD hook up to MMC1?
Do VMMC2 and GPIO-1/CD hook up to MMC2?


> Another way is to just copy mmc-twl4030.c 
> and add stuff there, but that would result in lots of code
> duplication. BTW, we also have wifi chip on MMC3.
> Any ideas?

For MMC3 you'll need to write some stuff to hook to that
controller ... currently only MMC1 and MMC2 are set up.

- Dave


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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-07  5:54                           ` David Brownell
@ 2008-11-07  9:36                             ` Grazvydas Ignotas
  2008-11-10 10:36                               ` Grazvydas Ignotas
  0 siblings, 1 reply; 30+ messages in thread
From: Grazvydas Ignotas @ 2008-11-07  9:36 UTC (permalink / raw)
  To: David Brownell; +Cc: Tony Lindgren, linux-omap

On Fri, Nov 7, 2008 at 7:54 AM, David Brownell <david-b@pacbell.net> wrote:
> On Thursday 06 November 2008, Grazvydas Ignotas wrote:
>> I have another SD slot connected to MMC2 via transceiver (in addition
>> to usual MMC1). I wonder how can I add support for that? The easiest
>> way is to add remaining twl_mmc2_* functions mmc-twl4030.c,
>
> I plan a followon to the patch I just sent, which will let the GPIOs
> hook up more generically and remove the need for most such non-generic
> functions.
>
>
>> and it
>> works, but this stuff would be useless for all other boards, and I
>> know you hate #ifdefs here.
>
> It would help if you explained what needed #ifdeffing, so we
> don't need to guess.
Card detect / WP handling for MMC2. If your following patches will
cover that, it will be great!

> I didn't see schematics in any easily
> found location on openpandora.org (that's your board?).
Yes, this is it. There are no public schematics yet, though.

> Do VMMC1 and GPIO-0/CD hook up to MMC1?
> Do VMMC2 and GPIO-1/CD hook up to MMC2?
Yes. There are also WP GPIOs connected from OMAP3 to both slots.

>> Another way is to just copy mmc-twl4030.c
>> and add stuff there, but that would result in lots of code
>> duplication. BTW, we also have wifi chip on MMC3.
>> Any ideas?
>
> For MMC3 you'll need to write some stuff to hook to that
> controller ... currently only MMC1 and MMC2 are set up.
ok, thanks.

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-07  9:36                             ` Grazvydas Ignotas
@ 2008-11-10 10:36                               ` Grazvydas Ignotas
  2008-11-12 22:11                                 ` Tony Lindgren
  0 siblings, 1 reply; 30+ messages in thread
From: Grazvydas Ignotas @ 2008-11-10 10:36 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap

> +static int hsmmc2_set_power(struct device *dev, int slot, int power_on, int vdd)
> +{
> +	int ret;
> +
> +	struct hsmmc_controller *c = &hsmmc[1];
> +
> +	if (power_on) {
> +		u32 reg;
> +
> +		reg = omap_ctrl_readl(c->control_devconf_offset);
> +		reg |= OMAP2_MMCSDIO2ADPCLKISEL;
> +		omap_ctrl_writel(reg, c->control_devconf_offset);

This is not correct for pandora, it needs input clock from the
transceiver, not loop back clock. Perhaps this can be controlled by
platform data, or removed altogether and left for the bootloader?

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

* Re: [PATCH 3/4] HSMMC: Add support for the second controller
  2008-11-10 10:36                               ` Grazvydas Ignotas
@ 2008-11-12 22:11                                 ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2008-11-12 22:11 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: linux-omap

* Grazvydas Ignotas <notasas@gmail.com> [081110 02:37]:
> > +static int hsmmc2_set_power(struct device *dev, int slot, int power_on, int vdd)
> > +{
> > +	int ret;
> > +
> > +	struct hsmmc_controller *c = &hsmmc[1];
> > +
> > +	if (power_on) {
> > +		u32 reg;
> > +
> > +		reg = omap_ctrl_readl(c->control_devconf_offset);
> > +		reg |= OMAP2_MMCSDIO2ADPCLKISEL;
> > +		omap_ctrl_writel(reg, c->control_devconf_offset);
> 
> This is not correct for pandora, it needs input clock from the
> transceiver, not loop back clock. Perhaps this can be controlled by
> platform data, or removed altogether and left for the bootloader?

Let's just pass that with the twl4030_hsmmc_info. Having the
bootloader initialize things adds unnecessary dependencies between
the kernel and bootloader version. Can you send a patch please?

Regards,

Tony

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

end of thread, other threads:[~2008-11-12 22:11 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-31  2:04 [PATCH 0/4] Init updates for hsmmc, also second controller Tony Lindgren
2008-10-31  2:04 ` [PATCH 1/4] HSMMC: Make hsmmc use omap_ctrl_read/write and existing defines Tony Lindgren
2008-10-31  2:04   ` [PATCH 2/4] HSMMC: Fix voltage defines, make card detect gpio controller specific Tony Lindgren
2008-10-31  2:04     ` [PATCH 3/4] HSMMC: Add support for the second controller Tony Lindgren
2008-10-31  2:04       ` [PATCH 4/4] HSMMC: Misc clean-up for hsmmc init Tony Lindgren
2008-10-31  3:12       ` [PATCH 3/4] HSMMC: Add support for the second controller David Brownell
2008-10-31  3:39         ` Tony Lindgren
2008-10-31  6:41           ` David Brownell
2008-10-31 16:35             ` Tony Lindgren
2008-10-31  4:05         ` Steve Sakoman
2008-10-31 10:00           ` David Brownell
2008-10-31 23:35             ` Steve Sakoman
2008-11-01  0:36               ` David Brownell
2008-11-01  2:31                 ` Felipe Balbi
2008-11-01  2:50                 ` Steve Sakoman
2008-11-01  3:02                   ` David Brownell
2008-11-01  3:11                     ` Steve Sakoman
2008-11-03 22:54             ` Steve Sakoman
2008-11-03 23:22               ` Tony Lindgren
2008-11-03 23:36               ` Steve Sakoman
2008-11-05 23:54                 ` David Brownell
2008-11-06  3:32                   ` Tony Lindgren
2008-11-06  7:09                     ` David Brownell
2008-11-06 17:04                       ` Tony Lindgren
2008-11-06 20:19                         ` Grazvydas Ignotas
2008-11-07  5:54                           ` David Brownell
2008-11-07  9:36                             ` Grazvydas Ignotas
2008-11-10 10:36                               ` Grazvydas Ignotas
2008-11-12 22:11                                 ` Tony Lindgren
2008-11-06 20:52                         ` David Brownell

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