omap: musb: introduce default board config
[deliverable/linux.git] / arch / arm / mach-omap2 / board-omap3touchbook.c
index 84cfddb19a741143ac0bf34565a6053d5dc4d938..392278d9a88260e1ae16d90d6a00b23141dbc5b6 100644 (file)
@@ -52,6 +52,7 @@
 #include "mux.h"
 #include "hsmmc.h"
 #include "timer-gp.h"
+#include "common-board-devices.h"
 
 #include <asm/setup.h>
 
@@ -95,15 +96,6 @@ static struct mtd_partition omap3touchbook_nand_partitions[] = {
        },
 };
 
-static struct omap_nand_platform_data omap3touchbook_nand_data = {
-       .options        = NAND_BUSWIDTH_16,
-       .parts          = omap3touchbook_nand_partitions,
-       .nr_parts       = ARRAY_SIZE(omap3touchbook_nand_partitions),
-       .dma_channel    = -1,           /* disable DMA in OMAP NAND driver */
-       .nand_setup     = NULL,
-       .dev_ready      = NULL,
-};
-
 #include "sdram-micron-mt46h32m32lf-6.h"
 
 static struct omap2_hsmmc_info mmc[] = {
@@ -252,9 +244,7 @@ static struct twl4030_usb_data touchbook_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
 
-static struct twl4030_codec_audio_data touchbook_audio_data = {
-       .audio_mclk = 26000000,
-};
+static struct twl4030_codec_audio_data touchbook_audio_data;
 
 static struct twl4030_codec_data touchbook_codec_data = {
        .audio_mclk = 26000000,
@@ -275,15 +265,6 @@ static struct twl4030_platform_data touchbook_twldata = {
        .vpll2          = &touchbook_vpll2,
 };
 
-static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = {
-       {
-               I2C_BOARD_INFO("twl4030", 0x48),
-               .flags = I2C_CLIENT_WAKE,
-               .irq = INT_34XX_SYS_NIRQ,
-               .platform_data = &touchbook_twldata,
-       },
-};
-
 static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
        {
                I2C_BOARD_INFO("bq27200", 0x55),
@@ -293,8 +274,7 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
 static int __init omap3_touchbook_i2c_init(void)
 {
        /* Standard TouchBook bus */
-       omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo,
-                       ARRAY_SIZE(touchbook_i2c_boardinfo));
+       omap3_pmic_init("twl4030", &touchbook_twldata);
 
        /* Additional TouchBook bus */
        omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo,
@@ -303,19 +283,7 @@ static int __init omap3_touchbook_i2c_init(void)
        return 0;
 }
 
-static void __init omap3_ads7846_init(void)
-{
-       if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) {
-               printk(KERN_ERR "Failed to request GPIO %d for "
-                               "ads7846 pen down IRQ\n", OMAP3_TS_GPIO);
-               return;
-       }
-
-       gpio_direction_input(OMAP3_TS_GPIO);
-       gpio_set_debounce(OMAP3_TS_GPIO, 310);
-}
-
-static struct ads7846_platform_data ads7846_config = {
+static struct ads7846_platform_data ads7846_pdata = {
        .x_min                  = 100,
        .y_min                  = 265,
        .x_max                  = 3950,
@@ -329,23 +297,6 @@ static struct ads7846_platform_data ads7846_config = {
        .keep_vref_on           = 1,
 };
 
-static struct omap2_mcspi_device_config ads7846_mcspi_config = {
-       .turbo_mode     = 0,
-       .single_channel = 1,    /* 0: slave, 1: master */
-};
-
-static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = {
-       {
-               .modalias               = "ads7846",
-               .bus_num                = 4,
-               .chip_select            = 0,
-               .max_speed_hz           = 1500000,
-               .controller_data        = &ads7846_mcspi_config,
-               .irq                    = OMAP_GPIO_IRQ(OMAP3_TS_GPIO),
-               .platform_data          = &ads7846_config,
-       }
-};
-
 static struct gpio_led gpio_leds[] = {
        {
                .name                   = "touchbook::usr0",
@@ -415,14 +366,15 @@ static struct omap_board_mux board_mux[] __initdata = {
 };
 #endif
 
-static void __init omap3_touchbook_init_irq(void)
+static void __init omap3_touchbook_init_early(void)
 {
-       omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
-       omap_board_config = omap3_touchbook_config;
-       omap_board_config_size = ARRAY_SIZE(omap3_touchbook_config);
        omap2_init_common_infrastructure();
        omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
                                  mt46h32m32lf6_sdrc_params);
+}
+
+static void __init omap3_touchbook_init_irq(void)
+{
        omap_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
        omap2_gp_clockevent_set_gptimer(12);
@@ -435,39 +387,6 @@ static struct platform_device *omap3_touchbook_devices[] __initdata = {
        &keys_gpio,
 };
 
-static void __init omap3touchbook_flash_init(void)
-{
-       u8 cs = 0;
-       u8 nandcs = GPMC_CS_NUM + 1;
-
-       /* find out the chip-select on which NAND exists */
-       while (cs < GPMC_CS_NUM) {
-               u32 ret = 0;
-               ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
-
-               if ((ret & 0xC00) == 0x800) {
-                       printk(KERN_INFO "Found NAND on CS%d\n", cs);
-                       if (nandcs > GPMC_CS_NUM)
-                               nandcs = cs;
-               }
-               cs++;
-       }
-
-       if (nandcs > GPMC_CS_NUM) {
-               printk(KERN_INFO "NAND: Unable to find configuration "
-                                "in GPMC\n ");
-               return;
-       }
-
-       if (nandcs < GPMC_CS_NUM) {
-               omap3touchbook_nand_data.cs = nandcs;
-
-               printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
-               if (gpmc_nand_init(&omap3touchbook_nand_data) < 0)
-                       printk(KERN_ERR "Unable to register NAND device\n");
-       }
-}
-
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
        .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
@@ -502,14 +421,12 @@ static int __init early_touchbook_revision(char *p)
 }
 early_param("tbr", early_touchbook_revision);
 
-static struct omap_musb_board_data musb_board_data = {
-       .interface_type         = MUSB_INTERFACE_ULPI,
-       .mode                   = MUSB_OTG,
-       .power                  = 100,
-};
-
 static void __init omap3_touchbook_init(void)
 {
+       omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
+       omap_board_config = omap3_touchbook_config;
+       omap_board_config_size = ARRAY_SIZE(omap3_touchbook_config);
+
        pm_power_off = omap3_touchbook_poweroff;
 
        omap3_touchbook_i2c_init();
@@ -523,12 +440,11 @@ static void __init omap3_touchbook_init(void)
        gpio_direction_output(176, true);
 
        /* Touchscreen and accelerometer */
-       spi_register_board_info(omap3_ads7846_spi_board_info,
-                               ARRAY_SIZE(omap3_ads7846_spi_board_info));
-       omap3_ads7846_init();
-       usb_musb_init(&musb_board_data);
+       omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
+       usb_musb_init(NULL);
        usbhs_init(&usbhs_bdata);
-       omap3touchbook_flash_init();
+       omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions,
+                            ARRAY_SIZE(omap3touchbook_nand_partitions));
 
        /* Ensure SDRC pins are mux'd for self-refresh */
        omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -538,8 +454,9 @@ static void __init omap3_touchbook_init(void)
 MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
        /* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */
        .boot_params    = 0x80000100,
-       .map_io         = omap3_map_io,
        .reserve        = omap_reserve,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3_touchbook_init_early,
        .init_irq       = omap3_touchbook_init_irq,
        .init_machine   = omap3_touchbook_init,
        .timer          = &omap_timer,
This page took 0.02867 seconds and 5 git commands to generate.