aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-10-21 03:01:11 -0400
committerPaul Walmsley <paul@pwsan.com>2012-10-21 03:01:11 -0400
commitff4ae5d9319b86f940e410e92659c50f9879ff46 (patch)
treec522f8b1c8981a51ed7fc0280be7a9d345074ad8 /arch/arm/mach-omap2/omap_hwmod.c
parent498153995b9ff41279be54fc56facb92f5cad793 (diff)
ARM: OMAP2+: CM/hwmod: split CM functions into OMAP2, OMAP3-specific files
Move OMAP3xxx-specific CM functions & macros into cm3xxx.[ch] and OMAP2xxx-specific macros into cm2xxx.[ch]. Move basic CM register access functions into static inline functions in cm2xxx_3xxx.h, leaving only OMAP2/3 hardreset functions in cm2xxx_3xxx.c. As part of this, split the CM and hwmod code that waits for devices to become ready into SoC-specific functions. This is in preparation for the upcoming move of this code to drivers/. Signed-off-by: Paul Walmsley <paul@pwsan.com> Reviewed-by: Russ Dill <Russ.Dill@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 525c58d25730..504e0e0ecbbd 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -147,7 +147,8 @@
147#include "common.h" 147#include "common.h"
148#include "clockdomain.h" 148#include "clockdomain.h"
149#include "powerdomain.h" 149#include "powerdomain.h"
150#include "cm2xxx_3xxx.h" 150#include "cm2xxx.h"
151#include "cm3xxx.h"
151#include "cminst44xx.h" 152#include "cminst44xx.h"
152#include "cm33xx.h" 153#include "cm33xx.h"
153#include "prm3xxx.h" 154#include "prm3xxx.h"
@@ -2668,7 +2669,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2668/* Static functions intended only for use in soc_ops field function pointers */ 2669/* Static functions intended only for use in soc_ops field function pointers */
2669 2670
2670/** 2671/**
2671 * _omap2_wait_target_ready - wait for a module to leave slave idle 2672 * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
2672 * @oh: struct omap_hwmod * 2673 * @oh: struct omap_hwmod *
2673 * 2674 *
2674 * Wait for a module @oh to leave slave idle. Returns 0 if the module 2675 * Wait for a module @oh to leave slave idle. Returns 0 if the module
@@ -2676,7 +2677,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2676 * slave idle; otherwise, pass along the return value of the 2677 * slave idle; otherwise, pass along the return value of the
2677 * appropriate *_cm*_wait_module_ready() function. 2678 * appropriate *_cm*_wait_module_ready() function.
2678 */ 2679 */
2679static int _omap2_wait_target_ready(struct omap_hwmod *oh) 2680static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2680{ 2681{
2681 if (!oh) 2682 if (!oh)
2682 return -EINVAL; 2683 return -EINVAL;
@@ -2689,9 +2690,36 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2689 2690
2690 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ 2691 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2691 2692
2692 return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, 2693 return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2693 oh->prcm.omap2.idlest_reg_id, 2694 oh->prcm.omap2.idlest_reg_id,
2694 oh->prcm.omap2.idlest_idle_bit); 2695 oh->prcm.omap2.idlest_idle_bit);
2696}
2697
2698/**
2699 * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
2700 * @oh: struct omap_hwmod *
2701 *
2702 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2703 * does not have an IDLEST bit or if the module successfully leaves
2704 * slave idle; otherwise, pass along the return value of the
2705 * appropriate *_cm*_wait_module_ready() function.
2706 */
2707static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
2708{
2709 if (!oh)
2710 return -EINVAL;
2711
2712 if (oh->flags & HWMOD_NO_IDLEST)
2713 return 0;
2714
2715 if (!_find_mpu_rt_port(oh))
2716 return 0;
2717
2718 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2719
2720 return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2721 oh->prcm.omap2.idlest_reg_id,
2722 oh->prcm.omap2.idlest_idle_bit);
2695} 2723}
2696 2724
2697/** 2725/**
@@ -3959,8 +3987,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
3959 */ 3987 */
3960void __init omap_hwmod_init(void) 3988void __init omap_hwmod_init(void)
3961{ 3989{
3962 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 3990 if (cpu_is_omap24xx()) {
3963 soc_ops.wait_target_ready = _omap2_wait_target_ready; 3991 soc_ops.wait_target_ready = _omap2xxx_wait_target_ready;
3992 soc_ops.assert_hardreset = _omap2_assert_hardreset;
3993 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
3994 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
3995 } else if (cpu_is_omap34xx()) {
3996 soc_ops.wait_target_ready = _omap3xxx_wait_target_ready;
3964 soc_ops.assert_hardreset = _omap2_assert_hardreset; 3997 soc_ops.assert_hardreset = _omap2_assert_hardreset;
3965 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 3998 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
3966 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 3999 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;