Merge branch 'for_2.6.39/pm-misc' of ssh://master.kernel.org/pub/scm/linux/kernel...
authorTony Lindgren <tony@atomide.com>
Fri, 11 Mar 2011 02:54:14 +0000 (18:54 -0800)
committerTony Lindgren <tony@atomide.com>
Fri, 11 Mar 2011 02:54:14 +0000 (18:54 -0800)
1  2 
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/common.c
arch/arm/mach-omap2/mailbox.c
arch/arm/plat-omap/include/plat/common.h

index b6752ac5b97e15c049c3301500f6ecfd01002b6b,91b4e1438aecea8116387c2c9358c3c96bafc72b..20c5dbea895387aa72ed8eee8d4d52dc1ee88240
@@@ -23,6 -23,7 +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,6 -231,14 +231,6 @@@ static struct omap_dss_board_info beagl
        .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");
  
@@@ -427,7 -438,9 +430,7 @@@ static struct twl4030_usb_data beagle_u
        .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,
@@@ -526,15 -539,11 +529,15 @@@ static struct platform_device keys_gpi
        },
  };
  
 -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);
  static struct platform_device *omap3_beagle_devices[] __initdata = {
        &leds_gpio,
        &keys_gpio,
 -      &beagle_dss_device,
  };
  
  static void __init omap3beagle_flash_init(void)
@@@ -603,6 -613,52 +606,52 @@@ static struct omap_musb_board_data musb
        .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);
        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);
        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,
index 48de4513de4989e775cec772a1df6d5900bc7ae9,994f0f00c70464c96b44a51500e55301e480dcc0..3f20cbb9967b6718f2fe5a02f9a0f7f124cea15e
@@@ -40,7 -40,7 +40,7 @@@ static void __init __omap2_set_globals(
  
  #endif
  
 -#if defined(CONFIG_ARCH_OMAP2420)
 +#if defined(CONFIG_SOC_OMAP2420)
  
  static struct omap_globals omap242x_globals = {
        .class  = OMAP242X_CLASS,
@@@ -50,9 -50,6 +50,6 @@@
        .ctrl   = OMAP242X_CTRL_BASE,
        .prm    = OMAP2420_PRM_BASE,
        .cm     = OMAP2420_CM_BASE,
-       .uart1_phys     = OMAP2_UART1_BASE,
-       .uart2_phys     = OMAP2_UART2_BASE,
-       .uart3_phys     = OMAP2_UART3_BASE,
  };
  
  void __init omap2_set_globals_242x(void)
@@@ -61,7 -58,7 +58,7 @@@
  }
  #endif
  
 -#if defined(CONFIG_ARCH_OMAP2430)
 +#if defined(CONFIG_SOC_OMAP2430)
  
  static struct omap_globals omap243x_globals = {
        .class  = OMAP243X_CLASS,
@@@ -71,9 -68,6 +68,6 @@@
        .ctrl   = OMAP243X_CTRL_BASE,
        .prm    = OMAP2430_PRM_BASE,
        .cm     = OMAP2430_CM_BASE,
-       .uart1_phys     = OMAP2_UART1_BASE,
-       .uart2_phys     = OMAP2_UART2_BASE,
-       .uart3_phys     = OMAP2_UART3_BASE,
  };
  
  void __init omap2_set_globals_243x(void)
@@@ -92,10 -86,6 +86,6 @@@ static struct omap_globals omap3_global
        .ctrl   = OMAP343X_CTRL_BASE,
        .prm    = OMAP3430_PRM_BASE,
        .cm     = OMAP3430_CM_BASE,
-       .uart1_phys     = OMAP3_UART1_BASE,
-       .uart2_phys     = OMAP3_UART2_BASE,
-       .uart3_phys     = OMAP3_UART3_BASE,
-       .uart4_phys     = OMAP3_UART4_BASE,     /* Only on 3630 */
  };
  
  void __init omap2_set_globals_3xxx(void)
@@@ -108,27 -98,6 +98,27 @@@ void __init omap3_map_io(void
        omap2_set_globals_3xxx();
        omap34xx_map_common_io();
  }
 +
 +/*
 + * Adjust TAP register base such that omap3_check_revision accesses the correct
 + * TI816X register for checking device ID (it adds 0x204 to tap base while
 + * TI816X DEVICE ID register is at offset 0x600 from control base).
 + */
 +#define TI816X_TAP_BASE               (TI816X_CTRL_BASE + \
 +                              TI816X_CONTROL_DEVICE_ID - 0x204)
 +
 +static struct omap_globals ti816x_globals = {
 +      .class  = OMAP343X_CLASS,
 +      .tap    = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE),
 +      .ctrl   = TI816X_CTRL_BASE,
 +      .prm    = TI816X_PRCM_BASE,
 +      .cm     = TI816X_PRCM_BASE,
 +};
 +
 +void __init omap2_set_globals_ti816x(void)
 +{
 +      __omap2_set_globals(&ti816x_globals);
 +}
  #endif
  
  #if defined(CONFIG_ARCH_OMAP4)
@@@ -140,10 -109,6 +130,6 @@@ static struct omap_globals omap4_global
        .prm    = OMAP4430_PRM_BASE,
        .cm     = OMAP4430_CM_BASE,
        .cm2    = OMAP4430_CM2_BASE,
-       .uart1_phys     = OMAP4_UART1_BASE,
-       .uart2_phys     = OMAP4_UART2_BASE,
-       .uart3_phys     = OMAP4_UART3_BASE,
-       .uart4_phys     = OMAP4_UART4_BASE,
  };
  
  void __init omap2_set_globals_443x(void)
index 6e15e3d7c65e03177dfbf61b9aa8e3192c39ea6b,24b88504df0f403227c3a0e20fb229f876649902..86d564a640bb80f8adf1dc961637907592530da4
  #include <linux/err.h>
  #include <linux/platform_device.h>
  #include <linux/io.h>
 +#include <linux/pm_runtime.h>
  #include <plat/mailbox.h>
  #include <mach/irqs.h>
  
  #define MAILBOX_REVISION              0x000
 -#define MAILBOX_SYSCONFIG             0x010
 -#define MAILBOX_SYSSTATUS             0x014
  #define MAILBOX_MESSAGE(m)            (0x040 + 4 * (m))
  #define MAILBOX_FIFOSTATUS(m)         (0x080 + 4 * (m))
  #define MAILBOX_MSGSTATUS(m)          (0x0c0 + 4 * (m))
  #define MAILBOX_IRQ_NEWMSG(m)         (1 << (2 * (m)))
  #define MAILBOX_IRQ_NOTFULL(m)                (1 << (2 * (m) + 1))
  
 -/* SYSCONFIG: register bit definition */
 -#define AUTOIDLE      (1 << 0)
 -#define SOFTRESET     (1 << 1)
 -#define SMARTIDLE     (2 << 3)
 -#define OMAP4_SOFTRESET       (1 << 0)
 -#define OMAP4_NOIDLE  (1 << 2)
 -#define OMAP4_SMARTIDLE       (2 << 2)
 -
 -/* SYSSTATUS: register bit definition */
 -#define RESETDONE     (1 << 0)
 -
  #define MBOX_REG_SIZE                 0x120
  
  #define OMAP4_MBOX_REG_SIZE           0x130
@@@ -58,6 -70,8 +58,6 @@@ struct omap_mbox2_priv 
        unsigned long irqdisable;
  };
  
 -static struct clk *mbox_ick_handle;
 -
  static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
                                  omap_mbox_type_t irq);
  
@@@ -75,13 -89,53 +75,13 @@@ static inline void mbox_write_reg(u32 v
  static int omap2_mbox_startup(struct omap_mbox *mbox)
  {
        u32 l;
 -      unsigned long timeout;
  
 -      mbox_ick_handle = clk_get(NULL, "mailboxes_ick");
 -      if (IS_ERR(mbox_ick_handle)) {
 -              printk(KERN_ERR "Could not get mailboxes_ick: %ld\n",
 -                      PTR_ERR(mbox_ick_handle));
 -              return PTR_ERR(mbox_ick_handle);
 -      }
 -      clk_enable(mbox_ick_handle);
 -
 -      if (cpu_is_omap44xx()) {
 -              mbox_write_reg(OMAP4_SOFTRESET, MAILBOX_SYSCONFIG);
 -              timeout = jiffies + msecs_to_jiffies(20);
 -              do {
 -                      l = mbox_read_reg(MAILBOX_SYSCONFIG);
 -                      if (!(l & OMAP4_SOFTRESET))
 -                              break;
 -              } while (!time_after(jiffies, timeout));
 -
 -              if (l & OMAP4_SOFTRESET) {
 -                      pr_err("Can't take mailbox out of reset\n");
 -                      return -ENODEV;
 -              }
 -      } else {
 -              mbox_write_reg(SOFTRESET, MAILBOX_SYSCONFIG);
 -              timeout = jiffies + msecs_to_jiffies(20);
 -              do {
 -                      l = mbox_read_reg(MAILBOX_SYSSTATUS);
 -                      if (l & RESETDONE)
 -                              break;
 -              } while (!time_after(jiffies, timeout));
 -
 -              if (!(l & RESETDONE)) {
 -                      pr_err("Can't take mailbox out of reset\n");
 -                      return -ENODEV;
 -              }
 -      }
 +      pm_runtime_enable(mbox->dev->parent);
 +      pm_runtime_get_sync(mbox->dev->parent);
  
        l = mbox_read_reg(MAILBOX_REVISION);
        pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f));
  
 -      if (cpu_is_omap44xx())
 -              l = OMAP4_SMARTIDLE;
 -      else
 -              l = SMARTIDLE | AUTOIDLE;
 -      mbox_write_reg(l, MAILBOX_SYSCONFIG);
 -
        omap2_mbox_enable_irq(mbox, IRQ_RX);
  
        return 0;
  
  static void omap2_mbox_shutdown(struct omap_mbox *mbox)
  {
 -      clk_disable(mbox_ick_handle);
 -      clk_put(mbox_ick_handle);
 -      mbox_ick_handle = NULL;
 +      pm_runtime_put_sync(mbox->dev->parent);
 +      pm_runtime_disable(mbox->dev->parent);
  }
  
  /* Mailbox FIFO handle functions */
@@@ -138,10 -193,12 +138,12 @@@ static void omap2_mbox_disable_irq(stru
                omap_mbox_type_t irq)
  {
        struct omap_mbox2_priv *p = mbox->priv;
-       u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
-       l = mbox_read_reg(p->irqdisable);
-       l &= ~bit;
-       mbox_write_reg(l, p->irqdisable);
+       u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
+       if (!cpu_is_omap44xx())
+               bit = mbox_read_reg(p->irqdisable) & ~bit;
+       mbox_write_reg(bit, p->irqdisable);
  }
  
  static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@@ -255,7 -312,7 +257,7 @@@ struct omap_mbox mbox_dsp_info = 
  struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL };
  #endif
  
 -#if defined(CONFIG_ARCH_OMAP2420)
 +#if defined(CONFIG_SOC_OMAP2420)
  /* IVA */
  static struct omap_mbox2_priv omap2_mbox_iva_priv = {
        .tx_fifo = {
@@@ -343,14 -400,14 +345,14 @@@ static int __devinit omap2_mbox_probe(s
        else if (cpu_is_omap34xx()) {
                list = omap3_mboxes;
  
 -              list[0]->irq = platform_get_irq_byname(pdev, "dsp");
 +              list[0]->irq = platform_get_irq(pdev, 0);
        }
  #endif
  #if defined(CONFIG_ARCH_OMAP2)
        else if (cpu_is_omap2430()) {
                list = omap2_mboxes;
  
 -              list[0]->irq = platform_get_irq_byname(pdev, "dsp");
 +              list[0]->irq = platform_get_irq(pdev, 0);
        } else if (cpu_is_omap2420()) {
                list = omap2_mboxes;
  
        else if (cpu_is_omap44xx()) {
                list = omap4_mboxes;
  
 -              list[0]->irq = list[1]->irq =
 -                      platform_get_irq_byname(pdev, "mbox");
 +              list[0]->irq = list[1]->irq = platform_get_irq(pdev, 0);
        }
  #endif
        else {
index 1dd97e7461c9097b69446de6967fc386b5e83c38,1b8095bb8d00f9236da2ebfa132b797636424df8..5288130be96e9b4cb95ff6b14ce6b8ad171e5558
@@@ -56,17 -56,12 +56,13 @@@ struct omap_globals 
        unsigned long   prm;            /* Power and Reset Management */
        unsigned long   cm;             /* Clock Management */
        unsigned long   cm2;
-       unsigned long   uart1_phys;
-       unsigned long   uart2_phys;
-       unsigned long   uart3_phys;
-       unsigned long   uart4_phys;
  };
  
  void omap2_set_globals_242x(void);
  void omap2_set_globals_243x(void);
  void omap2_set_globals_3xxx(void);
  void omap2_set_globals_443x(void);
 +void omap2_set_globals_ti816x(void);
  
  /* These get called from omap2_set_globals_xxxx(), do not call these */
  void omap2_set_globals_tap(struct omap_globals *);