aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c63
1 files changed, 47 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 87cc6d058de2..b3b00f43dd7c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -139,27 +139,25 @@
139#include <linux/slab.h> 139#include <linux/slab.h>
140#include <linux/bootmem.h> 140#include <linux/bootmem.h>
141 141
142#include <plat/clock.h> 142#include "clock.h"
143#include <plat/omap_hwmod.h> 143#include "omap_hwmod.h"
144#include <plat/prcm.h>
145 144
146#include "soc.h" 145#include "soc.h"
147#include "common.h" 146#include "common.h"
148#include "clockdomain.h" 147#include "clockdomain.h"
149#include "powerdomain.h" 148#include "powerdomain.h"
150#include "cm2xxx_3xxx.h" 149#include "cm2xxx.h"
150#include "cm3xxx.h"
151#include "cminst44xx.h" 151#include "cminst44xx.h"
152#include "cm33xx.h" 152#include "cm33xx.h"
153#include "prm2xxx_3xxx.h" 153#include "prm.h"
154#include "prm3xxx.h"
154#include "prm44xx.h" 155#include "prm44xx.h"
155#include "prm33xx.h" 156#include "prm33xx.h"
156#include "prminst44xx.h" 157#include "prminst44xx.h"
157#include "mux.h" 158#include "mux.h"
158#include "pm.h" 159#include "pm.h"
159 160
160/* Maximum microseconds to wait for OMAP module to softreset */
161#define MAX_MODULE_SOFTRESET_WAIT 10000
162
163/* Name of the OMAP hwmod for the MPU */ 161/* Name of the OMAP hwmod for the MPU */
164#define MPU_INITIATOR_NAME "mpu" 162#define MPU_INITIATOR_NAME "mpu"
165 163
@@ -2095,7 +2093,8 @@ static int _enable(struct omap_hwmod *oh)
2095 _enable_sysc(oh); 2093 _enable_sysc(oh);
2096 } 2094 }
2097 } else { 2095 } else {
2098 _omap4_disable_module(oh); 2096 if (soc_ops.disable_module)
2097 soc_ops.disable_module(oh);
2099 _disable_clocks(oh); 2098 _disable_clocks(oh);
2100 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 2099 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
2101 oh->name, r); 2100 oh->name, r);
@@ -2703,7 +2702,34 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2703/* Static functions intended only for use in soc_ops field function pointers */ 2702/* Static functions intended only for use in soc_ops field function pointers */
2704 2703
2705/** 2704/**
2706 * _omap2_wait_target_ready - wait for a module to leave slave idle 2705 * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
2706 * @oh: struct omap_hwmod *
2707 *
2708 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2709 * does not have an IDLEST bit or if the module successfully leaves
2710 * slave idle; otherwise, pass along the return value of the
2711 * appropriate *_cm*_wait_module_ready() function.
2712 */
2713static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2714{
2715 if (!oh)
2716 return -EINVAL;
2717
2718 if (oh->flags & HWMOD_NO_IDLEST)
2719 return 0;
2720
2721 if (!_find_mpu_rt_port(oh))
2722 return 0;
2723
2724 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2725
2726 return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2727 oh->prcm.omap2.idlest_reg_id,
2728 oh->prcm.omap2.idlest_idle_bit);
2729}
2730
2731/**
2732 * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
2707 * @oh: struct omap_hwmod * 2733 * @oh: struct omap_hwmod *
2708 * 2734 *
2709 * Wait for a module @oh to leave slave idle. Returns 0 if the module 2735 * Wait for a module @oh to leave slave idle. Returns 0 if the module
@@ -2711,7 +2737,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2711 * slave idle; otherwise, pass along the return value of the 2737 * slave idle; otherwise, pass along the return value of the
2712 * appropriate *_cm*_wait_module_ready() function. 2738 * appropriate *_cm*_wait_module_ready() function.
2713 */ 2739 */
2714static int _omap2_wait_target_ready(struct omap_hwmod *oh) 2740static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
2715{ 2741{
2716 if (!oh) 2742 if (!oh)
2717 return -EINVAL; 2743 return -EINVAL;
@@ -2724,9 +2750,9 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2724 2750
2725 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ 2751 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2726 2752
2727 return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, 2753 return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2728 oh->prcm.omap2.idlest_reg_id, 2754 oh->prcm.omap2.idlest_reg_id,
2729 oh->prcm.omap2.idlest_idle_bit); 2755 oh->prcm.omap2.idlest_idle_bit);
2730} 2756}
2731 2757
2732/** 2758/**
@@ -3994,8 +4020,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
3994 */ 4020 */
3995void __init omap_hwmod_init(void) 4021void __init omap_hwmod_init(void)
3996{ 4022{
3997 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 4023 if (cpu_is_omap24xx()) {
3998 soc_ops.wait_target_ready = _omap2_wait_target_ready; 4024 soc_ops.wait_target_ready = _omap2xxx_wait_target_ready;
4025 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4026 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4027 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
4028 } else if (cpu_is_omap34xx()) {
4029 soc_ops.wait_target_ready = _omap3xxx_wait_target_ready;
3999 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4030 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4000 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4031 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4001 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4032 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;