]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap1/board-innovator.c
Merge branches 'topic/fix/asoc', 'topic/fix/hda', 'topic/fix/misc' and 'topic/pci...
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap1 / board-innovator.c
index e90c137a4cf315cbf70ec3959d74090d4554643e..cbc11be5cd2a9ebcbc1fc43f82308f17c969076c 100644 (file)
 #include <linux/mtd/partitions.h>
 #include <linux/input.h>
 
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 
-#include <asm/arch/mux.h>
-#include <asm/arch/fpga.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/tc.h>
-#include <asm/arch/usb.h>
-#include <asm/arch/keypad.h>
-#include <asm/arch/common.h>
+#include <mach/mux.h>
+#include <mach/fpga.h>
+#include <mach/gpio.h>
+#include <mach/tc.h>
+#include <mach/usb.h>
+#include <mach/keypad.h>
+#include <mach/common.h>
+#include <mach/mcbsp.h>
+#include <mach/omap-alsa.h>
 
 static int innovator_keymap[] = {
        KEY(0, 0, KEY_F1),
@@ -112,6 +114,42 @@ static struct platform_device innovator_flash_device = {
        .resource       = &innovator_flash_resource,
 };
 
+#define DEFAULT_BITPERSAMPLE 16
+
+static struct omap_mcbsp_reg_cfg mcbsp_regs = {
+       .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
+       .spcr1 = RINTM(3) | RRST,
+       .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
+           RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
+       .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
+       .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
+           XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
+       .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
+       .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
+       .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
+       /*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/ /* mcbsp: master */
+       .pcr0 = CLKXP | CLKRP,  /* mcbsp: slave */
+};
+
+static struct omap_alsa_codec_config alsa_config = {
+       .name                   = "OMAP Innovator AIC23",
+       .mcbsp_regs_alsa        = &mcbsp_regs,
+       .codec_configure_dev    = NULL, /* aic23_configure, */
+       .codec_set_samplerate   = NULL, /* aic23_set_samplerate, */
+       .codec_clock_setup      = NULL, /* aic23_clock_setup, */
+       .codec_clock_on         = NULL, /* aic23_clock_on, */
+       .codec_clock_off        = NULL, /* aic23_clock_off, */
+       .get_default_samplerate = NULL, /* aic23_get_default_samplerate, */
+};
+
+static struct platform_device innovator_mcbsp1_device = {
+       .name   = "omap_alsa_mcbsp",
+       .id     = 1,
+       .dev = {
+               .platform_data  = &alsa_config,
+       },
+};
+
 static struct resource innovator_kp_resources[] = {
        [0] = {
                .start  = INT_KEYBOARD,
@@ -121,9 +159,11 @@ static struct resource innovator_kp_resources[] = {
 };
 
 static struct omap_kp_platform_data innovator_kp_data = {
-       .rows   = 8,
-       .cols   = 8,
-       .keymap = innovator_keymap,
+       .rows           = 8,
+       .cols           = 8,
+       .keymap         = innovator_keymap,
+       .keymapsize     = ARRAY_SIZE(innovator_keymap),
+       .delay          = 4,
 };
 
 static struct platform_device innovator_kp_device = {
@@ -139,6 +179,10 @@ static struct platform_device innovator_kp_device = {
 
 #ifdef CONFIG_ARCH_OMAP15XX
 
+#include <linux/spi/spi.h>
+#include <linux/spi/ads7846.h>
+
+
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc innovator1510_io_desc[] __initdata = {
        {
@@ -158,7 +202,7 @@ static struct resource innovator1510_smc91x_resources[] = {
        [1] = {
                .start  = OMAP1510_INT_ETHER,
                .end    = OMAP1510_INT_ETHER,
-               .flags  = IORESOURCE_IRQ,
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
 };
 
@@ -174,13 +218,44 @@ static struct platform_device innovator1510_lcd_device = {
        .id             = -1,
 };
 
+static struct platform_device innovator1510_spi_device = {
+       .name           = "spi_inn1510",
+       .id             = -1,
+};
+
 static struct platform_device *innovator1510_devices[] __initdata = {
        &innovator_flash_device,
        &innovator1510_smc91x_device,
+       &innovator_mcbsp1_device,
        &innovator_kp_device,
        &innovator1510_lcd_device,
+       &innovator1510_spi_device,
+};
+
+static int innovator_get_pendown_state(void)
+{
+       return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
+}
+
+static const struct ads7846_platform_data innovator1510_ts_info = {
+       .model                  = 7846,
+       .vref_delay_usecs       = 100,  /* internal, no capacitor */
+       .x_plate_ohms           = 419,
+       .y_plate_ohms           = 486,
+       .get_pendown_state      = innovator_get_pendown_state,
 };
 
+static struct spi_board_info __initdata innovator1510_boardinfo[] = { {
+       /* FPGA (bus "10") CS0 has an ads7846e */
+       .modalias               = "ads7846",
+       .platform_data          = &innovator1510_ts_info,
+       .irq                    = OMAP1510_INT_FPGA_TS,
+       .max_speed_hz           = 120000 /* max sample rate at 3V */
+                                       * 26 /* command + data + overhead */,
+       .bus_num                = 10,
+       .chip_select            = 0,
+} };
+
 #endif /* CONFIG_ARCH_OMAP15XX */
 
 #ifdef CONFIG_ARCH_OMAP16XX
@@ -194,7 +269,7 @@ static struct resource innovator1610_smc91x_resources[] = {
        [1] = {
                .start  = OMAP_GPIO_IRQ(0),
                .end    = OMAP_GPIO_IRQ(0),
-               .flags  = IORESOURCE_IRQ,
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        },
 };
 
@@ -233,7 +308,7 @@ static void __init innovator_init_smc91x(void)
        }
 }
 
-void innovator_init_irq(void)
+static void __init innovator_init_irq(void)
 {
        omap1_init_common_hw();
        omap_init_irq();
@@ -270,11 +345,11 @@ static struct omap_usb_config h2_usb_config __initdata = {
        .otg            = 2,
 
 #ifdef CONFIG_USB_GADGET_OMAP
-       .hmc_mode       = 19,   // 0:host(off) 1:dev|otg 2:disabled
-       // .hmc_mode    = 21,   // 0:host(off) 1:dev(loopback) 2:host(loopback)
+       .hmc_mode       = 19,   /* 0:host(off) 1:dev|otg 2:disabled */
+       /* .hmc_mode    = 21,*/ /* 0:host(off) 1:dev(loopback) 2:host(loopback) */
 #elif  defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
        /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
-       .hmc_mode       = 20,   // 1:dev|otg(off) 1:host 2:disabled
+       .hmc_mode       = 20,   /* 1:dev|otg(off) 1:host 2:disabled */
 #endif
 
        .pins[1]        = 3,
@@ -311,6 +386,8 @@ static void __init innovator_init(void)
 #ifdef CONFIG_ARCH_OMAP15XX
        if (cpu_is_omap1510()) {
                platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
+               spi_register_board_info(innovator1510_boardinfo,
+                               ARRAY_SIZE(innovator1510_boardinfo));
        }
 #endif
 #ifdef CONFIG_ARCH_OMAP16XX
@@ -334,6 +411,7 @@ static void __init innovator_init(void)
        omap_board_config = innovator_config;
        omap_board_config_size = ARRAY_SIZE(innovator_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init innovator_map_io(void)