OMAP2/3 clock: Extend find_idlest() to pass back idle state value
[pandora-kernel.git] / arch / arm / mach-omap2 / prcm.c
index e8e121a..0f87fdc 100644 (file)
@@ -242,26 +242,22 @@ u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
  * @reg: physical address of module IDLEST register
  * @mask: value to mask against to determine if the module is active
+ * @idlest: idle state indicator (0 or 1) for the clock
  * @name: name of the clock (for printk)
  *
  * Returns 1 if the module indicated readiness in time, or 0 if it
  * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
  */
-int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
+int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
+                               const char *name)
 {
        int i = 0;
        int ena = 0;
 
-       /*
-        * 24xx uses 0 to indicate not ready, and 1 to indicate ready.
-        * 34xx reverses this, just to keep us on our toes
-        */
-       if (cpu_is_omap24xx())
-               ena = mask;
-       else if (cpu_is_omap34xx())
+       if (idlest)
                ena = 0;
        else
-               BUG();
+               ena = mask;
 
        /* Wait for lock */
        omap_test_timeout(((__raw_readl(reg) & mask) == ena),