BeagleBoard/SPI/Patch-2.6.37

From 9241c22a3919d298aba3dd99ba578db9164eef2c Mon Sep 17 00:00:00 2001 From: Ben Gamari  Date: Sun, 28 Nov 2010 22:02:18 -0500 Subject: [PATCH] Setup mcspi3 and mcspi4 as spidev devices

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

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 14f4224..58bacb6 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -29,6 +29,7 @@ +#include  @@ -499,6 +500,54 @@ static struct platform_device *omap3_beagle_devices[] __initdata = { &beagle_dss_device, }; +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_mcspi4_mux(void) +{ +       // NOTE: Clock pins need to be in input mode +	omap_mux_init_signal("mcbsp1_clkr.mcspi4_clk", OMAP_PIN_INPUT); +	omap_mux_init_signal("mcbsp1_fsx.mcspi4_cs0", OMAP_PIN_OUTPUT); +	omap_mux_init_signal("mcbsp1_dx.mcspi4_simo", OMAP_PIN_OUTPUT); +	omap_mux_init_signal("mcbsp1_dr.mcspi4_somi", OMAP_PIN_INPUT_PULLUP); +} + +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, +	}, + +	// spi 4.0 +	{ +		.modalias	= "spidev", +		.max_speed_hz	= 48000000, //48 Mbps +		.bus_num	= 4, +		.chip_select	= 0, +		.mode = SPI_MODE_1, +	}, +}; + static void __init omap3beagle_flash_init(void) { 	u8 cs = 0; @@ -567,6 +616,11 @@ static void __init omap3_beagle_init(void) ARRAY_SIZE(omap3_beagle_devices)); 	omap_serial_init; +	omap3_beagle_config_mcspi3_mux; +	omap3_beagle_config_mcspi4_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 ... */ -- 1.7.0.4
 * 1) include 
 * 2) include 
 * 1) include 
 * 2) include 