Skip to contentSkip to conversation

Init updates for hsmmc, also second controller

PATCH In review Tony Lindgren 5 participants 30 messages Oct 31, 2008 – Nov 12, 2008

Subsystems (4)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Init updates for hsmmc, also second controller

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

author maintainer
#1 lore raw

PATCH 1/4 HSMMC: Make hsmmc use omap_ctrl_read/write and existing defines

Make hsmmc use omap_ctrl_read/write and existing defines

---
 arch/arm/mach-omap2/hsmmc.c               |  116 +++++++++++++++-------------
 arch/arm/plat-omap/include/mach/control.h |   17 ++++
 2 files changed, 79 insertions(+), 54 deletions(-)
arch/arm/mach-omap2/hsmmc.c +62 -54
index b1b18e3..b5ef975 100644
@@ -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);
 }
arch/arm/plat-omap/include/mach/control.h +17 -0
index 9ca0e08..b950e1e 100644
@@ -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);
Signature · 1 line
1.5.6.rc3.21.g8c6b5
author maintainer
#2 lore raw

PATCH 2/4 HSMMC: Fix voltage defines, make card detect gpio controller specific

Fix voltage defines, make card detect gpio controller specific

---
 arch/arm/mach-omap2/hsmmc.c |   60 ++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 26 deletions(-)
arch/arm/mach-omap2/hsmmc.c +34 -26
index b5ef975..f711d7b 100644
@@ -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,
 	},
 };
 
Signature · 1 line
1.5.6.rc3.21.g8c6b5
author maintainer
#3 lore raw

PATCH 3/4 HSMMC: Add support for the second controller

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

---
 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
arch/arm/mach-omap2/board-2430sdp.c +2 -2
index cea2540..8532ef3 100644
@@ -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);
arch/arm/mach-omap2/board-3430sdp.c +2 -2
index 8773698..0221b66 100644
@@ -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)
arch/arm/mach-omap2/board-ldp.c +2 -2
index d4d4e90..387bd41 100644
@@ -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)
arch/arm/mach-omap2/board-omap2evm.c +2 -2
index d284551..68aebe7 100644
@@ -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();
 }
arch/arm/mach-omap2/board-omap3beagle.c +2 -2
index ce6c7b4..062a28b 100644
@@ -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");
arch/arm/mach-omap2/board-omap3evm.c +2 -2
index a72772f..614fa02 100644
@@ -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();
arch/arm/mach-omap2/board-omap3pandora.c +2 -2
index f4180a0..ee001bb 100644
@@ -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();
arch/arm/mach-omap2/board-overo.c +2 -2
index b0e5cec..a4bd804 100644
@@ -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();
arch/arm/mach-omap2/hsmmc.c +136 -56

291 lines not on this page · raw message

arch/arm/plat-omap/include/mach/hsmmc.h deleted +0 -35
deleted file mode 100644
index 587e8ab..0000000
@@ -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 */
-
arch/arm/plat-omap/include/mach/mmc.h +8 -1
index 2f20789..5e8ac72 100644
@@ -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
Signature · 1 line
1.5.6.rc3.21.g8c6b5
author maintainer
#4 lore raw

PATCH 4/4 HSMMC: Misc clean-up for hsmmc init

Misc clean-up for hsmmc init

---
 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(-)
arch/arm/mach-omap1/devices.c +1 -1
index 375a874..024dab1 100644
@@ -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)
arch/arm/mach-omap2/board-overo.c +2 -0
index a4bd804..4f0b5d4 100644
@@ -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,
arch/arm/mach-omap2/devices.c +1 -1
index 32550a5..0dd8b96 100644
@@ -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,
arch/arm/mach-omap2/hsmmc.c +5 -11
index 23cbdf6..f1d050a 100644
@@ -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
arch/arm/plat-omap/devices.c +1 -1
index c22bd5f..25c6d10 100644
@@ -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
arch/arm/plat-omap/include/mach/mmc.h +4 -8
index 5e8ac72..0c2ef3b 100644
@@ -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
Signature · 1 line
1.5.6.rc3.21.g8c6b5
#5 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

In reply to Tony Lindgren

arch/arm/mach-omap2/board-overo.c static void __init overo_init(void) · line 215

Quoted 6 lines · Tony Lindgren
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#6 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 10 lines · David Brownell

arch/arm/mach-omap2/board-overo.c static void __init overo_init(void) · line 215

Quoted 6 lines · Tony Lindgren
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -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

Quoted 10 lines

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

Quoted 2 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 12 lines · Tony Lindgren
Quoted 11 lines · David Brownell

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

Quoted 8 lines
Quoted 2 lines

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.

Quoted 3 lines

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

author maintainer
#8 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 22 lines · David Brownell
Quoted 12 lines · Tony Lindgren
Quoted 11 lines · David Brownell

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

Quoted 8 lines
Quoted 2 lines

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.

Quoted 6 lines

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.

Quoted 17 lines
Quoted 3 lines

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 */
	};
Quoted 7 lines

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

#9 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

In reply to David Brownell
Quoted 10 lines · David Brownell

arch/arm/mach-omap2/board-overo.c static void __init overo_init(void) · line 215

Quoted 6 lines · Tony Lindgren
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -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

#10 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 4 lines · Steve Sakoman
Quoted 2 lines

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(-)
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -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();
arch/arm/mach-omap2/hsmmc.c +1 -0
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 8 lines · David Brownell
Quoted 4 lines · Steve Sakoman
Quoted 2 lines

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:

Quoted 8 lines

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.

Quoted 1 line

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

#12 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 4 lines · Steve Sakoman

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 6 lines · David Brownell
Quoted 4 lines · Steve Sakoman

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.

Quoted 7 lines

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.

Signature · 5 lines
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#14 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

In reply to David Brownell
Quoted 6 lines · David Brownell
Quoted 4 lines · Steve Sakoman

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.

Quoted 7 lines

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

#15 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 5 lines · Steve Sakoman
Quoted 2 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 8 lines · David Brownell
Quoted 5 lines · Steve Sakoman
Quoted 2 lines

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

#17 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

In reply to David Brownell
Quoted 15 lines · David Brownell
Quoted 4 lines · Steve Sakoman
Quoted 2 lines

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

Quoted 2 lines

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

--- 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:~#
author maintainer
#18 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 21 lines · Steve Sakoman
Quoted 15 lines · David Brownell
Quoted 4 lines · Steve Sakoman
Quoted 2 lines

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

Quoted 2 lines

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!

Quoted 7 lines

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

Quoted 55 lines

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

--- 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:~#
#19 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

In reply to Steve Sakoman
Quoted 21 lines · Steve Sakoman
Quoted 15 lines · David Brownell
Quoted 4 lines · Steve Sakoman
Quoted 2 lines

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

Quoted 2 lines

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!

Quoted 7 lines

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

#20 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 8 lines · Steve Sakoman
Quoted 5 lines

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

Quoted 4 lines

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

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

Quoted 8 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#21 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 33 lines · David Brownell
Quoted 8 lines · Steve Sakoman
Quoted 5 lines

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

Quoted 4 lines

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

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

Quoted 8 lines

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

Quoted 6 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 4 lines · Tony Lindgren

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.

Quoted 2 lines

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 <[email protected]>

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.

---
 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(-)
arch/arm/mach-omap2/board-2430sdp.c +3 -0
@@ -44,6 +44,9 @@
 
 #include <asm/io.h>
 
+#include "mmc-twl4030.h"
+
+
 #define	SDP2430_FLASH_CS	0
 #define	SDP2430_SMC91X_CS	5
 
arch/arm/mach-omap2/board-ldp.c +3 -0
@@ -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
arch/arm/mach-omap2/board-omap2evm.c +3 -0
@@ -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[] = {
arch/arm/mach-omap2/board-omap3beagle.c +2 -0
@@ -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
arch/arm/mach-omap2/board-omap3evm.c +2 -0
@@ -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] =	{
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
@@ -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
arch/arm/mach-omap2/mmc-twl4030.h +4 -4
@@ -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)
 {
 }
 
author maintainer
#23 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 7 lines · David Brownell
Quoted 4 lines · Tony Lindgren

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!

Quoted 10 lines

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

Quoted 2 lines

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.

Quoted 1 line

Yes, a better base.

Thanks, pushing.

Tony

Quoted 119 lines

- Dave

========= CUT HERE
From: David Brownell <[email protected]>

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.

---
 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(-)
arch/arm/mach-omap2/board-2430sdp.c +3 -0
@@ -44,6 +44,9 @@
 
 #include <asm/io.h>
 
+#include "mmc-twl4030.h"
+
+
 #define	SDP2430_FLASH_CS	0
 #define	SDP2430_SMC91X_CS	5
 
arch/arm/mach-omap2/board-ldp.c +3 -0
@@ -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
arch/arm/mach-omap2/board-omap2evm.c +3 -0
@@ -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[] = {
arch/arm/mach-omap2/board-omap3beagle.c +2 -0
@@ -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
arch/arm/mach-omap2/board-omap3evm.c +2 -0
@@ -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] =	{
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
@@ -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
arch/arm/mach-omap2/mmc-twl4030.h +4 -4
@@ -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)
 {
 }
 
#24 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#25 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 3 lines · Grazvydas Ignotas

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.

Quoted 3 lines

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?

Quoted 4 lines

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

#26 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 10 lines · David Brownell
Quoted 3 lines · Grazvydas Ignotas

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.

Quoted 6 lines
Quoted 3 lines

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!

Quoted 2 lines

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.

Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

#27 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Review

Quoted 12 lines
(quoted diff) +12 -0
+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?

author maintainer
#28 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

Quoted 8 lines · Grazvydas Ignotas
Quoted 8 lines
(quoted diff) +8 -0
+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;
Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+		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

#29 lore raw

Re: [PATCH 3/4] HSMMC: Add support for the second controller

In reply to Tony Lindgren
Quoted 7 lines · Tony Lindgren
Quoted 4 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html