diff options
author | Benoit Cousson <b-cousson@ti.com> | 2010-12-21 21:31:27 -0700 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-12-21 21:31:27 -0700 |
commit | 0102b62789af5aed92cea4cf7f36afaa1ab12c72 (patch) | |
tree | 83b7d7f6d0731dc28f68a1c3e3806e12158d4669 /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 50ebb7772c8975086dbfc3d21be74dd806650df4 (diff) | |
download | linux-stable-0102b62789af5aed92cea4cf7f36afaa1ab12c72.tar.gz linux-stable-0102b62789af5aed92cea4cf7f36afaa1ab12c72.tar.bz2 linux-stable-0102b62789af5aed92cea4cf7f36afaa1ab12c72.zip |
OMAP2+: hwmod: Make omap_hwmod_register private and remove omap_hwmod_unregister
Do not allow omap_hwmod_register to be used outside the core
hwmod code. An omap_hwmod should be registered only at init time.
Remove the omap_hwmod_unregister that is not used today since the
hwmod list will be built once at init time and never be modified
at runtime.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 137 |
1 files changed, 55 insertions, 82 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 81c109774b31..298fc3b779ec 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1418,60 +1418,8 @@ static int _setup(struct omap_hwmod *oh, void *data) return 0; } - - -/* Public functions */ - -u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) -{ - if (oh->flags & HWMOD_16BIT_REG) - return __raw_readw(oh->_mpu_rt_va + reg_offs); - else - return __raw_readl(oh->_mpu_rt_va + reg_offs); -} - -void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs) -{ - if (oh->flags & HWMOD_16BIT_REG) - __raw_writew(v, oh->_mpu_rt_va + reg_offs); - else - __raw_writel(v, oh->_mpu_rt_va + reg_offs); -} - -/** - * omap_hwmod_set_slave_idlemode - set the hwmod's OCP slave idlemode - * @oh: struct omap_hwmod * - * @idlemode: SIDLEMODE field bits (shifted to bit 0) - * - * Sets the IP block's OCP slave idlemode in hardware, and updates our - * local copy. Intended to be used by drivers that have some erratum - * that requires direct manipulation of the SIDLEMODE bits. Returns - * -EINVAL if @oh is null, or passes along the return value from - * _set_slave_idlemode(). - * - * XXX Does this function have any current users? If not, we should - * remove it; it is better to let the rest of the hwmod code handle this. - * Any users of this function should be scrutinized carefully. - */ -int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode) -{ - u32 v; - int retval = 0; - - if (!oh) - return -EINVAL; - - v = oh->_sysc_cache; - - retval = _set_slave_idlemode(oh, idlemode, &v); - if (!retval) - _write_sysconfig(v, oh); - - return retval; -} - /** - * omap_hwmod_register - register a struct omap_hwmod + * _register - register a struct omap_hwmod * @oh: struct omap_hwmod * * * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod @@ -1487,7 +1435,7 @@ int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode) * that the copy process would be relatively complex due to the large number * of substructures. */ -int omap_hwmod_register(struct omap_hwmod *oh) +static int _register(struct omap_hwmod *oh) { int ret, ms_id; @@ -1525,6 +1473,57 @@ ohr_unlock: return ret; } + +/* Public functions */ + +u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) +{ + if (oh->flags & HWMOD_16BIT_REG) + return __raw_readw(oh->_mpu_rt_va + reg_offs); + else + return __raw_readl(oh->_mpu_rt_va + reg_offs); +} + +void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs) +{ + if (oh->flags & HWMOD_16BIT_REG) + __raw_writew(v, oh->_mpu_rt_va + reg_offs); + else + __raw_writel(v, oh->_mpu_rt_va + reg_offs); +} + +/** + * omap_hwmod_set_slave_idlemode - set the hwmod's OCP slave idlemode + * @oh: struct omap_hwmod * + * @idlemode: SIDLEMODE field bits (shifted to bit 0) + * + * Sets the IP block's OCP slave idlemode in hardware, and updates our + * local copy. Intended to be used by drivers that have some erratum + * that requires direct manipulation of the SIDLEMODE bits. Returns + * -EINVAL if @oh is null, or passes along the return value from + * _set_slave_idlemode(). + * + * XXX Does this function have any current users? If not, we should + * remove it; it is better to let the rest of the hwmod code handle this. + * Any users of this function should be scrutinized carefully. + */ +int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode) +{ + u32 v; + int retval = 0; + + if (!oh) + return -EINVAL; + + v = oh->_sysc_cache; + + retval = _set_slave_idlemode(oh, idlemode, &v); + if (!retval) + _write_sysconfig(v, oh); + + return retval; +} + /** * omap_hwmod_lookup - look up a registered omap_hwmod by name * @name: name of the omap_hwmod to look up @@ -1604,8 +1603,8 @@ int omap_hwmod_init(struct omap_hwmod **ohs) oh = *ohs; while (oh) { if (omap_chip_is(oh->omap_chip)) { - r = omap_hwmod_register(oh); - WARN(r, "omap_hwmod: %s: omap_hwmod_register returned " + r = _register(oh); + WARN(r, "omap_hwmod: %s: _register returned " "%d\n", oh->name, r); } oh = *++ohs; @@ -1639,32 +1638,6 @@ int omap_hwmod_late_init(void) } /** - * omap_hwmod_unregister - unregister an omap_hwmod - * @oh: struct omap_hwmod * - * - * Unregisters a previously-registered omap_hwmod @oh. There's probably - * no use case for this, so it is likely to be removed in a later version. - * - * XXX Free all of the bootmem-allocated structures here when that is - * implemented. Make it clear that core code is the only code that is - * expected to unregister modules. - */ -int omap_hwmod_unregister(struct omap_hwmod *oh) -{ - if (!oh) - return -EINVAL; - - pr_debug("omap_hwmod: %s: unregistering\n", oh->name); - - mutex_lock(&omap_hwmod_mutex); - iounmap(oh->_mpu_rt_va); - list_del(&oh->node); - mutex_unlock(&omap_hwmod_mutex); - - return 0; -} - -/** * omap_hwmod_enable - enable an omap_hwmod * @oh: struct omap_hwmod * * |