Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

BeagleBoard/SPI/Patch-rcn-ee-2.6.38.2-d9 mcspi3 gpio144 gpio183

From eLinux.org
< BeagleBoard‎ | SPI
Revision as of 08:39, 28 April 2011 by Damian0815 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index dd083ae..de62907 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -2,6 +2,8 @@
 # Makefile for the linux kernel.
 #
 
+CFLAGS_mux.o += -DDEBUG
+
 # Common support
 obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
 	 common.o gpio.o dma.o wd_timer.o
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 10b33d7..b2ff61d 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -31,6 +31,7 @@
 #include <linux/mtd/nand.h>
 #include <linux/mmc/host.h>
 
+#include <linux/spi/spi.h>
 #include <linux/regulator/machine.h>
 #include <linux/i2c/twl.h>
 
@@ -56,6 +57,8 @@
 
 #define NAND_BLOCK_SIZE		SZ_128K
 
+#define DAMIANS_WATTEROTT_BOARD
+
 /*
  * OMAP3 Beagle revision
  * Run time detection of Beagle revision is done by reading GPIO.
@@ -351,18 +354,21 @@ static void __init beagle_display_init(void)
 
 #include "sdram-micron-mt46h32m32lf-6.h"
 
+
 static struct omap2_hsmmc_info mmc[] = {
 	{
 		.mmc		= 1,
 		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 		.gpio_wp	= 29,
 	},
+#ifndef DAMIANS_WATTEROTT_BOARD
 	{
 		.mmc		= 2,
 		.caps		= MMC_CAP_4_BIT_DATA,
 		.transceiver	= true,
 		.ocr_mask	= 0x00100000,	/* 3.3V */
 	},
+#endif
 	{}	/* Terminator */
 };
 
@@ -604,7 +610,9 @@ static int __init omap3_beagle_i2c_init(void)
 	}
 	else
 	{
+#ifndef DAMIANS_WATTEROTT_BOARD
 	omap_register_i2c_bus(2, 400, NULL, 0);
+#endif
 	}
 	/* Bus 3 is attached to the DVI port where devices like the pico DLP
 	 * projector don't work reliably with 400kHz */
@@ -685,6 +693,50 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&keys_gpio,
 };
 
+
+#ifdef DAMIANS_WATTEROTT_BOARD
+		
+static void __init omap3_beagle_config_mcspi3_mux(void)
+{
+        // NOTE: Clock pins need to be in input mode
+	omap_mux_init_signal("sdmmc2_clk.mcspi3_clk", OMAP_PIN_INPUT);
+	omap_mux_init_signal("sdmmc2_dat3.mcspi3_cs0", OMAP_PIN_OUTPUT);
+	omap_mux_init_signal("sdmmc2_dat2.mcspi3_cs1", OMAP_PIN_OUTPUT);
+	omap_mux_init_signal("sdmmc2_cmd.mcspi3_simo", OMAP_PIN_OUTPUT);
+	omap_mux_init_signal("sdmmc2_dat0.mcspi3_somi", OMAP_PIN_INPUT_PULLUP);
+}
+
+static void __init omap3_beagle_config_damians_watterott_mux(void)
+{
+	omap3_beagle_config_mcspi3_mux();
+
+	omap_mux_init_signal("uart2_cts.gpio_144", OMAP_PIN_OUTPUT );
+	omap_mux_init_signal("i2c2_sda.gpio_183", OMAP_PIN_OUTPUT );
+}
+
+static struct spi_board_info beagle_mcspi_board_info[] = {
+	// spi 3.0
+	{
+		.modalias	= "spidev",
+		.max_speed_hz	= 48000000, //48 Mbps
+		.bus_num	= 3,
+		.chip_select	= 0,	
+		.mode = SPI_MODE_1,
+	},
+
+	// spi 3.1
+	{
+		.modalias	= "spidev",
+		.max_speed_hz	= 48000000, //48 Mbps
+		.bus_num	= 3,
+		.chip_select	= 1,	
+		.mode = SPI_MODE_1,
+	},
+
+};
+
+#endif
+
 static void __init omap3beagle_flash_init(void)
 {
 	u8 cs = 0;
@@ -814,6 +866,10 @@ static void __init omap3_beagle_init(void)
 	omap_display_init(&beagle_dss_data);
 	omap_serial_init();
 
+	omap3_beagle_config_damians_watterott_mux();
+	spi_register_board_info(beagle_mcspi_board_info,
+			ARRAY_SIZE(beagle_mcspi_board_info));
+
 	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
 	gpio_request(170, "DVI_nPD");
 	/* REVISIT leave DVI powered down until it's needed ... */