Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-igep0020.c
index ad20f7b..0c1bfca 100644 (file)
@@ -31,8 +31,8 @@
 #include <plat/common.h>
 #include <plat/gpmc.h>
 #include <plat/usb.h>
-#include <plat/display.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omapdss.h>
+#include <video/omap-panel-generic-dpi.h>
 #include <plat/onenand.h>
 
 #include "mux.h"
 #define IGEP2_RC_GPIO_WIFI_NRESET  139
 #define IGEP2_RC_GPIO_BT_NRESET    137
 
+#define IGEP3_GPIO_LED0_GREEN  54
+#define IGEP3_GPIO_LED0_RED    53
+#define IGEP3_GPIO_LED1_RED    16
+#define IGEP3_GPIO_USBH_NRESET  183
+
 /*
  * IGEP2 Hardware Revision Table
  *
@@ -69,6 +74,7 @@
 
 #define IGEP2_BOARD_HWREV_B    0
 #define IGEP2_BOARD_HWREV_C    1
+#define IGEP3_BOARD_HWREV      2
 
 static u8 hwrev;
 
@@ -76,6 +82,11 @@ static void __init igep2_get_revision(void)
 {
        u8 ret;
 
+       if (machine_is_igep0030()) {
+               hwrev = IGEP3_BOARD_HWREV;
+               return;
+       }
+
        omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
 
        if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) {
@@ -299,17 +310,14 @@ static struct omap2_hsmmc_info mmc[] = {
 static struct gpio_led igep_gpio_leds[] = {
        [0] = {
                .name                   = "gpio-led:red:d0",
-               .gpio                   = IGEP2_GPIO_LED0_RED,
                .default_trigger        = "default-off"
        },
        [1] = {
                .name                   = "gpio-led:green:d0",
-               .gpio                   = IGEP2_GPIO_LED0_GREEN,
                .default_trigger        = "default-off",
        },
        [2] = {
                .name                   = "gpio-led:red:d1",
-               .gpio                   = IGEP2_GPIO_LED1_RED,
                .default_trigger        = "default-off",
        },
        [3] = {
@@ -335,26 +343,47 @@ static struct platform_device igep_led_device = {
 
 static void __init igep_leds_init(void)
 {
+       if (machine_is_igep0020()) {
+               igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
+               igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
+               igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
+       } else {
+               igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
+               igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
+               igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
+       }
+
        platform_device_register(&igep_led_device);
 }
 
 #else
 static struct gpio igep_gpio_leds[] __initdata = {
-       { IGEP2_GPIO_LED0_RED,   GPIOF_OUT_INIT_LOW, "gpio-led:red:d0"   },
-       { IGEP2_GPIO_LED0_GREEN, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
-       { IGEP2_GPIO_LED1_RED,   GPIOF_OUT_INIT_LOW, "gpio-led:red:d1"   },
+       { -EINVAL,      GPIOF_OUT_INIT_LOW, "gpio-led:red:d0"   },
+       { -EINVAL,      GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
+       { -EINVAL,      GPIOF_OUT_INIT_LOW, "gpio-led:red:d1"   },
 };
 
 static inline void igep_leds_init(void)
 {
+       int i;
+
+       if (machine_is_igep0020()) {
+               igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
+               igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
+               igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
+       } else {
+               igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
+               igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
+               igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
+       }
+
        if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) {
                pr_warning("IGEP v2: Could not obtain leds gpios\n");
                return;
        }
 
-       gpio_export(IGEP2_GPIO_LED0_RED, 0);
-       gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
-       gpio_export(IGEP2_GPIO_LED1_RED, 0);
+       for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++)
+               gpio_export(igep_gpio_leds[i].gpio, 0);
 }
 #endif
 
@@ -372,6 +401,21 @@ static int igep_twl_gpio_setup(struct device *dev,
        mmc[0].gpio_cd = gpio + 0;
        omap2_hsmmc_init(mmc);
 
+       /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
+#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
+       ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
+                              "gpio-led:green:d1");
+       if (ret == 0)
+               gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
+       else
+               pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
+#else
+       igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
+#endif
+
+       if (machine_is_igep0030())
+               return 0;
+
        /*
         * REVISIT: need ehci-omap hooks for external VBUS
         * power switch and overcurrent detect
@@ -385,18 +429,6 @@ static int igep_twl_gpio_setup(struct device *dev,
        if (ret < 0)
                pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
 
-       /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
-#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
-       ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
-                              "gpio-led:green:d1");
-       if (ret == 0)
-               gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
-       else
-               pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
-#else
-       igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
-#endif
-
        return 0;
 };
 
@@ -531,11 +563,8 @@ static struct twl4030_platform_data igep_twldata = {
 
        /* platform_data for children goes here */
        .usb            = &igep_usb_data,
-       .codec          = &igep2_codec_data,
        .gpio           = &igep_twl4030_gpio_pdata,
-       .keypad         = &igep2_keypad_pdata,
        .vmmc1          = &igep_vmmc1,
-       .vpll2          = &igep2_vpll2,
        .vio            = &igep_vio,
 };
 
@@ -549,16 +578,22 @@ static void __init igep_i2c_init(void)
 {
        int ret;
 
-       omap3_pmic_init("twl4030", &igep_twldata);
+       if (machine_is_igep0020()) {
+               /*
+                * Bus 3 is attached to the DVI port where devices like the
+                * pico DLP projector don't work reliably with 400kHz
+                */
+               ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
+                                           ARRAY_SIZE(igep2_i2c3_boardinfo));
+               if (ret)
+                       pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
+
+               igep_twldata.codec      = &igep2_codec_data;
+               igep_twldata.keypad     = &igep2_keypad_pdata;
+               igep_twldata.vpll2      = &igep2_vpll2;
+       }
 
-       /*
-        * Bus 3 is attached to the DVI port where devices like the pico DLP
-        * projector don't work reliably with 400kHz
-        */
-       ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
-               ARRAY_SIZE(igep2_i2c3_boardinfo));
-       if (ret)
-               pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
+       omap3_pmic_init("twl4030", &igep_twldata);
 }
 
 static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = {
@@ -572,6 +607,17 @@ static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = {
        .reset_gpio_port[2] = -EINVAL,
 };
 
+static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = {
+       .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
+
+       .phy_reset = true,
+       .reset_gpio_port[0] = -EINVAL,
+       .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
+       .reset_gpio_port[2] = -EINVAL,
+};
+
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
        { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -594,7 +640,7 @@ static void __init igep_wlan_bt_init(void)
                igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD;
                igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET;
                igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET;
-       } else if (hwrev == IGEP2_BOARD_HWREV_C) {
+       } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) {
                igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD;
                igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET;
                igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET;
@@ -630,15 +676,11 @@ static void __init igep_init(void)
        /* Register I2C busses and drivers */
        igep_i2c_init();
        platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
-       omap_display_init(&igep2_dss_data);
        omap_serial_init();
        usb_musb_init(NULL);
-       usbhs_init(&igep2_usbhs_bdata);
 
        igep_flash_init();
        igep_leds_init();
-       igep2_display_init();
-       igep2_init_smsc911x();
 
        /*
         * WLAN-BT combo module from MuRata which has a Marvell WLAN
@@ -646,6 +688,14 @@ static void __init igep_init(void)
         */
        igep_wlan_bt_init();
 
+       if (machine_is_igep0020()) {
+               omap_display_init(&igep2_dss_data);
+               igep2_display_init();
+               igep2_init_smsc911x();
+               usbhs_init(&igep2_usbhs_bdata);
+       } else {
+               usbhs_init(&igep3_usbhs_bdata);
+       }
 }
 
 MACHINE_START(IGEP0020, "IGEP v2 board")
@@ -657,3 +707,13 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
        .init_machine   = igep_init,
        .timer          = &omap_timer,
 MACHINE_END
+
+MACHINE_START(IGEP0030, "IGEP OMAP3 module")
+       .boot_params    = 0x80000100,
+       .reserve        = omap_reserve,
+       .map_io         = omap3_map_io,
+       .init_early     = igep_init_early,
+       .init_irq       = omap_init_irq,
+       .init_machine   = igep_init,
+       .timer          = &omap_timer,
+MACHINE_END