Merge branch 'for-linus' of git://android.git.kernel.org/kernel/tegra
[pandora-kernel.git] / arch / arm / mach-omap2 / board-omap3beagle.c
index f0963b6..33007fd 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/opp.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <plat/gpmc.h>
 #include <plat/nand.h>
 #include <plat/usb.h>
+#include <plat/omap_device.h>
 
 #include "mux.h"
 #include "hsmmc.h"
 #include "timer-gp.h"
+#include "pm.h"
 
 #define NAND_BLOCK_SIZE                SZ_128K
 
@@ -228,19 +231,13 @@ static struct omap_dss_board_info beagle_dss_data = {
        .default_device = &beagle_dvi_device,
 };
 
-static struct platform_device beagle_dss_device = {
-       .name          = "omapdss",
-       .id            = -1,
-       .dev            = {
-               .platform_data = &beagle_dss_data,
-       },
-};
-
 static struct regulator_consumer_supply beagle_vdac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
-static struct regulator_consumer_supply beagle_vdvi_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply beagle_vdvi_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 static void __init beagle_display_init(void)
 {
@@ -427,17 +424,15 @@ static struct regulator_init_data beagle_vpll2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &beagle_vdvi_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(beagle_vdvi_supplies),
+       .consumer_supplies      = beagle_vdvi_supplies,
 };
 
 static struct twl4030_usb_data beagle_usb_data = {
        .usb_mode       = T2_USB_MODE_ULPI,
 };
 
-static struct twl4030_codec_audio_data beagle_audio_data = {
-       .audio_mclk = 26000000,
-};
+static struct twl4030_codec_audio_data beagle_audio_data;
 
 static struct twl4030_codec_data beagle_codec_data = {
        .audio_mclk = 26000000,
@@ -536,11 +531,15 @@ static struct platform_device keys_gpio = {
        },
 };
 
-static void __init omap3_beagle_init_irq(void)
+static void __init omap3_beagle_init_early(void)
 {
        omap2_init_common_infrastructure();
        omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
                                  mt46h32m32lf6_sdrc_params);
+}
+
+static void __init omap3_beagle_init_irq(void)
+{
        omap_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
        omap2_gp_clockevent_set_gptimer(12);
@@ -550,7 +549,6 @@ static void __init omap3_beagle_init_irq(void)
 static struct platform_device *omap3_beagle_devices[] __initdata = {
        &leds_gpio,
        &keys_gpio,
-       &beagle_dss_device,
 };
 
 static void __init omap3beagle_flash_init(void)
@@ -610,6 +608,52 @@ static struct omap_musb_board_data musb_board_data = {
        .power                  = 100,
 };
 
+static void __init beagle_opp_init(void)
+{
+       int r = 0;
+
+       /* Initialize the omap3 opp table */
+       if (omap3_opp_init()) {
+               pr_err("%s: opp default init failed\n", __func__);
+               return;
+       }
+
+       /* Custom OPP enabled for XM */
+       if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) {
+               struct omap_hwmod *mh = omap_hwmod_lookup("mpu");
+               struct omap_hwmod *dh = omap_hwmod_lookup("iva");
+               struct device *dev;
+
+               if (!mh || !dh) {
+                       pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
+                               __func__, mh, dh);
+                       return;
+               }
+               /* Enable MPU 1GHz and lower opps */
+               dev = &mh->od->pdev.dev;
+               r = opp_enable(dev, 800000000);
+               /* TODO: MPU 1GHz needs SR and ABB */
+
+               /* Enable IVA 800MHz and lower opps */
+               dev = &dh->od->pdev.dev;
+               r |= opp_enable(dev, 660000000);
+               /* TODO: DSP 800MHz needs SR and ABB */
+               if (r) {
+                       pr_err("%s: failed to enable higher opp %d\n",
+                               __func__, r);
+                       /*
+                        * Cleanup - disable the higher freqs - we dont care
+                        * about the results
+                        */
+                       dev = &mh->od->pdev.dev;
+                       opp_disable(dev, 800000000);
+                       dev = &dh->od->pdev.dev;
+                       opp_disable(dev, 660000000);
+               }
+       }
+       return;
+}
+
 static void __init omap3_beagle_init(void)
 {
        omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -617,6 +661,7 @@ static void __init omap3_beagle_init(void)
        omap3_beagle_i2c_init();
        platform_add_devices(omap3_beagle_devices,
                        ARRAY_SIZE(omap3_beagle_devices));
+       omap_display_init(&beagle_dss_data);
        omap_serial_init();
 
        omap_mux_init_gpio(170, OMAP_PIN_INPUT);
@@ -633,13 +678,15 @@ static void __init omap3_beagle_init(void)
        omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
 
        beagle_display_init();
+       beagle_opp_init();
 }
 
 MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
        /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
        .boot_params    = 0x80000100,
-       .map_io         = omap3_map_io,
        .reserve        = omap_reserve,
+       .map_io         = omap3_map_io,
+       .init_early     = omap3_beagle_init_early,
        .init_irq       = omap3_beagle_init_irq,
        .init_machine   = omap3_beagle_init,
        .timer          = &omap_timer,