Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-omap3beagle.c
index b6752ac..7640c05 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
 
@@ -579,11 +582,11 @@ static void __init omap3beagle_flash_init(void)
        }
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-       .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-       .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-       .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
        .phy_reset  = true,
        .reset_gpio_port[0]  = -EINVAL,
@@ -603,6 +606,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);
@@ -619,7 +668,7 @@ static void __init omap3_beagle_init(void)
        gpio_direction_output(170, true);
 
        usb_musb_init(&musb_board_data);
-       usb_ehci_init(&ehci_pdata);
+       usbhs_init(&usbhs_bdata);
        omap3beagle_flash_init();
 
        /* Ensure SDRC pins are mux'd for self-refresh */
@@ -627,6 +676,7 @@ 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")