diff mbox

Kernel pinmux for OMAP3

Message ID 4A6DB6AE.5090706@balister.org (mailing list archive)
State RFC, archived
Headers show

Commit Message

Philip Balister July 27, 2009, 2:16 p.m. UTC
I've been working on setting up the kernel pinmux so we can use MCSPI3 
and MCSPI4 on the Beagleboard expansion connector. I've attached the 
patches I use to setup the pinumux and configure it from the board file.

There are some issues:

1) Kevin suggested the OMAP3_ prefix. The problem is that the same 
function may appear on multiple balls. Furthermore, depending on the IC 
package, the same ball may have completely different functions. How can 
we change the enum naming to account for this? Should the enum contain 
the ball and package ID? How about having a different mux array for each 
package?

2) I created subroutines to setup each function to avoid cluttering the 
init routine. I like this idea. These routines could be shared across 
different boards though. But the boards may use the same function on 
different pins.

I'd really like to see this issues sorted out so we can start making 
effective use of the kernel pinmux for boards like the beagle and overo 
where the pinmux settings may depend on what people attach to the 
expansion connectors.

Philip
diff mbox

Patch

From d92bebf67d632a7e94bf6e4fc62609c943a66cea Mon Sep 17 00:00:00 2001
From: Philip Balister <balister@moose.(none)>
Date: Wed, 22 Jul 2009 15:25:28 -0400
Subject: [PATCH 3/3] Configure pinmux for MCSPI2 and 4 for beagle.

---
 arch/arm/mach-omap2/board-omap3beagle.c |   41 ++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index ba51dfe..d3850ea 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -420,6 +420,25 @@  static void __init omap3beagle_flash_init(void)
 	}
 }
 
+#ifdef CONFIG_SPI_OMAP24XX
+static void __init omap3_beagle_config_mcspi3_mux(void)
+{
+        omap_cfg_reg(OMAP3_MCSPI3_CLK);
+        omap_cfg_reg(OMAP3_MCSPI3_SIMO);
+        omap_cfg_reg(OMAP3_MCSPI3_SOMI);
+        omap_cfg_reg(OMAP3_MCSPI3_CS0);
+        omap_cfg_reg(OMAP3_MCSPI3_CS1);
+}
+
+static void __init omap3_beagle_config_mcspi4_mux(void)
+{
+        omap_cfg_reg(OMAP3_MCSPI4_CLK);
+        omap_cfg_reg(OMAP3_MCSPI4_SIMO);
+        omap_cfg_reg(OMAP3_MCSPI4_SOMI);
+        omap_cfg_reg(OMAP3_MCSPI4_CS0);
+}
+#endif
+
 static void __init omap3_beagle_init(void)
 {
 	omap3_beagle_i2c_init();
@@ -429,8 +448,13 @@  static void __init omap3_beagle_init(void)
 	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
 	omap_serial_init();
 
+#ifdef CONFIG_SPI_OMAP24XX
+	omap3_beagle_config_mcspi3_mux();
+	omap3_beagle_config_mcspi4_mux();
+
 	spi_register_board_info(beagle_mcspi_board_info,
 			ARRAY_SIZE(beagle_mcspi_board_info));
+#endif
 
 	omap_cfg_reg(J25_34XX_GPIO170);
 	gpio_request(170, "DVI_nPD");
@@ -448,23 +472,6 @@  static void __init omap3_beagle_map_io(void)
 	omap2_map_common_io();
 }
 
-static void __init omap3_beagle_config_mcspi3_mux(void)
-{
-	omap_cfg_reg(OMAP3_MCSPI3_CLK);
-	omap_cfg_reg(OMAP3_MCSPI3_SIMO);
-	omap_cfg_reg(OMAP3_MCSPI3_SOMI);
-	omap_cfg_reg(OMAP3_MCSPI3_CS0);
-	omap_cfg_reg(OMAP3_MCSPI3_CS1);
-}
-
-static void __init omap3_beagle_config_mcspi4_mux(void)
-{
-	omap_cfg_reg(OMAP3_MCSPI4_CLK);
-	omap_cfg_reg(OMAP3_MCSPI4_SIMO);
-	omap_cfg_reg(OMAP3_MCSPI4_SOMI);
-	omap_cfg_reg(OMAP3_MCSPI4_CS0);
-}
-
 MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
 	/* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
 	.phys_io	= 0x48000000,
-- 
1.6.2.5