Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216850
b: refs/heads/master
c: 12b1fdb
h: refs/heads/master
v: v3
  • Loading branch information
Kevin Hilman authored and Paul Walmsley committed Sep 21, 2010
1 parent 614b7c3 commit a3d6430
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff4d3e186b7b92c74a4f64360f723c603193f344
refs/heads/master: 12b1fdb45c2594070bb36e39cd89a33547aad8fb
62 changes: 30 additions & 32 deletions trunk/arch/arm/mach-omap2/omap_hwmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,10 @@ static struct omap_hwmod *_lookup(const char *name)
* @data: not used; pass NULL
*
* Called by omap_hwmod_late_init() (after omap2_clk_init()).
* Resolves all clock names embedded in the hwmod. Must be called
* with omap_hwmod_mutex held. Returns -EINVAL if the omap_hwmod
* has not yet been registered or if the clocks have already been
* initialized, 0 on success, or a non-zero error on failure.
* Resolves all clock names embedded in the hwmod. Returns -EINVAL if
* the omap_hwmod has not yet been registered or if the clocks have
* already been initialized, 0 on success, or a non-zero error on
* failure.
*/
static int _init_clocks(struct omap_hwmod *oh, void *data)
{
Expand Down Expand Up @@ -838,10 +838,9 @@ static int _wait_target_ready(struct omap_hwmod *oh)
* @oh: struct omap_hwmod *
*
* Resets an omap_hwmod @oh via the OCP_SYSCONFIG bit. hwmod must be
* enabled for this to work. Must be called with omap_hwmod_mutex
* held. Returns -EINVAL if the hwmod cannot be reset this way or if
* the hwmod is in the wrong state, -ETIMEDOUT if the module did not
* reset in time, or 0 upon success.
* enabled for this to work. Returns -EINVAL if the hwmod cannot be
* reset this way or if the hwmod is in the wrong state, -ETIMEDOUT if
* the module did not reset in time, or 0 upon success.
*/
static int _reset(struct omap_hwmod *oh)
{
Expand Down Expand Up @@ -891,9 +890,8 @@ static int _reset(struct omap_hwmod *oh)
* @oh: struct omap_hwmod *
*
* Enables an omap_hwmod @oh such that the MPU can access the hwmod's
* register target. Must be called with omap_hwmod_mutex held.
* Returns -EINVAL if the hwmod is in the wrong state or passes along
* the return value of _wait_target_ready().
* register target. Returns -EINVAL if the hwmod is in the wrong
* state or passes along the return value of _wait_target_ready().
*/
int _omap_hwmod_enable(struct omap_hwmod *oh)
{
Expand Down Expand Up @@ -1004,11 +1002,10 @@ static int _shutdown(struct omap_hwmod *oh)
* @skip_setup_idle_p: do not idle hwmods at the end of the fn if 1
*
* Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh
* OCP_SYSCONFIG register. Must be called with omap_hwmod_mutex held.
* @skip_setup_idle is intended to be used on a system that will not
* call omap_hwmod_enable() to enable devices (e.g., a system without
* PM runtime). Returns -EINVAL if the hwmod is in the wrong state or
* returns 0.
* OCP_SYSCONFIG register. @skip_setup_idle is intended to be used on
* a system that will not call omap_hwmod_enable() to enable devices
* (e.g., a system without PM runtime). Returns -EINVAL if the hwmod
* is in the wrong state or returns 0.
*/
static int _setup(struct omap_hwmod *oh, void *data)
{
Expand Down Expand Up @@ -1038,6 +1035,7 @@ static int _setup(struct omap_hwmod *oh, void *data)
}
}

mutex_init(&oh->_mutex);
oh->_state = _HWMOD_STATE_INITIALIZED;

r = _omap_hwmod_enable(oh);
Expand Down Expand Up @@ -1323,9 +1321,9 @@ int omap_hwmod_enable(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;

mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
r = _omap_hwmod_enable(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return r;
}
Expand All @@ -1343,9 +1341,9 @@ int omap_hwmod_idle(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;

mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
_omap_hwmod_idle(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return 0;
}
Expand All @@ -1363,9 +1361,9 @@ int omap_hwmod_shutdown(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;

mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
_shutdown(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return 0;
}
Expand All @@ -1378,9 +1376,9 @@ int omap_hwmod_shutdown(struct omap_hwmod *oh)
*/
int omap_hwmod_enable_clocks(struct omap_hwmod *oh)
{
mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
_enable_clocks(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return 0;
}
Expand All @@ -1393,9 +1391,9 @@ int omap_hwmod_enable_clocks(struct omap_hwmod *oh)
*/
int omap_hwmod_disable_clocks(struct omap_hwmod *oh)
{
mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
_disable_clocks(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return 0;
}
Expand Down Expand Up @@ -1443,9 +1441,9 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;

mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
r = _reset(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return r;
}
Expand Down Expand Up @@ -1646,9 +1644,9 @@ int omap_hwmod_enable_wakeup(struct omap_hwmod *oh)
!(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP))
return -EINVAL;

mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
_enable_wakeup(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return 0;
}
Expand All @@ -1671,9 +1669,9 @@ int omap_hwmod_disable_wakeup(struct omap_hwmod *oh)
!(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP))
return -EINVAL;

mutex_lock(&omap_hwmod_mutex);
mutex_lock(&oh->_mutex);
_disable_wakeup(oh);
mutex_unlock(&omap_hwmod_mutex);
mutex_unlock(&oh->_mutex);

return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/arm/plat-omap/include/plat/omap_hwmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/ioport.h>
#include <linux/mutex.h>
#include <plat/cpu.h>

struct omap_device;
Expand Down Expand Up @@ -433,6 +434,7 @@ struct omap_hwmod_class {
* @_state: internal-use hwmod state
* @flags: hwmod flags (documented below)
* @omap_chip: OMAP chips this hwmod is present on
* @_mutex: mutex serializing operations on this hwmod
* @node: list node for hwmod list (internal use)
*
* @main_clk refers to this module's "main clock," which for our
Expand Down Expand Up @@ -461,6 +463,7 @@ struct omap_hwmod {
void *dev_attr;
u32 _sysc_cache;
void __iomem *_mpu_rt_va;
struct mutex _mutex;
struct list_head node;
u16 flags;
u8 _mpu_port_index;
Expand Down

0 comments on commit a3d6430

Please sign in to comment.