]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-apollon.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-apollon.c
index 5488961499d2c54a0cd7010a3ff4b5ae9258b615..2ee24a8cf3373dce99025cf610d6eefaa7d6257a 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/leds.h>
-#include <linux/irq.h>
 #include <linux/err.h>
 #include <linux/clk.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/tsc210x.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/arch/board.h>
 #include <asm/arch/common.h>
 #include <asm/arch/gpmc.h>
-#include "prcm-regs.h"
 
 /* LED & Switch macros */
 #define LED0_GPIO13            13
 #define LED1_GPIO14            14
 #define LED2_GPIO15            15
-#define SW_ENTER_GPIO16                16
-#define SW_UP_GPIO17           17
-#define SW_DOWN_GPIO58         58
+#define LED3_GPIO92            92
+#define LED4_GPIO93            93
 
 #define APOLLON_FLASH_CS       0
 #define APOLLON_ETH_CS         1
@@ -129,7 +128,7 @@ static struct resource apollon_smc91x_resources[] = {
        [1] = {
                .start  = OMAP_GPIO_IRQ(APOLLON_ETHR_GPIO_IRQ),
                .end    = OMAP_GPIO_IRQ(APOLLON_ETHR_GPIO_IRQ),
-               .flags  = IORESOURCE_IRQ,
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
 };
 
@@ -164,6 +163,20 @@ static struct omap_led_config apollon_led_config[] = {
                },
                .gpio   = LED2_GPIO15,
        },
+#ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
+       {
+               .cdev   = {
+                       .name   = "apollon:led3",
+               },
+               .gpio   = LED3_GPIO92,
+       },
+       {
+               .cdev   = {
+                       .name   = "apollon:led4",
+               },
+               .gpio   = LED4_GPIO93,
+       },
+#endif
 };
 
 static struct omap_led_platform_data apollon_led_data = {
@@ -250,18 +263,37 @@ static void __init omap_apollon_init_irq(void)
        apollon_init_smc91x();
 }
 
+static struct tsc210x_config tsc_platform_data = {
+       .use_internal           = 1,
+       .monitor                = TSC_TEMP,
+       .mclk                   = "sys_clkout",
+};
+
+static struct spi_board_info apollon_spi_board_info[] = {
+       [0] = {
+               .modalias       = "tsc2101",
+               .irq            = OMAP_GPIO_IRQ(85),
+               .bus_num        = 1,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_1,
+               .max_speed_hz   = 6000000,
+               .platform_data  = &tsc_platform_data,
+       },
+};
+
 static struct omap_uart_config apollon_uart_config __initdata = {
        .enabled_uarts = (1 << 0) | (0 << 1) | (0 << 2),
 };
 
+/*
+ * Note: If you want to detect card feature, please assign GPIO 37
+ */
 static struct omap_mmc_config apollon_mmc_config __initdata = {
        .mmc [0] = {
                .enabled        = 1,
                .wire4          = 1,
-               .wp_pin         = -1,
-               .power_pin      = -1,
-       /* Note: If you want to detect card feature, please assign 37 */
-               .switch_pin     = -1,
+       /* Use internal loop-back in MMC/SDIO Module Input Clock selection */
+               .internal_clock = 1,
        },
 };
 
@@ -276,7 +308,7 @@ static struct omap_lcd_config apollon_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
 
-static struct omap_board_config_kernel apollon_config[] = {
+static struct omap_board_config_kernel apollon_config[] __initdata = {
        { OMAP_TAG_UART,        &apollon_uart_config },
        { OMAP_TAG_MMC,         &apollon_mmc_config },
        { OMAP_TAG_USB,         &apollon_usb_config },
@@ -300,52 +332,18 @@ static void __init apollon_led_init(void)
        omap_request_gpio(LED2_GPIO15);
        omap_set_gpio_direction(LED2_GPIO15, 0);
        omap_set_gpio_dataout(LED2_GPIO15, 0);
-}
-
-static irqreturn_t apollon_sw_interrupt(int irq, void *ignored)
-{
-       static unsigned int led0, led1, led2;
-
-       if (irq == OMAP_GPIO_IRQ(SW_ENTER_GPIO16))
-               omap_set_gpio_dataout(LED0_GPIO13, led0 ^= 1);
-       else if (irq == OMAP_GPIO_IRQ(SW_UP_GPIO17))
-               omap_set_gpio_dataout(LED1_GPIO14, led1 ^= 1);
-       else if (irq == OMAP_GPIO_IRQ(SW_DOWN_GPIO58))
-               omap_set_gpio_dataout(LED2_GPIO15, led2 ^= 1);
-
-       return IRQ_HANDLED;
-}
-
-static void __init apollon_sw_init(void)
-{
-       /* Enter SW - Y11 */
-       omap_cfg_reg(Y11_242X_GPIO16);
-       omap_request_gpio(SW_ENTER_GPIO16);
-       omap_set_gpio_direction(SW_ENTER_GPIO16, 1);
-       /* Up SW - AA12 */
-       omap_cfg_reg(AA12_242X_GPIO17);
-       omap_request_gpio(SW_UP_GPIO17);
-       omap_set_gpio_direction(SW_UP_GPIO17, 1);
-       /* Down SW - AA8 */
-       omap_cfg_reg(AA8_242X_GPIO58);
-       omap_request_gpio(SW_DOWN_GPIO58);
-       omap_set_gpio_direction(SW_DOWN_GPIO58, 1);
-
-       set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQT_RISING);
-       if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt,
-                               IRQF_SHARED, "enter sw",
-                               &apollon_sw_interrupt))
-               return;
-       set_irq_type(OMAP_GPIO_IRQ(SW_UP_GPIO17), IRQT_RISING);
-       if (request_irq(OMAP_GPIO_IRQ(SW_UP_GPIO17), &apollon_sw_interrupt,
-                               IRQF_SHARED, "up sw",
-                               &apollon_sw_interrupt))
-               return;
-       set_irq_type(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), IRQT_RISING);
-       if (request_irq(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), &apollon_sw_interrupt,
-                               IRQF_SHARED, "down sw",
-                               &apollon_sw_interrupt))
-               return;
+#ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
+       /* LED3 - M15 */
+       omap_cfg_reg(M15_24XX_GPIO92);
+       omap_request_gpio(LED3_GPIO92);
+       omap_set_gpio_direction(LED3_GPIO92, 0);
+       omap_set_gpio_dataout(LED3_GPIO92, 0);
+       /* LED4 - P20 */
+       omap_cfg_reg(P20_24XX_GPIO93);
+       omap_request_gpio(LED4_GPIO93);
+       omap_set_gpio_direction(LED4_GPIO93, 0);
+       omap_set_gpio_dataout(LED4_GPIO93, 0);
+#endif
 }
 
 static void __init apollon_usb_init(void)
@@ -358,15 +356,22 @@ static void __init apollon_usb_init(void)
        omap_set_gpio_dataout(12, 0);
 }
 
+static void __init apollon_tsc_init(void)
+{
+       /* TSC2101 */
+       omap_cfg_reg(N15_24XX_GPIO85);
+       omap_request_gpio(85);
+       omap_set_gpio_direction(85, 1);
+
+       omap_cfg_reg(W14_24XX_SYS_CLKOUT);      /* mclk */
+}
+
 static void __init omap_apollon_init(void)
 {
        apollon_led_init();
-       apollon_sw_init();
        apollon_flash_init();
        apollon_usb_init();
-
-       /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */
-       CONTROL_DEVCONF |= (1 << 24);
+       apollon_tsc_init();
 
        /*
         * Make sure the serial ports are muxed on at this point.
@@ -377,10 +382,18 @@ static void __init omap_apollon_init(void)
        omap_board_config = apollon_config;
        omap_board_config_size = ARRAY_SIZE(apollon_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
+       omap_register_i2c_bus(2, 100, NULL, 0);
+
+       spi_register_board_info(apollon_spi_board_info,
+                               ARRAY_SIZE(apollon_spi_board_info));
+
+       apollon_mmc_init();
 }
 
 static void __init omap_apollon_map_io(void)
 {
+       omap2_set_globals_242x();
        omap2_map_common_io();
 }