]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-2430sdp.c
Merge omap-drivers
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-2430sdp.c
index 77e77c1a028f76c6d5be85b15ed80e96b2021329..ebd26304f755e558123f996de82c044a7f5a8c4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/omap2/board-2430sdp.c
+ * linux/arch/arm/mach-omap2/board-2430sdp.c
  *
  * Copyright (C) 2006 Texas Instruments
  *
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/delay.h>
-#include <linux/workqueue.h>
-#include <linux/input.h>
 #include <linux/err.h>
 #include <linux/clk.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/tsc2046.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/flash.h>
 
 #include <asm/arch/gpio.h>
-#include <asm/arch/gpioexpander.h>
 #include <asm/arch/mux.h>
-#include <asm/arch/usb.h>
-#include <asm/arch/irda.h>
 #include <asm/arch/board.h>
 #include <asm/arch/common.h>
-#include <asm/arch/keypad.h>
-#include <asm/arch/menelaus.h>
-#include <asm/arch/dma.h>
 #include <asm/arch/gpmc.h>
+#include <asm/arch/mcspi.h>
 #include "prcm-regs.h"
 
 #include <asm/io.h>
 
-
 #define        SDP2430_FLASH_CS        0
 #define        SDP2430_SMC91X_CS       5
 
+/* TSC2046 (touchscreen) */
+#define TS_GPIO                 24
+
 static struct mtd_partition sdp2430_partitions[] = {
        /* bootloader (U-Boot, etc) in first sector */
        {
@@ -128,6 +125,31 @@ static struct platform_device *sdp2430_devices[] __initdata = {
        &sdp2430_flash_device,
 };
 
+static struct tsc2046_platform_data tsc2046_config = {
+       .dav_gpio       = TS_GPIO,
+       .gpio_debounce  = 0xa,
+};
+
+static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
+       .turbo_mode     = 0,
+       .single_channel = 0,  /* 0: slave, 1: master */
+};
+
+static struct spi_board_info sdp2430_spi_board_info[] __initdata = {
+       [0] = {
+               /*
+                * TSC2046 operates at a max freqency of 2MHz, so
+                * operate slightly below at 1.5MHz
+                */
+               .modalias        = "tsc2046",
+               .bus_num         = 1,
+               .chip_select     = 0,
+               .max_speed_hz    = 1500000,
+               .controller_data = &tsc2046_mcspi_config,
+               .platform_data   = &tsc2046_config,
+       },
+};
+
 static inline void __init sdp2430_init_smc91x(void)
 {
        int eth_cs;
@@ -201,12 +223,91 @@ static struct omap_board_config_kernel sdp2430_config[] = {
        {OMAP_TAG_UART, &sdp2430_uart_config},
 };
 
+#if    defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
+
+#define OMAP2_I2C_BASE1                0x48070000
+#define OMAP2_I2C_BASE2                0x48072000
+#define OMAP2_I2C_INT1         56
+#define OMAP2_I2C_INT2         57
+
+static u32 omap2_i2c1_clkrate  = 400;
+static u32 omap2_i2c2_clkrate  = 2600;
+
+static struct resource i2c_resources1[] = {
+       {
+               .start  = OMAP2_I2C_BASE1,
+               .end    = OMAP2_I2C_BASE1 + 0x3f,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = OMAP2_I2C_INT1,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct resource i2c_resources2[] = {
+       {
+               .start  = OMAP2_I2C_BASE2,
+               .end    = OMAP2_I2C_BASE2 + 0x3f,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = OMAP2_I2C_INT2,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device omap_i2c_device1 = {
+       .name           = "i2c_omap",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(i2c_resources1),
+       .resource       = i2c_resources1,
+       .dev            = {
+               .platform_data  = &omap2_i2c1_clkrate,
+       },
+};
+
+static struct platform_device omap_i2c_device2 = {
+       .name           = "i2c_omap",
+       .id             = 2,
+       .num_resources  = ARRAY_SIZE(i2c_resources2),
+       .resource       = i2c_resources2,
+       .dev            = {
+               .platform_data  = &omap2_i2c2_clkrate,
+       },
+};
+
+static void omap_init_i2c(void)
+{
+       (void) platform_device_register(&omap_i2c_device2);
+       (void) platform_device_register(&omap_i2c_device1);
+}
+
+#else
+
+static void omap_init_i2c(void) {}
+
+#endif
+
+static int __init omap2430_i2c_init(void)
+{
+       omap_init_i2c();
+       return 0;
+}
+
+extern void __init sdp2430_flash_init(void);
+
 static void __init omap_2430sdp_init(void)
 {
        platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
        omap_board_config = sdp2430_config;
        omap_board_config_size = ARRAY_SIZE(sdp2430_config);
        omap_serial_init();
+
+       sdp2430_flash_init();
+
+       spi_register_board_info(sdp2430_spi_board_info,
+                               ARRAY_SIZE(sdp2430_spi_board_info));
 }
 
 static void __init omap_2430sdp_map_io(void)
@@ -214,6 +315,8 @@ static void __init omap_2430sdp_map_io(void)
        omap2_map_common_io();
 }
 
+arch_initcall(omap2430_i2c_init);
+
 MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
        /* Maintainer: Syed Khasim - Texas Instruments Inc */
        .phys_io        = 0x48000000,