Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260661
b: refs/heads/master
c: 11b1034
h: refs/heads/master
i:
  260659: cc7cc7d
v: v3
  • Loading branch information
Benoit Cousson authored and Paul Walmsley committed Jul 10, 2011
1 parent 8988e8b commit bded9fb
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0f0631ddc61026dca71b5b679803000d70fde50
refs/heads/master: 11b10341bd12c87a8409c69cdcd7ee898400842f
25 changes: 25 additions & 0 deletions trunk/arch/arm/mach-omap2/cminst44xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,28 @@ int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs,
return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
}

/**
* omap4_cminst_wait_module_idle - wait for a module to be in 'disabled'
* state
* @part: PRCM partition ID that the CM_CLKCTRL register exists in
* @inst: CM instance register offset (*_INST macro)
* @cdoffs: Clockdomain register offset (*_CDOFFS macro)
* @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
*
* Wait for the module IDLEST to be disabled. Some PRCM transition,
* like reset assertion or parent clock de-activation must wait the
* module to be fully disabled.
*/
int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
{
int i = 0;

if (!clkctrl_offs)
return 0;

omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) ==
CLKCTRL_IDLEST_DISABLED),
MAX_MODULE_READY_TIME, i);

return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
}
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-omap2/cminst44xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);

extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);

/*
* In an ideal world, we would not export these low-level functions,
Expand Down
40 changes: 40 additions & 0 deletions trunk/arch/arm/mach-omap2/omap_hwmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,36 @@ static int _wait_target_ready(struct omap_hwmod *oh)
return ret;
}

/**
* _wait_target_disable - wait for a module to be disabled
* @oh: struct omap_hwmod *
*
* Wait for a module @oh to enter slave idle. Returns 0 if the module
* does not have an IDLEST bit or if the module successfully enters
* slave idle; otherwise, pass along the return value of the
* appropriate *_cm*_wait_module_idle() function.
*/
static int _wait_target_disable(struct omap_hwmod *oh)
{
/* TODO: For now just handle OMAP4+ */
if (cpu_is_omap24xx() || cpu_is_omap34xx())
return 0;

if (!oh)
return -EINVAL;

if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
return 0;

if (oh->flags & HWMOD_NO_IDLEST)
return 0;

return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition,
oh->clkdm->cm_inst,
oh->clkdm->clkdm_offs,
oh->prcm.omap4.clkctrl_offs);
}

/**
* _lookup_hardreset - fill register bit info for this hwmod/reset line
* @oh: struct omap_hwmod *
Expand Down Expand Up @@ -1410,6 +1440,8 @@ static int _enable(struct omap_hwmod *oh)
*/
static int _idle(struct omap_hwmod *oh)
{
int ret;

pr_debug("omap_hwmod: %s: idling\n", oh->name);

if (oh->_state != _HWMOD_STATE_ENABLED) {
Expand All @@ -1422,6 +1454,10 @@ static int _idle(struct omap_hwmod *oh)
_idle_sysc(oh);
_del_initiator_dep(oh, mpu_oh);
_disable_clocks(oh);
ret = _wait_target_disable(oh);
if (ret)
pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
oh->name);

/* Mux pins for device idle if populated */
if (oh->mux && oh->mux->pads_dynamic)
Expand Down Expand Up @@ -1514,6 +1550,10 @@ static int _shutdown(struct omap_hwmod *oh)
_del_initiator_dep(oh, mpu_oh);
/* XXX what about the other system initiators here? dma, dsp */
_disable_clocks(oh);
ret = _wait_target_disable(oh);
if (ret)
pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
oh->name);
}
/* XXX Should this code also force-disable the optional clocks? */

Expand Down

0 comments on commit bded9fb

Please sign in to comment.