Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[sfrench/cifs-2.6.git] / arch / arm / mach-omap1 / board-h3.c
index 4f84ae273a1fe1e8912a5b6df863b2dbd7fc61ca..c3ef1ee5f77bcd4a01fb9a5ecac297493c850651 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/input.h>
+#include <linux/spi/spi.h>
+#include <linux/i2c/tps65010.h>
 
 #include <asm/setup.h>
 #include <asm/page.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 
-#include <asm/arch/tps65010.h>
 #include <asm/arch/gpioexpander.h>
 #include <asm/arch/irqs.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/tc.h>
+#include <asm/arch/nand.h>
 #include <asm/arch/irda.h>
 #include <asm/arch/usb.h>
 #include <asm/arch/keypad.h>
@@ -50,7 +52,7 @@
 #include <asm/arch/mcbsp.h>
 #include <asm/arch/omap-alsa.h>
 
-extern int omap_gpio_init(void);
+#define H3_TS_GPIO     48
 
 static int h3_keymap[] = {
        KEY(0, 0, KEY_LEFT),
@@ -179,7 +181,7 @@ static struct mtd_partition nand_partitions[] = {
 };
 
 /* dip switches control NAND chip access:  8 bit, 16 bit, or neither */
-static struct nand_platform_data nand_data = {
+static struct omap_nand_platform_data nand_data = {
        .options        = NAND_SAMSUNG_LP_OPTIONS,
        .parts          = nand_partitions,
        .nr_parts       = ARRAY_SIZE(nand_partitions),
@@ -208,7 +210,7 @@ static struct resource smc91x_resources[] = {
        [1] = {
                .start  = OMAP_GPIO_IRQ(40),
                .end    = OMAP_GPIO_IRQ(40),
-               .flags  = IORESOURCE_IRQ,
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        },
 };
 
@@ -374,6 +376,17 @@ static struct platform_device h3_lcd_device = {
        .id             = -1,
 };
 
+static struct spi_board_info h3_spi_board_info[] __initdata = {
+       [0] = {
+               .modalias       = "tsc2101",
+               .bus_num        = 2,
+               .chip_select    = 0,
+               .irq            = OMAP_GPIO_IRQ(H3_TS_GPIO),
+               .max_speed_hz   = 16000000,
+               /* .platform_data       = &tsc_platform_data, */
+       },
+};
+
 static struct omap_mcbsp_reg_cfg mcbsp_regs = {
        .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
        .spcr1 = RINTM(3) | RRST,
@@ -387,18 +400,18 @@ static struct omap_mcbsp_reg_cfg mcbsp_regs = {
        .srgr2 = GSYNC | CLKSP | FSGM | FPER(31),
 
        .pcr0  = CLKRM | SCLKME | FSXP | FSRP | CLKXP | CLKRP,
-       //.pcr0 = CLKXP | CLKRP,        /* mcbsp: slave */
+       /*.pcr0 = CLKXP | CLKRP,*/        /* mcbsp: slave */
 };
 
 static struct omap_alsa_codec_config alsa_config = {
        .name                   = "H3 TSC2101",
        .mcbsp_regs_alsa        = &mcbsp_regs,
-       .codec_configure_dev    = NULL, // tsc2101_configure,
-       .codec_set_samplerate   = NULL, // tsc2101_set_samplerate,
-       .codec_clock_setup      = NULL, // tsc2101_clock_setup,
-       .codec_clock_on         = NULL, // tsc2101_clock_on,
-       .codec_clock_off        = NULL, // tsc2101_clock_off,
-       .get_default_samplerate = NULL, // tsc2101_get_default_samplerate,
+       .codec_configure_dev    = NULL, /* tsc2101_configure, */
+       .codec_set_samplerate   = NULL, /* tsc2101_set_samplerate, */
+       .codec_clock_setup      = NULL, /* tsc2101_clock_setup, */
+       .codec_clock_on         = NULL, /* tsc2101_clock_on, */
+       .codec_clock_off        = NULL, /* tsc2101_clock_off, */
+       .get_default_samplerate = NULL, /* tsc2101_get_default_samplerate, */
 };
 
 static struct platform_device h3_mcbsp1_device = {
@@ -436,12 +449,13 @@ static struct omap_usb_config h3_usb_config __initdata = {
 
 static struct omap_mmc_config h3_mmc_config __initdata = {
        .mmc[0] = {
-               .enabled        = 1,
-               .power_pin      = -1,   /* tps65010 GPIO4 */
-               .switch_pin     = OMAP_MPUIO(1),
-       },
+               .enabled        = 1,
+               .wire4          = 1,
+       },
 };
 
+extern struct omap_mmc_platform_data h3_mmc_data;
+
 static struct omap_uart_config h3_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -450,7 +464,7 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
 
-static struct omap_board_config_kernel h3_config[] = {
+static struct omap_board_config_kernel h3_config[] __initdata = {
        { OMAP_TAG_USB,         &h3_usb_config },
        { OMAP_TAG_MMC,         &h3_mmc_config },
        { OMAP_TAG_UART,        &h3_uart_config },
@@ -458,21 +472,28 @@ static struct omap_board_config_kernel h3_config[] = {
 };
 
 static struct i2c_board_info __initdata h3_i2c_board_info[] = {
+       {
+               I2C_BOARD_INFO("tps65010", 0x48),
+               .type           = "tps65013",
+               /* .irq         = OMAP_GPIO_IRQ(??), */
+       },
+};
+
+static struct omap_gpio_switch h3_gpio_switches[] __initdata = {
        {
-               I2C_BOARD_INFO("tps65010", 0x48),
-               .type           = "tps65013",
-               /* .irq         = OMAP_GPIO_IRQ(??), */
+               .name                   = "mmc_slot",
+               .gpio                   = OMAP_MPUIO(1),
+               .type                   = OMAP_GPIO_SWITCH_TYPE_COVER,
+               .debounce_rising        = 100,
+               .debounce_falling       = 0,
+               .notify                 = h3_mmc_slot_cover_handler,
+               .notify_data            = NULL,
        },
-       /* TODO when driver support is ready:
-        *  - isp1301 OTG transceiver
-        *  - optional ov9640 camera sensor at 0x30
-        *  - ...
-        */
 };
 
 #define H3_NAND_RB_GPIO_PIN    10
 
-static int nand_dev_ready(struct nand_platform_data *data)
+static int nand_dev_ready(struct omap_nand_platform_data *data)
 {
        return omap_get_gpio_datain(H3_NAND_RB_GPIO_PIN);
 }
@@ -500,13 +521,14 @@ static void __init h3_init(void)
        omap_cfg_reg(V2_1710_GPIO10);
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
+       spi_register_board_info(h3_spi_board_info,
+                               ARRAY_SIZE(h3_spi_board_info));
        omap_board_config = h3_config;
        omap_board_config_size = ARRAY_SIZE(h3_config);
        omap_serial_init();
-
-       /* FIXME setup irq for tps65013 chip */
-       i2c_register_board_info(1, h3_i2c_board_info,
-                       ARRAY_SIZE(h3_i2c_board_info));
+       omap_register_i2c_bus(1, 100, h3_i2c_board_info,
+                             ARRAY_SIZE(h3_i2c_board_info));
+       h3_mmc_init();
 }
 
 static void __init h3_init_smc91x(void)
@@ -531,23 +553,6 @@ static void __init h3_map_io(void)
        omap1_map_common_io();
 }
 
-#ifdef CONFIG_TPS65010
-static int __init h3_tps_init(void)
-{
-       if (!machine_is_omap_h3())
-               return 0;
-
-       /* gpio4 for SD, gpio3 for VDD_DSP */
-       /* FIXME send power to DSP iff it's configured */
-
-       /* Enable LOW_PWR */
-       tps65013_set_low_pwr(ON);
-
-       return 0;
-}
-fs_initcall(h3_tps_init);
-#endif
-
 MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
        /* Maintainer: Texas Instruments, Inc. */
        .phys_io        = 0xfff00000,