diff mbox

[4/5] DaVinci: DM355: Update for SPI support in DM355 SOC

Message ID 1247663857-5835-1-git-send-email-s-paulraj@ti.com (mailing list archive)
State Superseded
Headers show

Commit Message

s-paulraj@ti.com July 15, 2009, 1:17 p.m. UTC
From: Sandeep Paulraj <s-paulraj@ti.com>

The patch does the following

1) Updates the SPI clocks so that they are similar
to the DM365.
2) Passes platform data to the SPI driver

A short explanation as to how to modify platform
data if GPIOs are used as chip selects is also given


Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
---
 arch/arm/mach-davinci/dm355.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index b4d709a..8d6122d 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -31,7 +31,7 @@ 
 #include <mach/serial.h>
 #include <mach/common.h>
 #include <mach/asp.h>
-
+#include <mach/spi.h>
 #include "clock.h"
 #include "mux.h"
 
@@ -365,9 +365,9 @@  static struct davinci_clk dm355_clks[] = {
 	CLK(NULL, "asp1", &asp1_clk),
 	CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
 	CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
-	CLK(NULL, "spi0", &spi0_clk),
-	CLK(NULL, "spi1", &spi1_clk),
-	CLK(NULL, "spi2", &spi2_clk),
+	CLK("spi_davinci.0", NULL, &spi0_clk),
+	CLK("spi_davinci.1", NULL, &spi1_clk),
+	CLK("spi_davinci.2", NULL, &spi2_clk),
 	CLK(NULL, "gpio", &gpio_clk),
 	CLK(NULL, "aemif", &aemif_clk),
 	CLK(NULL, "pwm0", &pwm0_clk),
@@ -406,12 +406,31 @@  static struct resource dm355_spi0_resources[] = {
 	 */
 };
 
+/*
+ * The davinci_spi_platform_data can have a "chip_sel" array of GPIOs
+ * For example :
+ * static u8 dm355_spi0_chip_sel[] = {23, 45, DAVINCI_SPI_INTERN_CS};
+ * This array should then become be a part of the platform data
+ * .chip_sel = dm355_spi0_chip_sel,
+ * Appropriately change the 'num_chipselect' in the structure below
+ */
+
+static struct davinci_spi_platform_data dm355_spi0_pdata = {
+	.version = DAVINCI_SPI_VERSION_1,
+	.num_chipselect = 2,
+	.clk_internal	= 1,
+	.cs_hold	= 1,
+	.intr_level	= 0,
+	.poll_mode	= 1,
+};
+
 static struct platform_device dm355_spi0_device = {
 	.name = "spi_davinci",
 	.id = 0,
 	.dev = {
 		.dma_mask = &dm355_spi0_dma_mask,
 		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &dm355_spi0_pdata,
 	},
 	.num_resources = ARRAY_SIZE(dm355_spi0_resources),
 	.resource = dm355_spi0_resources,