Re: [PATCH 06/10] OMAP3: MMC: Add mux for pins, v2

2009-08-16 Thread Tony Lindgren
* Russell King - ARM Linux  [090813 12:26]:
> On Wed, Aug 12, 2009 at 03:18:49PM +0300, Tony Lindgren wrote:
> > +   if (mmc_controller->slots[0].wires == 8)
> > +   printk(KERN_WARNING
> > +   "\n MMC2: DAT4, DAT5, DAT6, DAT7: "
> > +   "Setup the mux in board file");
> > +   }
> > +   if (controller_nr == 2) {
> > +   /* MMC3 */
> > +   printk(KERN_WARNING
> > +   "\n MMC3: Setup the mux in board file: "
> > +   "Multiple options exist, so is board specific");
> > +   }
> 
> Having printks which issue a level, followed by a newline, message and
> omitting the newline at the end looks really wrong:
> 
> - firstly, the KERN_WARNING "\n" line creates a blank line in the kernel
>   message log.
> - the message itself will be at the kernels default message level
> - the following kernel message will be appended to the end, with any
>   level tag exposed.
> 
> So I think the above printk statements are completely wrong and broken.

I've updated the patch to change the printk statements to just comments.

Regards,

Tony
>From fc3866a4da5cfcc7090809367997b2f4fce6a382 Mon Sep 17 00:00:00 2001
From: Vikram Pandita 
Date: Sun, 16 Aug 2009 18:17:06 +0300
Subject: [PATCH] OMAP3: MMC: Add mux for pins

For OMAP3 add MMC1 MMC2 pin mux MMC3 mux is not added as there are
multiple configurations possible, so the muxing is left to be done
in board file.

Signed-off-by: Vikram Pandita 
Signed-off-by: Chikkature Rajashekar 
Signed-off-by: Tony Lindgren 

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 894cc35..a2e9156 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -513,6 +513,47 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
 		}
 	}
+
+	if (cpu_is_omap3430()) {
+		if (controller_nr == 0) {
+			omap_cfg_reg(N28_3430_MMC1_CLK);
+			omap_cfg_reg(M27_3430_MMC1_CMD);
+			omap_cfg_reg(N27_3430_MMC1_DAT0);
+			if (mmc_controller->slots[0].wires == 4 ||
+mmc_controller->slots[0].wires == 8) {
+omap_cfg_reg(N26_3430_MMC1_DAT1);
+omap_cfg_reg(N25_3430_MMC1_DAT2);
+omap_cfg_reg(P28_3430_MMC1_DAT3);
+			}
+			if (mmc_controller->slots[0].wires == 8) {
+omap_cfg_reg(P27_3430_MMC1_DAT4);
+omap_cfg_reg(P26_3430_MMC1_DAT5);
+omap_cfg_reg(R27_3430_MMC1_DAT6);
+omap_cfg_reg(R25_3430_MMC1_DAT7);
+			}
+		}
+		if (controller_nr == 1) {
+			/* MMC2 */
+			omap_cfg_reg(AE2_3430_MMC2_CLK);
+			omap_cfg_reg(AG5_3430_MMC2_CMD);
+			omap_cfg_reg(AH5_3430_MMC2_DAT0);
+
+			/*
+			 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
+			 * in the board-*.c files
+			 */
+			if (mmc_controller->slots[0].wires == 4 ||
+mmc_controller->slots[0].wires == 8) {
+omap_cfg_reg(AH4_3430_MMC2_DAT1);
+omap_cfg_reg(AG4_3430_MMC2_DAT2);
+omap_cfg_reg(AF4_3430_MMC2_DAT3);
+			}
+		}
+
+		/*
+		 * For MMC3 the pins need to be muxed in the board-*.c files
+		 */
+	}
 }
 
 void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 026c4fc..d49b9a7 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -486,6 +486,55 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+/* MMC1 */
+MUX_CFG_34XX("N28_3430_MMC1_CLK", 0x144,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("M27_3430_MMC1_CMD", 0x146,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("N27_3430_MMC1_DAT0", 0x148,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("N26_3430_MMC1_DAT1", 0x14a,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("N25_3430_MMC1_DAT2", 0x14c,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("P28_3430_MMC1_DAT3", 0x14e,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("P27_3430_MMC1_DAT4", 0x150,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("P26_3430_MMC1_DAT5", 0x152,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("R27_3430_MMC1_DAT6", 0x154,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("R25_3430_MMC1_DAT7", 0x156,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+
+/* MMC2 */
+MUX_CFG_34XX("AE2_3430_MMC2_CLK", 0x158,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AG5_3430_MMC2_CMD", 0x15A,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AH5_3430_MMC2_DAT0", 0x15c,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AH4_3430_MMC2_DAT1", 0x15e,
+		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AG4_3430_MMC2_DAT2", 0x160,
+		OMA

Re: [PATCH 06/10] OMAP3: MMC: Add mux for pins

2009-08-13 Thread Russell King - ARM Linux
On Wed, Aug 12, 2009 at 03:18:49PM +0300, Tony Lindgren wrote:
> + if (mmc_controller->slots[0].wires == 8)
> + printk(KERN_WARNING
> + "\n MMC2: DAT4, DAT5, DAT6, DAT7: "
> + "Setup the mux in board file");
> + }
> + if (controller_nr == 2) {
> + /* MMC3 */
> + printk(KERN_WARNING
> + "\n MMC3: Setup the mux in board file: "
> + "Multiple options exist, so is board specific");
> + }

Having printks which issue a level, followed by a newline, message and
omitting the newline at the end looks really wrong:

- firstly, the KERN_WARNING "\n" line creates a blank line in the kernel
  message log.
- the message itself will be at the kernels default message level
- the following kernel message will be appended to the end, with any
  level tag exposed.

So I think the above printk statements are completely wrong and broken.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/10] OMAP3: MMC: Add mux for pins

2009-08-12 Thread Tony Lindgren
From: Vikram Pandita 

For OMAP3 add MMC1 MMC2 pin mux
MMC3 mux is not added as there are multiple configurations possible,
so the muxing is left to be done in board file

Signed-off-by: Vikram Pandita 
Signed-off-by: Chikkature Rajashekar 
Signed-off-by: Tony Lindgren 
---
 arch/arm/mach-omap2/devices.c |   42 
 arch/arm/mach-omap2/mux.c |   49 +
 arch/arm/plat-omap/include/mach/mux.h |   28 +++
 3 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 894cc35..91cb84d 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -513,6 +513,48 @@ static inline void omap2_mmc_mux(struct 
omap_mmc_platform_data *mmc_controller,
omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
}
}
+
+   if (cpu_is_omap3430()) {
+   if (controller_nr == 0) {
+   omap_cfg_reg(N28_3430_MMC1_CLK);
+   omap_cfg_reg(M27_3430_MMC1_CMD);
+   omap_cfg_reg(N27_3430_MMC1_DAT0);
+   if (mmc_controller->slots[0].wires == 4 ||
+   mmc_controller->slots[0].wires == 8) {
+   omap_cfg_reg(N26_3430_MMC1_DAT1);
+   omap_cfg_reg(N25_3430_MMC1_DAT2);
+   omap_cfg_reg(P28_3430_MMC1_DAT3);
+   }
+   if (mmc_controller->slots[0].wires == 8) {
+   omap_cfg_reg(P27_3430_MMC1_DAT4);
+   omap_cfg_reg(P26_3430_MMC1_DAT5);
+   omap_cfg_reg(R27_3430_MMC1_DAT6);
+   omap_cfg_reg(R25_3430_MMC1_DAT7);
+   }
+   }
+   if (controller_nr == 1) {
+   /* MMC2 */
+   omap_cfg_reg(AE2_3430_MMC2_CLK);
+   omap_cfg_reg(AG5_3430_MMC2_CMD);
+   omap_cfg_reg(AH5_3430_MMC2_DAT0);
+   if (mmc_controller->slots[0].wires == 4 ||
+   mmc_controller->slots[0].wires == 8) {
+   omap_cfg_reg(AH4_3430_MMC2_DAT1);
+   omap_cfg_reg(AG4_3430_MMC2_DAT2);
+   omap_cfg_reg(AF4_3430_MMC2_DAT3);
+   }
+   if (mmc_controller->slots[0].wires == 8)
+   printk(KERN_WARNING
+   "\n MMC2: DAT4, DAT5, DAT6, DAT7: "
+   "Setup the mux in board file");
+   }
+   if (controller_nr == 2) {
+   /* MMC3 */
+   printk(KERN_WARNING
+   "\n MMC3: Setup the mux in board file: "
+   "Multiple options exist, so is board specific");
+   }
+   }
 }
 
 void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 026c4fc..d49b9a7 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -486,6 +486,55 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+/* MMC1 */
+MUX_CFG_34XX("N28_3430_MMC1_CLK", 0x144,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("M27_3430_MMC1_CMD", 0x146,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("N27_3430_MMC1_DAT0", 0x148,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("N26_3430_MMC1_DAT1", 0x14a,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("N25_3430_MMC1_DAT2", 0x14c,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("P28_3430_MMC1_DAT3", 0x14e,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("P27_3430_MMC1_DAT4", 0x150,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("P26_3430_MMC1_DAT5", 0x152,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("R27_3430_MMC1_DAT6", 0x154,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("R25_3430_MMC1_DAT7", 0x156,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+
+/* MMC2 */
+MUX_CFG_34XX("AE2_3430_MMC2_CLK", 0x158,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AG5_3430_MMC2_CMD", 0x15A,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AH5_3430_MMC2_DAT0", 0x15c,
+   OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AH4_34