]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-omap3evm.c
USB: Clean-up USB init code for next merge window
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-omap3evm.c
index d8109ae087d2a1e2d99a0a8a3be550b415e5d2bd..657772677a347c756569e652891ca46d2d3f4086 100644 (file)
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/clk.h>
-#include <linux/io.h>
+#include <linux/input.h>
+
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
+#include <linux/i2c/twl4030.h>
 
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <asm/arch/gpio.h>
-#include <asm/arch/board.h>
-#include <asm/arch/hsmmc.h>
-#include <asm/arch/usb-musb.h>
-#include <asm/arch/usb-ehci.h>
-#include <asm/arch/common.h>
-#include <asm/arch/mcspi.h>
+#include <mach/gpio.h>
+#include <mach/board.h>
+#include <mach/usb.h>
+#include <mach/common.h>
+#include <mach/mcspi.h>
+
+#include "sdram-micron-mt46h32m32lf-6.h"
+#include "twl4030-generic-scripts.h"
+#include "mmc-twl4030.h"
+
 
 static struct resource omap3evm_smc911x_resources[] = {
        [0] =   {
@@ -69,34 +74,90 @@ static inline void __init omap3evm_init_smc911x(void)
        else
                rate = clk_get_rate(l3ck);
 
-       if (omap_request_gpio(OMAP3EVM_ETHR_GPIO_IRQ) < 0) {
+       if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMC911x irq") < 0) {
                printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
                        OMAP3EVM_ETHR_GPIO_IRQ);
                return;
        }
 
-       omap_set_gpio_direction(OMAP3EVM_ETHR_GPIO_IRQ, 1);
+       gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
 }
 
 static struct omap_uart_config omap3_evm_uart_config __initdata = {
        .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
 
+static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
+       .gpio_base      = OMAP_MAX_GPIO_LINES,
+       .irq_base       = TWL4030_GPIO_IRQ_BASE,
+       .irq_end        = TWL4030_GPIO_IRQ_END,
+};
+
+static struct twl4030_usb_data omap3evm_usb_data = {
+       .usb_mode       = T2_USB_MODE_ULPI,
+};
+
+static int omap3evm_keymap[] = {
+       KEY(0, 0, KEY_LEFT),
+       KEY(0, 1, KEY_RIGHT),
+       KEY(0, 2, KEY_A),
+       KEY(0, 3, KEY_B),
+       KEY(1, 0, KEY_DOWN),
+       KEY(1, 1, KEY_UP),
+       KEY(1, 2, KEY_E),
+       KEY(1, 3, KEY_F),
+       KEY(2, 0, KEY_ENTER),
+       KEY(2, 1, KEY_I),
+       KEY(2, 2, KEY_J),
+       KEY(2, 3, KEY_K),
+       KEY(3, 0, KEY_M),
+       KEY(3, 1, KEY_N),
+       KEY(3, 2, KEY_O),
+       KEY(3, 3, KEY_P)
+};
+
+static struct twl4030_keypad_data omap3evm_kp_data = {
+       .rows           = 4,
+       .cols           = 4,
+       .keymap         = omap3evm_keymap,
+       .keymapsize     = ARRAY_SIZE(omap3evm_keymap),
+       .rep            = 1,
+};
+
+static struct twl4030_madc_platform_data omap3evm_madc_data = {
+       .irq_line       = 1,
+};
+
+static struct twl4030_platform_data omap3evm_twldata = {
+       .irq_base       = TWL4030_IRQ_BASE,
+       .irq_end        = TWL4030_IRQ_END,
+
+       /* platform_data for children goes here */
+       .keypad         = &omap3evm_kp_data,
+       .madc           = &omap3evm_madc_data,
+       .usb            = &omap3evm_usb_data,
+       .power          = GENERIC3430_T2SCRIPTS_DATA,
+       .gpio           = &omap3evm_gpio_data,
+};
+
+static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
+       {
+               I2C_BOARD_INFO("twl4030", 0x48),
+               .flags = I2C_CLIENT_WAKE,
+               .irq = INT_34XX_SYS_NIRQ,
+               .platform_data = &omap3evm_twldata,
+       },
+};
+
 static int __init omap3_evm_i2c_init(void)
 {
-       omap_register_i2c_bus(1, 2600, NULL, 0);
+       omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
+                       ARRAY_SIZE(omap3evm_i2c_boardinfo));
        omap_register_i2c_bus(2, 400, NULL, 0);
        omap_register_i2c_bus(3, 400, NULL, 0);
        return 0;
 }
 
-static struct omap_mmc_config omap3_evm_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
-               .wire4          = 1,
-       },
-};
-
 static struct platform_device omap3_evm_lcd_device = {
        .name           = "omap3evm_lcd",
        .id             = -1,
@@ -106,17 +167,12 @@ static struct omap_lcd_config omap3_evm_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
 
-static struct platform_device omap3_evm_twl4030rtc_device = {
-       .name           = "twl4030_rtc",
-       .id             = -1,
-};
-
 static void ads7846_dev_init(void)
 {
-       if (omap_request_gpio(OMAP3_EVM_TS_GPIO) < 0)
+       if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
                printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
-       omap_set_gpio_direction(OMAP3_EVM_TS_GPIO, 1);
+       gpio_direction_input(OMAP3_EVM_TS_GPIO);
 
        omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1);
        omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa);
@@ -124,12 +180,20 @@ static void ads7846_dev_init(void)
 
 static int ads7846_get_pendown_state(void)
 {
-       return !omap_get_gpio_datain(OMAP3_EVM_TS_GPIO);
+       return !gpio_get_value(OMAP3_EVM_TS_GPIO);
 }
 
 struct ads7846_platform_data ads7846_config = {
+       .x_max                  = 0x0fff,
+       .y_max                  = 0x0fff,
+       .x_plate_ohms           = 180,
+       .pressure_max           = 255,
+       .debounce_max           = 10,
+       .debounce_tol           = 3,
+       .debounce_rep           = 1,
        .get_pendown_state      = ads7846_get_pendown_state,
        .keep_vref_on           = 1,
+       .settle_delay_usecs     = 150,
 };
 
 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
@@ -151,7 +215,7 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 
 static void __init omap3_evm_init_irq(void)
 {
-       omap2_init_common_hw();
+       omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
        omap_init_irq();
        omap_gpio_init();
        omap3evm_init_smc911x();
@@ -159,20 +223,28 @@ static void __init omap3_evm_init_irq(void)
 
 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
        { OMAP_TAG_UART,        &omap3_evm_uart_config },
-       { OMAP_TAG_MMC,         &omap3_evm_mmc_config },
        { OMAP_TAG_LCD,         &omap3_evm_lcd_config },
 };
 
 static struct platform_device *omap3_evm_devices[] __initdata = {
        &omap3_evm_lcd_device,
-#ifdef CONFIG_RTC_DRV_TWL4030
-       &omap3_evm_twl4030rtc_device,
-#endif
        &omap3evm_smc911x_device,
 };
 
+static struct twl4030_hsmmc_info mmc[] __initdata = {
+       {
+               .mmc            = 1,
+               .wires          = 4,
+               .gpio_cd        = -EINVAL,
+               .gpio_wp        = -EINVAL,
+       },
+       {}      /* Terminator */
+};
+
 static void __init omap3_evm_init(void)
 {
+       omap3_evm_i2c_init();
+
        platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
        omap_board_config = omap3_evm_config;
        omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
@@ -181,15 +253,13 @@ static void __init omap3_evm_init(void)
                                ARRAY_SIZE(omap3evm_spi_board_info));
 
        omap_serial_init();
-       hsmmc_init();
+       twl4030_mmc_init(mmc);
        usb_musb_init();
        usb_ehci_init();
        omap3evm_flash_init();
        ads7846_dev_init();
 }
 
-arch_initcall(omap3_evm_i2c_init);
-
 static void __init omap3_evm_map_io(void)
 {
        omap2_set_globals_343x();